akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main
{
  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s = r.readLine();
    int w = Integer.parseInt(r.readLine());

    for(int i = 0; i < s.length(); i += w)
    {
      System.out.print(s.charAt(i));
    }
  }
}

Measured memory_bytes: 22868
#include<iostream>
#include<vector>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;

int main(){
	int n;
	cin>>n;
	vector<int>a(n);
	vector<vector<int> > x(n),y(n);
	rep(i,n){
		cin>>a[i];
		vector<int> tmp(a[i]);
		x[i]=tmp;
		y[i]=tmp;
		rep(j,a[i])cin>>x[i][j]>>y[i][j];
	}
	int max = -1,sum;
	for(long long int i=0;i<(1<<n);i++){//all bits
		int tt=0;
		for(int k=0;k<n;k++){
			if((i&(1<<k))>0){//k bits 1?
				for(int xx=0;xx<a[k];xx++){//k 目線の矛盾を探す
					if(((i&(1<<(x[k][xx]-1)))>0&&y[k][xx]==0)||((i&(1<<(x[k][xx]-1)))==0&&y[k][xx]==1)){
						tt=1;
						break;
					}
				}
				if(tt==1)break;
			}
		}
		if(tt==0){//not conflict
			sum=0;
			for(int kk=0;kk<n;kk++){
				if((i&(1<<kk))>0)sum++;
			}
			if(max<sum)max=sum;
		}
	}
	cout<<max<<endl;



	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
   int resurt,book;
   while(1){
        cin>>resurt;
        if(resurt==0)break;
        for(int i=0;i<9;i++){
            cin>>book;
            resurt-=book;
        }
        cout<<resurt<<endl;
   }
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <numeric>//accumulate(v.begin(), v.end(), 0);
#include <algorithm>//sort(v.begin(),v.end());
#include <string>//
using namespace std;
#define ll long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main(){
        int n;
        cin >> n;
        vector <int> v(n,0);
        rep(i,n){
                cin  >> v[i];
        }
        sort(v.begin(),v.end());
        int i=n-1;
        ll w=0,h=0;
        while(true) {
                if(v[i]==v[i-1] &&w==0) {
                        w=v[i];
                        i--;
                }else if(v[i]==v[i-1]) {

                        h=v[i];
                        break;

                }
                i--;
                if(i<=0) {
                        break;
                }
        }
        cout << h*w << endl;

        return 0;
}


Measured memory_bytes: 640
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
# from fractions import gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))
ZIP = lambda: zip(*(MAP() for _ in range(n)))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    N = INT()
    print(sum([N//(i+1)*(N//(i+1) + 1)*(i+1)//2 for i in range(N)]))
    

if __name__ == '__main__':
    main()


Measured memory_bytes: 405432
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Created by hikigineer on 2017/03/04.
 */
public class Main {
    static Scanner in;
    static PrintWriter out;
    static String INPUT = "";

    public static void main(String[] args) throws Exception
    {
        in = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(INPUT);
        out = new PrintWriter(System.out);
        int N = ni();
        int M = ni();

        int ab[][] = new int[N][3];
        int cd[][] = new int[M][2];

        int i, j;
        for(i = 0; i < N; i++)
        {
            ab[i][0] = ni();
            ab[i][1] = ni();
            ab[i][2] = -1;
        }
        for(i = 0; i < M; i++)
        {
            cd[i][0] = ni();
            cd[i][1] = ni();
        }

        for(i = 0; i < N; i++)
        {
            int min = 400000000;
            for(j = M - 1; j >= 0; j--)
            {
                int distance = Math.abs(ab[i][0] - cd[j][0]) + Math.abs(ab[i][1] - cd[j][1]);
                if(min >= distance)
                {
                    min = distance;
                    ab[i][2] = j + 1;
                }
            }
        }

        for(i = 0; i < N; i++) out.println(ab[i][2]);
        out.flush();
    }

    static int ni() {
        return Integer.parseInt(in.next());
    }

}

Measured memory_bytes: 21716
#include<iostream>
#include<deque>
#include<algorithm>
using namespace std;

int main() {
    string s; int q; cin >> s >> q;
    deque<char> d;
    for(int i = 0; i < s.size(); ++i) d.push_back(s[i]);
    bool flag = 0;

    for(int i = 0; i < q; ++i) {
        int a; cin >> a;
        if(a == 1) flag = (flag ? 0 : 1); 
        else if(a == 2) {
            int x; char c; cin >> x >> c;
            if(x == 1) {
                if(flag) d.push_back(c);
                else d.push_front(c);
            } else {
                if(flag) d.push_front(c);
                else d.push_back(c);
            }
        }
    }   
    if(flag) {
        for(int i = d.size()-1; i >= 0; --i) {
            cout << d[i];
        }
    } else {
        for(int i = 0; i < d.size(); ++i) {
            cout << d[i];
        }
    }   
    cout << endl;
}


Measured memory_bytes: 896
n, x = list(map(int, input().split()))

pb = 0
p = 0

def christmas(l, x) :
    global pb, p
    if l == 0 :
        if pb < x :
            pb += 1
            p += 1
    else :
        if pb < x :
            pb += 1
        if pb + 2**(l+1)-3 <= x :
            pb += 2**(l+1)-3
            p += 2**l-1
        elif pb < x :
            christmas(l-1, x)
        if pb < x :
            pb += 1
            p += 1
        if pb + 2**(l+1)-3 <= x :
            pb += 2**(l+1)-3
            p += 2**l-1
        elif pb < x :
            christmas(l-1, x)
        if pb < x :
            pb += 1

christmas(n, x)
print(p)

Measured memory_bytes: 3064
S = input()

S_rmv =S.replace('x','')

count = 0
if S_rmv == S_rmv[::-1]:
    i = 0
    j = len(S)-1
    while i<j:
        if S[i] == S[j]:
            i +=1
            j -=1
        elif S[i] == 'x':
            i +=1
            count +=1
        elif S[j] == 'x':
            j -=1
            count +=1
    print(count)
else:
    print(-1)

Measured memory_bytes: 68480
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    string s;cin>>s;
    int n=s.size();
    int x;cin>>x;
    //0じゃないのがちょうどx個
    ll dp[n+1][x+10][2];//1なら越えない
    rep(i,n+1)rep(j,x+1)rep(k,2) dp[i][j][k]=0;
    dp[0][0][0]=1;
    rep(i,n){
        const int tar=s[i]-'0';
        rep(j,x+1){
            rep(k,2){
                for(int d=0;d<(k?10:(tar+1));d++){
                    if(d==0){
                        dp[i+1][j][k||d<tar]+=dp[i][j][k];
                    }else{
                        dp[i+1][j+1][k||d<tar]+=dp[i][j][k];
                    }
                }
            }
        }
    }
    cout<<dp[n][x][1]+dp[n][x][0]<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int N;
int T[200];
int main(){
  scanf("%d",&N);
  for(int i=0;i<(N*(N-1))/2;i++){
    int a,b,c,d;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    if(c < d) T[b]+=3;
    else if(c > d) T[a]+=3;
    else{
      T[a]++;
      T[b]++;
    }
  }
  for(int i=1;i<=N;i++){
    int rank=1;
    for(int j=1;j<=N;j++){
      if(T[i] < T[j]) rank++;
    }
    printf("%d\n",rank);
  }
}

Measured memory_bytes: 1188
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(long long i=0;i<(long long)(n);i++)
#define N 100010

int main() {
	int n;
	int x;
	int b[N];
	bool c[N];
	int dp[N][3];
	f(i, N) {
		f(j, 3)dp[i][j] = MOD;
	}
	scanf("%d", &n);
	f(i, n) {
		scanf("%d", &x);
		c[i] = false;
		b[i] = 0;
		while (x > 1) {
			if (x % 2 == 1)c[i] = true;
			b[i]++;
			x = x / 2;
		}
	}
	if (c[0]) {
		dp[0][0] = MOD;
		dp[0][1] = b[0] + 1;
		dp[0][2] = b[0] + 1;
	}
	else {
		dp[0][0] = b[0];
		dp[0][1] = MOD;
		dp[0][2] = MOD;
	}
	f(i, n-1) {
		if (c[i+1]) {
			if (c[i]) {
				dp[i + 1][1] = min(dp[i + 1][1], dp[i][1] + max(b[i + 1] - b[i] + 1, 0));
				dp[i + 1][1] = min(dp[i + 1][1], dp[i][2] + max(b[i + 1] - b[i], 0));
				dp[i + 1][2] = min(dp[i + 1][2], dp[i][1] + 1 + max(b[i + 1] - b[i], 0));
				dp[i + 1][2] = min(dp[i + 1][2], dp[i][2] + 1 + max(b[i + 1] - b[i] - 1, 0));
			}
			else {
				dp[i + 1][1] = min(dp[i + 1][1], dp[i][0] + max(b[i + 1] - b[i] + 1, 0));
				dp[i + 1][2] = min(dp[i + 1][2], dp[i][0] + 1 + max(b[i + 1] - b[i], 0));
			}
		}
		else {
			if (c[i]) {
				dp[i + 1][0] = min(dp[i + 1][0], dp[i][1] + max(b[i + 1] - b[i], 0));
				dp[i + 1][0] = min(dp[i + 1][0], dp[i][2] + max(b[i + 1] - b[i] - 1, 0));
			}
			else {
				dp[i + 1][0] = min(dp[i + 1][0], dp[i][0] + max(b[i + 1] - b[i], 0));
			}
		}
	}
	int ans = min(dp[n - 1][0], min(dp[n - 1][1], dp[n - 1][2]));
	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll, ll> pll;
//int dx[4] = { 1,0,0,-1 };
//int dy[4] = { 0,1,-1,0 };
#define MOD 1000000007
#define ARRAY_MAX 1005

const int INF = 1e9 + 7;


int main(){


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

	int n;
	cin >> n;
	vector<int> a(n);
	int x = 0;

	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		x ^= a[i];
	}

	int ans = 0;

	for (int i = 35; i >= 0; i--)
	{
		if ((x >> i) & 1)
		{
			for (int j = 0; j < n; j++)
			{
				int tmp = a[j] ^ (a[j] - 1);
				int bit = 1 << (i + 1);//i桁目のbitを0にする条件はtmpが2^(i+1)-1と等しい場合
				if (tmp == bit-1)
				{
					//ibit目の1は取り除かれた
					ans++;
					x ^= tmp;
					break;
				}
			}
		}
	}

	if (x == 0)
	{
		cout << ans << endl;
	}
	else {
		cout << "-1" << endl;
	}

	return 0;
}


Measured memory_bytes: 640
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: i32,
        b: i32,
        c: i32,
    }
    println!("{}", std::cmp::max(0, c-(a-b)));
}


Measured memory_bytes: 4352
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    s = input()
    t = s.replace("BC", "X")

    ans = 0
    cnt = 0

    for char in t[::-1]:
        if char == "X":
            cnt += 1
        elif char == "A":
            ans += cnt
        else:
            cnt = 0

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 73528
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
int a[100010],cnt[100010] = {0};
ll f[100010],inv[100010],fi[100010],mod = 1000000007,MX = 100010;
vector<int> v[100010];
void solve(){
    inv[1] = 1;
    for(int i=2;i<MX;i++){
        inv[i] = mod - (mod/i)*inv[mod%i]%mod;
    }
    f[1] = 1; fi[0] = 1;fi[1] = 1;
    for(int i=2;i<MX;i++){
        f[i] = f[i-1]*i%mod;
        fi[i] = fi[i-1]*inv[i]%mod;
    }
}

ll nck(ll n, ll k){
    if(n<k) return 0;
    if(k==0) return 1;
    return f[n]*fi[k]%mod*fi[n-k]%mod;
}

int main(){
    int i,n,s,t;
    cin >> n;
    for(i=0;i<=n;i++){
        cin >> a[i];
        v[a[i]].push_back(i+1);
    }
    for(i=1;i<=n;i++){
        if(v[i].size()>1){
            s = v[i][0]; t = v[i][1];
        }
    }
    solve();
    for(i=1;i<=n+1;i++){
        cout << (nck(n+1,i) - nck(n-t+s,i-1) + mod)%mod << endl;
    }
}

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

using namespace std;

int N;
int a[105];
int ans = 1e+9 + 7;

void solve() {
	for (int x = -100; x <= 100; x++) {
		int cost = 0;
		for (int i = 0; i < N; i++) {
			cost += (a[i] - x) * (a[i] - x);
		}
		ans = min(ans, cost);
	}
	cout << ans << endl;
}

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	solve();
	return 0;
}



Measured memory_bytes: 256
#define N 100
#include<stdio.h>


int main(){
  /*スワップ数*/
int count=0;
int A[N];
 int i,j,n,temp;
 /*入力数*/
  scanf("%d",&n);
  /*配列格納*/
  for(i=0;i<n;i++)

    scanf("%d",&A[i]);
  /*Bubble Sort*/
  for(i=0;i<n-1;i++){
    for(j=n-1;j>i;j--){
      if(A[j-1]>A[j]){
	temp=A[j-1];
	A[j-1]=A[j];
	A[j]=temp;
	count++;
      }}

  }
  /*カウント数と配列出力*/
  for(i=0;i<n;i++){
    if(i>0)printf(" ");
    printf("%d",A[i]);}
  printf("\n");
  printf("%d\n",count);
  return 0;


}





Measured memory_bytes: 2704
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ms(a,b) memset(a,b,sizeof(a))
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
const int maxn=1e6+10;
const int mod=1e9+7;
const int maxm=1e3+10;
using namespace std;
int main(int argc, char const *argv[])
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x,k;
    cin>>k>>x;
    int l=x-k+1;
    int r=x+k-1;
    for(int i=l;i<=r;i++)
    	cout<<i<<" ";
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
int A,B;
cin>>A>>B ;
if(B%2==0)
{
if (A>=13){
  cout<<(B)<<endl;
 
  }
else if (A>=6 && A<=12)
     {
    cout<<(0.5*B)<<endl;
    
   }
    else
      {	
      cout<<B*0 <<endl;
    }
}
  return 0;
 }

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

bool p(pair<int, int> a, pair<int, int> b) {
	int h1 = a.first;
	int h2 = b.first;
	int w1 = a.second;
	int w2 = b.second;
	int d1 = h1 * h1 + w1 * w1;
	int d2 = h2 * h2 + w2 * w2;
	if (d1 == d2) {
		return h1 < h2;
	}
	return d1 < d2;
}

int main() {
	int h, w;
	pair<int, int> rs[151 * 151];
	int idx = 0;
	for (int x = 1; x < 151; x++) {
		for (int y = 1; y < x; y++) {
			rs[idx++] = make_pair(y, x);
		}
	}
	sort(rs, rs + (151 * 151), p);
	for (;;) {
		cin >> h >> w;
		if ((h | w) == 0)
			break;
		for (int i = 0; i < 151 * 151; i++) {
			int y = rs[i].first;
			int x = rs[i].second;
			if (y == h && x == w) {
				cout << rs[i + 1].first << " " << rs[i + 1].second << endl;
				break;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 1340
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {

    	Scanner sc = new Scanner(System.in);
    	int x;
    	int i=1;
    	x = sc.nextInt();
    	while(x!=0){
    		System.out.println("Case " + i + ": " + x);
    		i++;
    		x = sc.nextInt();
    	}

    }
}

Measured memory_bytes: 41364
N=int(input())

lr = ""
i=1

if N==0:
    print(0)

else:    
    while N!=0:
        if N%(2**i)!=0:
            lr = "1" + lr
            N = N - (-2)**(i-1)
        else:
            lr = "0" + lr

        i+=1

    print(lr)

Measured memory_bytes: 3060
#include <algorithm>
#include <array>
#include <vector>
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <functional>
#include <queue>

//AtCoderC++.cpp

using namespace std;


struct Position {
	Position() {
		x = 0; y = 0;
	}
	Position(int px, int py) {
		x = px;
		y = py;
	}
	int x;
	int y;
	bool operator<(const Position& right) const {
		return (x + y) < (right.x + right.y);
	}
};

void Show(vector<bool> Ps) {
	for (int i = 0; i < Ps.size(); i++) {
		if (Ps[i]) {
			cout << "T" << endl;
		} else {
			cout << "F" << endl;
		}
	}
}

void Show(vector<int> Ns) {
	for (int i = 0; i < Ns.size(); i++) {
		cout << Ns[i] << endl;
	}
}



int main() {
	int N;
	cin >> N;
	string S;
	char prev = ' ';
	vector<string> Keys;
	for (int i = 0; i < N; i++) {
		cin >> S;
		if (prev != ' ') {
			if (S[0] != prev) {
				cout << "No" << endl;
				return 0;
			}
			for (int j = 0; j < Keys.size(); j++) {
				if (Keys[j] == S) {
					cout << "No" << endl;
					return 0;
				}
			}
			Keys.push_back(S);
			prev = S[S.length() - 1];
		} else {
			Keys.push_back(S);
			prev = S[S.length() - 1];
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<map>
#include<iomanip>
#include<functional>

using namespace std;
using  ull = unsigned long long int;

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


int main() {

	int n;
	cin >> n;
	vector<int>num(n);
	rep(i, 0, n)cin >> num[i];

	int cnt = 0;
	bool flag = false;
	int tmp;

	while (!flag) {
		flag = true;
		rep(i, 0, n) {
			if (num[i] == i + 1) {
				flag = false;
				if (i == 0) {
					tmp = num[i];
					num[i] = num[i + 1];
					num[i + 1] = tmp;
				}
				else if (i == n - 1) {
					tmp = num[i];
					num[i] = num[i - 1];
					num[i - 1] = tmp;
				}
				else {

					if (num[i + 1] == i + 2) {
						tmp = num[i];
						num[i] = num[i + 1];
						num[i + 1] = tmp;
					}
					else {
						tmp = num[i];
						num[i] = num[i - 1];
						num[i - 1] = tmp;
					}


				}

				cnt++;
			}
		}
		if (flag) {
			cout << cnt << endl;
			return 0;
		}	


	}



	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

int
main(int argc, char *argv[])
{
  int n, a[100000]; int max = 0, min = 100000; int cnt[100001] = {};
  scanf("%d", &n);
  for(int i = 0; i < n; i++){
    scanf("%d", &a[i]);
    max = (max > a[i] ? max : a[i]);
    min = (min > a[i] ? a[i] : min);
    cnt[a[i]]++; cnt[a[i] + 1]++;
    if(a[i] >= 1) cnt[a[i] - 1]++;
  }

  int ans = 0;

  for(int i = min; i <= max; i++){
    ans = (ans > cnt[i] ? ans : cnt[i]);
  }

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

  return 0;
}


Measured memory_bytes: 896
#define _LIBCPP_DEBUG 0
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1e9 + 7;

vector<vector<char>> MAP(22,vector<char>(22, '#'));

int bfs(int a, int b){

    vector<vector<int>> dist(22,vector<int>(22,-1));
    queue<int> RowQueue;
    queue<int> ColumnQueue;

    RowQueue.push(a); ColumnQueue.push(b);
    dist[a][b] = 0;

    int rotR[4] = {-1,0,1,0};
    int rotC[4] = {0,1,0,-1};
    while (!RowQueue.empty()){
        int r = RowQueue.front(); RowQueue.pop();
        int c = ColumnQueue.front(); ColumnQueue.pop();

        for (int i = 0; i < 4; ++i) {
            if (MAP[r+rotR[i]][c+rotC[i]]!='#' && dist[r+rotR[i]][c+rotC[i]]==-1){
                dist[r+rotR[i]][c+rotC[i]] = dist[r][c]+1;
                RowQueue.push(r+rotR[i]);
                ColumnQueue.push(c+rotC[i]);
            }
        }
    }

    // 最大値check
    int ans = 0;
    for (int i = 0; i < 22; ++i) {
        for (int j = 0; j < 22; ++j) {
            ans = max(ans, dist[i][j]);
        }
    }

    return ans;
}

int main(void) {
    int H,W; cin>>H>>W;

    for (int i = 1; i <= H; ++i) {
        for (int j = 1; j <= W; ++j) {
            cin>>MAP[i][j];
        }
    }

    int ans = 0;

    for (int i = 1; i <= H; ++i) {
        for (int j = 1; j <= W; ++j) {
            if(MAP[i][j]!='#'){
                ans = max(ans, bfs(i,j));
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>

int main() {
	std::string s, ans;
	std::cin >> s;
	for (int i = 0;i < s.size();i++) {
		if (s[i] == '0') {
			ans.push_back('0');
		}
		else if (s[i] == '1') {
			ans.push_back('1');
		}
		else{ 
			if(!ans.empty())
				ans.pop_back();
		}
	}
	std::cout << ans << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
  string ns="ACL";
  string p="";
  for(int i=0;i<t;i++)
  {
    p=p+ns;
  }
  cout<< p << endl;
  p="";
}

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

int main(){
    int n,k,q;
    cin >> n >> k >> q;
    vector<int> point(n,0);
    int a;
    for(int i=0; i<q; i++){
        cin >> a;
        point.at(a-1)++;
    }
    for(int i=0; i<n; i++){
        if(q-point.at(i)<k) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

Measured memory_bytes: 3792
program main
integer :: n,k,d,ans = 0
integer,allocatable :: a(:),sn(:)

read(*,*)n,k
allocate(a(n),sn(n))
sn = 0
a = 0

do i = 1,k
read(*,*)d
read(*,*)a(1:d)
do j = 1,d
if (sn(a(j)) == 0) ans = ans + 1
sn(a(j)) = 1
end do
end do

write(*,*) n - ans

end program main

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

using namespace std;

typedef long long ll;

int max(int a, int b)
{ return (a > b) ? a : b; }

const int MAXN = 200031;
int a[MAXN];

vector<ll> p(31);
int n;

int f[MAXN];
int s[MAXN];


bool check(int x)
{
    int sz = 0;
    for (int i = 1; i < n; i++)
    {
        if (a[i] > a[i - 1]) continue;
//        if (x == 3) cerr << st.size() << endl;
        while (sz > 0 && (f[sz - 1] > a[i]))
        {
            sz--;
        }
        if (sz == 0|| f[sz - 1] != a[i])
        {
            f[sz] = a[i];
            s[sz] = 0;
            sz++;
        }
        if (++s[sz - 1] == x)
        {
//            if (x == 3) cerr << st.back().first << " " << st.back().second << endl;
            do {
                int t = f[sz - 1];
                if (t == 1) return false;
                sz--;
                if (sz == 0 || f[sz - 1] != t - 1)
                {
                    f[sz] = t - 1;
                    s[sz] = 0;
                    sz++;
                }
                s[sz-1]++;
            } while (s[sz-1] >= x);
        }
    }

    return true;
}

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

    cin >> n;

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

    int l = 0;
    int r = 1000000000;
    while (r - l > 1)
    {
        int m = (l + r) / 2;
        if (check(m)) r = m;
        else l = m;
    }

    cout << r;

    return 0;
}


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

int main() {
  int64_t N, s=0;
  cin >> N;
  for(int64_t i=1;i<=N;i++){
    int64_t j=i%3;
    int64_t k=i%5;
    if(j!=0&&k!=0)
      s += i;
  }
  cout << s << endl;
}

Measured memory_bytes: 3636
N = int(input())
p = list(map(int, input().split()))
f = False
for i in range(N):
    for j in range(N):
        a = []
        for k in range(N):
            a.append(p[k])
        x, y = p[i], p[j]
        a[i] = y
        a[j] = x
        cnt = 0
        for k in range(N-1):
            if a[k] < a[k+1]:
                cnt += 1
        if cnt == N-1:
            print('YES')
            exit()

print('NO')
        
                

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const  ll INF = 1e18;
const  ll MOD = 1e9 + 7;
#define all(v) v.begin(), v.end()
#define repi(i,n,init) for(ll i=init;i<(n);i++)
#define repd(i,n,init) for(ll i=(n);i>=init;i--)
#define repm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define repb(bit,n,init) for(ll bit=init;bit<(1<<n);++bit)

int main()
{
    double w,h;
    cin >> w >> h;
    cout << w*h << " " << 2*w + 2*h << endl;
    return 0;
}


Measured memory_bytes: 3276
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iostream>
#include <vector>

int main()
{
	int n;
	std::cin >> n;

	std::vector<int32_t> inputs;
	inputs.reserve(n);

	std::vector<int64_t> sums;
	inputs.reserve(n);
	int64_t last_sum = 0;

	for (int i = 0; i < n; i++) {
		int a;
		std::cin >> a;
		inputs.push_back(a);
		last_sum += a;
		sums.push_back(last_sum);
	}

	int64_t reverse_sum = 0;
	int64_t min_diff = INT64_MAX;
	for (int araisan_count = 1; araisan_count < n; araisan_count++) {
		reverse_sum += inputs[n - araisan_count];
		min_diff = std::min(min_diff, std::abs(sums[n - araisan_count - 1] - reverse_sum));
	}

	std::cout << min_diff << std::endl;
}


Measured memory_bytes: 2932
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long M = sc.nextLong();

        long res = 0;
        
        if(N*2>=M){
            res = M/2;
        }else{
            res = N+((M-2*N)/4);
        }

        
        System.out.println(res);
        
        }
    }

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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

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;
}

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(){
    ll n; cin >> n;
    map<ll, ll>mp;
    REP(i, 2, 1e5){
        ll c = (i * (i-1))/2;
        mp[c] = i;
        if(c > 1e6){
            break;
        }
    }
    if(mp[n] > 0){
        cout << "Yes" << endl << mp[n] << endl;
        vector<vector<ll> > lis(mp[n], vector<ll>());
        int count = 1;
        REP(i, 0, mp[n]-1){
            REP(l, i+1, mp[n]){
                lis[i].pb(count);
                lis[l].pb(count);
                count++;
            }
        }
        REP(i, 0, mp[n]){
            cout << lis[i].size() << " ";
            REP(l, 0, lis[i].size()){
                cout << lis[i][l] << " ";
            }
            cout << endl;
        }
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 5092
N = int(input())
A = list(map(int, input().split()))
D = {}
for i in A:
  if i in D:
    D[i] += 1
  else:
    D[i] = 1
p = 0
for i in D:
  if D[i] >= i:
    p += D[i] - i
  else:
    p += D[i]
print(p)


Measured memory_bytes: 18172
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

vector<vector<vector<double>>> dp(310, vector<vector<double>>(310,vd(310,-1)));

int n;
double rec(double i, double j, double k){
    double res=0.0;
    if(dp[i][j][k]>=0)return dp[i][j][k];
    if(i==0&&j==0&&k==0)return 0.0;

    if (i > 0) res+=rec(i-1,j,k)*i;
    if (j > 0) res+=rec(i+1,j-1,k)*j;
    if (k > 0) res+=rec(i,j+1,k-1)*k;

    res+=n;
    res/=(i+j+k);
    return dp[i][j][k]=res;
}


int main(void) {
    
    
    cin>>n;
    vi a(n);
    rep(i,n)cin>>a[i];
    int in[3]={0};
    rep(i,a.size()){
        in[a[i]-1]++;
    }
    printf("%.9f\n",rec(in[0],in[1],in[2]));
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------


string S;
ll K;
int N;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>S>>K;
	N=S.size();
	
	int C[2]={},P[2]={};
	FOR(x,2) {
		int pre=x;
		int need=0;
		FOR(i,N) {
			if(pre==1) {
				pre=0;
			}
			else {
				if(S[i]==S[(i+N-1)%N]) {
					pre=1;
					need++;
				}
			}
		}
		P[x]=pre;
		C[x]=need;
	}
	
	if(P[1]==1) {
		cout<<C[1]*K<<endl;
	}
	else if(P[0]==1) {
		cout<<(K/2)*(C[0]+C[1])+C[1]<<endl;
	}
	else {
		cout<<C[1]+C[0]*(K-1)<<endl;
	}
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


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

int main(void){

  int a[10000];
  int i;

  for(i = 0; i < 10000; i++){
    scanf("%d", &a[i]);
    if(a[i] != 0){
      printf("Case %d: %d\n", i + 1, a[i]);
    }else{
      break;
    }
  }
    
  return 0;
}


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

using namespace std;

#define int long long
#define endl '\n'
#define maxn 100010
const int MOD = 1000000007;

int visited[maxn], h[maxn];
vector<int> g[maxn];
int ct;

void dfs(int u) {
    visited[u] = true;
    bool ch = true;
    for (auto x: g[u]) {
        if (h[x] >= h[u])
            ch = false;
    }
    if (ch)ct++;
    for (auto x : g[u]) {
        if (!visited[x]) {
            dfs(x);
        }
    }
}

void solve() {
    int n, m;
    cin >> n >> m;

    for (int i = 0; i < n; i++)cin >> h[i + 1];
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;

        g[a].push_back(b);
        g[b].push_back(a);
    }
    for (int i = 1; i <= n; i++)
        if (!visited[i])dfs(i);
    cout << ct << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 11844
#include <iostream>
#include<string>
#include<math.h>
using namespace std;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)


int main(){
    int N,M,X;

    cin >> N >> M >>X;

    int A[M];
    FOR(i,M){
        cin >>A[i];
    }
    int bef=0;
    int aft=0;
    FOR(i,M){
        if(A[i]<X){
            bef++;
        }else if(A[i]>X){
            aft++;
        }
    }
    if(bef>aft){
        cout << aft;
    }else{
        cout << bef;
    }

   return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
h = list(map(int, input().split()))
gb = [m]*n
for i in range(m):
    a, b = map(int, input().split())
    if h[a-1] > h[b-1]:
        gb[b-1] -= 1
    if h[a-1] < h[b-1]:
        gb[a-1] -= 1
    if h[a-1] == h[b-1]:
        gb[a-1] -= 1
        gb[b-1] -= 1
print(gb.count(m))

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

string ans="00100110010110111111110";
const int timelim=2;

int gettime(){
  timeval tv;
  gettimeofday(&tv, NULL);
  int x = tv.tv_sec % timelim * 1000 + tv.tv_usec / 1000;
  return x;
}
 
int T=40;
 
int main(){
  //puts("Yes"); while (gettime()>10); return 0;
  int x=gettime()/T;
  if (x>=23){
    x=0;
  }
  puts(ans[x]=='1'? "Yes": "No");
  int aim=((x+1)*T-440+timelim*1000)%(timelim*1000);
  while (1){
    int t=gettime();
    if (t<=aim&&t>=aim-1) return 0;
  }
}


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

int main() {
	int R;
	cin >> R;
	string S;
	if (R < 1200) S = "ABC";
	else if (R < 2800) S = "ARC";
	else  S = "AGC";
	cout << S << endl;
	return 0;
}


Measured memory_bytes: 3628
#[test]
fn test_solve() {
    assert_eq!(solve("3 3\n1 2\n1 3\n2 3\n"), "2\n");
    assert_eq!(solve("7 7\n1 3\n2 7\n3 4\n4 5\n4 6\n5 6\n6 7\n"), "1\n");
}
fn solve(src: &str) -> String {
    let mut sc = Scanner::from_str(src);

    let n: usize = sc.read();
    let m: usize = sc.read();
    let mut cnd = vec![vec![false; n]; n];
    for _ in 0..m {
        let a: usize = sc.read();
        let b: usize = sc.read();
        cnd[a - 1][b - 1] = true;
        cnd[b - 1][a - 1] = true;
    }
    let mut s = 0;
    let mut prm: Vec<_> = (0..n).collect();
    while {
        if prm[0] == 0 && (0..n - 1).all(|i| cnd[prm[i]][prm[i + 1]]) {
            s += 1;
        };
        next_permutation(&mut prm)
    } {}

    format!("{}\n", s)
}

fn next_permutation<T: Ord>(v: &mut [T]) -> bool {
    let len = v.len();
    if len <= 1 {
        return false;
    }
    let mut i = len - 1;
    loop {
        let i1 = i;
        i -= 1;
        if v[i] < v[i1] {
            let mut i2 = len - 1;
            while v[i] >= v[i2] {
                i2 -= 1;
            }
            v.swap(i, i2);
            for j in 0..(len - i1) >> 1 {
                v.swap(i1 + j, len - j - 1);
            }
            return true;
        }
        if i == 0 {
            v.reverse();
            return false;
        }
    }
}

fn main() {
    let mut buf = String::new();
    use std::io;
    use std::io::{Read, Write};
    io::stdin().read_to_string(&mut buf).unwrap();
    io::stdout().write_all(solve(&buf).as_bytes()).unwrap();
}

struct Scanner<'a>(std::str::SplitWhitespace<'a>);
impl<'a> Scanner<'a> {
    fn from_str(src: &str) -> Scanner {
        Scanner(src.split_whitespace())
    }
    fn get(&mut self) -> &str {
        self.0.next().unwrap()
    }
    fn read<T: std::str::FromStr>(&mut self) -> T {
        self.get().parse().ok().unwrap()
    }
}


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

int main(void) {

	int l,i;
	int count=0;
	char s[100];

	scanf("%s", s);

	l = strlen(s);

	for(i=0;i < l/2;i++){
		if(s[i] != s[l-i-1]){
			count++;
		}
	}

	printf("%d",count);


	return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int l = Integer.valueOf(sc.next()) + Integer.valueOf(sc.next());
        int r = Integer.valueOf(sc.next()) + Integer.valueOf(sc.next());
        System.out.println(whichLean(l,r));
        sc.close();
    }

    public static String whichLean(int l, int r) {
        if (l < r) {
            return "Right";
        } else if (l > r) {
            return "Left";
        } else {
            return "Balanced";
        }
    }
}

Measured memory_bytes: 21076
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef set<int> si;
const int inf = 1e9;
const int mod = 1e9+7;
const int BN = 18;
const int TN = 1<<BN;
ll N, K, A[200000], S[200001], T[TN];
set<ll> se;
map<ll, ll> mi;
ll getter(int i){
  ll ret = 0, j = i + 1;
  FOR(k, 0, BN + 1){
    if(j & (1 << k)){
      ret += T[((j >> k) << k) - 1];
    }
  }
  return ret;
}
void setter(int i){
  FOR(k, 0, BN){
    if(!(i & (1 << k))){
      T[(((i >> k) + 1) << k) - 1] += 1;
    }
  }
}
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll d, s = 0, ans = 0;
  cin >> N >> K;
  S[0] = 0;
  se.insert(0);
  FOR(i, 0, N){
    cin >> d;
    d -= K;
    A[i] = d;
    s += d;
    S[i + 1] = s;
    se.insert(s);
  }
  d = 0;
  for(set<ll>::iterator itr = se.begin(); itr != se.end(); itr++){
    mi[*itr] = d;
    d++;
  }
  FOR(i, 0, N + 1){
    d = mi[S[i]];
    ans += getter(d);
    setter(d);
  }
  cout << ans << endl;
}


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

const ll mod = 1e9 + 7;

long long modPow(long long a, long long r) {
	if (r == 0) return 1;
	if (r % 2 == 0) {
		int t = modPow(a, r / 2);
		return t * t % mod;
	}
	return a * modPow(a, r - 1);
}

vector<ll> pow26;
vector<ll> pow25;

struct combination {
	const int MAX = 2e6 + 100;
	const int MOD;
	vector<long long> fac, finv, inv;

	combination(int mod) :MOD(mod) {
		fac.resize(MAX);
		finv.resize(MAX);
		inv.resize(MAX);
		fac[0] = fac[1] = 1;
		finv[0] = finv[1] = 1;
		inv[1] = 1;
		for (int i = 2; i < MAX; i++) {
			fac[i] = fac[i - 1] * i % MOD;
			inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
			finv[i] = finv[i - 1] * inv[i] % MOD;
		}
	}

	long long COM(int n, int k) {
		if (n < k) return 0;
		if (n < 0 || k < 0) return 0;
		return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
	}
};

int main() {
	ll k;
	string s;
	cin >> k >> s;
	ll n = s.size();
	combination comb(mod);
	ll ans = 0;
	pow25.push_back(1);
	pow26.push_back(1);
	for (ll i = 0; i < 2e6 + 100;++i) {
		pow25.push_back((pow25[i] * 25 % mod));
		pow26.push_back((pow26[i] * 26) % mod);
	}
	for (ll i = 0; i <= k; ++i) {
		ll preans = pow26[i];
		preans *= pow25[k - i];
		preans %= mod;
		preans *= comb.COM(n + k - i - 1, n - 1);
		preans %= mod;
		ans += preans;
		ans %= mod;
	}
	cout << ans << endl;
}


Measured memory_bytes: 83776
// Problem : D - Chat in a Circle
// Contest : AtCoder - AtCoder Beginner Contest 173
// URL : https://atcoder.jp/contests/abc173/tasks/abc173_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define debug(x) cerr << #x << " = " << x << '\n'
#define debug_arr(a , n) for(ll i = 0 ; i < n ; i++)cerr << a[i] << " "
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define vi vector<ll>
#define vll vector<ll> 
#define all(x) (x).begin() , (x).end()
#define inf 1000000000
#define mod 1000000007

const ll max_n = 1e5 + 9;

typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
ll power(ll a , ll b)
{
    ll prod = 1;
    while(b)
    {
        if(b&1)
        prod = (prod*a)%mod;
        a = (a*a)%mod;
        b >>= 1;
    }
    return prod;
}
int main()
{
		ll n;
		cin >> n;
		
		ll a[n];
		for(ll i = 0 ; i < n ; i++){
			cin >> a[i];
		}
		
		sort(a , a+n);
		ll sum = 0 , index = n-1 , offset = 1;
		
		for(int i = n-2 ; i >= 0 ; i--){
			sum += a[index];
			if(offset == 1){
				index--;
			}
			offset ^= 1;
		}
		
		cout << sum << "\n";
    return 0;
}

Measured memory_bytes: 5144
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <climits>
#include <cassert>
#include <algorithm>
#include <utility>

using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;

int main(void) {
    string s;
    cin >> s;
    string array[3];
    if(s == "Sunny") {
        cout << "Cloudy" << endl;
    } else if(s == "Cloudy") {
        cout << "Rainy" << endl;
    } else if(s == "Rainy") {
        cout << "Sunny" << endl;
    }
    return 0;
}


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

int main(){
  int N;
  cin >> N;
  
  int s1000,s100,s10,s1;
  
  s1000 = N / 1000;
  s100 = N % 1000 / 100;
  s10 = N % 100 / 10;
  s1 = N % 10;
  
  if(s1000 == s100 && s100 == s10)
    cout << "Yes" << endl;
  else if(s100 == s10 && s10 == s1)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

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

 
int main() {
    int n;
    int ans=0;
    cin>>n;
    vector<int> p(n);
    rep(i,n)cin>>p[i];

    rep(i,n-1){
        if(p[i]==i+1){
            ans++;
            swap(p[i],p[i+1]);
        }
    }
    if(p[n-1]==n)ans++;
    cout<<ans<<endl;
}

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

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

    bool flag = false;
    int ans=0;

    while(!flag) {
        rep(i, n) if(a[i]%2 != 0) {
            flag = true;
            break;
        }
        if(flag) break;
        else rep(i, n) a[i] /= 2;
        ans++;
    }

    cout << ans << endl;

  	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("1");
            WillReturn.Add("24 30");
            //7
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("2");
            WillReturn.Add("6 8");
            WillReturn.Add("3 3");
            //4
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();

        int[] wkArr = { };
        Action<string> SplitAct = pStr =>
            wkArr = pStr.Split(' ').Select(X => int.Parse(X)).ToArray();

        int Answer = 0;

        foreach (string EachStr in InputList.Skip(1)) {
            SplitAct(EachStr);
            Answer += (wkArr[1] - wkArr[0] + 1);
        }
        Console.WriteLine(Answer);
    }
}


Measured memory_bytes: 13376
#include<iostream>
#include<stdio.h>
#include<string>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
using namespace std;
#define INF 999999999
#define lint long long
#define rep(i, n) for(int i = 1; i <= (int)(n); i++)
int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define P pair<lint, lint>


int main(){
    string S;
    cin >> S;
    for(int i=0; i<S.length(); ++i){
        switch (S[i])
        {
            case 'A':
                cout << "T";
                break;
            case 'T':
                cout << "A";
                break;
            case 'C':
                cout << "G";
                break;
            case 'G':
                cout << "C";
                break;
            default:
                break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int X=sc.nextInt();
		int m[]=new int [N];
		int a=0;
		for(int i=0;i<N;i++) {
			m[i]=sc.nextInt();
		}
		int min=m[0];
		for(int i=1;i<N;i++) {
			if(min>m[i]) {
				min=m[i];
			}
		}
		for(int i=0;i<N;i++) {
			X=X-m[i];
			a++;
		}
		a+=X/min;
		System.out.println(a);
	}
}


Measured memory_bytes: 22740
#include <stdio.h>
#include <math.h>

int main()
{
    int n,d,x[10][10],ans = 0;
    long double sum;

    scanf("%d %d",&n,&d);

    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < d; j++)
        {
            scanf("%d",&x[i][j]);
        }
    }

    for (int i = 0; i < n - 1; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            for (int k = 0; k < d; k++)
            {
                sum += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
            }
            sum = sqrt(sum);
            if (sum == (int)sum)
            {
                ans ++;
            }
            sum = 0;
        }
        
    }
    printf("%d",ans);
}

Measured memory_bytes: 128
fun main(args:Array<String>){
  val (a,b,c,d) = readLine()!!.split(" ").map { it.toInt() }

  when {
    a+b > c+d -> "Left"
    a+b == c+d -> "Balanced"
    a+b < c+d -> "Right"
    else -> null
  }.let { println(it) }
}

Measured memory_bytes: 38024
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#include <string>
#include <sstream>
#include <stack>
#include <deque>
#define pb push_back
#define make make_pair
#define kaku(a) cout << a << endl
#define isort(a) sort(a.begin(),a.end())

using namespace std;

#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define PI 3.14159265359
long long gcd(long long a,long long b){ return b==0?a:gcd(b,a%b);}
long long lcm(long long a,long long b){ return a/gcd(a,b)*b;}

typedef pair<ll,ll> Pair;
const ll inf =1000000007;



void solve(){
    ll x,y;
    cin >> x >>y;
    ll ans=0;
    while(y>=x){
        x*=2;
        ans++;
    }
    kaku(ans);
}


int main(){
    solve();
}

Measured memory_bytes: 256