akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>

using namespace std;

typedef long long ll;

ll n, cnt;
ll a[100005];

int main()
{
    //freopen("input.txt", "r", stdin);
    scanf("%lld", &n);
    for(ll i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
        if(a[i - 1] == 1 && a[i] >= 1) a[i]--, a[i - 1]--, cnt++;
        cnt += a[i] / 2;
        a[i] %= 2;
    }
    printf("%lld", cnt);
    return 0;
}


Measured memory_bytes: 1024
import java.util.*;

class Main {

	public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		int prev = 4280;
		for(;;){
			int use = in.nextInt();
			if(use == -1) return ;
			int cur = 1150;
			cur += Math.min(Math.max(0, use-10),10)*125;
			cur += Math.min(Math.max(0, use-20), 10)*140;
			cur += Math.max(0, use-30)*160;
			System.out.println(prev - cur);
		}
	}

}

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

using ll=long long;
#define int ll

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

int read(){
	int i;
	scanf("%lld",&i);
	return i;
}

signed main(){
	int n;
	while(n=read()){
		int score[n];
		int mean=0;
		REP(i,n){
			score[i] = read();
		}
		
		sort(score,score+n);

		
		FOR(i,1,n-1){
			mean += score[i];
		}
		mean /= (n-2);
		cout << mean << endl;
	}
}

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

int main(){
    string s;
    cin >> s;
    bool ans=true;
    for(int i=0;i<s.size();i++){
        if(i%2==0 && s.at(i)=='L'){
            ans=false;
            break;
        }
        if(i%2==1 && s.at(i)=='R'){
            ans=false;
            break;
        }
    }
    if(ans){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

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

using namespace std;

template <class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')
    cerr<<*sdbg++;
  cerr<<"="<<h<<","; 
  _dbg(sdbg+1, a...);
}

template<class T> ostream & operator<<(ostream & os, vector<T> V){
  os<<"[";
  for(auto vv: V) os << vv <<",";
  return os << "]";
}
template<class L, class R> ostream & operator <<(ostream & os, pair<L,R> P){
  return os <<"("<<P.first <<","<<P.second <<")";
}

#ifdef DEBUG
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

const int N = 105;

int main() {
    int l;
    scanf("%d", &l);
    long double len = (long double)l / 3;
    printf("%.10Lf\n", len * len * len);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int a;
	cin >> a;
	if (a >= 195) {
		cout << 5 << endl;
	}
	else if (a >= 189) {
		cout << 4 << endl;
	}
	else if (a >= 165) {
		cout << 3 << endl;
	}
	else if (a >= 135) {
		cout << 2 << endl;
	}
	else if (a >= 105) {
		cout << 1 << endl;
	}
	else {
		cout << 0 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
//============================================================================
// Name        : template.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <set>
#include <vector>
#include <string.h> // for memset in CF judge.
using namespace std;
#define _CRT_SECURE_NO_DEPRECATE // suppress some compilation warning messages (for VC++ users)
// Shortcuts for "common" data types in contests
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<string, int> msi;
// To simplify repetitions/loops, Note: define your loop style and stick with it!
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define REP(i, a, b) \
for (int i = int(a); i <= int(b); i++) // a to b, and variable i is local!
#define forn(i,n) \
for (int i =0; i<(n); i++)
#define TRvi(c, it) \
for (vi::iterator it = (c).begin(); it != (c).end(); it++)
#define TRvii(c, it) \
for (vii::iterator it = (c).begin(); it != (c).end(); it++)
#define TRmsi(c, it) \
for (msi::iterator it = (c).begin(); it != (c).end(); it++)
#define INF 2000000000 // 2 billion
// If you need to recall how to use memset:
#define MEMSET_INF 127 // about 2B
#define MEMSET_HALF_INF 63 // about 1B
//memset(dist, MEMSET_INF, sizeof dist); // useful to initialize shortest path distances
//memset(dp_memo, -1, sizeof dp_memo); // useful to initialize DP memoization table
//memset(arr, 0, sizeof arr); // useful to clear array of integers

int main() {
	ios::sync_with_stdio(false);
 cin.tie(0);
 ll n,m; cin >> n >> m;
 ll h[n];
 forn(i,n) {
 	cin >> h[i];
 }
 vector<ll> g[n+1];
 forn(i,m) {
   ll x, y; cin >> x >> y;
   g[x].pb(y);
   g[y].pb(x);
 }

 int ans = 0;
 for(ll i = 1; i <=n; i++) {
 	bool vld = true;
 	for(auto e : g[i]) {

       if(h[e-1] >= h[i-1]) {vld = false; break;}
 	}
 	if(vld) ans++;
 }
 cout << ans << endl;
return 0;
}


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

int main() {
  char N[4];
  for(int i=0; i<=2; i++)
  cin >> N[i];
  /*if(N[0]==N[1]){
    cout << "Yes" << endl;
  }
  else */if(N[0]==N[2]){
    cout << "Yes" << endl;
   }
   /*else if(N[1]==N[2]){
     cout << "Yes" << endl;
  }
  */ else{
     cout << "No" << endl;
  }
}


Measured memory_bytes: 256
function Main(input) {
  	inputArr = input.split("\n");
	var n = parseInt(inputArr[0], 10);
	var p = inputArr[1].split(" ");
    var ret = 0;
    for (i = 1; i < n - 1 ; i ++) {
		if (
          (parseInt(p[i-1], 10) < parseInt(p[i], 10) && parseInt(p[i], 10) < parseInt(p[i+1], 10))
          ||
          (parseInt(p[i-1], 10) > parseInt(p[i], 10) && parseInt(p[i], 10) > parseInt(p[i+1], 10))
           ) {
           ret++;
        }
    }
    console.log(ret);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 11468
h,w = map(int,input().split())
a = [0]

for _ in range(1,h+1):
    a.append([0]+list(map(int,input().split())))

#print(a)

y = []
x = []
yy = []
xx = []
left = 0
count = 0

for i in range(1,h+1):
    if i % 2 == 1:
        for j in range(1,w+1):
            if left == 0 and a[i][j] % 2 == 1:
                left = 1
                y.append(i)
                x.append(j)
            elif left == 1 and a[i][j] % 2 == 0:
                yy.append(i)
                xx.append(j)
                y.append(i)
                x.append(j)
                count += 1
            elif left == 1 and a[i][j] % 2 == 1:
                left = 0
                yy.append(i)
                xx.append(j)
                count += 1
    else:
        for j in range(0,w):
            if left == 0 and a[i][w-j] % 2 == 1:
                left = 1
                y.append(i)
                x.append(w-j)
            elif left == 1 and a[i][w-j] % 2 == 0:
                yy.append(i)
                xx.append(w-j)
                y.append(i)
                x.append(w-j)
                count += 1
            elif left == 1 and a[i][w-j] % 2 == 1:
                left = 0
                yy.append(i)
                xx.append(w-j)
                count += 1

print(count)
for k in range(count):
    print(" ".join(map(str,[y[k],x[k],yy[k],xx[k]])))

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

using namespace std;
const int N = 500010,M = 2e4 + 10;
char s[N];
int n,q;
set<int> st[26];

int main()
{
#ifdef ONLINE_JUDGE
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#endif

    cin >> n >> s >> q;
    for(int i = 0;i < n;i++)st[s[i] - 'a'].insert(i + 1);
    while(q--)
    {
        int a,b;
        cin >> a;
        if(a == 1)
        {
            char t;
            cin >> b >> t;
            st[s[b-1] - 'a'].erase(b);
            s[b-1] = t; 
            st[t - 'a'].insert(b);
        }
        else 
        {
            int l,r;
            cin >> l >> r;
            int ans = 0;
            for(int i = 0;i < 26;i++)
            {
                set<int>::iterator it;
                it = st[i].lower_bound(l);
                if(it != st[i].end() && *it <= r)ans++;
            }
            cout << ans <<"\n";
        }
    }
    return 0;
}


Measured memory_bytes: 24192
#1-3 Stack
from collections import deque
a=deque([])

for i in input().split() :
    if i == "+":
        x=a.pop()
        y=a.pop()
        a.append(x+y)
    elif i == "-":
        x=a.pop()
        y=a.pop()
        a.append(y-x)
    elif i == "*":
        x=a.pop()
        y=a.pop()
        a.append(x*y)
    else:
        a.append(int(i))
#    print(a)
print(a[0])


Measured memory_bytes: 6004
t = int(input())
for _ in range(t):
    n,a,b,c,d = map(int,input().split())

    memo = {}
    def dfs(n):
        if n == 0:
            return 0
        if n == 1:
            return d
        if n in memo:
            return memo[n]
        res = min(
            d*n,
            d*((n+1)//2*2-n)+a+dfs((n+1)//2),
            d*(n-n//2*2)+a+dfs(n//2),
            d*((n+2)//3*3-n)+b+dfs((n+2)//3),
            d*(n-n//3*3)+b+dfs(n//3),
            d*((n+4)//5*5-n)+c+dfs((n+4)//5),
            d*(n-n//5*5)+c+dfs(n//5),
        )
        memo[n] = res
        return res

    print(dfs(n))


Measured memory_bytes: 10812
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#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 pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

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

int main() {
    int H, W;
    cin >> H >> W;
    vector<string> field(H);
    rep(i, H) cin >> field[i];
    int cnt = 0;
    rep(i, H) {
        rep(j, W) {
            if(field[i][j] == '.')
                cnt++;
        }
    }

    vector<vector<int>> dist(H, vector<int>(W, INF));
    dist[0][0] = 0;
    queue<pair<int, pii>> que;
    que.push(MP(0, MP(0, 0)));
    while(!que.empty()) {
        auto p = que.front();
        que.pop();
        int nx = p.second.first;
        int ny = p.second.second;
        int d = p.first;
        rep(i, 4) {
            int newx = nx + dx[i];
            int newy = ny + dy[i];
            if(0 <= newx && newx < W && 0 <= newy && newy < H &&
               field[newy][newx] != '#' && dist[newy][newx] == INF) {
                dist[newy][newx] = d + 1;
                que.push(MP(d + 1, MP(newx, newy)));
            }
        }
    }

    if(dist[H - 1][W - 1] == INF) {
        cout << -1 << endl;
    } else {
        cout << cnt - dist[H - 1][W - 1] - 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))

num_4 = 0
num_2 = 0
num_1 = 0
for ai in a:
    if(ai%4==0):
        num_4 += 1
    elif(ai%2==0):
        num_2 += 1
    else:
        num_1 += 1

if(num_4 >= num_1):
    print('Yes')
elif(num_4 + 1 == num_1)&(num_2==0):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 19772
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> L(M);
    vector<int> R(M);
    for (int i = 0; i < M; i++)
    {
        cin >> L[i] >> R[i];
    }
    int r = *min_element(R.begin(), R.end());
    int l = *max_element(L.begin(), L.end());
    cout << max(r - l + 1, 0) << endl;
    return 0;
}

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

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

const int MAXN=1e5+777;
const ll inf=1e18;
ll A[MAXN];
ll max_lvl[MAXN];


int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int N; cin>>N;
	for (int i=0; i<N+1; i++)
		cin>>A[i];
	for (int i=0; i<=min(60,N); i++) {
		if(A[i]>(1LL<<i)) {
			cout<<-1<<"\n";
			return 0;
		}
	}
	ll ret=0, non=0, leaf=0, lvl=0;
	for (int i=0; i<=N; i++) {
		lvl=(i==0) ? 1 : 2*non;
		lvl=min(lvl,inf);
		max_lvl[i]=lvl;
		non=lvl-A[i];
	}
	lvl=0;
	for (int i=N; i>=0; i--) {
		leaf=A[i];
		ll mn=(lvl+1)/2+leaf;
		if(mn>max_lvl[i]) {
			cout<<-1<<"\n";
			return 0;
		}
		non=(i==N) ? 0 : min(max_lvl[i]-leaf,non);
		lvl=max(mn,leaf+non);
		ret+=lvl;
		non+=leaf;
	}
	cout<<ret<<"\n";
	return 0;
}

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

int main(){
	int N, W,A,B,C;
	cin >> A >> B>>C;
	if (C >= A && C <= B){
		cout << "Yes\n";
	}
	else{
		cout << "No\n";
	}



	return 0;
}

Measured memory_bytes: 384
S = input()
ans = 0
idx = 0
a_count = 0
while idx < len(S):
    if S[idx] == "A":
        a_count += 1
    elif S[idx:idx+2] == "BC":
        ans += a_count
        idx += 1
    else:
        a_count = 0
    idx += 1
print(ans)


Measured memory_bytes: 40304
n = int(input())
a = list(map(int, input().split()))
ai = max(a)
b = a[:]
for i in range(n):
    if a[i] != ai:
        b[i] = abs(a[i] - ai / 2)
    else:
        b[i] = abs(a[i] - ai / 2 + 1)
c = min(b)
d = b.index(c)
aj = a[d]
print(ai, aj)

Measured memory_bytes: 14428
#include "bits/stdc++.h"
using namespace std;
vector<int>to[1005];
int INF = 1e9;
int N;
vector<int> bfs(int s) {
	vector<int>dist(N, INF);
	vector<int>pre(N, -1);
	queue<int>q;
	dist[s] = 0;
	q.push(s);
	while (!q.empty()) {
		int v = q.front();
		q.pop();
		for (int i : to[v]) {
			if (dist[i] != INF) {
				continue;
			}
			pre[i] = v;
			dist[i] = dist[v] + 1;
			q.push(i);
		}
	}
	pair<int, int>best(INF, -1);
	for (int i = 0; i < N; ++i) {
		if (i == s) {
			continue;
		}
		for (int u :to[i]) {
			if (u == s) {
				best = min(best,make_pair(dist[i],i));
			}
		}
	}
	if (best.first == INF) {
		return vector<int>(N + 1);
	}
	int v = best.second;
	vector<int>res;
	while (-1 != v) {
		res.push_back(v);
		v = pre[v];
	}
	return res;
}

int main() {
	int M;
	cin >> N >> M;
	for (int i = 0; i < M; ++i) {
		int a, b;
		cin >> a >> b;
		--a;
		--b;
		to[a].push_back(b);
	}

	vector<int> ans(N + 1);
	for (int i = 0; i < N; ++i) {
		vector<int> now = bfs(i);
		if (now.size() < ans.size()) {
			ans = now;
		}
	}
	if (ans.size() == (N + 1)) {
		cout << -1 << endl;
		return 0;
	}
	cout << ans.size() << endl;
	for (auto i : ans) {
		cout << i + 1 << endl;
	}
	return 0;
}



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

int main() {
  string s;
  cin >> s;
  if (s[s.size()-1]=='s'){
    cout << s << "es" << endl;
  }else{
    cout << s << "s" << endl;
  }
  return 0;
}


Measured memory_bytes: 3624
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 1LL << 60;

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

uintmax_t combination(unsigned int n, unsigned int r) {
  if ( r * 2 > n ) r = n - r;
  uintmax_t dividend = 1;
  uintmax_t divisor  = 1;
  for ( unsigned int i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
  return dividend / divisor;
}

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

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

int main()
{
  int n,m;
  cin >> n >> m;
  vector<int> x(m);
  rep(i,m) cin >> x[i];

  sort(ALL(x));

  vector<int> gap(m-1);
  rep(i,m-1){
    gap[i] = abs(x[i+1] - x[i]);
  }

  sort(ALL(gap));
  
  ll ans = 0;

  rep(i,m-n){
    ans+=gap[i];
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>


#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define dump(x)  cout << #x << " = " << (x) << endl;
#define pb push_back
#define int long long
//#define lint long long

const int INF = 1e9;
const int MOD = 1e9+7;
//const lint LINF = 1e18;
const double eps = 0.000000001;//もとの値の10^(-16)まで

using namespace std;

//typedef pair<int, int> P;


int n;
int c[600];
int s[600];
int f[600];

signed main(){
  cin >> n;
  REP(i,n-1){
    cin >> c[i] >> s[i] >> f[i];
  }
  REP(i,n){
    int now = 0;
    for(int j=i;j<=n-2;j++){
      if(now<=s[j]){
        now = s[j]+c[j];
        continue;
      }
      now += (f[j]-now%f[j])%f[j];
      now += c[j];
    }
    cout << now << endl;
  }
  return 0;
}


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

const int N = 100005;

int n, a[N];

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

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

	int r = 0;
	int diff = 1e9;
	for (int i = 1; i < n - 1; ++i) {
		int half;
		if (a[n] % 2 == 1) {
			half = a[n] / 2 + 1;
		} else {
			if (a[i] <= a[n] / 2) half = a[n] / 2;
			else half = a[n] / 2 + 1;
		}
		if (abs(a[i] - half) < diff) {
			r = a[i];
			diff = abs(a[i] - half);
		}
	}

	cout << a[n] << ' ' << r << endl;
}

Measured memory_bytes: 640
#include <iostream>
using namespace std;
int main(){
    int n,x,m,i,j,k;
    int count = 0;
    while(1){
        cin>>n>>x;
        if(n==0&&x==0){
            break;
        }
        for(i=1;i<=n;i++){
            for(j=i+1;j<=n;j++){
                for(k=j+1;k<=n;k++){
                    m=i+j+k;
                    if(x==m){
                        count += 1;
                    }
                }
            }
        }
    cout<<count<<endl;
    count = 0;
    }
    return 0;
}


Measured memory_bytes: 3072
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>

using ll = long long;

int main() {
    int N, K;
    std::cin >> N >> K;

    if (N%K == 0) {
        std::cout << 0 << std::endl;
    }
    else {
        std::cout << 1 << std::endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
    string S;cin>>S;
    int Slength;
    Slength=S.length();
    string ans;
    for(int i=0;i<Slength;i++) {
        if (i % 2 != 0) {   //偶数
            if (S[i] == 'R') {
                cout << "No";
                return 0;
            }
        }
        if (i % 2 == 0) {   //奇数
            if (S[i] == 'L') {
                cout << "No";
                return 0;
            }
        }
    }
    cout<<"Yes";
    return 0;
}



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

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  int64_t array_num = 1;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}

int64_t calcmodcomb(int64_t n,int64_t r){
  return (((modfact.at(n)*modinvfact.at(r))%univMod)*modinvfact.at(n-r))%univMod;
}

int64_t calcmodpositive(int64_t n){
  return (n + ((abs(n)+univMod-1)/univMod)*univMod)%univMod;
}
  
    */


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

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


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int n,m;
    scanf("%d %d",&n,&m);

    int a[m],i,sum=0;
    for(i=0;i<m;i++){
        scanf("%d",&a[i]);
        sum+=a[i];
    }

    if(sum>n){
        printf("-1\n");
    }else{
        printf("%d\n",n-sum);
    }



    return 0;
}


Measured memory_bytes: 1732
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    int a,b;
    char o;
    cin>>a>>o>>b;

    if(o == '+'){
        cout << a+b << endl;
    }
    else{
        cout << a-b << endl;
    }

	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<string>
#include<stack>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<sstream>
#include<utility>
#include<map>
#include<ctime>
#include<cstdio>
#include<cassert>
#include<functional>
#include<unordered_map>
#include<deque>
#include<cmath>





using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;
typedef pair<double, double> pdd;

#define show(x) cerr << x
#define debug(x) show(#x << ": " << (x) << endl)

const long double PI = 3.14159265358979323846;
const long double eps = 1e-5;
const ll INF = numeric_limits<int>::max();
const ll LINF = numeric_limits<ll>::max();
const ll mod = 1000 * 1000 * 1000 + 7;


void solve() {
    int x;
    cin >> x;
    if (x < 1200)
        cout << "ABC\n";
    else 
    cout << "ARC\n";

}


//#define LOCAL

int main() {
    ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    solve();



#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif	
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr ll INF = 2147483647;
constexpr long long INFF = 9223372036854775807;

signed main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
    ll N,K;cin >> N >> K;
    ll A[N];REP(i,N) cin >> A[i];
    ll ans = 0;
    REP(p,min(K,N) + 1){
        REP(q,min(K,N) - p + 1){
            vector<ll> V;
            ll cnt = 0;
            REP(i,p){V.pb(A[i]);cnt += A[i];}
            REP(i,q){V.pb(A[N-1-i]);cnt += A[N-i-1];}
            sort ALL(V);
            REP(i,min(K - p - q,(long long)V.size())){
                if(V[i] < 0) cnt -= V[i];
            }
            ans = max(ans,cnt);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
N=int(input())
H=[""]*N
H=list(map(int,input().split()))
count=0
countmax=0
for i in range(N-1):
    if H[i]>=H[i+1]:
        count+=1
        if count>countmax and i==N-2:
            countmax=count
    elif count>countmax:
        countmax=count
        count=0
    else:
        count=0

        


print(countmax)


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

int main()
{
	for(int n;cin>>n && n;){
		vector<int> a(n);
		for(int& x:a) cin>>x;
		int64_t res=a[0]/2;
		a[0]%=2;
		for(int i=1;i<n;i++){
			int x=min(a[i-1],a[i]);
			res+=x;
			a[i]-=x;
			res+=a[i]/2;
			a[i]%=2;
		}
		cout<<res<<endl;
	}
}


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

int main(){
  long long n;
  cin >> n;
  string ans;
  while (n){
    n--;
    ans += 'a' + n%26;
    n /= 26;
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3616
/* --- author: dxm --- */
#include<bits/stdc++.h>
using namespace std;

#define INF 1e9
#define Inf 1e18
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
typedef long long ll;
inline void Fail(){printf("No");exit(0);}
inline void debug(int x){cerr<<"debug: "<<x<<"\n";}
inline void debug(int n,int x[]){cerr<<"debug "<<"\n";rep(i,n)cerr<<x[i]<<" ";cerr<<"\n";}
inline void debug(string x){cerr<<"debug: "<<x<<"\n";}

const int maxn=100005;
int n,m;
vector<pii>edge[maxn];
int val[maxn],deg[maxn];

void dfs(int x,int cur){
	val[x]=cur;
	rep(i,edge[x].size()){
		pii y=edge[x][i];
		if(val[y.first]>=0&&val[y.first]!=cur+y.second)Fail();
		if(val[y.first]<0)dfs(y.first,cur+y.second);
	}
} 

int main(){
	memset(val,-1,sizeof(val));
	scanf("%d%d",&n,&m);
	rep(i,m){
		int u,v,c;
		scanf("%d%d%d",&u,&v,&c);
		u--;v--;
		deg[v]++;
		edge[u].pb(mp(v,c));
	}
	rep(i,n)if(!deg[i])dfs(i,0);
	rep(i,n)if(val[i]<0)Fail();
	printf("Yes");
	return 0;
}

/*
Input:
-----------------
Output:
*/

Measured memory_bytes: 11136
#include <stdio.h>
//int linearSearch();                                                           
int same();
int linearSearch(int A[],int n,int key){

  int count=0;
  A[n]=key;
  // for(i=0;i<n-1;i++){                                                       \
                                                                                
  //if(A[i]==key){                                                             \
                                                                                
  while(A[count]!=key)count++;
  return count!=n; /**/
}

int main(){
  int n,q,i,sum=0;
  int S[10000+1];
  // int sasum=0;                                                               
  int key;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  scanf("%d",&q);

  for(i=0;i<q;i++){
    scanf("%d",&key);
    if(linearSearch(S,n,key))sum++;
  }
  /* for(j=0;j<q;j++){                                                          
    sum+=(linearSearch(S,n,T[j]));                                              
  }                                                                             
                                                                                
  sasum=same(&S,n);                                                             
  */
  //  printf("%d\n",sasum);                                                     
  //  if(sasum>0)sasum=sasum+1;                                                 
  // sum=sum-sasum;                                                             
  printf("%d\n",sum);

  return 0;
}
int same(int *array,int last){
  int cnt,ncnt,same,nsame=0;
  for(cnt=0;cnt<last-1;cnt++){
    same=*(array+cnt);
    for(ncnt=cnt+1;ncnt<last;ncnt++){
      if(*(array+ncnt)==same){
        nsame++;
        //      return 1;//nsame++;                                             
        //return nsame;                                                         
      }

    }
    // if(nsame>0)                                                              
    return nsame;
    // else return 0;                                                           
  }
}



Measured memory_bytes: 2108
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <math.h>

using namespace std;

typedef long long int ll;
typedef long double ld;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define vsort(a) sort(a.begin(), a.end())
#define rev(a) reverse(a.begin(), a.end())


// a,bの最小公倍数
ll LCM(ll a, ll b){ll lcm = a * b; ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return lcm /= b;}
// a,bの最大公約数
ll GCD(ll a, ll b){ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return b;}


const int MOD = 1000000007;
const int INF = INT_MAX;



int main(){

    int a, b;
    cin >> a >> b;

    if (a % 2 == 0 || b % 2 == 0) cout << "No" << endl;
    else cout << "Yes" << endl;

    
    
}





//              g++ -std=c++1z


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int a,b;
    cin >> a >> b;
    for(int i = 0; i < 1001; i++){
        bool flag = true;
        if(!(8*i/100 == a)) flag = false;
        if(!(10*i/100 == b)) flag = false;
        if(flag) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

typedef long long ll;

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

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

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

		ll ans = 1LL;
		for (int i = 0; i < N; i++) {
				ll t;
				cin >> t;
				ans = lcm(ans, t);
		}

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


Measured memory_bytes: 256
import bisect
n, k = map(int, input().split())
ab = []
for _ in range(n):
    ab.append(list(map(int, input().split())))

ab.sort()

cusum = [0]*(n+1)
for i in range(n):
    cusum[i+1] = cusum[i] + ab[i][1]

index = bisect.bisect_left(cusum, k) - 1
print(ab[0 if index < 0 else index][0])


Measured memory_bytes: 32144
#pragma region RegionDefs
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,j,n) for(int i=(j),i##_len=(n);i<i##_len;++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define all(x) begin(x),end(x)
using namespace std;
const int INF = 1e9;
template<class T=int> using P  = pair<T, T>;
template<class T=int> using V  = vector<T>;
template<class T=int> using PQ = priority_queue<T>;
template<class T=int> using PQG = priority_queue<T, V<T>, greater<T>>;
typedef long long ll;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail)
{
    cin >> head;
    in(move(tail)...);
}
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)
//時間が厳しいとき使う
#define INI(...) int __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
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;}
#define y0 y__0
#define y1 y__1
#define j0 j__0
#define j1 j__1
#define YN(e) cout << ((e) ? "YES" : "NO") << endl
#define yn(e) cout << ((e) ? "Yes" : "No") << endl
#pragma endregion RegionDefs

void solve()
{
    IN(a, b, c);
    if (c - a - b < 0)
        cout << "No" << endl;
    else
        yn(4 * a * b < (c - a - b)*(c - a - b));
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

Measured memory_bytes: 256
def f(x)
  if x.even?
    x / 2
  else
    3 * x + 1
  end
end

ans = gets.chomp!.to_i

a = [ans]

2.upto(1_000_000) do |i|
  ans = f(ans)
  if a.include?(ans)
    puts i
    break
  else
    a << ans
  end
end


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

int n, ans, a[105];
int main() {
	int i, j, k;
	cin >> n;
	for(i=0; i<n; i++) cin >> a[i];
	sort(a, a+n);
	for(i=0; i<n; i++) for(j=i+1; j<n; j++) for(k=j+1; k<n; k++) {
		if(a[i]==a[j] || a[j]==a[k]) continue;
		if(a[i] + a[j] > a[k]) ans++;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 3628
n,q=map(int,input().split())
s=input()
l=[list(map(int,input().split())) for _ in range(q)]
a=[0]*n

for i in range(n):
  a[i]=a[i-1]
  if s[i-1:i+1]=='AC':
    a[i]+=1

for i in range(q):
  print(a[l[i][1]-1]-a[l[i][0]-1])

Measured memory_bytes: 31132
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        n: usize,
        k: usize,
    }

    let mut x = 1;
    let mut ans = 0;
    for i in 0..(1<<n) {
        for j in 0..n {
            if ((i>>j) & 1)==1 {
                x *= 2;
            } else {
                x += k;
            }
        }
        if i==0 {
            ans = x;
        } else {
            ans = min(ans, x);
        }
        // debug!(ans);
        x = 1;
    }
    println!("{}", ans);
}


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

const int64_t MOD = 1e+09 + 7;

int main() {
    string S;
    cin >> S;
    
    int N = S.size();
    
    vector<vector<int64_t>> dp(4,vector<int64_t>(N+1,0));
    dp[0][0] = 1;
    
    for ( int i = 0; i < N; ++i){
        if ( S[i] == '?' ){
            for ( int j = 0; j < 4; ++j){
                dp[j][i+1] = ( dp[j][i+1] + 3 * dp[j][i] ) % MOD;
            }
        } else {
            for ( int j = 0; j < 4; ++j){
                dp[j][i+1] = ( dp[j][i+1] + dp[j][i]) % MOD;
            }
        }
        if ( S[i] == '?' or S[i] == 'A' ) dp[1][i+1] = ( dp[1][i+1] + dp[0][i] ) % MOD;
        if ( S[i] == '?' or S[i] == 'B' ) dp[2][i+1] = ( dp[2][i+1] + dp[1][i] ) % MOD;
        if ( S[i] == '?' or S[i] == 'C' ) dp[3][i+1] = ( dp[3][i+1] + dp[2][i] ) % MOD;
    }
    
    int64_t ans = dp[3][N];
    if ( ans < 0 ) ans += MOD;
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 7492
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<numeric>

typedef long long LL;

using namespace std;

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

int main(void) {
	int h, w;
	cin >> h >> w;
	vector<string>s(h);
	for (int i = 0; i < h; i++) cin >> s[i];
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (s[i][j] == '.') {
				s[i][j] = '0';
			}
		}
	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (s[i][j] == '#') {
				for (int dx = -1; dx <= 1; dx++) {
					for (int dy = -1; dy <= 1; dy++) {
						int nx = j + dx; int ny = i + dy;
						if (0 <= nx && nx < w && 0 <= ny && ny < h&&s[ny][nx] != '#') {
							s[ny][nx]++;
						}
					}
				}
			}
		}
	}
	for (int i = 0; i < h; i++) {
		cout << s[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
	int n,a,b,c;
	cin>>n;
	for(int i=0;i<n;i++){
		bool t=true;
		b=0,c=0;
		for(int j=0;j<10;j++){
			cin>>a;
			if(b<a)
				b=a;
			if(b>a&&c<a)
				c=a;
			if(c>a)
				t=false;
		}
		if(t==true)
			cout<<"YES"<<endl;
		if(t==false)
			cout<<"NO"<<endl;
	}
	return 0;
}

Measured memory_bytes: 1152
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder.ABC
{
    class QuestionB
    {
        public static void Main(string[] args)
        {
            string[] In = Console.ReadLine().Split(' ');
            long a = long.Parse(In[0]);
            long b = long.Parse(In[1]);
            long g = GCD(a, b);
            var ans = CountPrime(g);
            Console.WriteLine(ans + 1);
        }

        //ユークリッドの互除法
        public static long GCD(long a, long b)
        {
            if (a < b) {
                return GCD(b, a);
            }

            while (true) {
                var r = a % b;
                if (r == 0) {
                    return b;
                }

                a = b;
                b = r;
            }
        }

        public static long CountPrime(long n)
        {
            var res = new HashSet<long>();
            for (long i = 2; i * i <= n; i++) {
                if (n % i != 0) {
                    continue;
                }

                if (res.Contains(i) == false) {
                    res.Add(i);
                }

                while (n % i == 0)
                {
                    n /= i;
                }
            }

            if (n != 1) {
                if (res.Contains(n) == false) {
                    res.Add(n);
                }
            }

            return res.Count;
        }
    }
}


Measured memory_bytes: 27840
def main():
    N, M, K=map(int, input().split())
    friend_or_block = [0 for _ in range(N)]
    friends_chain = UnionFindTree(N)

    for _ in range(M):
        a, b = map(int, input().split())
        a, b = a-1, b-1
        friends_chain.unite(a, b)
        friend_or_block[a] += 1
        friend_or_block[b] += 1

    for _ in range(K):
        c, d = map(int, input().split())
        c, d = c-1, d-1
        if friends_chain.same(c, d):
            friend_or_block[c] += 1
            friend_or_block[d] += 1

    print(' '.join(map(str, [friends_chain.count(i) - friend_or_block[i] - 1 for i in range(N)])))

class UnionFindTree:
    def __init__(self, n):
        self.parent = [-1 for _ in range(n)]

    def root(self, x):
        p, seq = self.parent[x], list()
        while p >= 0:
            seq.append(x)
            x, p = p, self.parent[p]
        for c in seq: self.parent[c] = x
        return x

    def same(self, x, y): return self.root(x) == self.root(y)

    def count(self, x): return -self.parent[self.root(x)]

    def unite(self, x, y):
        xr, yr = self.root(x), self.root(y)
        if xr == yr: return
        if self.parent[xr] > self.parent[yr]: xr, yr = yr, xr
        self.parent[xr] += self.parent[yr]
        self.parent[yr] = xr

if __name__ == '__main__':
    main()



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

constexpr long double PI = acos(-1);
constexpr long double EPS = 1e-15;
constexpr int inf = 2e9;
constexpr ll INF = 2e18;
constexpr ll MOD = 1e9+7;
constexpr ll MOD1 = 998244353;
typedef pair<ll,ll> P;

#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define rrep(i,a,b) for (int i = (a); i >= (b); i--)
#define REP(i,n) rep(i,0,n)
#define RREP(i,n) rrep(i,n,0)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
//#define mp make_pair

int main(){
  ull l, k, ans = 0;
  std::cin >> l >> k;
  for(ull i = 1; i <= l; i += 2){
    ull tmp = 1;
    for(ull j = 0; j < (i + 3)/ 2 && i + (k - 1) * j <= l; ++j){
      ans += tmp;
      // std::cout << i << ' ' << j << ' ' << tmp << std::endl;
      tmp = tmp * ((i + 1) / 2 - j) / (j + 1);
    }
  }
  std::cout << ans << std::endl;
}



Measured memory_bytes: 3112
#include <bits/stdc++.h>
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define P 1000000007
#define in(x, a, b) (a <= x && x < b)

using namespace std;
using ll = long long;
typedef pair<int, int> ii;
typedef vector<ii> vii; 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
const ll inf = 1000000001, INF = (ll)1e18 + 1;

int n;
string s;

bool check(int len) {
	map<string, int> seen, first;
	for(int i = 0; i <= n - len; i++) {	
		string t = s.substr(i, len);
		if(seen[t] && first[t] + len <= i) return true;
		else {
			seen[t] = 1;
			if(!first.count(t)) first[t] = i;
		}
	}
	
	return false;
}

void solve() {
	cin >> n >> s;
	
	int l = 0, r = n / 2, ans = 0;
	while(l <= r) {
		int mid = (r + l) / 2;
		if(check(mid)) {
			ans = max(ans, mid);
			l = mid + 1;
		} else r = mid - 1;
	}
	
	cout << ans << endl;
}

int main() {
	ios_base::sync_with_stdio(false);
	solve();
    return 0;
}

Measured memory_bytes: 16112
import bisect
n,q=map(int,input().split())
s=input()
query=[list(map(int,input().split())) for i in range(q)]
x=[]
for i in range(n):
  if s[i:i+2]=='AC':
    x.append(i)
for i in range(q):
  x1=bisect.bisect_left(x,query[i][0]-1)
  x2=bisect.bisect_left(x,query[i][1]-1)
  print(x2-x1)

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
using namespace std;

int main() {
    int k, a, b;
    cin >> k >> a >> b;
    bool ans = false;
    for (int i = a; i <= b; i++)if (i % k == 0)ans = true;

    cout << (ans ? "OK" : "NG") << endl;


    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

static const int INTINF = (2147483647 >> 1); // 10^9 + 5000
static const ll LLINF = (9223372036854775807 >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;

namespace Kunitaka{
    template<
        typename TYPE,
        std::size_t SIZE
    >
    std::size_t array_length(const TYPE (&array)[SIZE])
    {
        return SIZE;
    }

    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 namespace Kunitaka;
namespace Printer{
    void br(){
        cout << endl;
    }

    void loop_cnt(int i){
        cout << "i = " << i << endl;
    }

    void loop_cnt(int i, int j){
        cout << "i = " << i << ", " << "j = " << j << endl;
    }

    template<class T>
    void print(T x){
        cout << x << endl;
    }

    template<class T, class S>
    void print(T x, S y){
        cout << x << "," << y << endl;
    }

    template<class T, class S, class U>
    void print(T x, S y, U z){
        cout << x << "," << y << "," << z << endl;
    }

    template<class T, class S>
    void print(pair<T, S> p){
        cout << p.first << ", " << p.second << endl;
    }

    template<
        typename TYPE,
        std::size_t SIZE
    >
    void print(const TYPE (&array)[SIZE]){
        int lim = array_length(array);
        for(int i=0; i<lim; i++){
            if(i) cout << " ";
            cout << array[i];
        }
        cout << endl;
    }

    template<class S>
    void print(vector<S> v){
        for(int i=0; i<v.size(); i++){
            if(i) cout << " ";
            cout<< v[i];
        }
        cout << endl;
    }

    template<class S>
    void print(vector<vector<S> > vv){
        for(int i=0; i<vv.size(); i++){
            for(int j=0; j<vv[i].size(); j++){
                if(j) cout << " ";
                cout << vv[i][j];
            }
            cout << endl;
        }
    }

    void yesno(bool x){
        if(x) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
};
using namespace Printer;
int N, A[303], C[4];
double dp[303][303][303];
//---------------------------------------------------------------------------------------------------
int main() {
    cin >> N;
    rep2(i, 0, N) cin >> A[i];
    rep2(i, 0, N) C[A[i]]++;
 
    rep2(c3, 0, N + 1) rep2(c2, 0, N + 1) rep2(c1, 0, N + 1) {
        int sm = c1 + c2 + c3;
        if (sm == 0) continue;
 
        dp[c1][c2][c3] = 1.0 * N / sm;
        if (c1) dp[c1][c2][c3] += dp[c1 - 1][c2][c3] * c1 / sm;
        if (c2) dp[c1][c2][c3] += dp[c1 + 1][c2 - 1][c3] * c2 / sm;
        if (c3) dp[c1][c2][c3] += dp[c1][c2 + 1][c3 - 1] * c3 / sm;
    }
 
    printf("%.10f\n", dp[C[1]][C[2]][C[3]]);

    return 0;
}

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

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

using Graph = vector<vector<int>>;

ll kzyou(ll a,ll k){//aのk乗を返す
    ll zyou = 1;
    for(ll i = 1;i<=k;i++){
        zyou *= a;
    }
    return zyou;
}
typedef pair<int,int> P;

bool is_prime(int n){//nが素数であるかどうか判定 iで割り切れると素数でない
    if(n == 1) return false;//1は例外
    for(int i = 2;i*i <= n;i++){
        if(n%i == 0) return false;
    }
    
    return true;
}

int main(){
  int A,B;
  cin >> A >> B;
  vector<int> v = {1,2,3};
  rep(i,3){
    if(v[i] != A && v[i] != B){
      cout << v[i] << endl;
      break;
    }
  }
 }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    map<int,int> mp;
    int n;
    cin>>n;
    bool ok=true;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        if(mp[x]!=0)    ok=false;
        mp[x]++;
    }
    if(ok)  cout<<"YES";
    else    cout<<"NO";
}


Measured memory_bytes: 9600
use std::io::*;

fn gcd(a: u64, b: u64) -> u64 {
    if b == 0 {
        return a;
    }
    gcd(b, a % b)
}
fn lcm(a: u64, b: u64) -> u64 {
    a / gcd(a, b) * b
}

fn lcm_array(a: &Vec<u64>) -> u64 {
    let mut res = a[0];
    for i in 1..a.len() {
        res = lcm(res, a[i]);
    }
    res
}

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();

    let n: usize = itr.next().unwrap().parse().unwrap();
    let m: u64 = itr.next().unwrap().parse().unwrap();
    let a: Vec<u64> = (0..n)
        .map(|_| itr.next().unwrap().parse().unwrap())
        .collect();

    let l = lcm_array(&a);
    for i in 0..n {
        if l / a[i] % 2 == 0 {
            println!("0");
            return;
        }
    }
    println!("{}", (m / (l / 2) + 1) / 2);
}


Measured memory_bytes: 6396