akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <stdio.h>
#include <string>
#include <vector>
#include <functional>
#include <algorithm>
#include <queue>
#include <string>
#include <map>
#include <iostream>
using namespace std;

int main() {

    enum Index {
        M = 0,
        A,
        R,
        C,
        H,

        Max
    };

    long long count[5] = {0};
    int P[] = {0, 0, 0, 0, 0, 0, 1, 1, 1, 2};
    int Q[] = {1, 1, 1, 2, 2, 3, 2, 2, 3, 3};
    int K[] = {2, 3, 4, 3, 4, 4, 3, 4, 4, 4};
    int N;
    scanf(" %d", &N);

    for(int i = 0; i < N; i++) {
        string s;
        cin >> s;

        switch(s[0]) {
            case 'M' : {
                count[Index::M]++;
                break;
            }

            case 'A' : {
                count[Index::A]++;
                break;
            }

            case 'R' : {
                count[Index::R]++;
                break;
            }

            case 'C' : {
                count[Index::C]++;
                break;
            }

            case 'H' : {
                count[Index::H]++;
                break;
            }
        }
    }

    long long res = 0;
    for(int i = 0; i < 10; i++) {
        res += count[P[i]] * count[Q[i]] * count[K[i]];
    }
    printf("%lld\n", res);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MAX 3005
#define P 998244353
#define INF 0x3f3f3f3f
using namespace std;

template<typename T>
void read(T &n){
    n = 0;
    T f = 1;
    char c = getchar();
    while(!isdigit(c) && c != '-') c = getchar();
    if(c == '-') f = -1, c = getchar();
    while(isdigit(c)) n = n*10+c-'0', c = getchar();
    n *= f;
}
template<typename T>
void write(T n){
    if(n < 0) putchar('-'), n = -n;
    if(n > 9) write(n/10);
    putchar(n%10+'0');
}

int n, m;
int a[MAX];
ll f[MAX][MAX], s[MAX];

void add(ll &a, ll b){
    a += b;
    if(a >= P) a -= P;
}

int main()
{
    cin >> n >> m;
    for(int i = 1; i <= n; i++){
        scanf("%d", &a[i]);
    }
    ll ans = 0;
    for(int i = 1; i <= n; i++){
        for(int j = m; j > a[i]; j--){
            add(f[i][j], s[j-a[i]]);
            add(s[j], f[i][j]);
        }
        f[i][a[i]] = i;
        add(s[a[i]], i);
        add(ans, f[i][m]*(n-i+1)%P);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 70656
PROGRAM ATCODER

implicit none
integer :: n, k, i, j
integer, allocatable :: h(:), dp(:)

read(*,*) n, k
allocate(h(n), dp(n))
read(*,*) (h(i), i=1,n)

dp = 10**9
dp(1) = 0

do i = 2, n
	do j = 1, min(k,i-1)
		call chmin(dp(i), dp(i-j)+abs(h(i)-h(i-j)))
    end do
end do

write(*,'(i0)') dp(n)

END PROGRAM ATCODER

subroutine chmin(dp,x)
implicit none
integer :: dp, x

if (dp > x) then
	dp = x
	return
end if

end subroutine

Measured memory_bytes: 1536
#include <iostream>
#include <bitset>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <unordered_map>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 1000000007;

void fast_input() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main(void) {
    int N, Q; cin >> N >> Q;
    vector<tuple<int, int, int>> S;
    vector<int> ans(Q, -1);
    set<pair<int, int>> D;
    for (int i = 0; i < N; i++) {
        int a, b, c; cin >> a >> b >> c;
        S.push_back({c, a, b});
    }
    sort(S.begin(), S.end());
    for (int i = 0; i < Q; i++) {
        int d; cin >> d;
        D.insert({d, i});
    }

    sort(S.begin(), S.end());
    for (int i = 0; i < N; i++) {
        auto itr = D.lower_bound({get<1>(S[i]) - get<0>(S[i]), 0});
        while (itr->first < get<2>(S[i]) - get<0>(S[i]) && itr != D.end()) {
            ans[itr->second] = get<0>(S[i]);
            D.erase(itr++);
        }
    }
    for (auto itr = D.begin(); itr != D.end(); itr++) {
        ans[itr->second] = -1;
    }
    for (auto i : ans) {
        cout << i << endl;
    }
}   

Measured memory_bytes: 14448
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int N, K; cin >> N >> K;
    ll pre = 0;
    ll suf = 0;
    ll ans = 0;
    FOR(i, 1, N+2) {
        pre += i-1;
        suf += N+1-i;
        pre %= MOD; suf %= MOD;
        if (i >= K) {
            ans += suf - pre + 1 + MOD;
            ans %= MOD;
        }
    }
    cout << ans << nl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



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

int N;

int main(){
  cin >> N;
  repi(i, N, 1000){
    if (i%10 == (i/10)%10 && (i/10)%10 == (i/100)%10){
      cout << i << endl;
      break;
    }
  }
}


Measured memory_bytes: 3564
#include<cstdio>
#include<iostream>
using namespace std;
int h,n;
int x[100005];
int main()
{
    scanf("%d%d",&h,&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&x[i]);
        x[i]+=x[i-1];
    }
    if(x[n]>=h)
    {
        printf("Yes");
    }
    else
    {
        printf("No");
    }
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int a,b,c,d,e,f;
	cin >> a >> b >> c >> d;
	e = max(a,c);
	f = min(b,d);
	if((f - e) >= 0)
	{
		cout << (f - e) << endl;
	}
	else
	{
		cout << 0 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X, i) ((X>>i)&1)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define r_all(a) (a).rbegin(), (a).rend()
#define in(x) cin>>x
#define ina(x, n) rep(x_i,n) cin>>x[x_i]
#define outa(x, n) rep(x_i,n) cout<<x[x_i]<<" \n"[x_i==n-1]

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pll;
typedef vector<pll> vll;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = (1<<30);
const ll INFL = (1L<<62);

int main() {
  int n; in(n);
  cout << (double)(n/2+(n&1))/n << endl;
  return 0;
}


Measured memory_bytes: 256
n=int(input())
rb=[]
for i in range(n):
  x,l=map(int,input().split())
  rb.append((x,l))
rb.sort()

d=[1,sum(rb[0])]
for i in range(1,len(rb)):
  if sum(rb[i])<d[1]:
    d[1]=sum(rb[i])
  elif rb[i][0]-rb[i][1]>=d[1]:
    d[0]+=1
    d[1]=sum(rb[i])
print(d[0])

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

int main()
{
    int a,b,c;
    while(~scanf("%d %d %d",&a,&b,&c))
    {
        if(c>=a&&c<=a+b)
        {
            printf("YES\n");
        }
        else
        {
            printf("NO\n");
        }
    }
    return 0;
}


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

typedef long long int int64;

int cmp(const void *a,const void *b){
  int64 p=*(int64 *)a;
  int64 q=*(int64 *)b;
  return p==q?0:p<q?-1:1;
}

void run(void){
  int n;
  scanf("%d",&n);
  int64 *sum=(int64 *)malloc(sizeof(int64)*(n+1));
  sum[0]=0;
  int i;
  for(i=1;i<=n;i++){
    int a;
    scanf("%d",&a);
    sum[i]=a+sum[i-1];
  }
  qsort(sum,n+1,sizeof(int64),cmp);
  int64 ans=0;
  i=0;
  while(i<n+1){
    int j=i+1;
    while(j<n+1&& sum[i]==sum[j]) j++;
    int d=j-i;
    ans+=(int64)d*(d-1)/2;
    i=j;
  }
  printf("%lld\n",ans);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 3324
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,s,e) for (int i=s;i<e;i++)
#define FOE(i,s,e) for (int i=s;i<=e;i++)
#define FOD(i,s,e) for (int i=s;i>=e;i--)
#define SET(a,e) memset(a,e,sizeof(a))
#define LL long long
#define LD long double
#define pb push_back
#define x first
#define y second
#define PII pair<int,int>
#define PLI pair<LL,int>
#define PIL pair<int,LL>
#define PLL pair<LL,LL>
#define PDD pair<LD,LD>
#define eps 1e-9
#define HH1 402653189
#define HH2 1610612741

int n, a[100055], mn;
LL ans[100055], cnt;
vector<PII> r;

bool cmp(PII u, PII v) {
	if (u.x != v.x) return u.x > v.x;
	return u.y < v.y;
}

int main () {
	
	scanf("%d", &n);
	
	FOR(i, 0, n) scanf("%d", a + i);
	
	FOR(i, 0, n) r.pb((PII){a[i], i + 1});
	
	sort(r.begin(), r.end(), cmp);
	
	r.pb((PII){0, 0});
	
	mn = r[0].y;
	
	FOR(i, 0, n) {
		int p = i;
		while (r[p].x == r[i].x) {
			mn = min(mn, r[p].y);
			p++;
		}
		
		ans[mn] += (LL)p * (LL)(r[i].x - r[p].x);
		
		i = p - 1;
	}
	
	FOE(i, 1, n) printf("%lld\n", ans[i]);
	
	return 0;
	
}

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

using namespace std;

const int N = 1e5 + 5;
const int M = 1e9 + 7;

int n, k;
int dp[N];
int lp[N];
int prime[N];

int fastpow(long long x, int y) {
    long long ret = 1;
    while (y > 0) {
        if (y & 1) ret = (ret * x) % M;
        y >>= 1;
        x = (x * x) % M;
    }
    return ret;
}

void upd(int& x, int y) {
    x = (x + y) % M;
    x = (x % M + M) % M;
}

int get(int x) {
    int ret = 0;
    for (int i = 1; i <= x; i++) {
        if (lp[i] != 1) continue;
        if (prime[i] % 2 == 0) {
            upd(ret, dp[x / i]);
        } else {
            upd(ret, -dp[x / i]);
        }
    }
    return ret;
}

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

    cin >> n >> k;
    iota(lp + 1, lp + 1 + k, 1);
    for (int i = 2; i <= k; i++) {
        if (prime[i]) continue;
        for (int j = i; j <= k; j += i) {
            prime[j]++;
            lp[j] /= i;
        }
    }
    for (int i = 1; i <= k; i++) {
        dp[i] = fastpow(i, n);
    }
    long long ans = 0;
    for (int i = 1; i <= k; i++) {
        long long cur = ((1LL) * i * get(k / i)) % M;
        ans = (ans + cur) % M;
    }
    cout << (ans % M + M) % M << '\n';

    return 0;
}

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

int main(){
  char S[10] = {};
  /* int index_begin, index_end; */
  int max = 0;
  int count = 0;
  int begin = 0;
  int loop_flag = 0;
  int i;

  scanf("%s", S);

  for(i = 0; i < 10; i++){
    if(S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T'){
      loop_flag = 1;
      count++;
      if(begin == 0){
	/* index_begin = i; */
	begin = 1;
      }
      if(count > max){
	max = count;
	/* index_begin = i - max + 1; */
      }
    }
    else{
      /* if(loop_flag == 1 && max == count){ */
      /* 	index_end = i; */
      /* } */
      loop_flag = 0;
      count = 0;
    }
  }


  printf("%d", max);

  return 0;
}
      


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
double kyori(int mae,int ato,int *X,int *Y){
    double a=pow(X[ato]-X[mae],2);
    double b=pow(Y[ato]-Y[mae],2);
    double ans=pow(a+b,0.5);
    return ans;
}

int main() {
    int N;cin>>N;
    int X[N],Y[N];
    for(int i=0;i<N;i++){
        cin>>X[i]>>Y[i];
    }

    vector<int> v(N);
    iota(v.begin(),v.end(),0);
    double sum=0.0;

    do{
        for(int i=0;i<N-1;i++){
            sum+=kyori(v[i],v[i+1],X,Y);
        }
    }while(next_permutation(v.begin(),v.end()));
    int kaijo=1;
    for(int i=2;i<=N;i++)kaijo*=i;

    double res=sum/kaijo;

    cout<<fixed<<setprecision(12)<<res<<endl;

    }






Measured memory_bytes: 384
// template {{{

#include <bits/stdc++.h>
using namespace std;

#define loop(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) loop(i, 0, n)
#define rloop(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); i--)
#define rrep(i, n) rloop(i, 0, n)
#define pb push_back
#define pf push_front
#define eb emplace_back
#define ef emplace_front
#define mp std::make_pair
#define mt std::make_tuple
#define fi first
#define se second

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

template<typename T, size_t H, size_t W>
using matrix = std::array<std::array<T, W>, H>;

const int MOD = 1e9 + 7;
const int INF = 1e9 + 10;
const ll LLINF = 1e18 + 10;

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

template<typename T>
inline T sq(T x){ return x * x; }

template<typename T, typename U>
inline void chmax(T &x, U y){ x = std::max<T>(x, y); }

template<typename T, typename U>
inline void chmin(T &x, U y){ x = std::min<T>(x, y); }

template<typename T>
inline void sort(T &c){ std::sort(std::begin(c), std::end(c)); }

template<typename T>
inline void reverse(T &c){ std::reverse(std::begin(c), std::end(c)); }

template<typename T>
inline void unique(T &c){ std::sort(c); c.erase(std::unique(std::begin(c), std::end(c))); }

// }}}

ll p, q, a, n;

ll calc(ll i, ll j, ll x, ll y)
{
	if (x * q > y * p) return 0;
	if (x * q == y * p) return 1;
	if (i == n) return 0;
	if (j * y > a) return 0;
	return calc(i, j + 1, x, y) + calc(i + 1, j, x * j + y, j * y);
}

int main()
{
	while (cin >> p >> q >> a >> n, n){
		cout << calc(0, 1, 0, 1) << endl;
	}
}

Measured memory_bytes: 4388
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
using namespace std;
int main() {
    int n;
    cin >> n;
    switch (n) {
      case 22:
        cout << "Christmas Eve Eve Eve" << endl;
        break;
      case 23:
        cout << "Christmas Eve Eve" << endl;
        break;
      case 24:
        cout << "Christmas Eve" << endl;
        break;
      case 25:
        cout << "Christmas" << endl;
        break;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int x = sc.nextInt();
    int posi = 0;
    int nega = 0;
    for(int i = 0; i < m; i++) {
        if(sc.nextInt() > x) {
            posi++;
        } else {
            nega++;
        }
    }
    
    if(posi > nega) {
        System.out.println(nega);
    } else {
        System.out.println(posi);
    }
  }
}

Measured memory_bytes: 23124
N = int(input())
B = list(map(int, input().split()))
A = [0 for _ in range(N)]
A[0] = B[0]
A[N-1] = B[N-2]
for i in range(1, N-1):
    A[i] = min(B[i], B[i-1])
print(sum(A))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
ll niz[1000005];
ll dp[1000005];
 
int main(){
    ios_base::sync_with_stdio(false);
    cout.precision(10);
    cout<<fixed;
 
    int n;
    cin >> n;
    for(int i=1; i<=n; i++){
        cin >> niz[i];
    }
    dp[2] = abs(niz[2] - niz[1]);
    for(int i=3; i<=n; i++){
        dp[i] = min(dp[i-1] + abs(niz[i]-niz[i-1]), dp[i-2] + abs(niz[i]-niz[i-2]));
    }
    cout << dp[n];
    return 0;
}

Measured memory_bytes: 5120
#include<iostream>

using namespace std;

int main(){
  	int a, b, c, d;
  	cin >> a >> b >> c >> d;
  	while(true) {
      c -= b;
      if(c <= 0) {
          printf("Yes\n");
          break;
      }
      
      a -= d;
      if(a <= 0) {
          printf("No\n");
          break;
      }
    }
  
  	return 0;
}

Measured memory_bytes: 3132
#include<bits/stdc++.h>
using namespace std;
const int MAXN=110;
int n;
int a[MAXN];
int main() {
	int n,cnt=0;
	scanf("%d",&n);
	for(int i=0; i<n; i++) {
		scanf("%d",&a[i]);
	}
	bool flag=1;
	for(int i=0; flag; i++) {
		flag=0;
		for(int j=n-1; j>=i+1; j--) {
			if(a[j]<a[j-1]) {
				swap(a[j],a[j-1]);
				flag=1;
				cnt++;
			}
		}
	}
	for(int i=0; i<n; i++) {
		if(i) cout<<" ";
		printf("%d",a[i]);
	}
	printf("\n");
	printf("%d\n",cnt);
}

Measured memory_bytes: 3192
#include<iostream>
#include<cmath>
#include <cstdio>
using namespace std;
int main(){
	double x,h,seihou = 0,naname = 0,y = 0,sannkaku = 0,kotae = 0;
	
	
	while(true){
		cin >> x >> h;
		if(x == 0 && h == 0){
			break;
		}
		seihou = x * x;
		y = x/2;
		naname = sqrt(y*y + h*h) ;
		sannkaku = x * naname * 4 / 2;
		kotae = sannkaku + seihou;
		printf("%.6f\n",kotae);
	}
	
}

Measured memory_bytes: 1236
#include <stdio.h>

int main(void)
{
	int i,a,min,max;
	int	b[10000];
	long long sum;
	
	sum = 0;
	min = 1000000;
	max = -1000000;

	scanf("%d",&a);

	for(i=0;i<a;i++)
	{
		scanf("%d", &b[i]);

		if(b[i] < min)
		{
			min = b[i];
		}
		if(b[i] > max)
		{
			max = b[i];
		}

		sum = sum + b[i];
	}

	printf("%d %d %lld\n",min,max,sum);

	return 0;
}

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

int main()
{
  int N, i, j = 0, k = 1000000;
  cin >> N;
  vector<int> A(N);
  for (i = 0; i < N; i++)
  {
    cin >> A[i];
  }
  for (i = 0; i < N; i++)
  {
    j = 0;
    while (A[i] % 2 == 0)
    {
      A[i] = A[i] / 2;
      j++;
    }
    if (j < k)
    {
      k = j;
    }
  }
  cout << k << endl;
  return 0;
}


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

#define int long long

using namespace std;

#ifdef LOCAL 
#include "/media/brayand/BrayanD/debugger.h"
#else
template<typename... Args>
void db(Args... args){}
#endif

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

    int N;
    cin >> N;

    vector<int> vect;

    for(int i = 0 ; i < N ; i++)
    {
    	int n;
    	cin >> n;
    	vect.push_back(n);
    }

    sort(vect.rbegin(),vect.rend());

    multiset<pair<int,int>> st;

    // db(vect);

    int sum = 0;

    for(int i = 0 ; i < N ; i++)
    {
    	if(i == 0)
    	{
    		st.insert({-vect[0],1});
    	}
    	else
    	{
    		pair<int,int> it = *st.begin();
    		st.erase(st.begin());

    		sum += -it.first;
    		// db(-it.first);
    		it.second--;

    		if(it.second)st.insert(it);

    		st.insert({-vect[i],2});
    	}
    }

    cout << sum << '\n';

    return 0;
}

Measured memory_bytes: 11120
#include <bits/stdc++.h>
using namespace std;
int main() {
	int h1, m1, h2, m2, k;
  	cin >> h1 >> m1 >> h2 >> m2 >> k;
  	int t1 = h1 * 60 + m1, t2 = h2 * 60 + m2;
  	int ans = 0;
  	for (int i = t1; i < t2; i++) {
    	if (i + k < t2) ans++;
      	else break;
    }
  	cout << ans << endl;
}


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

c=1
kc=0
ansc=0
ans=[]
for i in range(len(a)):
    for j in range(a[i]):
        ans.append(c)
    c=c+1
for i in range(h):
    for j in range(w):
        if kc%2!=0:
            for k in range(ansc+w-1,ansc-1,-1):
                print(ans[k],end=" ")
            ansc=ansc+w
            break
        else:
            print(ans[ansc],end=" ")
            ansc=ansc+1
    kc=kc+1
    print()


Measured memory_bytes: 3920
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		int count = 0;
		for(int i = a ; i<=b ; i++){
				if(c%i==0)count++;
		}
		System.out.println(count);
		
	}

}

Measured memory_bytes: 26256
/* ****revpro**** */
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define endl     '\n'
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)    
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define mii      map<ll,ll>
using namespace std;

#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define N  100005
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;  
#define ordered_set tree<double, null_type,less<double>, rb_tree_tag,tree_order_statistics_node_update> 
void solve()
{
  ll k;
  ll ans=0;
  cin>>k;
  rep(i,1,k+1) rep(j,1,k+1) rep(l,1,k+1) ans+=__gcd(i,__gcd(j,l));
  cout<<ans;
}
signed main()
{
  
    /***********************************/
    unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
    mt19937_64 generator (seed);
    /***********************************/
 
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS=1;
//  cin>>TESTS;
  while(TESTS--)
  {
    solve();
    
  }
  TIME
  return 0;
}

Measured memory_bytes: 3804
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <memory.h>
#include <string>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <cassert>

using namespace std;

typedef long long LL;
typedef pair<int,int> PII;

#define MP make_pair
#define PB push_back
#define FF first
#define SS second

#define FORN(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD(i, n) for (int i = (int)(n) - 1; i >= 0; i--)

#define DEBUG(X) { cout << #X << " = " << (X) << endl; }
#define PR0(A,n) { cout << #A << " = "; FORN(_,n) cout << A[_] << ' '; cout << endl; }

// #define FL fflush(stdout)

#define MOD 1000000007
#define INF 2000000000
#define MAXN 200010

int GLL(LL& x) {
  return scanf("%lld", &x);
}

int GI(int& x) {
  return scanf("%d", &x);
}

int n, m;
vector< set<int> > adj;
int main() {
  GI(n);
  GI(m);
  adj.resize(n+2);

  FORN(i, m) {
    int a, b;
    GI(a);
    GI(b);
    adj[a].insert(b);
    adj[b].insert(a);
  }

  for (auto mid : adj[1]) {
    if (adj[mid].find(n) != adj[mid].end()) {
      printf("POSSIBLE\n");
      return 0;
    }
  }
    
  printf("IMPOSSIBLE\n");
  return 0;
}


Measured memory_bytes: 28416
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long i,j,k,n,m,s;
    cin>>n;
    long long a[n+3],b[n+3],c[n+3];
    for(i=1;i<=n;i++) cin>>a[i];
    for(i=1;i<=n;i++) cin>>b[i];
    for(i=1;i<=n-1;i++) cin>>c[i];
    s=b[a[1]];
    for(i=2;i<=n;i++){
        s+=b[a[i]];
        if(a[i-1]+1==a[i]) s+=c[a[i-1]];
    }cout<<s;
}


Measured memory_bytes: 3592
#include <stdio.h>

int computeDigit(n){
   int i = 0;

   while(n != 0){
      n /= 10;
      i++;
   }
   return i;
}

int main(void){
   int a, b;

   while(scanf("%d %d", &a, &b) != EOF){
      printf("%d\n", computeDigit(a + b));
   }
   return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<math.h>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;

#include<cstdio>

#define FOR(i, n) for(int i = 0; i < (n); i++)
#define FORq(i, m, n) for(int i = (m); i < (n); i++)
#define FORr(i, n) for (int i = (n); i >= 0; i++)


int main() {
	int A, B;
	cin >> A >> B;
	if (abs(A - B) >= 2) {
		cout << max(A, B) * 2 - 1 << endl;
	}
	else {
		cout << A + B << endl;
	}
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int compare(const void *a,const void *b){
    if(*(int *)a>*(int *)b)return -1;
    return 1;
}
int main()
{   
    long long h;
    scanf("%lld",&h);
    long long cnt=0;
    while(h>1){
        h/=2;
        cnt++;
    }
    long long ans=0;
    for(int i=cnt;i>=0;i--){
        ans+=pow(2,i);
    }
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using mii = map<int, int>;
using mll = map<ll, ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vpi = vector<pii>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpl = vector<pll>;
using vs = vector<string>;

int main()
{
    ll x;
    cin >> x;
    for(ll i=-120; i<=120; i++)
    {
        for(ll j=-120; j<=120; j++)
        {
            if(i*i*i*i*i - j*j*j*j*j == x)
            {
                cout << i << " " << j << endl;
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3596
#include <algorithm>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f, MOD = 1000000007;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*-----------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int a, b, c; cin >> a >> b >> c;
  long long k; cin >> k;
  cout << (k & 1 ? b - a : a - b) << '\n';
  return 0;
}


Measured memory_bytes: 256
import itertools
H,W=map(int,input().split())
c=[list(map(int,input().split())) for i in range(10)]
A=[list(map(int,input().split())) for i in range(H)]
for k,i,j in itertools.product(list(range(10)),repeat=3):
    c[i][j]=min(c[i][j],c[i][k]+c[k][j])
res=sum(c[A[i][j]][1] if A[i][j]!=-1 else 0 for j in range(W) for i in range(H))
print(res)

Measured memory_bytes: 41180
#include <iostream>
using namespace std;
int main(void){
     int a, b, c, z; 
     cin >> a >> b >> c; 
     if(a > b){ z = a; a = b; b = z; } 
     if(b > c){ z = b; b = c; c = z; } 
     if(a > b){ z = a; a = b; b = z; } 
     cout << a << " " << b << " " <<c << endl; 
     return 0; 
}



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

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

    vector<size_t> A(H);
    vector<size_t> B(H);
    for (size_t i = 0; i < H; i++)
    {
        cin >> A[i] >> B[i];
    }

    set<pair<size_t, size_t>> goal_start;
    set<pair<int, size_t>> ans;
    for (size_t i = 1; i <= W; i++)
    {
        goal_start.insert(make_pair(i, i));
        ans.insert(make_pair(0, i));
    }

    for (size_t i = 0; i < H; i++)
    {
        size_t start = 0;
        size_t right = 0;
        for (set<pair<size_t, size_t>>::iterator itr = goal_start.lower_bound(make_pair(A[i], 0)); itr != goal_start.end() && itr->first <= B[i]; itr = goal_start.erase(itr))
        {
            size_t goal = itr->first;
            start = itr->second;

            ans.erase(ans.find(make_pair(goal - start, goal)));
            right = max(right, start);
        }
        if (start > 0 && B[i] < W)
        {
            goal_start.insert(make_pair(B[i] + 1, right));
            ans.insert(make_pair(B[i] + 1 - right, B[i] + 1));
        }

        if (ans.empty())
        {
            cout << -1 << endl;
        }
        else
        {
            cout << i + 1 + ans.begin()->first << endl;
        }
    }
}


Measured memory_bytes: 31416
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const int MOD = 998244353;
const ll INF = 1000000000000000000;

int H[1010];
int main()
{
	int N, T, A;
	cin >> N >> T >> A;
	for (int i = 0; i < N; i++) cin >> H[i];
	pair<double,int> ans = { mod,0 };
	for (int i = 0; i < N; i++) {
		double t = T - (double)H[i] * 0.006;
		ans = min(ans, { abs(A - t), i + 1 });
	}
	cout << ans.second << endl;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define OUT(x) cout << (x) << endl;
#define OUTA(a, n) \
    REP(i, n) { cout << (a[i]) << (i == n - 1 ? "\n" : " "); }
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

int main()
{
    ll H, W, K;
    cin >> H >> W >> K;
    vector<string> S(H);
    REP(i, H)
    {
        cin >> S[i];
    }

    // vector<vi> acc(H, vi(0, W + 1));
    // REP(j, W)
    // {
    //     REP(i, H)
    //     {
    //         acc[i][j + 1] = acc[i][j] + S[i][j] - '0';
    //     }
    // }

    ll ans = INF;
    REP(p, 1 << (H - 1))
    {
        ll cut = 0;
        vi dp;
        dp.push_back(0);
        REP(k, H - 1)
        {
            if ((p >> k) & 1)
            {
                dp.push_back(0);
                ++cut;
            }
        }

        // for (ll j = 1; j <= W; ++j)
        REP(j, W)
        {
            // ll s = acc[0][j] - acc[0][l];
            ll s = S[0][j] - '0';
            vi wc;
            REP(k, H - 1)
            {
                if ((p >> k) & 1)
                {
                    wc.push_back(s);
                    s = 0;
                }
                s += S[k + 1][j] - '0';
                // s += acc[k + 1][j] - acc[k + 1][l];
            }
            wc.push_back(s);
            bool ok = true;
            REP(i, wc.size())
            {
                if (dp[i] + wc[i] > K)
                {
                    ok = false;
                }
            }
            if (ok)
            {
                REP(i, dp.size())
                {
                    dp[i] += wc[i];
                }
            }
            else
            {
                ++cut;
                REP(i, dp.size())
                {
                    if (wc[i] > K)
                    {
                        cut = INF;
                    }
                    dp[i] = wc[i];
                }
            }
        }
        ans = min(ans, cut);
    }
    OUT(ans);
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

static const ll INF = 1001001001;
static const ll LLINF = 1001001001001001001;
static const ll MOD = (ll)1e9 + 7;
static const double EPS = 1e-9;

#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define RANGE(i, m, n) for(ll i = (m); i <= (n); ++i)
#define RRANGE(i, m, n) for(ll i = (m); i >= (n); --i)
#define POSITIVE(x) (x)=((x) < 0) ? 0 : (x)

ll power(ll x, ll y) {
    ll ret = 1;
    while(y-- > 0) ret *= x;
    return ret;
}

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

ll extgcd(ll a, ll b, ll& x, ll& y) {
    x = 1; y = 0;
    assert(a >= 0);
    assert(b >= 0);
    if (b == 0) return a;
    ll X, Y;
    auto d = extgcd(b, a % b, X, Y);
    x = Y;
    y = X - (a / b) * Y;
    return d;
}

int run(istream& in, ostream& out) {
    ll N, M;
    in >> N >> M;
    vector<ll> H(N);
    set<ll> good{};
    REP(i, N) {
        in >> H[i];
        good.emplace(i);
    }
    vector<ll> A(M);
    vector<ll> B(M);
    REP(i, M) {
        in >> A[i];
        in >> B[i];
        A[i]--;
        B[i]--;
        auto a = A[i];
        auto b = B[i];
        if (H[a] > H[b]) swap(a,b);
        good.erase(a);
        if (H[a] == H[b]) {
            good.erase(b);
        }
    }
    ll ans = good.size();
    out << ans << endl;
    return 0;
}

int main() {
    return run(cin, cout);
}


Measured memory_bytes: 10388
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod=1e9+7;
ll const maxn=4e5+5;
ll const inf=1e18;
ll add(ll a,ll b){
    return ((a%mod)+(b%mod))%mod;
}
ll mul(ll a,ll b){
    return ((a%mod)*(b%mod))%mod;
}
ll powm(ll x,ll n,ll M)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}
int main(){
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    // #endif
    ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   ll n,k;
   cin>>n>>k;
   ll ans=0;
   for(int i=0;i<n;i++){
    ll x;
    cin>>x;
    if(x>=k)ans++;
   }
   cout<<ans;
    return 0;
}


Measured memory_bytes: 256
/*
  abc177_a.rs
*/

use std::io::{self, Read};

fn run_puzzle(input: &str) {

  let nums: Vec<i32> = input.trim().split(' ').map(|x| str::parse(x).unwrap()).collect();

  let d = nums[0];
  let t = nums[1];
  let s = nums[2];

  if d <= t * s {
    println!("Yes");
  } else {
    println!("No");
  }
}

fn main() {

  // Get input.
  let mut buffer = String::new();
  let stdin = io::stdin();
  let mut handle = stdin.lock();
  handle.read_to_string(&mut buffer).unwrap();

  // Run puzzle.
  run_puzzle(&buffer);

}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
                 
#define ll long long int
#define ld long double
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define sld(x) scanf("%llf",&x)
#define pb push_back
#define mk make_pair
#define F first
#define S second
#define Next ((pos+1)%2)
#define BiG(x,y) (g[x].pb(y),g[y].pb(x))
#define lsd(x) ((x)&(-x))

using namespace std;

const int i=1e5+3;

int main(){

    int a,b;

    si(a),si(b);

    if(a>8 or b>8)
        printf(":(\n");
    else
        printf("Yay!\n");

    return 0;    
}

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void ans(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=INF,res2=-INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  ll l,r;
  bool judge = true;
  string s;cin>>s;
  ll p=0,g=0;
  for(i=0;i<s.size();i++){
    if(s[i]=='g')g++;
    else p++;
  }
  cout<<s.size()/2-p<<endl;
  return 0;
}

Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main(){

        int a,b;
        int i,j;
        int count;

        cin >> a >> b;

        count = 0;

        for(i=1; i <= a -1 ; i++){

                for(j=1; j <= 31 ; j++){

                        if(i==j){
                                count++;
                        }

                }

        }

        for(j=1; j <= b ; j++){

                if(i==j){
                        count++;
                }

        }


        cout << count << endl;

        return 0;

}

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

int main(){
  int a,b;
  string s;
  cin >> a >> b;
  
  for(int i = 0; i < a;i++){
    for(int j = 0; j < b;j++){
       cin >> s;
       if(s == "snuke"){
         cout << (unsigned char)(j+65) << i+1 << endl;
       }
    }
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
using namespace std;
#define endl '\n'

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string a;
    cin >> a;
    for(int i = 0; i < a.size(); i++)
    {
        if(a[i]=='?'){
            a[i] = 'D';
        }
    }
    cout << a << endl;
}

Measured memory_bytes: 3756
import collections
from sys import stdin
N = int(stdin.readline().rstrip())
data = [int(x) for x in stdin.readline().rstrip().split()]
c = collections.Counter(data)
ans = 0
max_v = max(data)
for i in range(max_v+1):
    ans = max(ans,c[i]+c[i+1]+c[i+2])
print(ans)

Measured memory_bytes: 14556
import sys
import math
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
a,b,c = LI()



if c-a-b > 0 and (4*a*b) < ((c-a-b)**2) :
    print('Yes')
else:
    print('No')

Measured memory_bytes: 38384
//...code_sm....
 
//27-03-20   20:48
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll  long long 
#define vi vector<ll>
using namespace std;
int main()
{
    fastio
int n;
cin>>n;
vi v(n);
	map<ll,ll>mp;
for(int i=0;i<n;i++)
{
cin>>v[i];
mp[v[i]]++;
}
ll temp_ans=0;
for(auto x:mp)
{
    temp_ans+=(x.second)*(x.second-1)/2;
}
for(int i=0;i<n;i++)
{
 ll ans=temp_ans-(mp[v[i]]-1);
 cout<<ans<<"\n";
}
	}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    long long R_min = 10000000000LL, R, diff_max = -10000000000LL;
    for ( int i = 0; i < n; i++ ) {
        cin >> R;
        if ( diff_max < R - R_min ) diff_max = R - R_min;
        if ( R_min > R ) R_min = R;
    }
    cout << diff_max << '\n';
    return 0;
}


Measured memory_bytes: 3104
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define dump(x)  cout << #x << " = " << (x) << endl;

#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
//             0123456789 - digits. check the limits, int vs long
const int MX = 100001;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(0);
    cout << std::fixed;
    // freopen("ex.in","r",stdin);
    // freopen("ex.out","w",stdout);
    int n;
    cin >> n;
    ll ans = (ll) n;
    ans = ans * (ans - 1) / 2;
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <bitset>
#include <iostream>
#include <deque>
#include <functional>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <string>
#include <vector>
#include <vector>

using namespace std;

#define int long long

#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

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

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

const int MOD = 1e9 + 7;

signed main(void)
{
  bool flag = true;
  string s; cin >> s;
  for (int i = 1; i < s.length(); ++i) {
    if (s[i - 1] == s[i]) flag = false;
  }

  cout << (flag ? "Good" : "Bad") << endl;
}


Measured memory_bytes: 256
s = input()
N = len(s)
x,y = map(int, input().split())
ls = s.split('T')
A = []
B = []
dpx = [0]*(2*N+1)
dpy = [0]*(2*N+1)
for i,c in enumerate(ls):
  if i%2==0:
    A += [len(c)]
  else:
    B += [len(c)]
x -= A[0]
A = A[1:]
dpx[N] = 1
dpy[N] = 1
for a in A:
  dpx = [1 if (i>=a and dpx[i-a]) or (i<=2*N-a and dpx[i+a]) else 0 for i in range(2*N+1)]
for b in B:
  dpy = [1 if (i>=b and dpy[i-b]) or (i<=2*N-b and dpy[i+b]) else 0 for i in range(2*N+1)]
if x>N or y>N:
  print('No')
elif dpx[x+N] and dpy[y+N]:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 133128
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

int main() {
  int n,ans = 0;
  cin >> n;
  vector<int> p(n);
  rep(i,n) cin >> p[i];
  for(int i = 1; i < n-1; i++) {
    if(p[i-1] < p[i] && p[i] < p[i+1]) ans++;
    if(p[i-1] > p[i] && p[i] > p[i+1]) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
typedef pair<int, int> p;
 
int main() {
	cin.tie(0);
    ios::sync_with_stdio(false);

    int N;
    ll x;
    cin >> N >> x;

    vector<ll> a(N);

    for(int i = 0; i < N; i++) cin >> a[i];

    ll ans = 0;

    for(int i = 1; i < N; i++) {
        if(a[i] + a[i - 1] <= x) continue;
        if(a[i - 1] <= x) {
            ans += a[i] + a[i - 1] - x;
            a[i] -= a[i] + a[i - 1] - x;
            //cerr << "a " << a[i - 1] << " " << a[i] << endl;
        } else {
            ans += a[i];
            a[i] = 0;
            ans += a[i - 1] - x;
            a[i - 1] = x;
            //cerr << "b " << a[i - 1] << " " << a[i] << endl;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  int k,s,ans=0;
  cin>>k>>s;
  for(int i=0;i<=k;i++){
    for(int j=0;j<=k;j++){
      if(s-i-j>=0 && s-i-j<=k) ans++;
    }
  }
  cout<<ans<<endl;
}

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

using namespace std;

#define INF 1000000000
#define INFLL 0x3f3f3f3f3f3f3f3fLL 
#define EPS 10e-9
#define MOD 998244353
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define st first
#define nd second
#define sz(v) int(v.size())
#define all(X) (X).begin(), (X).end()
#define FOR(I, A, B) for(int I = A; I < B; I++)
#define RFOR(I, A, B) for(int I = A; I >= B; I--)

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef vector<iii> viii;
typedef vector<ll> vll;

vll fat;

ll poww(ll x, ll e){
	if(e == 0) return 1;
	if(e%2){
		ll ans = poww(x, e/2);
		return (((ans*ans)%MOD)*x)%MOD;
	} else {
		ll ans = poww(x, e/2);
		return (ans*ans)%MOD;
	}
}

ll invmod(ll x){
	return poww(x, MOD-2);
}

ll comb(ll k, ll n){
	ll ans = (fat[n]*invmod(fat[k]))%MOD;
	ans = (ans*invmod(fat[n-k]))%MOD;
	return ans;
}

int main(){
	ll n, m, k;
	scanf("%lld %lld %lld", &n, &m, &k);
	fat.resize(n+1);
	fat[0] = 1;
	for(ll i = 1; i <= n; i++){
		fat[i] = (i*fat[i-1])%MOD;
	}

	ll sol = 0;
	for(int i = 0; i <= k; i++){
		ll next = (comb(i,n-1)*poww(m-1,(n-1)-i))%MOD;
		sol = (sol+next)%MOD;
	}
	sol = (sol*m)%MOD;
	cout << sol << endl;	
	return 0;
}



Measured memory_bytes: 4776
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, res = 0;
  cin >> n;
  FOR(i,1,n+1) {
    int len = (to_string(i)).size();
    if(len % 2 != 0) res++;
  }
  cout << res << endl;
  return 0;
}
//templete by private_yusuke

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

//template
#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 ALL(v) (v).begin(),(v).end()
typedef long long int ll; typedef pair<ll, ll> P;
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; }
template<typename A,size_t N,typename T>void Fill(A(&array)[N],const T &val){fill((T*)array, (T*)(array+N), val);}
const int inf = INT_MAX / 2; const ll INF = LLONG_MAX / 2;
//template end



int main(){
    int a,n,m; scanf("%d%d%d",&a,&n,&m);
    int val=1,ans=0;
    rep(rot,0,100){
        ll x=1;
        rep(i,0,n)x*=(val+a);
        if(x>m)break;
        int sum=0;
        while(x){
            sum+=x%10;
            x/=10;
        }
        if(val==sum)ans++;
        val++;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 3216
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=1; i<n; i++)
int main()
{
  int n; cin>>n;
  vector<int>v(n+1);
  rep(i,n+1) cin>>v[i];
  rep(i,n+1)
  {
    int key = v[i];
    int j = i - 1;
    while (j >= 0 && v[j] > key)
    {
      v[j+1] = v[j];
      j--;
    }
    v[j+1] = key;
    rep(k,n+1)
    {
      cout << v[k];
      k==n ? cout << "\n" : cout << " ";
    }
  }
}


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

int main(){
  int X;
  cin >>X;
  
  vector<int> dp(2000000,0);
  dp[100] = 1;
  dp[101] = 1;
  dp[102] = 1;
  dp[103] = 1;
  dp[104] = 1;
  dp[105] = 1;
  
  for(int i=106;i<=X;i++){
    bool sub1 = dp[i-100] > 0;
    bool sub2 = dp[i-101] > 0;
    bool sub3 = dp[i-102] > 0;
    bool sub4 = dp[i-103] > 0;
    bool sub5 = dp[i-104] > 0;
    bool sub6 = dp[i-105] > 0;
    if(sub1 || sub2 || sub3 || sub4 || sub5 || sub6){
      dp[i] = 1;
    }
  }
  
  if(dp[X] > 0) cout << 1 << endl;
  else cout << 0 << endl;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = pow(10, 9) + 7;
//const int MOD = 998244353;
//const int MOD = ;
int mod(int A, int M) {return (A % M + M) % M;}
const int INF = 1LL << 60;
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string abc = "abcdefghijklmnopqrstuvwxyz";
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}

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

  string ans = "Good";
  if (S.at(0) == S.at(1) || S.at(1) == S.at(2) || S.at(2) == S.at(3))
    ans = "Bad";
  
  cout << ans << endl;
}

Measured memory_bytes: 256