akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <memory.h>
#include <vector>

using namespace std;
typedef long long LL;

static const int MAXS = 100000 + 10;
LL w[MAXS][26];

LL fib(int id, LL order ,int n, int k) {
    if (order <= n) return w[order][id];
    if (order <= 2*n) return w[n][id] + w[order-n][id];
    LL f1 = w[n][id];
    LL f2 = w[n][id] + w[k][id];
    LL x1 = n;
    LL x2 = n + k;
    while (x1 + x2 < order) {
        LL tmp = f2;
        f2 = f2 + f1;
        f1 = tmp;
        tmp = x2;
        x2 = x1 + x2;
        x1 = tmp;
    }
    return f2 + fib(id, order - x2, n, k);

}


int main() {
//    freopen("test.txt", "r", stdin);
    string s;
    cin >> s;
    int n = s.size() >> 1;
    LL left, right;
    cin >> left >> right;
    memset(w, 0, sizeof(w));
    vector<int> next(n, 0);
    for (int i = 1; i < n; i++) {
        int len = next[i-1];
        while (len >= 1 && s[len] != s[i]) {
            len = next[len-1];
        }
        if (s[len] == s[i]) next[i] = len + 1;
        else next[i] = 0;
    }
    int k = n - next.back();
    for (int i = 1; i <= n; i++) {
        w[i][s[i-1]-'a']++;
        for (int j = 0; j < 26; j++) {
            w[i][j] += w[i-1][j];
        }
    }
    for (int i = 0; i < 26; i++) {
        cout << fib(i, right, n, k) - fib(i, left-1, n, k);
        if (i != 25) cout << ' ';
    }
    cout << endl;


    return 0;
}

Measured memory_bytes: 21252
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    int n;
    vector<int> arr;
    cin>>n;
    for(int i=0,t=0;i<n;i++){
        cin>>t;
        arr.push_back(t);
    }
    int times=0;
    for(int i=0;i<n;i++){
        int minIndex=i;
        for(int j=i+1;j<n;j++){
            if(arr[j]<arr[minIndex]){
                minIndex=j;
            }
        }
        if(i!=minIndex){
            swap(arr[i],arr[minIndex]);
            times++;
        }
    }
    for(int i=0;i<n;i++){
        if(i)
            cout<<" ";
        cout<<arr[i];
    }
    cout<<endl;
    cout<<times<<endl;


    return 0;
}


Measured memory_bytes: 3148
#include<stdio.h>

//A,B円硬貨2枚でC円のお買い物ができるか?

int main(void)
{
  int a,b,c;

  scanf("%d %d %d",&a ,&b ,&c);
  if (a+b<c)
    printf("No");
  else printf("Yes");
}

Measured memory_bytes: 128
#include<stdio.h>

int main()
{
	char str[10001];
	int i=0;
	fgets(str,10001,stdin);
	while(*(str+i)!='\0')
	{
		if(*(str+i)>='a'&&*(str+i)<='z')
		{
			*(str+i)+=-'a'+'A';
		}
		i++;
	}
	*(str+i-1)='\0';
	puts(str);
	return 0;
}

Measured memory_bytes: 0
# -*- coding: utf-8 -*-
# 標準入力の取得
R, G, B, N = list(map(int, input().split()))


def main() -> None:
    # 求解処理
    r_max = N // R
    g_max = N // G
    result = 0
    for r in range(r_max+1):
        n_r = r * R
        for g in range(g_max+1):
            n_rg = n_r + g*G
            if N < n_rg:
                continue
            if (N - n_rg) % B == 0:
                result += 1

    # 結果出力
    print(result)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
N,K=(int(x) for x in input().split())
h=[]
for i in range(N):
    h.append(int(input()))
sortedH=sorted(h)
min=1000000000
for i in range(N-K+1):
    tmp=sortedH[i+K-1]-sortedH[i]
    if min>tmp:
        min=tmp
print(min)

Measured memory_bytes: 8280
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2,fma,tune=native")
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
#include <x86intrin.h>
#define pb push_back
using namespace std;
using ll = long long;
using pi = pair<int, int>;
using vi = vector<ll>;
const int maxn = 4003, mod = 998244353;
ll n, s, dp[maxn][maxn];
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> s;
	vi a(n);
	for(auto &i : a) cin >> i;
	dp[0][0] = 1;
	for(int i = 0; i < n; i++) {
		for(int j = 0; a[i] + j <= s; j++) {
			if(j==0&&j+a[i]==s) {
				(dp[i+1][j+a[i]] += (dp[i][j]*(i+1)%mod)*(n-i))%=mod;
			} else if(j==0) {
				(dp[i+1][j+a[i]] += dp[i][j]*(i+1)%mod)%=mod;
			} else if(j+a[i]==s) {
				(dp[i+1][j+a[i]] += dp[i][j]*(n-i)%mod)%=mod;
			} else {
				(dp[i+1][j+a[i]] += dp[i][j])%=mod;
			}
		}
		for(int j = 0; j <= s; j++) 
			(dp[i+1][j] += dp[i][j])%=mod;
	}
	cout << dp[n][s];
}


Measured memory_bytes: 94208
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, BinaryHeap, VecDeque, BTreeSet, BTreeMap};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_imports)]
use std::io::stdin;

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
}

#[allow(unused_macros)]
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    get!($t)
                   ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($($t),*)
                   ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    let (n, m) = get!(usize, usize);
    let e = get!(usize, usize; m);
    let q = get!(usize);
    let vdc = get!(usize, usize, usize; q);

    let mut g = vec![Vec::new(); n];

    for &(a, b) in &e {
        g[a - 1].push(b - 1);
        g[b - 1].push(a - 1);
    }

    let mut col = vec![(0, 0); n];

    for &(v, d, c) in vdc.iter().rev() {
        let mut stack = vec![(v - 1, d)];

        while let Some((v, d)) = stack.pop() {
            let (c2, d2) = col[v];
            if c2 == 0 {
                col[v] = (c, d);
            }

            if d2 < d {
                for &to in &g[v] {
                    stack.push((to, d - 1));
                }
                col[v].1 = d;
            }
        }
    }

    for &(c, _) in &col {
        println!("{}", c);
    }

}


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

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

  for (int i = 0; i < s.size(); i ++) {
    for (int j = 0; j <= s.size() - 7; j ++) {
      string tmp = s;
      tmp.erase(i, j);
      if (tmp == "keyence") {
        cout << "YES" << endl;
        return 0;
      }
    }
  }

  cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;

bool f[N];
vector<int> res;

int main() {
    int n;
    cin >> n;
    if (n == 3) {
        cout << "2 5 63" << endl;
    } else if (n == 4) {
        cout << "2 5 63 20" << endl;
    } else if (n == 6) {
        cout << "2 4 3 9 15 21" << endl;
    } else {
        vector<int> a2, a3, a6;
        for (int i = 1 ; i <= 30000 ; ++ i) {
            if (i % 6 == 0) {
                a2.emplace_back(i);
            } else {
                if (i % 2 == 0) {
                    a2.emplace_back(i);
                }
                if (i % 3 == 0) {
                    a3.emplace_back(i);
                }
            }
        }
        //cout << a2.size() << endl;
        //cout << a3.size() << endl;
        reverse(a2.begin() , a2.end());
        reverse(a3.begin() , a3.end());

        if (n % 3 == 0) {
            for (int i = 0 ; i < 4 ; ++ i) {
                res.push_back(a3.back());
                a3.pop_back();
            }
        }

        //a2.push_back(a6.back()), a6.pop_back();
        //a2.push_back(a6.back()), a6.pop_back();

        for (int i = 0 ; i < 3 ; ++ i) {
            res.push_back(a2.back());
            a2.pop_back();
        }
        for (int i = 0 ; i < 2 ; ++ i) {
            res.push_back(a3.back());
            a3.pop_back();
        }

        while (a2.size() >= 3 && res.size() + 3 <= n) {
            for (int i = 0 ; i < 3 ; ++ i) {
                res.push_back(a2.back());
                a2.pop_back();
            }
        }
        while (a3.size() >= 2 && res.size() + 2 <= n) {
            for (int i = 0 ; i < 2 ; ++ i) {
                res.push_back(a3.back());
                a3.pop_back();
            }
        }
        if (res.size() != n) {
            res.clear();
            int cnt = 20000 - n;
            for (int i = 1 ; i <= 30000 ; ++ i) {
                if (i % 2 == 0 || i % 3 == 0) {
                    res.push_back(i);
                    if (cnt && i % 6 == 0) {
                        -- cnt;
                        res.pop_back();
                    }
                }
            }
        }


        assert(res.size() == n);
        int sum = 0 , gcd = 0;
        for (int i = 0 ; i < n ; ++ i) {
            cout << res[i] << ' ';
            sum += res[i];
            gcd = __gcd(res[i] , gcd);
        }
        //cout << sum << endl;
        assert(gcd == 1);
        for (int i = 0 ; i < n ; ++ i) {
            assert(__gcd(sum , res[i]) != 1);
            //  cout << i << endl;
        }

        cout << endl;
    }

}


Measured memory_bytes: 640
n = int(input())
lst = [list(map(int,input().split())) for _ in range(n)]

total = 0
for i in range(1,n):
    x0,y0 = lst[i][0],lst[i][1]
    for j in range(i):
        x1,y1 = lst[j][0],lst[j][1]
        total += ((x1 - x0)**2 + (y1 - y0)**2)**0.5
print(total*2/n)

Measured memory_bytes: 3188
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
#define eps 1e-12 
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N; cin >> N;
	VI A(N);
	REP(i, N)cin >> A[i];

	multiset<int>S;
	REP(i, N) {
		if (S.empty()) {
			S.insert(A[i]);
			continue;
		}
		auto it = S.lower_bound(A[i]);
		if (it != S.begin()) {
			it--;
			S.erase(it);
			S.insert(A[i]);
		}
		else {
			S.insert(A[i]);
		}
	}

	cout << S.size() << endl;

	return 0;
}



Measured memory_bytes: 8660
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
const int MOD = 1e9+7;
const long long INF = 1e18+10;

/*--------------------------------------------------------------------*/

signed main(){	
	int n,k;
	cin>>n>>k;
	vi a(n);
	rep(i,n)cin>>a[i];

	vi l(2002,0),g(2002,0);

	rep(i,n){
		l[a[i]+1]++;
		l[2001]--;
		g[a[i]]--;
		g[0]++;
	}
	FOR(i,1,2000){
		l[i]+=l[i-1];
		g[i]+=g[i-1];
	}

	int ans=0;
	rep(i,n){
		int cnt=0;
		rep(j,i){
			if(a[i]<a[j]) cnt++;
		}
		cnt*=k;
		cnt%=MOD;

		ans+=cnt;
		ans%=MOD;
		ans+=((k*(k-1)/2)%MOD) * ((/*g[a[i]]+*/l[a[i]])%MOD);
		ans%=MOD;

	}

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


Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
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; }


using namespace std;

const int MAX = 210000;
int Q;
ll type[MAX], a[MAX], b[MAX];

int main(){
    cin >> Q;

    ll sum = 0;
    priority_queue<ll> zen;
    priority_queue<ll, vector<ll>, greater<ll>> kou;
    ll zensum = 0;
    ll kousum = 0;
    for (int i = 0; i < Q; ++i) {
        cin >> type[i];
        if (type[i] == 1) {
            cin >> a[i] >> b[i];
            sum += b[i];

            if (zen.size() > kou.size()) {
                int t = zen.top();
                if (a[i] >= t) {
                    kou.push(a[i]);
                    kousum += a[i];
                } else {
                    zen.pop(); zensum -= t;
                    zen.push(a[i]); zensum += a[i];
                    kou.push(t); kousum += t;
                }
            } else {
                if (zen.empty()) zen.push(a[i]), zensum += a[i];
                else {
                    int t = kou.top();
                    if (a[i] <= t) {
                        zen.push(a[i]); zensum += a[i];
                    } else {
                        kou.pop(); kousum -= t;
                        kou.push(a[i]); kousum += a[i];
                        zen.push(t); zensum += t;
                    }
                }
            }
        }
        else {
            ll x = zen.top();
            ll res = (x * (int)zen.size() - zensum) + (kousum - x * (int)kou.size()) + sum;
            cout << x << " " << res << endl;
        }

    }
}


Measured memory_bytes: 8564
#include <iostream>

using namespace std;

int main(){
	const int maxP = 1299710;
	bool pr[maxP+1];
	for(int i=2;i<=maxP;i++) pr[i] = true;
	for(int i=2;i<=maxP;i++){
		if(!pr[i]) continue;
		for(int j=2*i;j<=maxP;j+=i)
			pr[j] = false;
	}
	int p;
	while(cin >> p, p){
		int L = p, R = p;
		while(!pr[L]) L--;
		while(!pr[R]) R++;
		printf("%d\n", R-L);
	}
}

Measured memory_bytes: 0
#include <stdio.h>
 
int sum_digits(int n, int base)
{
    int count = 0;
 
    while(n) {
        count++;
        n /= base;
    }
 
    return count;
}
 
int main(void)
{
    int a, b;
 
    while(~scanf("%d%d", &a, &b))
        printf("%d\n", sum_digits(a + b, 10));
 
    return 0;
}



Measured memory_bytes: 2048
import sys

n = int(sys.stdin.readline())
g = [list(map(int, sys.stdin.readline().split())) for _ in range(n)]

V = set(range(n))
U = set()
E = []

U.add(V.pop())

while len(U)<n:
    minw = 1e10
    mine = []
    for u in U:
        for v in V:
            if g[u][v]>=0 and minw>g[u][v]:
                minw = g[u][v]
                mine = [u, v]
    E.append(mine)
    U.add(mine[1])
    V.remove(mine[1])

vv=0
for u, v in E:
    vv += g[u][v]
print(vv)    



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

int main(){
	int a,b,c;
	cin >> a >> b >> c;
	if(b - a == 0){
		cout << c << endl;
	}else if (c - b == 0){
		cout << a << endl;
	}else{
		cout << b << endl;
	}
	return 0;
}

Measured memory_bytes: 256
n_list = list(map(int,input().split()))
n_list.sort()
num = 2 * n_list[2]
dummy = num - (n_list[0] + n_list[1])
#print(dummy)
a,b = divmod(dummy,2)
if b == 0:
  print(a)
else:
  print(a+2)



Measured memory_bytes: 2940
n,k=map(int,input().split())
a=list(map(int,input().split()))
visited=[]
o=(n+1)*[-1]
cycle,l=1,0
v=1
while o[v]==-1:
  o[v]=len(visited)
  visited.append(v)
  v=a[v-1]
cycle=len(visited)-o[v]
l=o[v]
if k<l:
  print(visited[k])
else:
  k-=l
  k%=cycle
  print(visited[l+k])

Measured memory_bytes: 32360
#include<stdio.h>
char a[4],b[4];
int main(void){
    scanf("%s%s",a,b);
    int i,ans;
    for(i=0;i<3;i++){
        if(a[i] == b[i]){
            ans += 1;
        }
    }
    printf("%d",ans);
    return 0;
}

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

int main() {
  int h,w;cin>>h>>w;
  vector<vector<string>> s(h,vector<string>(w));
  rep(i,h)rep(j,w)cin>>s[i][j];
  rep(i,h)rep(j,w){
    if(s[i][j]=="snuke")cout<<char('A'+j)<<i+1<<endl;
  }
}

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

int main()
{
	string s;
	while(cin >> s){
		int flag = 0;
		for(int i = 1; i <= s.length(); i++){
			if(i % 2 == 1){
				if(s[i-1] == 'L'){
					flag = 1;
				}
			}
			if(i % 2 == 0){
				if(s[i-1] == 'R'){
					flag = 1;
				}
			}
		}
		if(flag == 1)
			cout << "No" << endl;
		else
			cout << "Yes" << endl;
	}
	return 0;
 } 

Measured memory_bytes: 256
#! -*- coding: utf-8-unix -*-
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0004
import sys

def main_(a,b,c,d,e,f):
  y = (a*f-d*c)/(a*e-d*b)
  x = (c - b * y) / a
  return (x, y)

def main(lines):
  for line in lines:
    a,b,c,d,e,f = map(float, line.split(' '))
    print '%.3f %.3f' % main_(a,b,c,d,e,f)
  return

if __name__=='__main__':
  lines = []
  for line in sys.stdin:
    lines.append(line.strip())
  # print lines
  main(lines)

Measured memory_bytes: 4240
h, w = map(int, input().split())
n = int(input())
a = list(map(int, input().split()))

cells = [0] * (h * w)
p = 0
for i in range(n):
    for j in range(p, p + a[i]):
        cells[j] = i + 1
    p += a[i]

for i in range(h):
    if i % 2 == 0:
        print(*cells[i * w: i * w + w])
    else:
        print(*cells[i * w: i * w + w][::-1])


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

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl "\n"

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) 
{
    os << "{ ";
    for(auto& y : x) 
    {
        os << y << " ";
    }
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) 
{
    return os << "[" << p.ff << ", " << p.ss << "]";
}

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

    return gcd(b, a%b);
}

ll modexp(ll a, ll b, ll c)
{   
    a%=c;

    ll ans = 1;

    while(b)
    {
        if(b&1)
        {
            ans = (ans*a)%c;
        }

        a = (a*a)%c;
        b >>= 1;
    }

    return ans;
}

const ll L = 1e5+5;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    ll N, M;
    cin >> N >> M;

    if(N == M)
    {
        cout << "Yes" << endl;
    }

    else
    {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    
    if(a < b){
        cout << "a < b" << endl;
    }
    else if(a > b){
        cout << "a > b" << endl;
    }
    else{
        cout << "a == b" << endl;
    }
}



Measured memory_bytes: 3084
#include "bits/stdc++.h"
#define REP(i, m, n) for(long long i = m; i < n; ++i)
#define CO(n) cout << n << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

//二部グラフであれば，二部グラフを保ったまま辺の数を最大化
//B*(N-B)-M
//そうでなければ全ての頂点を結ぶ
//N*(N-1)/2

//V頂点数，E辺数
ll N, M;
//辺
vector<int> G[100000];
//二部グラフ用
int color[100000];
//1の個数
int B=0;

//二部グラフ判定
bool dfs(int v, int c) {
    color[v] = c;
    if (c == 1) ++B;
    REP(i,0,G[v].size()){
        if (color[G[v][i]] == c) return false;
        if (color[G[v][i]] == 0 && !dfs(G[v][i], -c)) return false;
    }
    return true;
}

int main()
{
    ios::sync_with_stdio(false);
    cin >> N >> M;
    REP(i,0,M){
        int from, to;
        cin >> from >> to;
        --from; --to; //0〜N-1にする
        G[from].push_back(to);
        G[to].push_back(from);
    }
    if (dfs(0,1)) {
        // CO("yes");
        CO(B*(N-B)-M);
    } else {
        // CO("no");
        CO(N*(N-1)/2 - M);
    }
    // REP(i,0,N) cout << color[i] << ' ';
    // cout << endl;
    return 0;
}

Measured memory_bytes: 6528
#include<stdio.h>
#define N 8

int a[N][N]={0};

void update(int y,int x){
	int i,j;
	/*横*/
	for(i=0;i<N;i++){
		if(i!=x)a[y][i]=2;
	}
	/*縦*/
	for(i=0;i<N;i++){
		if(i!=y)a[i][x]=2;
	}
	/*右上*/
	i=y-1; j=x+1;
	while(i>=0 && j<N){
		a[i--][j++]=2;
	}
	/*左上*/
	i=y-1; j=x-1;
	while(i>=0 && j>=0){
		a[i--][j--]=2;
	}
	/*左下*/
	i=y+1; j=x-1;
	while(i<N && j>=0){
		a[i++][j--]=2;
	}
	/*右下*/
	i=y+1; j=x+1;
	while(i<N && j<N){
		a[i++][j++]=2;
	}
	
	return;

}

void printboard(){
	int i,j;
	
	for(i=0;i<N;i++){
		for(j=0;j<N;j++){
			if(a[i][j]==1)printf("Q");
			else printf(".");
		}
		printf("\n");
	}

	return;	
}


int check(int y,int x){
	int i,j;
	
	/*横*/
	for(i=0;i<N;i++){
		if(i!=x && a[y][i]==1)return 0;
	}
	/*縦*/
	for(i=0;i<N;i++){
		if(i!=y && a[i][x]==1)return 0;
	}
	/*右上*/
	i=y-1; j=x+1;
	while(i>=0 && j<N){
		if(a[i--][j++]==1)return 0;
	}
	/*左上*/
	i=y-1; j=x-1;
	while(i>=0 && j>=0){
		if(a[i--][j--]==1)return 0;
	}
	/*左下*/
	i=y+1; j=x-1;
	while(i<N && j>=0){
		if(a[i++][j--]==1)return 0;
	}
	/*右下*/
	i=y+1; j=x+1;
	while(i<N && j<N){
		if(a[i++][j++]==1)return 0;
	}
	
	return 1;
	
}


int Get_Solution(int d){
	int i;
	
	for(i=0;i<N;i++){
		if(a[d][i]==1){
			if(!Get_Solution(d+1))return 0;
		}
	}
	

	if(d==N){
		printboard();
		return 1;
	}
	
	else {
		for(i=0;i<N;i++){
			if(a[d][i]==0 && check(d,i)){
				a[d][i]=1;
				if(!Get_Solution(d+1)){
					a[d][i]=0;
				}
			}
		}
	}
	
	
	return 0;

}

int main(){
	int n,i,j;
	int x,y;
	int d=0;
	
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		scanf("%d %d",&y,&x);
		a[y][x]=1;
		update(y,x);
	}
	
	i=Get_Solution(d);

	return 0;
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define sz(v) (int) v.size()
#define pr(v) For(i, 0, sz(v)) {cout<<v[i]<<" ";} cout<<endl;
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define int long long
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
typedef vector<int> vi;
#define MOD 1000000007
#define INF 1000000000000000007LL

const int N = 100005;
 
// it's swapnil07 ;)
 
#ifdef SWAPNIL07
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define endl '\n'
#define end_routine()
#endif


signed main()
{
    fast
    #ifdef SWAPNIL07
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int n, a, b; cin>>n>>a>>b;
    int x = a+b;
    int y = (n/x);
    n -= (y*x);
    int ans = y*a;
    if(n > a)
        ans += a;
    else
        ans += n;
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
# https://atcoder.jp/contests/agc003/tasks/agc003_b
# 各数字について、その数字の１つ前とその数字だけでできるだけ作る。
# その数字だけでペアをできるだけ作る。
# 1については、0のカードが0枚なので、実質無視できる。
from collections import defaultdict
n = int(input())
d = defaultdict(int)
for i in range(n):
    num = int(input())
    d[i + 1] = num

ans = 0
for i in range(1, n + 1):
    pre = d.get(i - 1, 0)
    cur = d.get(i, 0)
    t = min(pre, cur)
    ans += t
    d[i - 1] -= t
    d[i] -= t
    cur = d.get(i, 0)
    t = cur // 2
    ans += t
    d[i] -= t * 2
print(ans)

Measured memory_bytes: 89344
import java.util.Scanner;

/**
 * Frog 1
 */
public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();
            int[] H = new int[N + 1];
            for (int i = 1; i <= N; i++) {
                H[i] = sc.nextInt();
            }

            long[] dp = new long[N + 1];

            for (int i = 2; i <= N; i++) {
                dp[i] = dp[i - 1] + Math.abs(H[i] - H[i - 1]);
                if (i >= 3) {
                    dp[i] = Math.min(dp[i], dp[i - 2] + Math.abs(H[i] - H[i - 2]));
                }
            }

            System.out.println(dp[N]);
        }
    }

}


Measured memory_bytes: 50796
#include <iostream>
#include <algorithm>
#include <map>

using namespace std;

int main() {
    int n, m, q;
    cin >> n >> m >> q;
    int rui[510][510] = {{0}};
    for (int i=0; i<m; i++) {
        int li, ri;
        cin >> li >> ri;
        rui[li][ri]++;
    }
    for (int l=n; l>0; l--)
        for (int r=l; r<=n; r++)
            rui[l][r] += rui[l+1][r] + rui[l][r-1] - rui[l+1][r-1];
    for (int i=0; i<q; i++) {
        int a, b;
        cin >> a >> b;
        cout << rui[a][b] << '\n';
    }
    return 0;
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#define int long long int
int c[10000001];
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout<<setprecision(9)<<fixed;
	
	for(int i=1;i<=10000000;i++)
		for(int j=i;j<=10000000;j+=i)
			c[j]+=1;
	int n;
	cin>>n;
	int s=0;
	for(int i=1;i<=n;i++)
		s+=i*c[i];
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 81772
A = []*3

for i in range(3):
    A.append(list(map(int, input().split())))
N = int(input())
flag = 0

for i in range(N):
    aaa = int(input())
    for m in range(3):
        for n in range(3):
            if A[m][n] == aaa:
                A[m][n] = 0

    for k in range(3):
        if A[0][k] == A[1][k] and A[0][k] == A[2][k]:
            flag = 1
            break
        if A[k][0] == A[k][1] and A[k][0] == A[k][2]:
            flag = 1
            break
    if A[0][0] == A[1][1] and A[0][0] == A[2][2]:
        flag = 1
        break
    if A[0][2] == A[1][1] and A[0][2] == A[2][0]:
        flag = 1
        break


if flag == 1:
    print('Yes')
else:
    print('No')



Measured memory_bytes: 3064
Vnum = 0
Enum = 0
Edge = {}
L = []
V = []

def visit(n):
    if V[n] == 1:
        sys.exit()
    elif V[n] == 0:
        V[n] = 1
        if n in Edge.keys():
            for m in Edge[n]:
                visit(m)
        V[n] = 2
        L.append(n)
        return True

Vnum,Enum = map(int,input().split())
V = [ 0 for v in range(Vnum) ]
for _ in range(Enum):
    s,t = map(int,input().split())
    if s in Edge.keys():
        Edge[s].append(t)
    else:
        Edge[s] = [t]
#print(Edge)

for n in range(Vnum):
    if V[n] == 0:
        visit(n)
#print(V)
L.reverse()
for a in L:
    print(a)



Measured memory_bytes: 9184
using System;
using static System.Console;
using static System.Math;
using System.Collections.Generic;
using System.Linq;
using System.IO;

class Program
{
    public static void Main()
    {
        int r = int.Parse(ReadLine());
        if (r < 1200) WriteLine("ABC");
        else if (r >= 1200 && r < 2800) WriteLine("ARC");
        else WriteLine("AGC");
    }
    public static partial class EnumerableCommon
    {
        public static IEnumerable<int> Range(int count)
        {
            return Enumerable.Range(0, count);
        }
    }
}

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

int main(void){
	double x[2],y[2],r[2];
	int n;
	cin >> n;
	rep(i,n){
		rep(j,2) cin >> x[j] >> y[j] >> r[j];
		double D=norm(x[1]-x[0])+norm(y[1]-y[0]);
		double RG=norm(r[1]+r[0]);
		double RL=norm(r[1]-r[0]);
		if(RG<D)
			cout << 0 << endl;
		else if(RL<=D && D<=RG)
			cout << 1 << endl;
		else{
			if(r[0]<r[1])
				cout << -2 << endl;
			else
				cout << 2 << endl;
		}
	}
}

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

int main(){
  vector<int> T;
  {
    int t = 1;
    while(true){
      long long s = t*(t+1)*(t+2)/6;
      if(s > 1e6) break;
      T.push_back(s);
      ++t;
    }
  }
  const int INF = 1e9;

  int n = 1e6;

  vector<int> dp(n+1,INF), dp2(n+1,INF);
  dp[0] = 0;
  dp2[0] = 0;
  for(int i = 0; i <= n; ++i){
    for(auto e : T){
      if(i+e > n) break;
      dp[i+e] = min(dp[i+e],dp[i]+1);
      if(e%2)
        dp2[i+e] = min(dp2[i+e],dp2[i]+1);
    }
  }


  while(cin >> n, n){
    cout << dp[n] << " " << dp2[n] << endl;
  }
}



Measured memory_bytes: 10524
n = input()
if n[-1] == "2" or n[-1] == "4" or n[-1] == "5" or n[-1] == "7" or n[-1] == "9":
    print("hon")
elif n[-1] == "0" or n[-1] == "1" or n[-1] == "6" or n[-1] == "8":
    print("pon")
else:
    print("bon")

Measured memory_bytes: 9052
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pii pair<int,int> 
#define pb push_back
#define INF INT_MAX 
#define mod 1000000007ll
#define fi first
#define se second
#define f(i,p,q) for(int i=p;i<q;i++)
#define si(a) scanf("%d",&a)
#define sii(a,b) scanf("%d %d",&a,&b)
#define siii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define pi(a) printf("%d\n",a)
#define psi(a) printf(" %d",a)
#define poi(a) printf("%d",a)
#define sl(a) scanf("%lld",&a)
#define pl(a) printf("%lld\n",a)
#define Nline() printf("\n")
#define sstr(str) scanf("%s",str)
#define pstr(str) printf("%s\n",str)
#define SET(a) memset(a,-1,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))
#define vi vector<int>
#define vvi vector<vi>
#define all(v) (v).begin(),(v).end()
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())
#define ios ios::sync_with_stdio(false); cin.tie(0);cout.tie(NULL);
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
#define S(X) ( (X) * (X) )
const char nl = '\n';
#define SZ(V) (int )V.size()
#define FORN(i, n) for(i = 0; i < n; i++)
#define FORAB(i, a, b) for(i = a; i <= b; i++)
#define ALL(V) V.begin(), V.end()
#define IN(A, B, C)  (B) <= (A) && (A) <= (C)
#define AIN(A, B, C) assert(IN(A, B, C))
ll power(ll x, unsigned int y) {ll res = 1;	while (y > 0) { if (y & 1) res = res*x%mod; y = y>>1; x = (x*x)%mod;} return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
void solve(){
    string s;
    cin>>s;
    int ans=0;
    int l=0;
    f(i,0,3){
    	if(s[i]=='R')l++;
    	else{
    		ans=max(ans,l);
    		l=0;
    	}
    }
    cout<<max(ans,l);
}
int main() {
    ios;
	int t=1;
	//cin>>t;
	while(t--)solve();
 
    
}


Measured memory_bytes: 3576
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main(){

    input!{
        a: usize,
        b: usize,
    }

    println!("{}", a*b);

}

Measured memory_bytes: 2116
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

bool Solve(std::string s){
  int count[100]={};
  for(auto c:s){
    count[c-'A']++;
  }
  int t=0;
  for(int i=0;i<30;i++){
    if(count[i]==2) t++;
    else if(count[i]!=0) return false;
  }
  return t==2;
}

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);

  std::string s;
  cin>>s;
  if(Solve(s)){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  };


  return 0;
}


Measured memory_bytes: 888
data = {
    "AC":0,
    "WA":0,
    "TLE":0,
    "RE":0
    }

n = int(input())
for i in range(n):
    t = input()
    data[t] += 1

print(f"AC x {data['AC']}")
print(f"WA x {data['WA']}")
print(f"TLE x {data['TLE']}")
print(f"RE x {data['RE']}")


Measured memory_bytes: 9104
#include <stdio.h>

int main(void)
{
	int x, y;
	x = 1, y = 1;

	while (1)
	{
		scanf("%d %d", &x, &y);
		if ((0 <= x)&&(y <= 10000))
		{
			if ((x == 0) && (y == 0))
			{
				break;
			}
			else
			{
				if (x < y)//xがyより小さい時
				{
					printf("%d %d\n", x, y);
				}
				else //xがyより大きい時
				{
					printf("%d %d\n", y, x);
				}
			}
			
		}
	}
	return 0;
}


Measured memory_bytes: 2056
a = list(map(int, input().split()))
count = 0
count1 = 0
for i in range(3):
  if a[i] == 5:
    count+=1
  elif a[i] == 7:
    count1+=1
    
if (count == 2) & (count1 == 1):
  print("YES")
else:
  print("NO")


Measured memory_bytes: 2940
n = int(input())
l = list(str(input()))
m = []
W_all = 0
for i in l:
    if i == 'W':
        W_all += 1
    else:
        continue

W_left = 0
ans = 300000

for i in range(len(l)):
    if l[i] == 'W':
        W_left += 1    
    E_count = n - (i + 1) - (W_all-W_left)


    if l[i] == 'W':
        ans = min(ans, W_left -1 + E_count)
    else:
        ans =min(ans, W_left + E_count)
print(ans)


Measured memory_bytes: 5920
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 1101010101010101010
#define MOD 1000000007
#define int long long
using P = pair<int,int>;

signed main(){
  int s,w;
  cin >> s >> w;
  if(s <= w) cout << "unsafe" << endl;
  else cout << "safe" << endl;
}

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

class Node{
  public:
    int parent;
    int right_sibling;
    int left_child;
    int depth;
    Node(){
      parent = -1;
      right_sibling = -1;
      left_child = -1;
      depth = -1;
    }
};

void set_depth(Node* nodes,int id,int d){
  nodes[id].depth = d;
  if(nodes[id].right_sibling != -1){
    set_depth(nodes, nodes[id].right_sibling, d);
  }
  if(nodes[id].left_child != -1){
    set_depth(nodes, nodes[id].left_child, d+1);
  }
}

string type(Node* nodes, int id){
  if(nodes[id].parent == -1){
    return "root";
  }else if(nodes[id].left_child == -1){
    return "leaf";
  }else{
    return "internal node";
  }
}

string childs(Node* nodes, int id){
  int c = nodes[id].left_child;
  if(c==-1) return "";
  string childs_str = "";
  int cnt = 0;
  do{
    if(cnt) childs_str = childs_str + ", ";
    childs_str = childs_str + to_string(c);
    c = nodes[c].right_sibling;
    cnt++;
  }while(c!=-1);
  return childs_str;
}

int main(){
  int n; cin>>n;
  Node nodes[n];
  for(int i=0;i<n;i++){
    int id; cin>>id;
    int  k; 
    cin>>k;
    if(k==0) continue;
    int c[k];
    for(int j=0;j<k;j++){
      cin>>c[j];
      nodes[c[j]].parent = id;
      if(j==0){ nodes[id].left_child=c[j];
      }else{
        nodes[c[j-1]].right_sibling = c[j];
      }
    }
  }
  int root;
  for(int i=0;i<n;i++){
    if(nodes[i].parent==-1) root = i;
  }

  set_depth(nodes,root,0); 
  for(int i=0;i<n;i++){
    printf("node %d: parent = %d, depth = %d, %s, [",
        i,
        nodes[i].parent,
        nodes[i].depth,
        type(nodes,i).c_str()
        );
    int c = nodes[i].left_child;
    int cnt = 0;
    while(c!=-1){
      if(cnt) printf(", ");
      printf("%d",c);
      cnt++;
      c = nodes[c].right_sibling;
    }
    printf("]\n");
  }

}

Measured memory_bytes: 7808
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
using namespace std;

typedef pair<int,int> pi;
#define MK make_pair
#define F first
#define S second

int a[50][50];
const int MX=1e6;

int search(int x,int y,int w){
    int k=MX;
    if(w==0){return k;}
    if(a[x][y+1]!=1){
        for(int i=1;;i++){
            if(a[x][y+i]==-1){break;}
            if(a[x][y+i]==1){a[x][y+i]=0; k=min(k,search(x,y+i-1,w-1)+1); a[x][y+i]=1; break;}
            if(a[x][y+i]==3){return 0;}
        }
    }
    if(a[x+1][y]!=1){
        for(int i=1;;i++){
            if(a[x+i][y]==-1){break;}
            if(a[x+i][y]==1){a[x+i][y]=0; k=min(k,search(x+i-1,y,w-1)+1); a[x+i][y]=1; break;}
            if(a[x+i][y]==3){return 0;}
        }
    }
    if(a[x][y-1]!=1){
        for(int i=-1;;i--){
            if(a[x][y+i]==-1){break;}
            if(a[x][y+i]==1){a[x][y+i]=0; k=min(k,search(x,y+i+1,w-1)+1); a[x][y+i]=1; break;}
            if(a[x][y+i]==3){return 0;}
        }
    }
    if(a[x-1][y]!=1){
        for(int i=-1;;i--){
            if(a[x+i][y]==-1){break;}
            if(a[x+i][y]==1){a[x+i][y]=0; k=min(k,search(x+i+1,y,w-1)+1); a[x+i][y]=1; break;}
            if(a[x+i][y]==3){return 0;}
        }
    }
    
    return k;
}







int main(){
    while(1){
        
        
        
        
    
    int w,h;
    cin>>w>>h;
        if(w==0 && h==0){break;}
    fill(&a[0][0],&a[49][50],-1);
    int x,y;
    for(int i=1;i<=h;i++){
        for(int t=1;t<=w;t++){
            cin>>a[i][t];
            if(a[i][t]==2){x=i; y=t;}
        }
    }
    
    int ans=search(x,y,10);
    cout<<(ans==MX? -1:ans+1)<<endl;
        
        
        
        
        
        
    }
    
    
    return 0;
}


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

using namespace std;

vector <int> idx[26];
int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	string s;
	int res = 1e9;

	cin >> s;

	for(int i=0;i<s.length();i++)
	{
		idx[s[i]-'a'].push_back(i);
	}
	
	for(int i=0;i<26;i++)
	{
		if(idx[i].size()==0)
		{
			continue;
		}
		int Max = idx[i][0];
		for(int j=1;j<idx[i].size();j++)
		{
			Max = max(Max, idx[i][j] - idx[i][j-1] - 1);
			//cout << idx[i][j] - idx[i][j-1] - 2 << '\n';
		}
		Max = max(Max, (int)(s.length()) - 1 - idx[i][idx[i].size()-1]);
		res = min(res,Max);
	}

	cout << res << '\n';

	return 0;
}

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

const int INF = 1001001001;

int main() {
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> s(h);
    rep(i,h) cin >> s[i];

    int ans = INF;
    rep(div,1<<h-1) {
        int g = 0;
        vector<int> id(h);
        rep(i,h) {
            id[i] = g;
            if (div>>i&1) g++;
        }
        g++;
        vector<vector<int>> c(g, vector<int>(w));
        rep(i,h)rep(j,w) c[id[i]][j] += s[i][j] - '0';
        bool ok = true;
        rep(i,g)rep(j,w) {
            if (c[i][j] > k) ok = false;
        }
        if (!ok) continue;

        int num = g-1;
        vector<int> now(g);
        auto add = [&](int j) {
            rep(i,g) now[i] += c[i][j];
            rep(i,g) if (now[i] > k) return false;
            return true;
        };
        rep(j,w) {
            if (!add(j)) {
                num++;
                now = vector<int>(g);
                add(j);
            }
        }
        ans = min(ans, num);
    }
    cout << ans << endl;
    return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
	ost<<"{";
	for(int i=0;i<v.size();i++){
		if(i)ost<<",";
		ost<<v[i];
	}
	ost<<"}";
	return ost;
}

signed main(){
	string S;cin>>S;
	int K;
	cin>>K;

	vint num(10);
	for(int i=1;i<10;i++){
		string T;
		rep(j,i)T+=S;
		int cur=0;
		while(cur+1<T.size()){
			if(T[cur]==T[cur+1]){
				num[i]++;
				cur+=2;
			}
			else{
				cur++;
			}
		}
	}

	if(K<=2)cout<<num[K]<<endl;
	else{
		int f;
		if(K&1)f=1;
		else f=2;
		int ans=num[f];
		ans+=(num[f+2]-num[f])*((K-f)/2);
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <set>
#include <unordered_map>

using namespace std;
int N, Q, K;
vector<long> dist(100001);
vector<vector<int>> v(100001);
vector<long> a(100000), b(100000), c(100000);

void hoge(int pos, long dis) {
  for (int i=0; i<v.at(pos).size(); i++) {
    int f = v.at(pos).at(i);
    if (a.at(f) == pos) {
      if (dist.at(b.at(f)) == LONG_MAX) {
        dist.at(b.at(f)) = dis + c.at(f);
        hoge(b.at(f), dist.at(b.at(f)));
      }
    } else {
      if (dist.at(a.at(f)) == LONG_MAX) {
        dist.at(a.at(f)) = dis + c.at(f);
        hoge(a.at(f), dist.at(a.at(f)));
      }
    }
  }
}

int main() {
  cin >> N;
  for (int i=0; i<N-1; i++) {
    cin >> a.at(i) >> b.at(i) >> c.at(i);
    v.at(a.at(i)).push_back(i);
    v.at(b.at(i)).push_back(i);
  }
  cin >> Q >> K;
  for (int i=1; i<=N; i++) {
    dist.at(i) = LONG_MAX;
  }
  dist.at(K) = 0;
  hoge(K, 0);

  for (int i=0; i<Q; i++) {
    int x, y;
    cin >> x >> y;
    cout << dist.at(x) + dist.at(y) << endl;
  }
}

Measured memory_bytes: 16640
#include<stdio.h>
int main()
{
    int i,n,sum=0;
    scanf("%d",&n);
    if(n>=1 && n<=100)
    {
    for(i=1;i<=n;i++)
    {
    sum=sum+i;
    }
    }
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
using namespace std;
int main() {
	string a, b;
	cin >> a >> b;
	int x = stoi(a + b);
	for (int i = 0; i < 320; i++) {
		if (i * i == x) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include<ctime>
#include<random>
#include<cstring>
#include<cstdlib>
#include<cstdint>
#include<fstream>
#include<strstream>
#include<vector>
#include<string>
#include<chrono>
#include<algorithm>

//#include "D:\Code\C++\Headers\zle_STL.h"
//#include "D:\Code\C++\Headers\zle_OLD.h"

#define ll long long

using namespace std;

int main() {
	int a;
	cin >> a;
	int ans;
	ans = a + a * a + a * a * a;
	cout << ans;
}

Measured memory_bytes: 3156
#include <cstdio>
#include <iostream>
#define rs register short
using namespace std;

typedef long long LL;
const int N = 2005;
const LL mod = 1e9 + 7;

namespace MathCal {
#define ri register int
  static const int R = N * N;
  LL fac[R], inv[R];
  inline LL pow(LL x, LL e) {
    LL res = 1;
    for (; e; e >>= 1, x = x * x % mod)
      if (e & 1) res = res * x % mod;
    return res;
  }
  inline void Init(int n) {
    for (ri i = fac[0] = 1; i <= n; i ++) fac[i] = fac[i - 1] * i % mod;
    inv[n] = pow(fac[n], mod - 2);
    for (ri i = n; i; i --) inv[i - 1] = inv[i] * i % mod;
  }
  inline LL Co(int x, int y) {
    if (y > x) return 0;
    return fac[x] * inv[y] % mod * inv[x - y] % mod;
  }
#undef ri
}
using namespace MathCal;

LL dp[N][N];

int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  if (k == 1 || n == 1) return !puts("1");
  MathCal::Init(n * k);
  dp[0][0] = 1;
  for (rs i = 1; i <= n; i ++)
    for (rs j = 0; j <= i; j ++) {
      dp[i][j] = dp[i - 1][j];
      if (j) {
	dp[i][j] += Co(n * k - i - (k - 1) * (j - 1) - 1, k - 2) * dp[i][j - 1] % mod;
	if (dp[i][j] >= mod) dp[i][j] -= mod;
      }
    }
  printf("%lld\n", dp[n][n] * fac[n] % mod);
  return 0;
}


Measured memory_bytes: 92928
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,k;cin>>n>>k;
  vector<int>a(n);
  int res=0;
  rep(i,n)cin>>a[i];
  sort(all(a));
  vector<int>need(k+1,-1);
  rep(i,n){
    vector<int>dp(k);
    int f=0,ma=0;
    dp[0]=1;
    if(a[i]>k&&need[k]!=-1){res+=need[k];continue;}
    if(a[i]<=k&&need[a[i]]!=-1){res+=need[a[i]];continue;}
    rep(j,n){
      if(j==i)continue;
      if(a[j]>=k)break;
      auto tdp=dp;
      rep(l,min(ma+1,k-a[j])){
        if(!dp[l])continue;
        tdp[l+a[j]]=1;
        chmax(ma,l+a[j]);
        if(ma>=k-a[i])break;
      }
      if(ma>=k-a[i])break;
      dp=tdp;
    }
    f=(ma>=k-a[i]);
    if(!f)need[min(k,a[i])]=1;
    else need[min(k,a[i])]=0;
    res+=need[min(k,a[i])];

  }
  //rep(i,k+1)cout<<need[i]<<endl;
  cout<<res<<endl;

  return 0;

}


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

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

  while(1) {
    C -= B;
    if (C<=0) {
      cout << "Yes" << endl;
      break;
    } else 
    A -= D;
    if (A<=0) {
      cout << "No" << endl;
      break;
    }
  }
}

Measured memory_bytes: 3636