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

using namespace std;

#define READ() 	    freopen("in.txt","r",stdin)
#define WRITE()     freopen("out.txt","w",stdout)
#define sf(n) 	    scanf("%d",&n)
#define sl(x)       scanf("%I64d",&x)
#define lsf(n) 	    scanf("%lld", &n)
#define pb(n) 	    push_back(n)
#define mem(x,y)    memset(x,y,sizeof(x))
#define D(x)      	cout << #x << " = " << x << endl
#define CHKRTE		assert(false)
#define YOLO        cout << "YOLO" << endl
#define NL			printf("\n")
#define EPS 	    1e-10
#define INF         INT_MAX
#define MAX         INT_MAX
#define MOD         1000000007
#define LL          long long
#define endl        "\n"
#define pi          2.0*acos(0.0)
#define cnd         tree[idx]
#define lnd         tree[left]
#define rnd         tree[right]
#define callLeft    left,st,mid
#define callRight   right,mid+1,ed

int len; /// total len
int digitUp[20];
void toDigUpper(LL x)
{
    stack <int> stk;
    while(x>0)
    {
        stk.push(x%10); x/=10;
    }
    if(stk.empty())stk.push(0);
    while(!stk.empty())
    {
        digitUp[len++] = stk.top();stk.pop();
    }
}


LL dp[17][2][150];
/// print till upper bound
LL rec(int pos, bool noLimitOfPrvPos,LL sum)/// permute all possible numbers in a given range
{
    if(pos >= len)
    {
        return sum;
    }

    if(dp[pos][noLimitOfPrvPos][sum] != -1)return dp[pos][noLimitOfPrvPos][sum];

    int limit;
    if(noLimitOfPrvPos == true)limit = 9;
    else limit = digitUp[pos];

    LL mx = 0;
    for(int i=0;i<=limit;i++)
    {
//        char c = i+'0';
        mx = max(rec(pos+1,noLimitOfPrvPos || i<digitUp[pos],sum+i), mx);
    }
    dp[pos][noLimitOfPrvPos][sum] = mx;
    return mx;
}

int main()
{
//	ios_base::sync_with_stdio(false);
//    cin.tie(0); /// use "\n" instead of endl

/**
#ifndef ONLINE_JUDGE
    READ();
    WRITE();
#endif
**/

#ifdef JAMILPC
//	READ();
//	WRITE();

//    int t;
//    cin >> t;
//    while(t--)
//    {
#endif

    mem(dp,-1);

    LL x;
    cin >> x;

    toDigUpper(x);

    cout << rec(0,false,0) << endl;

#ifdef JAMILPC
//	}
#endif


    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = Integer.valueOf(scan.next());
        int cnt = 0;
        for(int i=0;i<n;i++) {
        	cnt+=isPrime(Integer.valueOf(scan.next()));
        }
        System.out.println(cnt);
        scan.close();
    }
    public static int isPrime(int n) {
        if (n<2) {
        	return 0;
        }
        else if (n==2) {
        	return 1;
        }
        else if (n%2==0) {
        	return 0;
        }
        for (int i = 3; i <= Math.sqrt(n); i+=2){
            if (n%i==0){
                return 0;
            }
        }
        return 1;
    }
}


Measured memory_bytes: 41860
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int i = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    vector<string> W(N);
    rep(i, N) cin >> W[i];
    set<string> words;
    rep(i, N - 1) {
        if(W[i][W[i].size() - 1] != W[i + 1][0]) {
            cout << "No" << endl;
            return 0;
        }
    }
    rep(i, N) {
        if(words.count(W[i])) {
            cout << "No" << endl;
            return 0;
        } else {
            words.insert(W[i]);
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

const int N = 3e5 + 9;

int pre[N], suf[N];
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n, k, c; cin >> n >> k >> c;
    string s; cin >> s;
    vector<int> v;
    for(int i = 0; i < n; i++) if(s[i] == 'o') v.push_back(i);
    for(int i = 0; i < v.size(); i++){
        int l = 0, r = i - 1, nw = -1;
        while(l <= r){
            int mid = (l + r) >> 1;
            if(v[mid] < v[i] - c) nw = mid, l = mid + 1;
            else r = mid - 1;
        }
        pre[i] = 1;
        if(nw != -1) pre[i] += pre[nw];
    }
    for(int i = (int)v.size() - 1; i >= 0; i--){
        int l = i + 1, r = (int)v.size() - 1, nw = -1;
        while(l <= r){
            int mid = (l + r) >> 1;
            if(v[mid] > v[i] + c ) nw = mid, r = mid - 1;
            else l = mid + 1;
        }
        suf[i] = 1;
        if(nw != -1) suf[i] += suf[nw];
    }
    vector<int> ans;
    for(int i = 0; i < v.size(); i++){
        int id = -1;
        if(i){
            int l = 0, r = i - 1, nw = i - 1;
            while(l <= r){
                int mid = (l + r) >> 1;
                if(pre[mid] == pre[i - 1]) nw = mid, r = mid - 1;
                else l = mid + 1;
            }
            l = i + 1, r = (int)v.size() - 1;
            while(l <= r){
                int mid = (l + r) >> 1;
                if(v[mid] > v[nw] + c ) id = mid, r = mid - 1;
                else l = mid + 1;
            }
        }
        else id = i + 1;
        int res = 0;
        if(i) res = pre[i - 1];
        if(id != -1) res += suf[id];
        if(res < k) ans.push_back(v[i]);
    }
    for(auto x: ans) cout << x + 1 << '\n';
    return 0;
}


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

int cmpnum(const void * n1, const void * n2) {
	if (*(long *)n1 > *(long *)n2)
	{
		return 1;
	}
	else if (*(long *)n1 < *(long *)n2)
	{
		return -1;
	}
	else
	{
		return 0;
	}
}

int main(void) {

  long n;
  scanf("%ld", &n);
  long a[n];
  for (long i = 0; i < n; i++) {
    scanf("%ld", &a[i]);
    a[i] -= i+1;
  }
  qsort(a, n, sizeof(long), cmpnum);
  long all = 0;
  for (long i = 1; i < n; i++) {
    all += a[i]-a[0];
  }
  long sadness = all;
  long min = all;
  long level = a[0];
  long width,height;
  for (long i = 0; i < n; i++) {
    if (a[i+1] == level) {
      continue;
    }
    width = i+1;
    if (n-width*2 <= 0) {
      break;
    }
    height = a[i+1]-a[i];
    if (height*(n-width*2) <= sadness) {
      level = a[i+1];
      sadness -= height*(n-width*2);
      min = sadness;
    } else {
      height = sadness/(n-width*2);
      level += height;
      sadness -= height*(n-width*2);
      if (sadness <= min) {
        min = sadness;
      }
      sadness = -(sadness-(n-width*2));
      if (sadness <= min) {
        min = sadness;
      }
      break;
    }
  }
  printf("%ld\n", min);

  return 0;
}

Measured memory_bytes: 3324
/*********************
*  Author: xuziyuan  * 
*********************/

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

LL n,t,a[60][60],res[60][60],ans=0;
vector <vector <LL> > tmp;

vector <vector <LL> > mul(LL b[60][60],LL c[60][60])
{
  vector <vector <LL> > ret(n,vector <LL> (n,0));
  rep(k,n) rep(i,n) rep(j,n) ret[i][j]=(ret[i][j]+b[i][k]*c[k][j])%MOD;
  return ret;
}

int main()
{
  cin>>n>>t;
  rep(i,n) rep(j,n) cin>>a[i][j];
  bool have=false;
  while(t>0)
  {
    if(t%2==1) 
    {
      if(have)
      {
        tmp=mul(res,a);
        rep(i,n) rep(j,n) res[i][j]=tmp[i][j];
      }
      else
      {
        rep(i,n) rep(j,n) res[i][j]=a[i][j];
        have=true;
      }
    }
    t/=2;
    tmp=mul(a,a);
    rep(i,n) rep(j,n) a[i][j]=tmp[i][j];
  }
  rep(i,n) rep(j,n) ans=(ans+res[i][j])%MOD;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 384
<?php
// 桁数が増えてもOK！$valueと$sumを任意で変更する
$value = fgets(STDIN);
// 計算後の値
$sum = 7;
// 桁数(なぜか入力に改行(?)があるのでtrimする)
$length = strlen(trim($value));
// +,-の数
$signCount = $length - 1;
// 左から順番に1桁ずつ配列に格納
$array = array();
for ($i = 0; $i < $length; $i ++) {
    $array[] = (int) substr($value, $i, 1);
}

// 全探索(記号種類2(+,-)を計算回数分べき乗する)
// 1ならプラス、0ならマイナス
for ($i = 0; $i < pow(2, $signCount); $i ++) {
    $result = $array[0];
    $resultStr = $array[0];
    // 桁の右から比較する
    for ($j = $signCount - 1; $j >= 0; $j --) {
        // 左シフトした値と比べる
        if (($i & (1 << $j)) === (1 << $j)) {
            $result += $array[$signCount - $j];
            $resultStr .= "+" . $array[$signCount - $j];
        } else {
            $result -= $array[$signCount - $j];
            $resultStr .= "-" . $array[$signCount - $j];
        }
    }
    if ($result === $sum) {
        echo $resultStr . "=" . $sum;
        exit(0);
    }
}


Measured memory_bytes: 4340
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MAXN=1e7+7;
ll dp[MAXN];
vector<ll> dp2;
vector<ll> nextdp2;

int main(){
	ll X;
	cin>>X;
	ll total;total=0;
	ll ret;ret=0;
	for(ll a=0;;++a){
		ll total=a*ceil(a*0.5);
		total+=a%2?0:a*0.5;
		if(total>=X){ret=a;break;}
	}
	cout<<ret<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define ll long long
#define REP(a,b,c) for(int a=b;a<=c;a++)
#define re register
#define file(a) freopen(a".in","r",stdin);freopen(a".out","w",stdout)
typedef pair<int,int> pii;
#define mp make_pair
inline int gi()
{
	int f=1,sum=0;char ch=getchar();
	while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();}
	return f*sum;
}
const int N=100010;
int n,a[N],ans;
int main()
{
	n=gi();
	for(int i=1;i<=n;i++)a[i]=gi();
	for(int i=1;i<=n;i++)ans^=a[i]&1;
	puts(ans?"NO":"YES");
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 

ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k,t;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>a>>b>>t;
    Cout(b*(t/a));
    return 0;
}


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

int main() {
long long n,p,f=0,s[100000];
cin>>n>>p;
for(int i=0;i<n;i++){
    long long w,b;
    cin>>w>>b;
    f-=b;
    s[i]=(100-p)*w+p*b;
}
sort(s,s+n,greater<long long>());
f*=p;
int l=0;
while(f<0){
    f+=s[l];
    l++;
}
cout<<l<<endl;
	return 0;
}

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

// G13E_5.cpp

const LL MOD = 1000000007;

void mat_prod(LL a[3][3], LL b[3][3], LL c[3][3]) { // a = b * c;
	LL d[3][3];
	inc(i, 3) {
	inc(j, 3) {
		d[i][j] = 0;
	}
	}
	
	inc(i, 3) {
	inc(j, 3) {
	inc(k, 3) {
		// (d[i][j] += b[i][k] * c[k][j]) %= MOD;
		d[i][j] += b[i][k] * c[k][j];
		if(d[i][j] >= MOD) { d[i][j] %= MOD; }
	}
	}
	}
	
	inc(i, 3) {
	inc(j, 3) {
		a[i][j] = d[i][j];
	}
	}
}

void mat_exp(LL a[3][3], LL b[3][3], LL c) { // a = b ^ c;
	static LL t[60][3][3];
	static bool flag = true;
	
	if(flag) { // いいかげんな高速化
		inc(i, 3) {
		inc(j, 3) {
			t[0][i][j] = b[i][j];
		}
		}
		inc(i, 60 - 1) {
			mat_prod(t[i + 1], t[i], t[i]);
		}
		flag = false;
	}
	
	LL cc = c, d = 0;
	while(cc) { cc >>= 1; d++; }
	
	inc(i, 3) {
	inc(j, 3) {
		a[i][j] = 0;
	}
	}
	inc(i, 3) { a[i][i] = 1; }
	inc(i, d) {
		if((c >> i) & 1) {
			mat_prod(a, a, t[i]);
		}
	}
}

LL n, m, x[100002];

int main() {
	cin >> n >> m;
	inc1(i, m) { cin >> x[i]; }
	x[0] = 0;
	x[m + 1] = n + 1;
	
	LL a[3][3] = { { 2, 1, 1 }, { 2, 1, 0 }, { 1, 1, 1 } };
	LL b[3][3] = { { 1, 0, 0 }, { 2, 1, 0 }, { 1, 1, 1 } };
	LL c[3][3] = { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } };
	LL d[3][3];
	
	inc(i, m + 1) {
		if(i != 0) { mat_prod(c, b, c); }
		mat_exp(d, a, x[i + 1] - x[i] - 1);
		mat_prod(c, d, c);
	}
	
	cout << c[2][0] << endl;
	
	return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>

#define ABS(x) ( (x)>0 ? x : -(x) )
#define MIN(x,y) ( (x) < (y) ? (x) : (y) )
#define MAX(x,y) ( (x) > (y) ? (x) : (y) )

#define INF 1000000000

void swap(int* x, int *y)
{
	int t;

	t = *x;
	*x = *y;
	*y = t;
}

int binary_search(int p[], int n, int key)
{
	int left, right, middle;

	left = 0;
	right = n-1;


	while (left <= right)
	{
		middle = (left + right) / 2;

		if (p[middle] == key)
			return middle;
		else if (p[middle] > key)
		{
			right = middle - 1;
		}
		else if (p[middle] < key)
		{
			left = middle + 1;
		}
	}

	return -1;

}

void bubble_sort(int p[], int n)
{
	int i, j;

	for (i = 0; i < n-1; i++)
	{
		for (j = 0; j < n - i - 1; j++)
		{
			if (p[j] > p[j + 1])
				swap(&p[i], &p[i + 1]);
		}
	}
}

int main()
{
	double r;

	scanf("%lf", &r);

	printf("%f %f\n", M_PI * r * r, 2 * M_PI * r);
}


Measured memory_bytes: 2072
#include<stdio.h>
int main(){
	int a[3];
	for(int i=0; i<3; i++){
		scanf("%d", &a[i]);
	}
	for(int i=2; i>0; i--){
		for(int j=0; j<i; j++){
			if(a[j]>a[j+1]){
				int temp = j[a];
				j[a]=j[a+1];
				j[a+1]=temp;
			}
		}
	}
	printf("%d %d %d\n", a[0], a[1], a[2]);
	
}


Measured memory_bytes: 2732
def main():
    S = list(input().rstrip())
    N = len(S)
    if S != list(reversed(S)):
        print("No")
    elif S[:int((N-1)/2)] != list(reversed(S[:int((N-1)/2)])):
        print("No")
    elif S[int((N+3)/2) - 1:] != list(reversed(S[int((N+3)/2) - 1:])):
        print("No")
    else:
        print("Yes")


if __name__ == '__main__':
    main()


Measured memory_bytes: 61328
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
using namespace std;

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

    int right = 0;
    int left = 0;

    left = max(-1000000, x - (k - 1));
    right = min(1000000, x + k - 1);

    for(int i = left; i <= right; ++i) {
        cout << i << " ";
    }
    cout << endl;
}

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

typedef long long ll;
typedef pair<ll, ll> Pll;

int main() {
    int N, M; cin >> N >> M;
    int sum = 0;
    vector<int> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
        sum += a[i];
    }
    sort(a.begin(), a.end(), greater<int>());
    for (int i = 0; i < M; i++) {
        if (a[i] * 4 * M < sum) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


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

using namespace std;

int n, k;

int main()
{
    scanf("%d%d", &n, &k);
    long long ans = 0;
    for (int b = max(k + 1, 1); b <= n; b++)
    {
        int rem = (n + 1) % b, loop_num = (n + 1) / b;
        int bpart = b - k;
        long long pans = 1LL * loop_num * bpart + max(0, rem - k) - (k == 0);
        ans += pans;
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
int n;
int a[100005];
struct DT
{
   int value,ans;
}ji[100005],ou[100005];
bool cmp(DT a,DT b)
{
    return a.ans>b.ans;
}
int main()
{
    cin>>n;
    for(int i=1; i<=n; i++)
        cin>>a[i];
    for(int i=1; i<=n; i+=2)
        {
          ji[a[i]].ans++;
          ji[a[i]].value=a[i];
        }
    for(int i=2; i<=n; i+=2)
        {
          ou[a[i]].ans++;
          ou[a[i]].value=a[i];
        }
    ll ansn=0;
    sort(ji+1,ji+100005+1,cmp);
    sort(ou+1,ou+100005+1,cmp);
    if(ji[1].value==ou[1].value)
    {
       ansn=min((n-ji[2].ans-ou[1].ans),(n-ji[1].ans-ou[2].ans));
    }
    else
      ansn=n-ji[1].ans-ou[1].ans;
    cout<<ansn<<endl;
    return 0;
}

Measured memory_bytes: 2176
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
using namespace std;
#define INF 100000000

typedef long long ll;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};

int lr[100];

const string migi = "yuiophjklnm";

int main(void) {
    string s;
    while (cin >> s) {
        if (s == "#") break;
        int ans = 0;
        for (int i = 0; i < s.size(); i++) {
            lr[i] = 0;
            for (int j = 0; j < migi.size(); j++) {
                if (s[i] == migi[j]) {
                    lr[i] = 1;
                    break;
                }
            }
        }
        for (int i = 0; i < s.size()-1; i++) {
            if (lr[i] != lr[i+1]) ans++;
        }
        cout << ans << endl;
    }
    return 0;
}

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

using namespace std;

int count(string s){
  int i = 0,max = 0;
  for(int j = 0; j < s.length(); j++){
    
    if(s[j] == 'A' || s[j] == 'C' || s[j] == 'G' || s[j] == 'T'){
      i++;
      if(i > max)
        max = i;
    }
    
	else
      i = 0;
  }
  
  return max;
}

int main(){
  string s;
  cin >> s;
  
  cout << count(s);
  
  return 0;
}

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

#define MOD 1000000007
typedef unsigned long long ull;

int n;

int main() {
  cin >> n;

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

  int m = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == m + 1) {
      // 残す
      m++;
    }
  }

  if (m == 0) {
    cout << -1;
    return 0;
  }
  cout << n - m;
}


Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <math.h>
#include <string.h>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#include <sstream>

#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;
const int mod = 2019;

int main() {
    ll l, r; cin >> l >> r;
    for (ll i = l; i <= r; i++) {
        if (i % 2019 == 0) {
            cout << 0 << endl;
            return 0;
        }
        if (i % 673 == 0) {
            for (ll j = l; j <= r; j++) {
                if (j % 3 == 0) {
                    cout << 0 << endl;
                    return 0;
                }
            }
        }
    }
    
    ll min = 100000000000;
    for (ll i = l; i <= r; i++) {
        for (ll j = l; j <= r; j++) {
            if (i > j) continue;
            if (i == j) continue;
            ll tmp = (i % mod * j % mod) % mod;
            // cout << tmp << " " << i << " " << j << endl;
            if (tmp < min) min = tmp;
        }
    }
    cout << min << endl;
    
    // cout << min({(l%mod * (l+1)%mod) % mod, (r%mod * (r-1)%mod) % mod, }) << endl;
    
   
    // for (int i = 2020; i < 4038; i++) {
    //     for (int j = 2020; j < 4038; j++) {
    //         cout << i*j % mod << endl;
    //     }
    // }
    // for (int i = 1; i < 2019; i++) {
    //     for (int j = 2019; j > 0; j--) {
    //         cout << i * j % mod << endl;
    //     }
    // }
}



Measured memory_bytes: 256
import java.util.*;

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

    // 標準入力から子どもの人数を取得
    int number = scanner.nextInt();

    // N人の子どもそれぞれについてキャンディーの数を足していく
    int sum = 0; // *キャンディーの個数（初期値は0）
	for(int i = 1; i <= number; i++) {
      sum += i;
    }

    // キャンディーの合計数を出力
    System.out.println(sum);
  }
}

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

void solve(){
    int A,B;
    cin>>A>>B;
    if((A>8)||(B>8))cout<<":("<<endl;
    else{
        cout<<"Yay!"<<endl;
    }

}

int main(){
    solve();
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        while(true){
            int n=sc.nextInt();
            if(n==0){
                break;
            }
            double y=sc.nextInt();
            int x=0;
            double max=0;
            for(int i=0;i<n;i++){
                int b=sc.nextInt();
                double r=sc.nextInt();
                int t=sc.nextInt();
                if(t==1){
                    double sum=1+y*(r/100);
                    if(sum>max){
                        max=sum;
                        x=b;
                    }
                }else{
                    double sum=Math.pow(1+(r/100),y);
                    if(sum>max){
                        max=sum;
                        x=b;
                    }
                }
            }
            System.out.println(x);
        }
    }
}


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

int main() {
    int n, m;
    cin >> n >> m;
    vector<bool> broken(n + 1);
    REP(i, m) {
        int tmp;
        cin >> tmp;
        broken[tmp] = true;
    }
    vector<int> dp(n + 1);
    const int mod = 1000000007;
    dp[0] = 1;
    dp[1] = !broken[1];
    for(int i = 2; i < n + 1; i++) {
        if(broken[i]) {
            dp[i] = 0;
            continue;
        }
        dp[i] = (dp[i - 2] + dp[i - 1]) % mod;
    }
    cout << dp[n] << endl;
}

Measured memory_bytes: 640
using System;
class Program
 {
   	static void Main(string[] args)
        {
    　　	string S = Console.ReadLine(); //標準入力
		
    　　	string T = Console.ReadLine(); //標準入力
		
      int S_length = S.Length;
      int T_length = T.Length;
      
      int maxlength = 0;
    for(int i = 0; i< S_length-T_length+1; i++){
      int count = 0;
 	 	for(int j = 0; j< T_length; j++){
          if(S.Substring(i+j,1)==T.Substring(j,1)){
            count++;
          }
      	}
             if(maxlength <count){
               maxlength = count;
             }
      }
		
	
     		Console.WriteLine("{0}", T_length - maxlength);
        }
 
  
 }

Measured memory_bytes: 37452
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    int n; cin>>n;
    vector<vector<pp>> path(n);
    vector<int> ans(n,-1);
    rep(i,n-1){
        int a,b,w; cin>>a>>b>>w;
        a--; b--;
        path[a].push_back(mk(b,w));
        path[b].push_back(mk(a,w));
    }
    queue<pp> que;
    que.push(mk(0,-1));
    ans[0]=1;
    int s,from;
    while(!(que.empty())){
        tie(s,from)=que.front();
        que.pop();
        for(auto to:path[s]){
            if(to.first==from) continue;
            que.push(mk(to.first,s));
            ans[to.first]=(ans[s]+to.second)%2;
        }
    }
    rep(i,n) printf("%d\n",ans[i]);
}


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

int main(){
    int n,ans;
    cin>>n;
    for(int i=1;i<=n;i++){
        ans=0;
        for(int x=1;x<100;x++){
            for(int y=1;y<=x;y++){
                for(int z=1;z<=y;z++){
                    if(x*x+y*y+z*z+x*y+y*z+z*x==i){
                        if(x==y && y==z)ans++;
                        else if(x==y || y==z || x==z)ans+=3;
                        else ans+=6;
                    }
                }
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 3560
#include <iostream>
#include <vector>
#include <algorithm>
#include <tuple>


using namespace std;

long long K, N;

int main(){
    cin >> N >> K;
    long long l[N];

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

    sort(l, l + N); 

    long long min_score = l[N-1];

    for (int i = 0; i < N - K + 1 ; i++ ){
        if (min_score > l[i + K - 1] - l[i]) min_score =  l[i + K - 1] - l[i];
    }

    cout << min_score << endl;

    return 0;
}

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

int main()
{
	int H, W;
	cin.tie(0);	ios::sync_with_stdio(false);
	cin >> H >> W;

	vector<vector<char>> b(H, vector<char>(W));
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			cin >> b[i][j];
		}
	}
	cout << endl;
	for (int i = 0; i < H; ++i) {
		bool tf = true;
		for (int j = 0; j < W; ++j) {
			tf = tf && (b[i][j] == '.');
		}
		if (tf) {
			for (int j = 0; j < W; ++j) {
				b[i][j] = 'X';
			}
		}
	}
	for (int j = 0; j < W; ++j) {
		bool tf = true;
		for (int i = 0; i < H; ++i) {
			tf = tf && (b[i][j] == '.' || b[i][j] == 'X');
		}
		if (tf) {
			for (int i = 0; i < H; ++i) {
				b[i][j] = 'X';
			}
		}
	}
	for (auto& l : b) {
		bool tf = true;
		for (auto& r : l) {
			tf = tf && (r == 'X');
		}
		if (!tf) {
			for (auto& r : l) {
				if (r != 'X')
					cout << r;
			}
			cout << endl;
		}
	}
}

Measured memory_bytes: 256
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
import sys,bisect,string,math,time,functools,random
def Golf():*a,=map(int,open(0))
def I():return int(input())
def S_():return input()
def IS():return input().split()
def LS():return [i for i in input().split()]
def LI():return [int(i) for i in input().split()]
def LI_():return [int(i)-1 for i in input().split()]
def NI(n):return [int(input()) for i in range(n)]
def NI_(n):return [int(input())-1 for i in range(n)]
def StoLI():return [ord(i)-97 for i in input()]
def ItoS(n):return chr(n+97)
def LtoS(ls):return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[];g=[[] for i in range(n)]
    for i in range(E):
        inp=LI();org_inp.append(inp)
        if index==0:inp[0]-=1;inp[1]-=1
        if len(inp)==2:
            a,b=inp;g[a].append(b)
            if not Directed:g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp;aa=(inp[0],inp[2]);bb=(inp[1],inp[2]);g[a].append(bb)
            if not Directed:g[b].append(aa)
    return g,org_inp
def GGI(h,w,boundary=1,search=[],replacement_of_found='.',mp_def={'#':1,'.':0}):
#h,w,g,sg=GGI(h,w,boundary=1,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0}) # sample usage
    mp=[boundary]*(w+2);found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[boundary]+[mp_def[j] for j in s]+[boundary]
    mp+=[boundary]*(w+2)
    return h+2,w+2,mp,found
def TI(n):return GI(n,n-1)
def bit_combination(k,n=2):return [[tb//(n**bt)%n for bt in range(k)] for tb in range(n**k)]
def show(*inp,end='\n'):
    if show_flg:print(*inp,end=end)
def show2d(g,h,w):
    for i in range(h):show(g[i*w:i*w+w])

YN=['YES','NO'];Yn=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
#sys.setrecursionlimit(10**7)
input=lambda: sys.stdin.readline().rstrip()

show_flg=False
show_flg=True




k,a,b=LI()

if a+1>=b:
    ans=k+1
else:
    if k<a:
        ans=1+k
    else:
        k-=a+1
        ans=b
        d=k//2
        ans+=(b-a)*d
        ans+=k%2

print(ans)



Measured memory_bytes: 38892
#include<set>
#include<map>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<math.h>
#include<time.h>
#include<vector>
#include<bitset>
#include<memory>
#include<utility>
#include<fstream>
#include<stdio.h>
#include<sstream>
#include<iostream>
#include<stdlib.h>
#include<string.h>
#include<algorithm>
using namespace std;
char a[1005];
int main()
{
    #ifdef absi2011
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    scanf("%s",a);
    int sum=0;
    int n=strlen(a);
    int i;
    for (i=0;i<n;i++)
    {
        sum+=a[i]-'0';
    }
    int ans=sum;
    for (i=n-1;i>=0;i--)
    {
        if (a[i]!='0')
        {
            ans=max(ans,sum-1);
        }
        sum+='9'-a[i];
        a[i]='9';
    }
    printf("%d\n",ans);
    return 0;
} 


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

using namespace std;

int main(){
    int n,max = 0;
    string str;

    cin >> n;

    map<string,int>s;

    for(int i = 0;i < n;i++){
        cin >> str;
        if(s.find(str) == s.end())
            s[str] = 1;
        else
            s[str]++;
    }

    for(auto &i:s){
        if(max < i.second) max = i.second;
    }

    for(auto &i:s){
        if(max == i.second)
        cout << i.first << endl;
    }


    return 0;


}

Measured memory_bytes: 25216
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

def main():
    h,w = LI()
    d = collections.defaultdict(int)
    for _ in range(h):
        for c in S():
            d[c] += 1

    t = 0
    t2 = 0
    for v in d.values():
        t += v//4
        t2 += (v%4) // 2

    f = (h//2) * (w//2)
    if t < f:
        return 'No'
    t2 += (t-f) * 2
    if w%2 == 1:
        t2 -= h//2
    if h%2 == 1:
        t2 -= w//2
    if t2 < 0:
        return 'No'
    return 'Yes'



print(main())




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

const int MAXN = 1e6 + 5;
const int MOD = 1e9 + 7;

int N;
int fact[MAXN], inv[MAXN];

inline int add(int x, int y) {
	x += y;
	if (x >= MOD)
		x -= MOD;
	else if (x < 0)
		x += MOD;
	return x;
}

inline int mul(int x, int y) {
	return (long long)x * y % MOD;
}

int pot(int x, int y) {
	int res = 1;
	for (; y; y /= 2) {
		if (y % 2)
			res = mul(res, x);
		x = mul(x, x);
	}
	return res;
}

int choose(int n, int k) {
	if (k < 0 || n < k)
		return 0;
	return mul(fact[n], mul(inv[k], inv[n - k]));
}

int main() {
	scanf("%d", &N);
	
	fact[0] = inv[0] = 1;
	for (int i = 1; i <= N; i++) {
		fact[i] = mul(fact[i - 1], i);
		inv[i] = pot(fact[i], MOD - 2);
	}
	
	int sol = 0;
	for (int k = 0; k < N - 1; k++)
		sol = add(sol, add(1, -mul(choose(k - 1, N - k - 1), pot(choose(N - 1, k), MOD - 2))));
	
	printf("%d\n", mul(sol, fact[N - 1]));
		
	return 0;
}

Measured memory_bytes: 8064
s=input()
if s=="SUN":
  print(7)
elif s=="MON":
  print(6)
elif s=="TUE":
  print(5)
elif s=="WED":
  print(4)
elif s=="THU":
  print(3)
elif s=="FRI":
  print(2)
else:
  print(1)

Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <map>
#include <queue>
#include <string>
using namespace std;

int W,N,v[1000],w[1000],dp[1001][1001];
char c;

int main(){
	int cn=0;
	while(cin>>W){
		if(W==0)return 0;
		cn++;
		cin>>N;
		for(int i=0;i<N;i++)cin>>v[i]>>c>>w[i];
		for(int i=0;i<N;i++){
			for(int j=0;j<=W;j++){
				if(j<w[i])dp[i+1][j]=dp[i][j];
				else dp[i+1][j]=max(dp[i][j],dp[i][j-w[i]]+v[i]);
			}
		}
		int V=dp[N][W],w2=W;
		while(dp[N][w2]==V)w2--;
		cout<<"Case "<<cn<<":"<<endl<<dp[N][W]<<endl<<w2+1<<endl;
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define repr(i,from,to) for(int (i)=(from);(i)<(to);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
#define vprint(x) for(auto a:(x)) cout << x << endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;
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(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;cin>>n;
    string s;cin>>s;
    ll count = 0;
    char now = '-';
    rep(i,n) {
        if (now != s[i]) {
            count++;
        }
        now = s[i];
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
#include<stdlib.h>
#define N 10001
#define M NULL

struct node{
  int key;
  int shu;
  struct node *next;
};

typedef struct node *Shuto;

Shuto G[N];
Shuto mNode(int,int,Shuto);
void insert(int,int,int);

int main(){
  int i,j,n,cnt = 0,v,c,c1,v1;
  int clr[N],d[N],pi[N],minshu,ii;
  Shuto GGG;

  scanf("%d",&n);
  for(i = 0 ; i < n ; i++)G[i] = mNode(0,0,M);

  for(i = 0 ; i < n ; i++){
    scanf("%d%d",&v,&c);

    for(j = 0 ; j < c ; j++){
      scanf("%d%d",&v1,&c1);
      insert(i,v1,c1);
    }
  }

  for(i = 0 ; i < n ; i++){
    clr[i] = 0;
    pi[i] = -1;
    d[i] = 10000001;
  }

  d[0] = 0;

  while(1){
    minshu = 10000001;

    for(i = 0 ; i < n ; i++){
      if(clr[i] != 2 && d[i] < minshu){
	minshu = d[i];
	ii = i;
      }
    }

    if(minshu == 10000001)break;
    clr[ii]=2;

    for(GGG = G[ii] ; GGG != M ; GGG = GGG -> next){
      if(clr[GGG->key] != 2 && (GGG -> shu + d[ii]) < d[GGG->key]){
	pi[GGG->key] = ii;
	d[GGG->key] = GGG -> shu + d[ii];
	clr[GGG->key] = 1;
      }
    }
  }

  for(i = 0 ; i < n ; i++)printf("%d %d\n",i,d[i]);

  return 0;
}

Shuto mNode(int key,int shu,Shuto node){
  Shuto n;
  n = (Shuto)malloc(sizeof(struct node));
  n -> key = key;
  n -> shu = shu;
  n -> next = node;
  return n;
}

void insert(int s,int t,int u){
  Shuto GGG;
  GGG = mNode(t,u,G[s] -> next);
  G[s] -> next = GGG;
}



Measured memory_bytes: 17428
n ,q=map(int, input().split())
s=input()
t=[0]*(n+1)

for i in range(n):
    if s[i:i+2]=="AC":
        c=1
    else:
        c=0

    t[i+1]=t[i]+c

for i in range(q):
    l, r=map(int, input().split())
    print(t[r-1]-t[l-1])

Measured memory_bytes: 7748
#include<stdio.h>

int main(){

	int N,P,i,j=0,sum=0;

	scanf("%d",&N);

	for(i=0;i<N;i++){
		scanf("%d",&P);
		sum += P;
		if(j<P)
			j=P;
	}

	printf("%d\n",sum-j/2);

	return 0;
}

Measured memory_bytes: 128
N,X,Y=map(int,input().split())
count=[0]*(N-1)
for i in range(1,N):
    for j in range(i+1,N+1):
        num=min(abs(j-i),abs(X-i)+1+abs(j-Y),abs(Y-i)+1+abs(j-X))
        #d=[]
        
        #d.append(abs(j-i))
        #d.append(abs(X-i)+1+abs(j-Y))
        #d.append(abs(Y-i)+1+abs(j-X))
        count[num-1]+=1
for k in count:
    print(k)

Measured memory_bytes: 3444
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>

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

using namespace std;
typedef long long int ll;
const int INF = 1000000000;
const double PI = 3.1415926535897932;
const ll MOD = 1000000007;

vector<int> to[100000];

int main()
{
	int n, m;
	cin >> n >> m;
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		to[a].push_back(b);
		to[b].push_back(a);
	}
	
	vector<int> ans(n, -1);
	queue<int> que;
	que.push(0);
	while(!que.empty()) {
		int now = que.front();
		que.pop();
		for (auto i : to[now]) {
			if (ans[i] != -1) continue;
			ans[i] = now;
			que.push(i);
		}
	}
	rep(i, n) {
		if (i == 0) {
			cout << "Yes" << endl;
			continue;
		}
		cout << ans[i] + 1 << endl;
    }
	return 0;
}

Measured memory_bytes: 10128
#include "bits/stdc++.h"
using namespace std;

long long C[51][51];
void comb_table(int N) {
	for (int i = 0; i <= N; ++i) {
		for (int j = 0; j <= i; ++j) {
			if (j == 0 || j == i) {
				C[i][j] = (long long)1;
			}
			else {
				C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
			}
		}
	}
}

int main() {
	// 前処理
	int N, A, B;
	cin >> N >> A >> B;
	comb_table(N);
	vector<long long>V(N);
	for (int i = 0; i < N; ++i) {
		cin >> V[i];
		V[i] = -V[i];
	}
	sort(V.begin(), V.end());

	pair<long long, long long>pans;
	long long anscount = 0;
	long long sum = 0;
	{
		for (int i = 0; i < A; ++i) {
			sum += -1 * V[i];
		}
		pans = make_pair(sum, A);
		auto low1 = lower_bound(V.begin(), V.end(), V[A - 1]);
		auto up1 = upper_bound(V.begin(), V.end(), V[A - 1]);
		long long count = up1 - low1;
		long long first = low1 - V.begin();//V[frist]
		long long anscountsub = C[count][((A - 1) - (first)+1)];
		anscount = anscountsub;
	}
	{
		for (long long i = A + 1; i <= B; ++i) {
			sum += -1 * V[i - 1];
			auto low1 = lower_bound(V.begin(), V.end(), V[i - 1]);
			auto up1 = upper_bound(V.begin(), V.end(), V[i - 1]);
			long long count = up1 - low1;
			long long first = low1 - V.begin();//V[frist]
			long long anscountsub = C[count][((i - 1) - (first)+1)];
			if ((pans.first*i) < (sum*pans.second)) {
				pans = make_pair(sum, i);
				anscount = anscount;
			}
			else if ((pans.first*i) == (sum*pans.second)) {
				anscount += anscountsub;
			}
		}
	}
	long double dans = (long double)pans.first / (long double)pans.second;
	printf("%.10Lf\n", dans);
	cout << anscount << endl;
	return 0;

}

Measured memory_bytes: 3792
A = int(input())
ans, max_count = 0, 0

if A == 1:
    print(1)
else:
    for a in range(1, A + 1):
        count = 0
        tmp = a
        while True:
            if tmp % 2 != 0:
                if count > max_count:
                    max_count = count
                    ans = a
                break

            tmp /= 2
            count += 1

    print(ans)

Measured memory_bytes: 3060
# include <iostream>
# include <string>
using namespace std;
int main(){
  int n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;
  char grid[n+5];
  for(int i=1; i<=n; i++) cin >> grid[i];

  for(int i=a; i<c; i++){
    if(grid[i] == '#' && grid[i+1] == '#'){
      cout << "No" << endl;
      return 0;
    }
  }

  for(int i=b; i<d; i++){
    if(grid[i] == '#' && grid[i+1] == '#'){
      cout << "No" << endl;
      return 0;
    }
  }

  if(c < d){
    cout << "Yes" << endl;
  }
  else{
    for(int i=2; i<n; i++){
      if(grid[i-1] == '.' && grid[i] == '.' && grid[i+1] == '.' && b <= i && i <= d){
        cout << "Yes" << endl;
        return 0;
      }
    }
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3804
def solve():
    ans = 0
    A, B = [int(i) for i in input().split()]
    for i in range(A, B + 1):
        s = str(i)
        l = len(s)
        if all(s[j] == s[l - 1 - j] for j in range(int(l / 2))):
            ans += 1
    print(ans)

if __name__ == "__main__":
    solve()

Measured memory_bytes: 68728
n=int(input())
t=list(map(int,input().split()))
T=[-1,0]
for i in range(n):
  T.append(T[-1]+t[i])
T.append(T[-1]+1)
V=[0]+list(map(int,input().split()))+[0]
VV=[110]*(2*T[-1]+1)
for i in range(n+2):
  for j in range(2*T[-1]+1):
    if j<2*T[i]:
      a=T[i]-j/2
      VV[j]=min(VV[j],a+V[i])
    elif 2*T[i]<=j and j<=2*T[i+1]:
      VV[j]=min(VV[j],V[i])
    else:
      a=j/2-T[i+1]
      if a>100:
        break
      VV[j]=min(VV[j],a+V[i])
print(sum(VV)/2)

Measured memory_bytes: 3316
#include<stdio.h>
#include<string.h>
int main(void)
{
	int i,j,n,m,x[100],y[100],z;
	char a[101][101];
	scanf("%d %d",&n,&m);
	for(i=0;i<n;i++){
		scanf("%s",a[i]);
		x[i]=0;
		y[i]=0;
	}
	for(i=0;i<n;i++){
		y[i]=i;
		for(j=i;j<n;j++){
			if(strcmp(a[i],a[j])>0){
				x[j]++;
			}
			else if(strcmp(a[i],a[j])<0){
				x[i]++;
			}
		}
	}
	for(i=0;i<n;i++){
		for(j=i;j<n;j++){
			if(x[i]<x[j]){
				z=x[i];
				x[i]=x[j];
				x[j]=z;
				z=y[i];
				y[i]=y[j];
				y[j]=z;
				
			}
		}
		//printf("%d=%d\n",i,x[i]);
	}
	for(i=0;i<n;i++){
		printf("%s",a[y[i]]);
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <chrono>
#include <string>
#include <map>
using namespace std;
using ll = long long;

struct Line {
	string op;
	string v1, v2, v3;
	
	Line () {};
	Line (string &op, string &v1, string &v2, string &v3):
	op(op), v1(v1), v2(v2), v3(v3) {};
};

int n;
map<string, int> var;
Line program[1005];
int i2n[1005];

int main() {
	for (int i = 0; i < 1005; i++) {
		i2n[i] = -1;
	}
	
	cin >> n;
	for (int i = 0; i < n; i++) {
		int l;
		string op;
		string v1, v2, v3;
		
		cin >> l >> op;
		if (op == "ADD" || op == "SUB") {
			cin >> v1 >> v2 >> v3;
			
			if ('a' <= v1[0] && v1[0] <= 'z') {
				var[v1] = 0;
			}
			if ('a' <= v2[0] && v2[0] <= 'z') {
				var[v2] = 0;
			}
			if ('a' <= v3[0] && v3[0] <= 'z') {
				var[v3] = 0;
			}
		}
		
		if (op == "SET" || op == "IF") {
			cin >> v1 >> v2;
			if ('a' <= v1[0] && v1[0] <= 'z') {
				var[v1] = 0;
			}
			if ('a' <= v2[0] && v2[0] <= 'z') {
				var[v2] = 0;
			}
		}
		
		Line v(op, v1, v2, v3);
		program[i] = v;
		i2n[l] = i;
	}
	
	int pc = 0;
	auto start = chrono::system_clock::now();
	auto end = chrono::system_clock::now();
	double elapsed = chrono::duration_cast<std::chrono::milliseconds>(end-start).count();
	while (elapsed <= 4500.0) {
		if (pc < 0 || pc >= n ||
			program[pc].op.empty()) {
			for (auto &x:var) {
				cout << x.first << '=' << x.second << endl;
			}
			return 0;
		}
		
		Line p = program[pc]; pc++;
		bool over_flow = false;
		
		if (p.op == "ADD") {
			if ('a' <= p.v3[0] && p.v3[0] <= 'z') {
				if (var[p.v2] + var[p.v3] >= 16) over_flow = true;
				else var[p.v1] = var[p.v2] + var[p.v3];
			}
			else {
				if (var[p.v2] + stoi(p.v3) >= 16) over_flow = true;
				else var[p.v1] = var[p.v2] + stoi(p.v3);
			}
		}
		
		if (p.op == "SUB") {
			if ('a' <= p.v3[0] && p.v3[0] <= 'z') {
				if (var[p.v2] - var[p.v3] < 0) over_flow = true;
				else var[p.v1] = var[p.v2] - var[p.v3];
			}
			else {
				if (var[p.v2] - stoi(p.v3) < 0) over_flow = true;
				else var[p.v1] = var[p.v2] - stoi(p.v3);
			}
		}
		
		if (p.op == "SET") {
			if ('a' <= p.v2[0] && p.v2[0] <= 'z') {
				var[p.v1] = var[p.v2];
			}
			else {
				int v = stoi(p.v2);
				if (v >= 0 && v < 16) {
					var[p.v1] = v;
				}
				else {
					over_flow = true;
				}
			}
		}
		
		if (p.op == "IF") {
			if (var[p.v1]) {
				pc = i2n[stoi(p.v2)];
			}
		}
		
		if (p.op == "HALT" ||
			over_flow) {
			for (auto &x:var) {
				cout << x.first << '=' << x.second << endl;
			}
			return 0;
		}
		
		end = chrono::system_clock::now();
		elapsed = chrono::duration_cast<std::chrono::milliseconds>(end-start).count();
	}
	
	cout << "inf" << endl;
	
	return 0;
}


Measured memory_bytes: 3216
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN=100000;
int dp[MAXN+5];//dp[i]表示凑出i元最少需要多少张纸币 
int main()
{
	for(int i=0;i<=MAXN;i++)//若只用1元的纸币 
		dp[i]=i;
	int x=6;
	while(x<=MAXN)
	{
		for(int i=x;i<=MAXN;i++)
			dp[i]=min(dp[i],dp[i-x]+1);
		x*=6;
	}
	x=9;
	while(x<=MAXN)
	{
		for(int i=x;i<=MAXN;i++)
			dp[i]=min(dp[i],dp[i-x]+1);
		x*=9;
	}
	int n;
	scanf("%d",&n);
	printf("%d\n",dp[n]);
	return 0;
}


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

vector<int> apples;
int n;
int number;
int main(){
	int l;
	cin >> number >> l;
	int su = 0;
	for(int i = 0; i < number; i++){
		su += l + i;
		apples.push_back(l+i);
	}
	int mini = 1e9;
	int optimi = 0;
	for(auto u : apples){
		if(abs(su - (su - u)) < mini){
			mini = abs(su - (su - u));
			optimi = u;
		}
	}
	cout << su - optimi << "\n";
}


Measured memory_bytes: 256
// g++ -std=c++11 -O2 -Wall X.cpp -o X
#include <bits/stdc++.h>

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pi;


#define F first
#define S second
#define PB push_back
#define MP make_pair


int main() {
	string S,T;
	cin >> S;
	cin >> T;
	if (S.size() != T.size() - 1) {
		cout << "No" << endl;
		return 0;
	}
	for (int i = 0; i < S.size(); i++) {
		if (S[i] != T[i]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 3624
Len, Pos = map(int, input().split())
Left = -1000000
Right = 1000000

candL = max(Pos-Len+1, Left)
candR= min(Pos+Len-1, Right)

cand = [x for x in range(candL, candR+1)]
ans = ''

for s in cand:
  ans += str(s) + ' '
  
print(ans.rstrip())
  

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

int main() {
  long long N,K,S;
  cin >> N >> K >> S;
  if (S != 1) {
  	for (long long i = 0;i < K;i++) {
    	cout << S << " ";
  	}
  	for (long long i = 0;i < N-K;i++) {
    	cout << S - 1 << " ";
  	}
  }
  else {
    for (long long i = 0;i < K;i++) {
    	cout << S << " ";
  	}
  	for (long long i = 0;i < N-K;i++) {
    	cout << S + 1 << " ";
  	}
  }
}


Measured memory_bytes: 1280
s=input()
t=input()
a,b={},{}
cnt=1
for i in s:
    if i not in a:
        a[i]=cnt
        cnt+=1
cnt=1
for i in t:
    if i not in b:
        b[i]=cnt
        cnt+=1

for i in range(len(s)):
    if a[s[i]]!=b[t[i]]:
        print("No")
        exit()
print("Yes")


Measured memory_bytes: 3632
#include <stdio.h>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <string>
using namespace std;
int main(){
    int x;
    scanf("%d", &x);
    int res = 0;
    int now = x/500;
    res += now*1000;
    x = x%500;
    now = x/5;
    res += now*5;
    printf("%d\n", res);
    
    return 0;
}


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

#define rep(i,n) for(int i=0; i<(n); i++)
#define lep(j,n) for(int j=0; j<(n); j++)
#define reps(i,n) for(int i=1; i<(n); i++)
#define leps(j,n) for(int j=1; j<(n); j++)
#define pii pair<int,int>
#define gsort(x,n) sort((x),(x)+(n),greater<int>())
#define all(x) (x).begin(), (x).end()
#define int long long
#define setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
const long long mod = 1000000007;
using namespace std;

#define return(Z) re:(Z)

long long h[10000010],x[10000010],z[10000010];

signed main(){

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

    string s,a="9";
    cin>>s;

    if(s.find(a) != string::npos) cout<<"Yes"<<'\n';
    else cout<<"No"<<'\n';
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))

change = False
ans = 0
re = 0

for i in range(N):
    if A[i]==re+1:
        re += 1
        change = True
    else:
        ans += 1

if change == True:
    print(ans)
else:
    print(-1)    

Measured memory_bytes: 77644