akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 100005

enum Type{
	GU,
	KI,
};

struct Info{
	Info(int arg_node_index,int arg_sum_dist,Type arg_type){
		node_index = arg_node_index;
		sum_dist = arg_sum_dist;
		type = arg_type;
	}
	bool operator<(const struct Info &arg) const{
		return sum_dist > arg.sum_dist;
	}
	int node_index,sum_dist;
	Type type;
};

int N,M,S,T;
int table[2*NUM],prime_table[NUM];
int min_dist[2][NUM];
vector<int> G[NUM];
Type rev[2] = {KI,GU};


int main(){

	//20万以下の素数を求める
	for(int i = 0; i < 2*NUM; i++){
		table[i] = 1;
	}
	table[0] = 0;
	table[1] = 0;

	for(int i = 2; i < 2*NUM; i++){
		if(table[i] == 0)continue;

		for(int k = 2*i; k < 2*NUM; k += i){
			table[k] = 0;
		}
	}

	int index = 0;
	for(int i = 3; i < 2*NUM; i++){
		if(table[i] == 1){
			prime_table[index++] = i;
		}
	}

	scanf("%d %d %d %d",&N,&M,&S,&T);

	S--;
	T--;

	int from,to;

	for(int loop = 0; loop < M; loop++){

		scanf("%d %d",&from,&to);
		from--;
		to--;

		G[from].push_back(to);
		G[to].push_back(from);
	}

	for(int i = 0; i < N; i++){
		min_dist[GU][i] = BIG_NUM;
		min_dist[KI][i] = BIG_NUM;
	}

	priority_queue<Info> Q;
	min_dist[GU][S] = 0;
	Q.push(Info(S,0,GU));

	int next_node,next_cost;
	Type next_type;

	while(!Q.empty()){

		if(Q.top().sum_dist > min_dist[Q.top().type][Q.top().node_index]){

			Q.pop();
		}else{

			for(int i = 0; i < G[Q.top().node_index].size(); i++){

				next_node = G[Q.top().node_index][i];
				next_cost = Q.top().sum_dist+1;
				next_type = rev[Q.top().type];

				if(min_dist[next_type][next_node] > next_cost){
					min_dist[next_type][next_node] = next_cost;
					Q.push(Info(next_node,next_cost,next_type));
				}
			}

			Q.pop();
		}
	}

	if(min_dist[GU][T] == 2){

		printf("2\n");

	}else{

		if(min_dist[KI][T] == BIG_NUM){

			printf("-1\n");

		}else{

			int left = 0,right = index-1,mid = (left+right)/2;
			int ans;

			while(left <= right){

				if(prime_table[mid] >= min_dist[KI][T]){

					ans = prime_table[mid];
					right = mid-1;

				}else{

					left = mid+1;
				}
				mid = (left+right)/2;
			}

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

	return 0;
}



Measured memory_bytes: 10484
/*input
31 17
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}

int main()
{
	IOS;
	int n,k;
	cin>>n>>k;
	int cnt=0;
	for(int i=1;i<=n;i+=2){
		cnt++;
	}
	if(cnt>=k) cout<<"YES\n";
	else cout<<"NO\n";
	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys, math, fractions, itertools, collections


def solve(N: int, A: "List[int]"):
    c = collections.Counter(A).items()
    a = [aa[0] for aa in c if aa[1] > 1]
    a.sort()
    s = [aa[0] for aa in c if aa[1] > 3]
    s.sort()

    if len(a) > 1:
        r = a[-1] * a[-2]
    else:
        r = 0
    
    if len(s) > 0:
        ss = s[-1] ** 2
    else:
        ss = 0
    
    print(max(r, ss))
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 26536
n = int(input())
h = list(map(int,input().split()))

cnt = 0
ans = 0
for i in range(n-1):
  if h[i] >= h[i+1]:
    cnt += 1
  else:
    ans = max(ans,cnt)
    cnt = 0

ans = max(ans,cnt)

print(ans)

Measured memory_bytes: 14252
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int a[200005],vis[200005],n,pos[200005];
long long k;
int main()
{int i;
	scanf("%d%lld",&n,&k);k++;
	for (i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	int x=1,cnt=1,len;
	for (i=1;i<=n;i++)
	{
		if (vis[x]) {
			cnt=vis[x];
			len=i-vis[x];
			break;
		}
		vis[x]=i;
		pos[i]=x;
		//printf("%d\n",x);
		x=a[x];
		cnt++;
	} 
	//printf("%d %d\n",cnt,len);
	if (k<=cnt) printf("%d",pos[k]);
	else printf("%d",pos[(k-cnt)%len+cnt]);
} 

Measured memory_bytes: 5972
#include <stdio.h>
int main(void){
	int a=0,b=0,c=0,d,x,w,v,y,count[10][10][10];
	
	while(c != 4){
		while(b != 3){
			while(a != 10){
				count[b][a][c]=0;
				a++;
			}
			a=0;
			b++;
		}
		b=0;
		c++;
	}
	a=0; b=0; c=0;
	scanf("%d",&d);
	while(a != d){
		scanf("%d %d %d %d",&v,&w,&x,&y);
		count[w-1][x-1][v-1] += y;
		a++;
	}
	a=0;
	while(c != 4){
		while(b != 3){
			while(a != 10){
				printf(" %d",count[b][a][c]);
				a++;
			}
			printf("\n");
			a=0;
			b++;
		}
		b=0;
		c++;
		if(c!=4)
			printf("####################\n");
	}
	return 0;
}

Measured memory_bytes: 616
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
 string str; cin>>str; if(str[0]=='A' && str[1]=='B')cout<<"Yes";
 else if(str[0]=='B' && str[1]=='A')cout<<"Yes";
 else if(str[1]=='A' && str[2]=='B')cout<<"Yes";
 else if(str[1]=='B' && str[2]=='A')cout<<"Yes";
 else cout<<"No";
}




Measured memory_bytes: 3580
/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, 
C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <stdio.h>

int main()
{
    int N;
    int D1[100];
    int D2[100];
    int i;
    int count = 0;
    int flag = 0;
    
    scanf("%d", &N);
    
    for(i=0;i<N;i++){
        scanf("%d %d", &D1[i],&D2[i]);
    }


    for(i=0;i<N;i++){
        if(D1[i] == D2[i]){
            count++;
            if(count>=3){
                flag =1;   
            }
        }
        if(D1[i] != D2[i]){
            count = 0;
        } 
    }

 
    if(flag==1){
        printf("Yes");
    }
    else{
        printf("No");
    }

    return 0;
}


Measured memory_bytes: 1736
import java.io.*;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String s = br.readLine();
		StringTokenizer st = new StringTokenizer(s, " ");
		int x = Integer.parseInt(st.nextToken());
		int y = Integer.parseInt(st.nextToken());
		
		System.out.println(x*y+" "+ (x*2+y*2));
	}

}

Measured memory_bytes: 16864
x = gets
y = x.split(" ")
t = y[0].to_i
h = y[1].to_i
s = y[2].to_i
until t == -1 && h == -1 && s == -1
 left = 7200
 ttoh = t * 60
 htos = (h + ttoh) * 60
 sums = htos + s

 leftsecond = left - sums

 anst = leftsecond / 3600
 ansh = (leftsecond - (3600 * anst)) / 60
 anss = leftsecond - (3600 * anst) - (ansh * 60)
 if anst < 10
  str = "0" + anst.to_s
  anst = str
 end
 if ansh < 10
  str = "0" + ansh.to_s
  ansh = str
 end
 if anss < 10
  str = "0" + anss.to_s
  anss = str
 end
 leftsecond3 = leftsecond * 3
 
 anst3 = leftsecond3 / 3600
 ansh3 = (leftsecond3 - (3600 * anst3)) / 60
 anss3 = leftsecond3 - (3600 * anst3) - (ansh3 * 60)
 if anst3 < 10
  str = "0" + anst3.to_s
  anst3 = str
 end
 if ansh3 < 10
  str = "0" + ansh3.to_s
  ansh3 = str
 end
 if anss3 < 10
  str = "0" + anss3.to_s
  anss3 = str
 end

 puts "#{anst}:#{ansh}:#{anss}"
 puts "#{anst3}:#{ansh3}:#{anss3}"
 
 x = gets
 y = x.split(" ")
 t = y[0].to_i
 h = y[1].to_i
 s = y[2].to_i
end


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

int main()
{
	int N;
	string S;
	cin >> N >> S;
	int res = 0;
	for (int i = 0; i < 1000; i++) {
		int t = i;
		vector<int> vs;
		for (int j = 0; j < 3; j++) {
			vs.push_back(t % 10);
			t /= 10;
		}
		int it = 0;
		for (int j = 0; j < N && it < 3; j++) if (S[j] - '0' == vs[it]) {
			++it;
		}
		res += it == 3;
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int a,b,c,i,count=0;
	scanf("%d %d %d",&a,&b,&c);
	for(i=a;i<=b;i++){
		if((c%i)==0){
			count++;
		}
	}
	printf("%d\n",count);
	return 0;
}
		

Measured memory_bytes: 596
#include <stdio.h>
#include <string.h>

int isKaibun(char *s)
{
    int i;
    int size = (int)strlen(s);
    
    for (i = 0; i < size / 2; i ++) {
        if (s[i] != s[size - 1]) {
            return 0;
        }
    }
    
    return 1;
}

int main(void)
{
    int i, j;
    int size;
    char s[99];
    
    scanf("%s", s);
    size = (int)strlen(s);
    
    j = 1;
    for (i = 0; i < size / 2; i ++) {
        if (s[i] != s[size - j]) {
            printf("No\n");
            return 0;
        }
        j ++;
    }
    
    j = 1;
    for (i = 0; i < (size / 4); i ++) {
        if (s[i] != s[size / 2 - j]) {
            printf("No\n");
            return 0;
        }
        j ++;
    }
    
    j = 1;
    for (i = 0; i < (size / 4); i ++) {
        if (s[size / 2 + j] != s[size - j]) {
            printf("No\n");
            return 0;
        }
        j ++;
    }
    
    printf("Yes\n");
    
    return 0;
}

Measured memory_bytes: 128
N = int(input())
h = [int(i) for i in input().split()]
dp = [10**10 for _ in range(N)]
dp[0] = 0
for i in range(N-1):
    dp[i+1] = min(dp[i+1], dp[i] + abs(h[i+1]-h[i]))
    if i+2 < N:
        dp[i+2] = min(dp[i+2], dp[i] + abs(h[i+2]-h[i]))
print(dp[-1])

Measured memory_bytes: 13712
#include<iostream>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<limits.h>
#include<utility>
#include<vector>
#include<tuple>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(A) A.begin(),A.end()
vector<vector<bool>> seat;

int main() {
	ll a[4]
		;
	rep(i, 4) {
		cin >> a[i];
	}
	ll max = LLONG_MIN;
	for (int i = 0; i < 2; i++) {
		for (int j = 2; j < 4; j++) {
			ll tmp = a[i] * a[j];
			if (tmp > max) {
				max = tmp;
			}
		}
	}
	cout << max << endl;
}


Measured memory_bytes: 3168
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        N = int(input())

        ans = 100000000000000
        for A in range(1, N):
            B = N - A
            ans = min(ans, self.f(A) + self.f(B))
        print(ans)

    def f(self, n: int) -> int:
        s = str(n)
        res = 0
        for c in s:
            res += int(c)
        return res


if __name__ == '__main__':
    AtCoder().main()

Measured memory_bytes: 42348
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <set>
#include <string>
#include <vector>
#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
typedef long long ll;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

int main() {
    long long x;
    cin >> x;
    int res = 0;
    long long m = 100LL;
    rep(i, 0, 376000) {
        m = 1.01 * m;
        res++;
        if(m >= x)
            break;
    }
    cout << res << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define f(i,j,k) for(int i=j;i<k;i++)
#define f2(i,j,k) for(int i=j;i>k;i--)
using namespace std;
int main(){
    long long n;
    cin>>n;
    long long a[n];
    f(i,0,n){
        cin>>a[i];
    }
    sort(a,a+n);
    vector<long long> b(100002,0);
    f(i,0,n){
        b[a[i]]++;
        b[a[i]+1]++;
        if(a[i]>0){
            b[a[i]-1]++;
        }
    }
    sort(b.begin(),b.end());
    cout<<b[100001]<<endl;
    return 0;
}


Measured memory_bytes: 4812
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
#define len_max 1000


string X;
string Y;
int dp[len_max+1][len_max+1];

int lcs(){
    int m = X.length();
    int n = Y.length();

    X = ' ' + X;//ずらす
    Y = ' ' + Y;
    

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

    for(int i = 0; i <= m; i++){
        dp[0][i] = 0;
    }

    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= m; j++){
            if(Y[i] == X[j]){
                dp[i][j] = dp[i-1][j-1] + 1;
            }
            else{
                dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
            }
        }
    }
    return dp[n][m];

}


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

    int ans[q];

    for(int i = 0; i < q; i++){
        cin >> X >> Y;
        //printf("%d\n", lcs());
        ans[i] = lcs();
    }

    for(int i = 0; i < q; i++){
        printf("%d\n", ans[i]);
    }

    return 0;
}


Measured memory_bytes: 7140
#include <bits/stdc++.h>
// #include <iostream>
// #include <vector>
// #include <map>
// #include <algorithm>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

template<typename T>
T mod(T a, T b){
    return (a + b) % b;
}

template<typename T>
T gcd(T a, T b){
    if (b == 0) return a;
    return gcd(b, a % b);
}

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

// n を素因数分解
map<ll, ll> factor(ll n){
    map<ll, ll> mp;
    for (ll i = 2; i*i <= n; i++) {
        while (n % i == 0) {
            mp[i]++;
            n /= i;
        }
    }

    if (n > 1) {
        mp[n]++;
    }

    return mp;
}

// 文字列に "hoge" が含まれているか
// string str = "hogepiyo";
// if (str.find("hoge") != string::npos) {
//     cout << "文字列が含まれています" << endl;
// }

// char to string
// char c = 'a';
// string str = {c};

void solve(){
    string s;
    cin >> s;

    if (s.compare("keyence") == 0) {
        cout << "YES" << endl;
        return;
    }

    for (int i = 0; i < (int)s.size(); i++) {
        for (int j = i+1; j < (int)s.size(); j++) {
            string str = "";
            for (int k = 0; k <= i; k++) {
                str += s[k];
            }
            for (int k = j; k < (int)s.size(); k++) {
                str += s[k];
            }
            if (str.compare("keyence") == 0) {
                cout << "YES" << endl;
                return;
            }
            // cout << str << endl;
        }
    }

    cout << "NO" << endl;

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


Measured memory_bytes: 256
/*****/

#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);
#include <stdexcept>

using namespace std;
using ll = long long;

#define nextline() (std::cerr << "\n")
#define debug(x) (#x " : " + (x))
#define debug_cout(x) (std::cerr << #x << " : " <<  (x) << "\n")
#define debug_tabCout(n, x) (std::cerr << strMulti("\t",n) << #x << " : " <<  (x) << "\n")
#define debug_headCout(h, x) (std::cerr << h << " : " <<  (x) << "\n")
#define debug_tabHeadCout(n, h, x) (std::cerr << strMulti("\t",n) << h << " : " <<  (x) << "\n")

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep1(i, n) for(int i=1, i##_len=(n); i<=i##_len; i++)
#define rrep(i, n) for(int i=(n)-1; i >= 0; i--)
#define rrep1(i, n) for(int i=(n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b);
//#define int long long
constexpr int INF = 2000000100;
constexpr ll DIV = 1000000007;	// 10e9+7
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> T divUp(T a, T b) { if (a % b == 0) { return a / b; } return a / b + 1; }
std::string strMulti(std::string t, int n) { std::string out = ""; for (int i = 0; i < n; i++) { out += t; } return out; }
template<class T> T math_P(T m, T n) { T ret = 1; for (T i = m; i > m - n; i--) { ret *= i; } return ret; }
template<class T> T math_C(T m, T n) { T ret = mathP(m, n); for (T i = 2; i <= n; i++) { ret /= i; } return ret; }
template<class T> bool compare_by_b(pair<T, T> a, pair<T, T> b) { if (a.second != b.second) { return a.second < b.second; } return a.first < b.first; }
template<class T> T math_gcd(T a, T b) { a = abs(a); b = abs(b); if (a < b) { std::swap(a, b); } T tmp; while (b != 0) { tmp = b; b = a % b; a = tmp; } return a; }
template<class T> T math_lcm(T a, T b) { a = abs(a); b = abs(b); if (a > b) { std::swap(a, b); } if (a == 1) { return b; } T i = a; while (i % b != 0) { i += a; } return i; }

/*****/

int Main()
{
	int N, K;
	cin >> N >> K;
	vector<int> h(N);
	rep(i, N) cin >> h[i];

	int cnt = 0;
	rep(i, N)
	{
		if (h[i] >= K)
		{
			cnt++;
		}
	}

	cout << cnt;

	return 0;
}

/*****/

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

	//std::cout << std::fixed << std::setprecision(10);

	Main();

	return 0;
}


Measured memory_bytes: 640
//#pragma GCC optimize ("-O3","unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include <random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n-1;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m-1;i >= n;i--)
#define SORT(v, n) sort(v, v+n)
#define VSORT(v) sort(v.begin(), v.end())
#define REVERSE(v,n) reverse(v,v+n)
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb push_back
#define print(x) cout<<x<<'\n'
#define pe(x) cout<<x<<" "
#define lb lower_bound
#define ub upper_bound
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
//#define int long long
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7; const int MAX = 200060;
const double pi = acos(-1); const double EPS = 1e-12;
const ll INF = 1e18;

int pcnt(int x) {
	int cnt = 0;
	REP(i, 30) {
		if (x & (1 << i))cnt++;
	}
	return cnt;
}

int bit_dp[1 << 26];
int dp[200020];
int h[200020];
void solve() {
	string S; cin >> S;
	int N = S.size();
	REP(i, N) {
		int num = S[i] - 'a';
		h[i + 1] = h[i] ^ (1 << num);
	}
	REP(i, 1 << 26)bit_dp[i] = 1e9;
	REP(i, N) {
		int ret = 1e9;
		int num = S[i] - 'a';
		if (pcnt(h[i + 1]) <= 1)ret = 1;
		REP(x, 26) {
			int bit = (1 << x) ^ h[i + 1];
			ret = min(ret, bit_dp[bit]+1);
		}
		chmin(bit_dp[h[i + 1]], ret);
		dp[i + 1] = ret;
	}
	print(dp[N]);
}

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

	solve();
}

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

typedef long long int lli;
typedef pair<int, int> ii;

const int N = 10;
const int D = 10;

int n, d;

int pt[N][D];

lli getDistSquare(int i, int j) {
	lli ans = 0;
	for(int k=0; k<d; k++) {
		ans += (pt[i][k]-pt[j][k])*(pt[i][k]-pt[j][k]);
	}
	return ans;
}

bool checker(int i, int j) {
	int base = getDistSquare(i, j);

	return ((int)sqrt(base)*(int)sqrt(base) == base);
}

int main() {
	ios_base::sync_with_stdio(false);

	cin >> n >> d;

	for(int i = 0; i < n; i++) for(int j=0; j<d; j++) cin >> pt[i][j];

	int ans = 0;
	for(int i = 0; i < n; i++) for(int j = i+1; j<n; j++) if(checker(i, j)) ans++;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define repp(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

const ll INF = 1e12;
signed main(){
    ll n,m,l; cin >> n >> m >> l;
    ll d[n][n];
    rep(i,n)rep(j,n)d[i][j]=INF;
    rep(i,m){
        int a,b; ll c;
        cin >> a >> b >> c;
        a--; b--;
        if(c<=l){
            d[a][b]=c;
            d[b][a]=c;
        }
    }
    rep(k,n){
        rep(i,n){
            rep(j,n){
                d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
            }
        }
    }
    ll d2[n][n];
    rep(i,n)rep(j,n)d2[i][j]=INF;
    rep(i,n){
        rep(j,n){
            if(d[i][j]<=l) d2[i][j]=1;
        }
    }
    rep(k,n){
        rep(i,n){
            rep(j,n){
                d2[i][j]=min(d2[i][j],d2[i][k]+d2[k][j]);
            }
        }
    }
    int q; cin >> q;
    rep(i,q){
        int a,b; cin >> a >> b;
        a--; b--;
        ll x=d2[a][b];
        if(x==INF) cout << -1 << endl;
        else cout << x-1 << endl;
    }
}


Measured memory_bytes: 1920
A, B, C = STDIN.gets.chomp.split(' ').map(&:to_i)

odd = 0
even = 0

min = [A, B, C].sort[0]

a = A - min
b = B - min
c = C - min

[a, b, c].each do |n|
  if n % 2 == 0
    even += 1
  else
    odd += 1
  end
end

arr = [a, b, c].sort.reverse



cnt = 0
# puts "#{cnt} #{arr.join(',')}"

while arr[1] - arr[2] > 2
  arr[0] -= 2
  arr[1] -= 2
  cnt += 1
  # puts "#{cnt} #{arr.join(',')}"
end

while arr[0] - arr[1] > 2
  arr[0] -= 2
  cnt += 2
  # puts "#{cnt} #{arr.join(',')}"
end


case [arr[0] - arr[1], arr[1] - arr[2]]
when [1, 1]
  # 3, 2, 1
  cnt += 3
when [2, 2]
  # 4, 2, 0
  cnt += 3
when [0, 2]
  # 2, 2, 0
  cnt += 1
when [2, 0]
  # 2, 0, 0
  cnt += 2
when [1, 2]
  # 3, 2, 0
  cnt += 2
when [2, 1]
  # 3, 1, 0
  cnt += 4
when [0, 2]
  # 3, 3, 1
  cnt += 1
when [2, 0]
  # 3, 1, 1
  cnt += 2
when [1, 0]
  # 2, 1, 1
  cnt += 1
when [0, 1]
  # 1, 1, 0
  cnt += 2
when [0, 0]
  #pass
end

puts cnt


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

int main(){
int N;cin >>N;
vector <int> h(N);
for (auto&& x :h)cin >>x;
int m=*max_element(h.begin(),h.end());
int ans=0;  
for (int i=1;i<=m;i++){
bool flg=false;
for(auto&& x :h)
  if(x>=i && flg==false){
    ans++;flg=true;}
    //cout<<i<<" "<<x<<endl;}
  else if(x<i)flg=false;  
}
  cout <<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define maxN 1000001
#define mod 1000000007
#define maxLL 1000000000000000000
#define PI 3.14159265358979323846264338327950L
typedef long long ll;

bool compared(int a,int b){
	return a < b;
}

int cmp(const void *a,const void *b){
	return(*(int*)b - *(int*)a);
}

int GCD(int a,int b){
	return b?GCD(b,a%b):a;
}

int main(){
	int a,b,h,m;
	cin>>a>>b>>h>>m;
	long double rad = PI * 2 * (
(long double)h / 12.0 + ((long double)m / 60.0) / 12.0 - (long double)m / 60.0);
	long double rsq = (long double)(a*a+b*b)-(long double)(2*a*b)*cosl(rad);
	printf("%20.20Lf\n",sqrtl(rsq));
	return 0;
}


Measured memory_bytes: 4136
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    return

#B
def B():
    return

#C
def C():
    a,b,c,d = list(map(int, S()))
    s = ["-","+"]
    for i in range(2):
        for j in range(2):
            for k in range(2):
                if eval(str(a)+s[i]+str(b)+s[j]+str(c)+s[k]+str(d)) == 7:
                    print(str(a)+s[i]+str(b)+s[j]+str(c)+s[k]+str(d)+"=7")
                    quit()
#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    C()


Measured memory_bytes: 38768
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);



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

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


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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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 (a>b) { a=b; return 1; } return 0; }

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"; return os;}
template<class T,size_t n> ostream& operator<<(ostream &os, const array<T,n> &t) {os<<"{"; rep(i,n) {os<<t[i]<<",";} os<<"}"; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

const ll INF = 1e9+7;


int main(){
	ios_base::sync_with_stdio(false);
	int N, ans=0;

	cin >> N;

	vector<pair<double,ll>> st;
	for(ll i=1; i<=1e15; i++){
		ll sum = 0, cur = i, cnt = 0;
		while(cur){
			sum += cur % 10;
			cur /= 10;
			cnt++;
		}
		double score = (double)i/(double)sum;
		while( st.size() && st.back().X > score ) st.pop_back();
		st.emplace_back(score, i);
		if( cnt > 2 ){
			ll add = 1, cur = i;
			rep(j, cnt){
				if( cur%10 != 9 || j >= cnt - 4 ){
					i += add - 1;
					break;
				}
				cur /= 10;
				add *= 10;
			}
		}
	}
	//for(auto t: st){
	//	cout << t.Y << "\t" << t.X << endl;
	//}
	rep(i,N) cout << st[i].Y << endl;

	//rep(i,N){
	//	if( i<9 ) cout << i+1 << endl;
	//	else{
	//		cout << 1;
	//		rep(j,i-8) cout << 9;
	//		cout << endl;
	//	}
	//}

	return 0;
}

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

int main(){
  int n;
  string a,b;
  cin>>n>>a>>b;
  if(a==b){
    cout<<n<<endl;
    return 0;
  }
  if(n==1&&a!=b){
    cout<<2<<endl;
    return 0;
  }
  int kazu=0;
  int saidai=0;
  rep(i,n){
    string bubun=b.substr(0,n-i);
    //cout<<a.substr(i,n-i)<<" "<<bubun<<endl;
    if(b.substr(0,n-i)==a.substr(i,n-i)){
      saidai=max(saidai,n-i);
      //cout<<"OK"<<endl;
    }
  }
  //cout<<saidai<<endl;
  int count=n-saidai;
  cout<<n+count<<endl;
  return 0;
}

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


#define REP(i, n) for(int i = 0; i < n; i++)
using namespace std;

int main()
{
    int n, x;
    cin >> n >> x;

    int m, m_min = 1000, cnt = n;

    REP(i, n){
        cin >> m;
        x -= m;
        if (m_min > m)
            m_min = m;
    }

    while (x >= m_min){
        x -= m_min;
        cnt++;
    }

    cout << cnt << endl;

}

Measured memory_bytes: 256
s=input()
n=len(s)

if s[0]==s[1]:
    print(1,2)
    exit(0)

a=-1
b=-1
for i in range(n-2):
    d={}

    for j in range(3):
        t=s[i+j]

        if t not in d:
            d[t]=1
        else:
            a=i+1
            b=i+j+1
            print(a,b)
            exit(0)

print(a,b)



Measured memory_bytes: 9100
A = []
for i in range(3):
    a =  list(map(int,input().split()))
    A.append(a)
N = int(input())
for i in range(N):
    b = int(input())
    for j in range(3):
        for k in range(3):
            if(A[j][k] == b):
                A[j][k] = 0

flag =False
check_c1 = 0
check_c2 = 0
for i in range(3):
    check_v = 0
    check_h = 0
    for j in range(3):
        check_v += A[j][i]
        check_h += A[i][j]
        check_c1 += A[i][i]
        check_c2 += A[2-i][i]
    if (check_v == 0 or check_h == 0):
        flag = True
if (check_c1 == 0 or check_c2 == 0):
    flag = True

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

Measured memory_bytes: 9068
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
  sc.Split(bufio.ScanWords)
  x, y, a, b, c := nextInt(), nextInt(), nextInt(), nextInt(), nextInt()
  p, q, r := nextInts(a), nextInts(b), nextInts(c)

  sort.Sort(sort.Reverse(sort.IntSlice(p)))
  	sort.Sort(sort.Reverse(sort.IntSlice(q)))
  	sort.Sort(sort.Reverse(sort.IntSlice(r)))

  	r = append(r, p[:x]...)
  	r = append(r, q[:y]...)
  	sort.Sort(sort.Reverse(sort.IntSlice(r)))

  	var ans int
  	for i := 0; i < x+y; i++ {
  		ans += r[i]
  	}

  // p = p[len(p)-x:]
  // q = q[len(q)-y:]
  //
  // sort.Ints(p)
  // sort.Ints(q)
  // var d []int
  // d = append(d, p...)
  // d = append(d, q...)
  // d = append(d, r...)
  // sort.Ints(d)
  //
  // var ans int
	// for i := 0; i < x+y; i++ {
  //   ans += d[len(d)-1]
  //   d = d[:len(d)-1]
	// }
	fmt.Println(ans)
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextInts(n int) []int {
	sl := make([]int, n)
	for i := range sl {
		sl[i] = nextInt()
	}
	return sl
}


Measured memory_bytes: 9984
n, c = gets.split.map(&:to_i)
discomforts = []
c.times { discomforts << gets.split.map(&:to_i) }
grids = []
n.times { grids << gets.split.map(&:to_i) }
hash_0 = Hash.new(0)
hash_1 = Hash.new(0)
hash_2 = Hash.new(0)
grids.each_with_index do |row, row_index|
  row.each_with_index do |column, column_index|
    if (row_index + column_index) % 3 == 0
      hash_0[column] += 1
    elsif (row_index + column_index) % 3 == 1
      hash_1[column] += 1
    else (row_index + column_index) % 3 == 2
      hash_2[column] += 1
    end
  end
end

ans = []
colors = (1..c).to_a
colors.permutation(3).each do |a, b, c|
  cost = 0
  hash_0.each do |k, v|
    cost += discomforts[k - 1][a - 1] * v
  end
  hash_1.each do |k, v|
    cost += discomforts[k - 1][b - 1] * v
  end
  hash_2.each do |k, v|
    cost += discomforts[k - 1][c - 1] * v
  end
  ans << cost
end
puts ans.min


Measured memory_bytes: 4732
a, b, k = map(int, input().split(' '))
for i in range(k):
    if i%2 == 0:
        if a%2 == 1:
            a -= 1
        a = a/2
        b += (a)
    else:
        if b%2 == 1:
            b -= 1
        b = b/2
        a += (b)
print(str(int(a)) + " " + str(int(b)))
    


Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include <functional>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <stack>

using namespace std;

int main() {
	int n;
	cin >> n;
	int a,b;
	cin >> a >> b;
	for (int i = a; i < b + 1; i++) {
		if (i % n == 0) {
			cout << "OK";
			return 0;
		}
	}
	cout << "NG";
}

Measured memory_bytes: 3636
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
import itertools
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N, K = MI()

cnt = 0
while N > 0:
    N = N // K
    cnt += 1

print(cnt)

Measured memory_bytes: 26964
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll dp[100001][4],n,k,a[100001],b[100001],c[100001];

ll solve(int idx,int prev)
{
    if(idx>=n) return 0;
    
    if(dp[idx][prev]!=-1) return dp[idx][prev];
    dp[idx][prev]=0;
    
    if(prev!=0) dp[idx][prev]=max(dp[idx][prev],a[idx]+solve(idx+1,0));
    if(prev!=1) dp[idx][prev]=max(dp[idx][prev],b[idx]+solve(idx+1,1));
    if(prev!=2) dp[idx][prev]=max(dp[idx][prev],c[idx]+solve(idx+1,2));
    
    return dp[idx][prev];
}

int main()
{
   cin>>n;
   for(int i=0;i<n;i++) cin>>a[i]>>b[i]>>c[i];
   memset(dp,-1,sizeof(dp));
   cout<<solve(0,3);
   return 0;
}

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

using namespace std;

#define int_ int64_t
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define db double
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PII pair<int, int>

const ll N=100010;
ll n,c,x[N],v[N];
ll lma[N],lmb[N],rma[N],rmb[N];

int main()
{
    scanf("%lld%lld",&n,&c);
    for (ll i=1;i<=n;i++) {
        scanf("%lld%lld",x+i,v+i);
    }
    ll tmp1=0,tmp2=0;
    for (ll i=1;i<=n;i++) {
        tmp1+=v[i];
        tmp2+=v[i];
        ll dis=x[i]-x[i-1];
        tmp1-=dis;
        tmp2-=2*dis;
        lma[i]=max(lma[i-1],tmp1);
        lmb[i]=max(lmb[i-1],tmp2);
    }
    tmp1=tmp2=0;
    for (ll i=n;i>=1;i--) {
        tmp1+=v[i];
        tmp2+=v[i];
        ll dis=i==n?(c-x[i]):(x[i+1]-x[i]);
        tmp1-=dis;
        tmp2-=2*dis;
        rma[i]=max(rma[i+1],tmp1);
        rmb[i]=max(rmb[i+1],tmp2);
    }
    ll ans=max(lma[n],rma[1]);
    for (ll i=1;i<=n;i++) {
        ans=max(ans,lmb[i]+rma[i+1]);
        ans=max(ans,rmb[i]+lma[i-1]);
    }
    printf("%lld\n",ans);
}


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

int main() {
  int n; //計算指示の個数                                                                         
  stack<int> st;
  int cef;
  int ans;

  cin >> n;

  for(int i = 0; i < n; i++) {
    string mcxi1, mcxi2;
    cin >> mcxi1 >> mcxi2;

    int temp1 = 0;
    int temp2 = 0;

    cef = 1;
    for(int i = 0; i < mcxi1.size(); i++) {
      if(mcxi1[i] >= '2' && mcxi1[i] <= '9') {
        st.push(mcxi1[i]-'0');
      }
      else {
        while(!st.empty()) {
          cef = st.top();
          st.pop();
        }
        if(mcxi1[i] == 'm') temp1 += cef * 1000;
        else if(mcxi1[i] == 'c') temp1 += cef * 100;
        else if(mcxi1[i] == 'x') temp1 += cef * 10;
        else if(mcxi1[i] == 'i') temp1 += cef * 1;
        cef = 1;
      }
    }
    cef = 1;
    for(int i = 0; i < mcxi2.size(); i++) {
      if(mcxi2[i] >= '2' && mcxi2[i] <= '9') {
        st.push(mcxi2[i]-'0');
      }
      else {
        while(!st.empty()) {
          cef = st.top();
          st.pop();
        }
        if(mcxi2[i] == 'm') temp2 += cef * 1000;
        else if(mcxi2[i] == 'c') temp2 += cef *100;
        else if(mcxi2[i] == 'x') temp2 += cef * 10;
        else if(mcxi2[i] == 'i') temp2 += cef * 1;
        cef = 1;
      }
    }
    ans = temp1 + temp2;

    if((cef = ans / 1000) != 0) {
      ans = ans % 1000;
      if(cef != 1) cout << cef;
      cout << 'm';
    }
    if((cef = ans / 100) != 0) {
      ans = ans % 100;
      if(cef != 1) cout << cef;
      cout <<'c';
    }
    if((cef = ans / 10) != 0) {
      ans = ans % 10;
      if(cef != 1) cout << cef;
      cout <<'x';
    }
    if(ans / 1 != 0) {
      cef = ans;
      if(cef != 1) cout << cef;
      cout <<'i';
    }
    cout << endl;
  }
  return 0;
}



Measured memory_bytes: 3080
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
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; }
using ll=long long;
using namespace std;
int main(){
    string s;
    cin>>s;
    s.at(5)=' ';
    s.at(13)=' ';
    cout<<s<<endl;
 }



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

const int MOD = (int)1e9+7;

int main(){
  int N,A,B;
  cin >> N >> A >> B;

  string turn="Alice";
  for(;;){
    if(turn=="Alice" && A+1<B){
      A++;
      turn="Borys";
    }
    else if(turn=="Borys" && A<B-1){
      B--;
      turn="Alice";
    }
    else{
      if(turn=="Alice") cout << "Borys" << endl;
      else  cout << "Alice" << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		int[] p = new int[N];
		for (int i = 0; i < N; i++) {
			p[i] = i + 1;
		}
		double[] x = new double[N];
		double[] y = new double[N];
		for (int i = 0; i < N; i++) {
			x[i] = in.nextDouble();
			y[i] = in.nextDouble();
		}
		double count = 0;
		double ans = 0;
		do {
			for (int i = 0; i < N - 1; i++) {
				ans += Math
						.sqrt(Math.pow(x[p[i] - 1] - x[p[i + 1] - 1], 2) + Math.pow(y[p[i] - 1] - y[p[i + 1] - 1], 2));
			}
			count++;
		} while (nextPermutation(p));
		System.out.println(String.format("%.6f", ans / count));
		in.close();
	}

	static boolean nextPermutation(int[] array) {
		int i = array.length - 1;
		while (i > 0 && array[i - 1] >= array[i])
			i--;

		if (i <= 0)
			return false;

		int j = array.length - 1;
		while (array[j] <= array[i - 1])
			j--;

		int temp = array[i - 1];
		array[i - 1] = array[j];
		array[j] = temp;
		j = array.length - 1;
		while (i < j) {
			temp = array[i];
			array[i] = array[j];
			array[j] = temp;
			i++;
			j--;
		}
		return true;
	}
}

Measured memory_bytes: 24740
#include<cstdio>
#include<cstring>
#include<algorithm>
#define rep(a,b,c) for (int a=b;a<=c;a++)
#define per(a,b,c) for (int a=b;a>=c;a--)
#define go(u) for (int o=ft[u],v;v=E[o].t;o=E[o].n)
#define fi first
#define se second
using namespace std;
typedef long long LL;
typedef double dob;
typedef pair<int,int> par;
int n;
char s[100010];
int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	char mid=s[n/2+1];
	int l=n/2+1,r=n+1-l;
	while (l!=1){
		if (s[l-1]!=mid||s[r+1]!=mid) break;
		--l,++r;
	}
	printf("%d\n",r);
	return 0;
}


Measured memory_bytes: 256
import bisect
import sys
input = sys.stdin.readline
 
n = int(input())
l = [int(li) for li in input().split(' ')]
l.sort()

cnt = 0
for i in range(n):
  for j in range(i+1, n):
    cnt += bisect.bisect_left(l, l[i]+l[j])-j-1
    
print(cnt)

Measured memory_bytes: 3188
use std::io::*;
use std::str::FromStr;
use std::f64::consts::PI;
/* 
The read function reads a string according to each one. 
*/
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

//main function
fn main() {
    let n: f64 = read();
    println!("{}",2.0*n*PI);
}


Measured memory_bytes: 2208
#include <stdio.h>

int main(void)
{
	char str[10000];
	int i = 0, j;
	
	fgets(str, 10000, stdin);
	
	while (str[i] != '\n'){
		if (str[i] >= 'a' && str[i] <= 'z'){
			str[i] -= 32;
		}
		i++;
	}
	printf("%s", str);
	
	return (0);
}

Measured memory_bytes: 524
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main() {
    string s, t;    cin >> s >> t;
    long long l_s = s.length(), l_t = t.length();
    vector<vector<int> > dp(l_s+1, vector<int>(l_t+1, 0));

    for (int i = 0; i < l_s; i++) {
        for (int j = 0; j < l_t; j++) {
            if (s[i] == t[j])
                dp[i+1][j+1] = max(dp[i][j]+1, dp[i+1][j+1]);
            dp[i+1][j+1] = max(dp[i+1][j], dp[i+1][j+1]);
            dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j+1]); 
        }
    }

    string res = "";
    int i = l_s, j = l_t;
    while (i > 0 && j > 0) {
        if (dp[i][j] == dp[i-1][j])
            i--;
        else if (dp[i][j] == dp[i][j-1])
            j--;
        else {
            res = s[i-1] + res;
            i--;
            j--;
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 38944
#coding: utf-8
import math
import heapq
import bisect

MOD = 10**9+7

S = input()
ans = [0]*13
ans[0]=1
 
for c in S:
    dp=[0]*13
    for i in range(13):
        #dpはansを一桁ずらしたもの
        dp[(i*10)%13]=ans[i]%MOD
    #0~12と13~25と同じものを増設
    dp+=dp
 
    if c=='?':
        for i in range(13):
            #添字を13から26まで増やしたから、ここでこう楽な計算ができる。
            ans[i]=sum(dp[i+4:i+14])
    else:
        for i in range(13):
            ans[i]=dp[i+13-int(c)]

print(ans[5]%MOD)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
#include "dbgtoki.hpp"
#define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i) 
#else
#define DUMP(i) 
#endif

#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(s) (s).begin(), (s).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()) , v.end());

using namespace std;
typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const int EPS = 1e-9;
const int MOD = 1e9+7;

 vector<bool> isprime(55556);

void eratos(int n){
  REP(i,n+1){
    isprime[i] = true;
  }
  isprime[0] = false;
  isprime[1] = false;
  int last = ((int)sqrt(n)) + 1;
  FOR(i,2,last){
    if(isprime[i]){
      int j = i+i;
      while(j <= n){
	isprime[j] = false;
	j += i;
      }
    }
  }
}

int main (){
  cin.tie(0);
  ios::sync_with_stdio(false);
  eratos(55555);
  int n;
  cin >> n;
  vi V;
  FOR(i,2,55556){
    if(isprime[i] && i % 10 == 1){
      V.push_back(i);
      if(SZ(V) == n)break;
    }
  }
  REP(i,n){
    if(i != 0) cout << " ";
    cout << V[i];
  }
  cout << endl;
  
  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

	stack<char> b;

	string t;
	for (ll i = 0; i < n; i++)
	{
		if (s[i] == ')')
		{
			if (b.empty())
			{
				t += "(";
			}
			else
			{
				b.pop();
			}
		}
		else
		{
			b.push(s[i]);
		}
	}

	s = t + s;

	t = "";
	while (!b.empty())
	{
		b.pop();
	}

	for (ll i = s.size() - 1; i >= 0; i--)
	{
		if (s[i] == '(')
		{
			if (b.empty())
			{
				t += ")";
			}
			else
			{
				b.pop();
			}
		}
		else
		{
			b.push(s[i]);
		}
	}

	s = s + t;

	println(s);

}

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

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

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

}

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

int main()
{
	int64_t n, m;
	cin >> n >> m;
	vector<int64_t> hs(n);
	for (auto &&h : hs)
	{
		cin >> h;
	}
	vector<int64_t> as(m), bs(m);
	for (int64_t i = 0; i < m; i++)
	{
		cin >> as[i] >> bs[i];
		as[i]--;
		bs[i]--;
	}

	vector<bool> good(n, true);
	for (int64_t i = 0; i < m; i++)
	{
		if (hs[as[i]] <= hs[bs[i]])
		{
			good[as[i]] = false;
		}
		if (hs[as[i]] >= hs[bs[i]])
		{
			good[bs[i]] = false;
		}
	}

	int64_t ans = 0;
	for (auto &&f : good)
	{
		if (f)
		{
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 5636
#include <stdio.h>
#include <iostream>
using namespace std;

#define MAX_NUM 1000

int W[MAX_NUM];
int N;

int Compare(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

void Swap(int idx1, int idx2) {
	int tmp = W[idx1];
	W[idx1] = W[idx2];
	W[idx2] = tmp;
}

int SearchIdx(int wi)
{	
	for (int i = 0; i < N; i++) {
		if (W[i] == wi) {
			return i;
		}
	}
	return -1;
}

void Copy(int *ary)
{
	for (int i = 0; i < N; i++) {
		ary[i] = W[i];
	}
}

int main(void)
{
	//input
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> W[i];
	}

	//minimum cost?
	int cost = 0;
	int w2[MAX_NUM];
	Copy(w2);
	qsort(w2, N, sizeof(int), Compare);

	for (int i = 0; i < N; i++) {
		int local_cost = 0;
		int local_change_num = 0;
		int idx1 = SearchIdx(w2[i]);
		while (idx1 != i) {
			int idx2 = SearchIdx(w2[idx1]);
			Swap(idx1, idx2);
			local_cost = local_cost + W[idx1] + W[idx2];
			local_change_num++;
			idx1 = idx2;
		}
		if (w2[i] * local_change_num > w2[0] * local_change_num + (w2[i] + w2[0]) * 2) {
			local_cost -= (w2[i] * local_change_num) - (w2[0] * local_change_num + (w2[i] + w2[0]) * 2);
		}
		cost += local_cost;
	}

	//output
	cout << cost << "\n";
	
	return 0;
}


Measured memory_bytes: 3224
import math
def resolve():
    x = int(input())
    sqrt_x = int(math.sqrt(x))
    al = list()
    for i in range(2, 10):
        for j in range(sqrt_x, 0, -1):
            if j**i <= x:
                al.append(j**i)
                break
    al = sorted(al)
    print(al[-1])
resolve()

Measured memory_bytes: 9160