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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> piipi;
typedef pair<pii, pii> piipii;

#define mp make_pair
#define fi first
#define se second
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define eb emplace_back

int a[100005];
int main(){
    int n, x;
    scanf("%d%d", &n, &x);
    for(int i=1;i<=n;i++) scanf("%d", &a[i]);

    ll ans = 0;
    for(int i=2;i<=n;i++){
        if(a[i]+a[i-1] > x){
            int d = a[i]+a[i-1]-x;
            if(d > 0){
                a[i] -= d;
                if(a[i] < 0) a[i] = 0;
                ans += d;
            }
        }
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 4232
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
	string s;cin>>s;
	vector<int> lr;
	for(int i=1;i<s.size()+1;++i)
	{
		int l=1;
		while(s[i]==s[i-1])
		{
			l++;
			i++;
		}
		lr.push_back(l);
		//if(l!=1)i--;
	}
 
	for(int i=0;i<lr.size();i+=2)
	{
		for(int j=0;j<lr[i]-1;++j)cout<<0<<" ";
		int num=lr[i]/2+lr[i+1]/2;
		cout<<num+lr[i]%2<<" ";
		cout<<num+lr[i+1]%2<<" ";
		for(int j=0;j<lr[i+1]-1;++j)cout<<0<<" ";
	}
	cout<<endl;
/*
	for(int i=0;i<lr.size();++i)
	{
		cout<<lr[i]<<endl;
	}
	*/
	return 0;
}

Measured memory_bytes: 1144
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long 

// fact(n)
int fact(int n){
	if(n == 1)	return 1;
	else return (n * fact(n - 1));
}

// combination(n,r)
int combination(int n, int r){
	if(r == 0 || r == n)	return 1;
	else if(r == 1)	return n;
	return (combination(n - 1, r - 1) + combination(n - 1, r));
}

// gcd(a,b)
int gcd(int a,int b){
	int ret;
	ret = (b == 0) ? a : gcd(b, a % b);
	return ret;
}

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

// qsort(array, size, sizeof(int),comp);
int comp(const int *a,const int *b){
	return (*a - *b);
}

// append(array,*size,addNum)
void append(int *array,int *size,int num){
	realloc(array, sizeof(int) * (*size + 1));
	array[(*size)] = num;
	++(*size);
}

// pop(array,*size) & nongetpop(array,*size)
int pop(int *array,int *size){
	int temp = array[(*size - 1)];
	realloc(array,sizeof(int) * (*size - 1));
	--(*size);
	return temp;
}

void nongetpop(int *array,int *size){
	realloc(array,sizeof(int) * (*size - 1));
	--(*size);
}

int main(int argc, char const *argv[])
{
	char ymd[17];
	scanf("%s",ymd);
	ymd[3] = '8';
	printf("%s\n", &ymd);
	return 0;
}



Measured memory_bytes: 128
#include<stdio.h>
int main()
{
	int h, w;
	scanf("%d %d", &h, &w);
	int i, j;
	char s[55][55];
	for (i = 0; i < h; i++)
		scanf("%s", s[i]);
	int v[55][55];
	for (i = 0; i < h; i++)
		for (j = 0; j < w; j++)
			v[i][j] = 1000000009;
	v[0][0] = 1;
	int q[1000006], l;
	q[0] = 0;
	l = 1;
	int x, y;
	while (l > 0)
	{
		l--;
		x = q[l] / w;
		y = q[l] % w;
		if (x > 0)
		{
			if (v[x - 1][y] > v[x][y] + 1 && s[x - 1][y] == '.')
			{
				v[x - 1][y] = v[x][y] + 1;
				q[l] = w * (x - 1) + y;
				l++;
			}
		}
		if (y > 0)
		{
			if (v[x][y - 1] > v[x][y] + 1 && s[x][y - 1] == '.')
			{
				v[x][y - 1] = v[x][y] + 1;
				q[l] = w * x + y - 1;
				l++;
			}
		}
		if (x < h - 1)
		{
			if (v[x + 1][y] > v[x][y] + 1 && s[x + 1][y] == '.')
			{
				v[x + 1][y] = v[x][y] + 1;
				q[l] = w * (x + 1) + y;
				l++;
			}
		}
		if (y < w - 1)
		{
			if (v[x][y + 1] > v[x][y] + 1 && s[x][y + 1] == '.')
			{
				v[x][y + 1] = v[x][y] + 1;
				q[l] = w * x + y + 1;
				l++;
			}
		}
	}
	if (v[h - 1][w - 1] > 1000006)
	{
		printf("-1\n");
		return 0;
	}
	int count = 0;
	for (i = 0; i < h; i++)
		for (j = 0; j < w; j++)
			if (s[i][j] == '.')
				count++;
	printf("%d\n", count - v[h - 1][w - 1]);
	return 0;
}

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

#define ll long long int
#define str string
#define ALL(a)  (a).begin(),(a).end()
#define P pair<ll,ll>

using Graph = vector<vector<int>>;

const int dy[] = { 0, 0, 1, -1 }, dx[] = { 1, -1, 0, 0 };
ll INFL = 1ll << 60, INF = 1 << 30, mod = 1e9 + 7, Min = INFL, Max = -1;
double a, b, c ,n, sum, A[500010], B[500000],rui[500000],  dp[5000];
str S,T,U;bool check = true;	vector<ll> v;



int main() {
	//Code Line
cin >> a;
b = a/3;
cout <<fixed << setprecision(15) << b*b*b << endl;





	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char a[301][301];
int h,w,k;
int cnt=1;
int c[301][301]={0};
void dfs(int x,int y)
{
	int num=0;
	for(int i=0;i<w;i++)
	{
		if(a[x][i]=='#')
		{
			num++;
		}
		if(num==2)
		{
			cnt++;
			num=1;
		}
		c[x][i]=cnt;
	}
}
int main()
{
	cin>>h>>w>>k;
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			cin>>a[i][j];
		}
	}
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			if(a[i][j]=='#')
			{
				dfs(i,j);
				cnt++;
				break;
			}
		}
	}
	int last=0;
	for(int i=0;i<h;i++)
	{
		if(c[i][0]==0)
		{
			last=i;
			while(c[last][0]==0&&last<h)
			{
				last++;
			}
			if(last==h)
			{
				for(int j=0;j<w;j++)
				{
					for(int k=i;k<last;k++)
					{
						c[k][j]=c[i-1][j];
					}
				}
				break;
			}
			for(int j=0;j<w;j++)
			{
				for(int k=i;k<last;k++)
				{
					c[k][j]=c[last][j];
				}
			}
		}
	}
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			cout<<c[i][j]<<' ';
		}
		cout<<endl;
	}
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  int A[n];
  rep(i,n) cin >> A[i];
  
  string ans = "APPROVED";
  
  rep(i,n){
  if(A[i]%2 == 0 && A[i]%3 != 0 && A[i]%5 != 0) ans = "DENIED";
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


const int m_max = 105;
int masu[m_max][m_max] = {0};

int main()
{
    int h, w;
    cin >> h >> w;
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) {cin >> a[i];}

    int color = 0;
    rep(i, h){
        rep(j, w){
            if (a[color] == 0){
                color++;
            }
            if (i%2==0){
                masu[i][j] = color+1;
            } else {
                masu[i][w-1-j] = color+1;
            }
            a[color]--;
        }
    }

    rep(i, h){
        rep(j, w){
            cout << masu[i][j] << " ";
        }
        cout << endl;
    }

}



Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>

using namespace std;

typedef long long ll;

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

// ref. arihon 3-3
// E: type of data, R: type of query result
template<typename E, typename R>
class SegmentTree {
    public:
        SegmentTree(const int _n, const E inf, R (*f)(E, E)): f(f), inf(inf) {
            n = 1;
            while (n < _n) n *= 2;
            data.resize(2 * n, inf);
        }

        // update data[k] with a
        // 0-index, [0, _n) in other words
        // time complexity: O(n)
        void update(int k, E a) {
            k += n - 1;
            data[k] = a;
            while (k > 0) {
                k = (k - 1) / 2;
                data[k] = (*f)(data[k * 2 + 1], data[k * 2 + 2]);
            }
        }

        // query value from [a, b)
        // 0-index, [0, _n) in other words
        // time complexity: O(n)
        R query(int a, int b) {
            return query(a, b, 0, 0, n);
        }

    private:
        int n;
        R (*f)(E, E);
        const E inf;
        vector<E> data;

        R query(int a, int b, int k, int l, int r) {
            // if [a, b) intersect [l, r) = empty
            if (r <= a || b <= l) {
                return inf;
            }

            // if [a, b) includes [l, r)
            if (a <= l && r <= b) {
                return data[k];
            } else {
                R vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
                R vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
                return (*f)(vl, vr);
            }
        }
};

const int MAX_N = 500000;

int bits_count(int x) {
    int res = 0;
    while (x > 0) {
        if (x & 0x1) {
            res++;
        }
        x >>= 1;
    }
    return res;
}

int main(void) {
    int N;
    cin >> N;
    string S;
    cin >> S;
    int Q;
    cin >> Q;

    auto f = [](int x, int y) {
        return x | y;
    };
    SegmentTree<int, int> *st = new SegmentTree<int, int>(N, 0LL, f);

    for (int i = 0; i < N; i++) {
        int c = S[i] - 'a';
        st->update(i, 1 << c);
    }

    for (int i = 0; i < Q; i++) {
        int a;
        cin >> a;
        if (a == 1) {
            int b;
            char c;
            cin >> b >> c;
            b--;
            int x = c - 'a';
            st->update(b, (1 << x));
        } else {
            int l, r;
            cin >> l >> r;
            l--;
            cout << bits_count(st->query(l, r)) << endl;
        }
    }

    delete st;
    return 0;
}


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

#define pb push_back
#define F first
#define S second
#define y1 dasdasfasfas
#define x1 wqdadfasfasfas
#define All(c) c.begin(), c.end()
#define SZ(A) (int((A).size()))
#define umap unordered_map
#define __ fflush(stdout)
#define FILENAME ""

typedef long long ll;
typedef long double ld;    

using namespace std;

void FREOPEN() {
	#ifdef LOCAL
		freopen(".in", "r", stdin);
		freopen("1.out", "w", stdout);
	#else
		//freopen(FILENAME".in", "r", stdin);
		//freopen(FILENAME".out", "w", stdout);
	#endif
}

inline double Time() {return (clock() * 1.0) / CLOCKS_PER_SEC; }             

const int N = 3000, inf = 1e9 * 2;

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

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

double p[N], dp[N][N];

int main() {
	FREOPEN();
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		scanf("%lf", p + i);
	}
	dp[0][0] = 1.0;
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j < n - i; j++) {
			dp[i + 1][j] += dp[i][j] * p[i + j + 1];
			dp[i][j + 1] += dp[i][j] * (1.0 - p[i + j + 1]);
		}
	}
	double ans = 0;
	for (int i = (n + 1) / 2; i <= n; i++) ans += dp[i][n - i];
	printf("%.9lf", ans);
	return 0;
}


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

using namespace std;

typedef long long ll;

int main(){
        ll N, T;
        cin>>N>>T;
        vector <ll> t;
        for(int i=0;i<N;i++){
                int tt;
                cin>>tt;
                t.push_back(tt);
        }
        t.push_back(1111111111111);
        ll tsum=T;
        ll now[2];
        now[0]=0;now[1]=T;
        for(int i=1;i<N;i++){
                if(t[i]<now[1]){
                        while(t[i]<now[1]){
                                i++;
                        }
                        i--;
                        tsum+=t[i]-now[0];
                        now[1]=t[i]+T;
                        now[0]=t[i];
                }
                else{
                        tsum+=T;
                        now[0]=t[i];now[1]=t[i]+T;
                }
                //cout<<"t:"<<t[i]<<endl;
                //cout<<tsum<<endl;
                //cout<<now[0]<<":"<<now[1]<<endl;
        }
        cout<<tsum<<endl;
        return 0;
}


Measured memory_bytes: 2420
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int n, k;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n >> k;
  int ans = 0;
  REP(i, n) {
    int a;
    cin >> a;
    if(a >= k) ans++;
  }

  cout << ans << endl;
}


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

int main() {
	int n,d,t,s,i,j,k,ans;
	cin >> d >> t >> s;
	if(s*t>=d){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

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

int main() {
  int A, B, C, K, Rem, Poi = 0;
  cin >> A >> B >> C >> K;
  Rem = K;
  
  if (Rem < A) {
    Poi = Rem;
  }
  else {
    Poi = A;
    Rem -= A;
    if (B < Rem) {
      Rem -= B;
      Poi -= Rem;
    }
  }
  
  cout << Poi << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
/*
g++ -std=c++11 -Wall -g -fsanitize=undefined -D_GLIBCXX_DEBUG keyence/c.cpp
*/
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define INF (1e16)
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);//おまじないでcin, cout早くする
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n);
    vector<int> d(n);

    rep(i, n){
        cin >> a[i];
    }
    rep(i, n){
        cin >> b[i];
        d[i] = a[i] - b[i];
    }

    sort(d.begin(), d.end());
    ll sum = 0;
    rep(i, n){
        sum += d[i];
    }
    if(sum < 0){
        cout << -1 << "\n";
        return 0;
    }

    int ans = 0;
    ll fu = 0;
    rep(i, n){
        if(d[i] < 0){
            ans++;
            fu += d[i];
        }else{
            break;
        }
    }

    for(int i = n - 1; i >= 0; i--){
        if(fu >= 0){
            break;
        }
        fu += d[i];
        ans++;
    }

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>

int main()
{
    int a[5][4][11];
    for(int i = 1; i<=4; i++) {
        for(int j = 1; j<=3; j++) {
            for(int k = 1; k<=10; k++){
                a[i][j][k] = 0;
            }
        }
    }
    // spades, hearts, clubs and diamonds
    int n = 0;
    scanf("%d", &n);
    int b,f,r,v;
    //printf("%d\n",n);
    for(int i = 0; i<n; i++){
        scanf("%d %d %d %d",&b,&f,&r,&v);
        a[b][f][r] += v;
    }
    
    for(int i = 1; i<=4; i++) {
        for(int j = 1; j<=3; j++) {
            for(int k = 1; k<=10; k++){
                if(k==1) printf(" ");
                printf("%d",a[i][j][k]);
                if(k!=10) printf(" ");
            }printf("\n");
        }
        if(i!=4)
        printf("####################\n");
    }
    
    return 0;
}



Measured memory_bytes: 2748
import sys
input=sys.stdin.buffer.readline
n,c=map(int,input().split())
a=[ [0 for _ in range(10**5+2)] for _ in range(c)]
for _ in range(n):
    s,t,cc=map(int,input().split())
    cc-=1
#    print(s-1,end=' s-1\n')
    #a[cc][s-1]+=1
    #a[cc][t]-=1
    for i in range(s-1,t):
        a[cc][i]=1
'''for i in range(c):
    for j in range(1,10**5+1):
        a[i][j]+=a[i][j-1]
'''
ans=1
for j in range(0,10**5):
    su=0
#    print(c,'hello')
    for i in range(c):
#        print('asdf hello')
#        print(j,i,a[i][j])
        su+=a[i][j]
    ans=max(ans,su)
print(ans)


Measured memory_bytes: 26648
#include <stdio.h>
#include <string.h>
#include <math.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int n, i, j, cnt=0, save=0, connect=0;//connect=0初回  ３連続でない 7連続である
    
   
    scanf("%d",&n);
    int s[n][2];
    
    for(i=0; i<n; i++)
        for(j=0; j<2; j++)
            scanf("%d", &(s[i][j]) );
    
    
//    printf("%d", n);
//    printf("\n");
//    for (i = 0; i < n; i++) {
//        for (j = 0; j < 2; j++) {
//            printf("%d ", s[i][j]);
//        }
//        printf("\n");
//    }
    for(i = 0; i < n; i++){
        if(s[i][0]==s[i][1]){
            if(connect==0||connect==7){
                cnt++;
            }else{
                cnt=1;
            }
            connect=7;
        }else{
           
            if(cnt>save){
                save = cnt;
            }
        
            connect=3;
        }
    }
    if(save>cnt){
        cnt=save;
    }
//    printf("zorome = %d\n", cnt);
    if(cnt>2){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 2108
var inputRaw = require('fs').readFileSync('/dev/stdin', 'utf8')
var rows = inputRaw.trim().split('\n');
var row1 = rows[0].split(' ').map(Number);
var N = row1[0];
var K = row1[1];
var h = rows[1].split(' ').map(Number);
var dp = Array(N).fill(0);

function solve() {
  for (var i = 1; i < N; i++) {
    if (i === 1) {
      dp[i] = Math.abs(h[i - 1] - h[i]);
    } else {
      var list = [];
      for (var j = i - 1; j >= Math.max(i - K, 0); j--) {
        list.push(dp[j] + Math.abs(h[j] - h[i]));
      }
      dp[i] = Math.min.apply(null, list);
    }
  }
  return dp[N - 1];
}

console.log(solve());


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

using namespace std;

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

using ll = long long;

const int Inf = 1e9;
const double EPS = 1e-9;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
	int n, k;
	cin >> n >> k;
	vector<int> v(n);
	rep (i, n) cin >> v[i];
	ll res = 0;
	rep (i, k + 1) {
	  // 宝石を捨てる回数
	  rep (j, i + 1) {
		int chance = i - j; // 宝石を取り出せる回数
		// 左から宝石を取り出す回数を全探索
		rep (l, chance + 1) {
		  vector<int> hand;
		  int left = 0, right = n - 1;
		  while (left < l && left <= right) {
			hand.push_back(v[left++]);
		  }
		  int rest = chance - l;
		  rep (r, rest) {
			if (left >= right) break;
			hand.push_back(v[right--]);
		  }
		  sort(hand.begin(), hand.end());
		  ll tmp = 0;
		  rep (r, j) {
			if (r >= hand.size()) break;
			if (hand[r] < 0) hand[r] = 0;
		  }
		  rep (r, hand.size()) tmp += hand[r];
		  res = max(res, tmp);
		}
	  }
	}
	cout << res << endl;
    
    return 0;
}



Measured memory_bytes: 3616
//#pragma warning(disable:4996)
//#pragma comment(linker, "/STACK:336777216")
//#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <db, db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))
#define sz(x) (int)(x.size())
#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>

inline ll gcd(ll a,ll b){if(a==0) return b;return gcd(b%a,a);}
inline ll power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
const ll MOD =998244353;
const ll hell=1000000007;
const int INF = 1e18;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
const int N=200005;


void solve()
{
    int h,w,n;
    cin>>h>>w>>n;
    int mn1=ceil((double)n/w);
    int mn2=ceil((double)n/h);
    cout<<min(mn1,mn2)<<endl;
}
int32_t main()
{
    IOS;
    int t;
    t=1;
   // cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	a := map[string]int{"AC": 0, "WA": 0, "TLE": 0, "RE": 0}
	order := []string{"AC", "WA", "TLE", "RE"}
	for i := 0; i < n; i++ {
		var in string
		fmt.Scan(&in)
		a[in]++
	}

	for _, item := range order {
		fmt.Println(item, "x", a[item])
	}
}


Measured memory_bytes: 6332
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <numeric>
using namespace std;
typedef long long ll;

int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
   string s;cin>>s;
   int n=s.length();
   vector<ll> v1(2019,0);
   ll ans=0;
   for(int i=1;i<=n;i++){
       vector<ll> v2(2019);
       int cur=s[i-1]-'0';
       v2[cur]++;
       for(int j=0;j<2019;j++){
           ll a=v1[j];
           v2[(10*j+cur)%2019]+=a;
       }
       ans+=v2[0];
       v1=vector<ll> (v2.begin(),v2.end());
   }
   cout<<ans;
    
}

Measured memory_bytes: 3776
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
long mod = (long) 1e9 + 7;

int main(){
    
    long n, ans = 0;
    cin >> n;
    
    rep(i,n+1){
        if(i % 3 > 0 && i % 5 > 0) ans += i;
    }
    
    cout << ans << "\n";
    
    return 0;
}



Measured memory_bytes: 3124
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<ll,ll> P;
#define pb push_back
#define mp make_pair
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i++<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)
#define iFr(i,n) for(int i=n;i>0;i--)

int main(){
  string s;
  int k,a,n;
  cin>>s>>k;
  n=s.length();
  fr(i,n){
    if(i==n-1){
      a=s[i]-'a';
      a+=k;
      a%=26;
      s[i]='a'+a;
      break;
    }
    if(s[i]=='a') continue;
    a='{'-s[i];
    if(a<=k){
      s[i]='a';
      k-=a;
    }
  }
  cout<<s<<endl;
}

Measured memory_bytes: 512
//
//  main.cpp
//  atc-reg68-E
//
//  Created by 岩井聡 on 2017/02/10.
//  Copyright © 2017年 岩井聡. All rights reserved.
//

#include <iostream>
#include <map>
#include <vector>
#define M 100000

using namespace std;

int n,m;
int l[3000001];
int r[3000001];
int diff[3000001];
int ans[100000];
map<int,vector<int>> indexes;

void solve_normal(void);


void solve_bit(void);
void add(int a,int w, int *t_bit);
void addRange(int l,int r, int *t_bit);
int getVal(int a, int *t_bit);
int sum(int a, int *t_bit);
int bit[M];
int bit2[M];


int main(int argc, const char * argv[]) {
    //    freopen("/Volumes/4HOPE/Dropbox/17Todai/CodeJam/R1C-2015-C/in.txt","r",stdin);
    //    freopen("/Volumes/4HOPE/Dropbox/17Todai/CodeJam/R1C-2015-C/out.txt","w",stdout);
    
    scanf("%d %d",&n, &m);
    for(int i=1;i<=n;i++){
        scanf("%d %d",&l[i],&r[i]);
        diff[i] = r[i]-l[i]+1;
        indexes[diff[i]].push_back(i);
        add(diff[i],1,bit);
    }
    solve_bit();
//    solve_normal();
//    time_t t1 = time(NULL);
//    }
//    time_t t2=time(NULL);
//    printf("%d",t2-t1);
    return 0;
}


void solve_normal(void){
    int *ansp = &ans[0];
    for(int d=1;d<=m;d++){
        *ansp = 0;
        for(int i=1;i<=n;i++){
            *ansp += (((int)r[i]/d) - ((int)(l[i]-1)/d) > 0);
        }
        ansp++;
    }
    for(int d=0;d<m;d++){
        printf("%d\n",ans[d]);
    }

}

void solve_bit(void){
    for(int d=1;d<=m;d++){
        int ret = n-sum(d,bit);
        vector<int>::iterator iter=indexes[d].begin();
        for(;iter != indexes[d].end();iter++){
            int i=*iter;
            addRange(l[i],r[i],bit2);
        }
        for(int i=0;i<=m;i+=d){
            ret += sum(i,bit2);
        }
        printf("%d\n",ret);
    }
}

void addRange(int l,int r, int *t_bit){//Add 1 to the range (l,r] : l exclusive r inclusive
    add(l,1,t_bit);
    add(r+1,-1,t_bit);
}
int getVal(int a, int *t_bit){// O(logM)
    return sum(a, t_bit) - sum(a-1,t_bit);
}


void add(int a,int w, int *t_bit){//O(logM)
    for(int x=a; x<=m; x+= x&-x)
        *(t_bit+x) += w;
}

int sum(int a, int *t_bit){
    int ret=0;
    for(int x=a; x>0; x-= x&-x){
        ret += *(t_bit+x);
    }
    return ret;
}


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



int main() {
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    a += b;
    c += d;

    if(a>c){
        cout<<"Left";
    }else if(a==c){
        cout<<"Balanced";
    }else{
        cout<<"Right";
    }



}


Measured memory_bytes: 256
import sys, math, itertools, bisect, copy, re
from collections import Counter, deque, defaultdict

from itertools import accumulate, permutations, combinations, takewhile, compress, cycle

# from functools import reduce
# from math import ceil, floor, log10, log2, factorial
# from pprint import pprint
import heapq

INF = float('inf')
MOD = 10 ** 9 + 7
EPS = 10 ** -7
sys.setrecursionlimit(1000000)

# N = int(input())
# N,M = [int(x) for x in input().split()]
# V = [[0] * 100 for _ in range(100)]
# A = [int(input()) for _ in range(N)]
# DP = [[0] * 100 for _ in range(100)]
# DP = defaultdict(lambda: float('inf'))

N, M = [int(x) for x in input().split()]
AB = []
for _ in range(N):
    A, B = [int(x) for x in input().split()]
    AB.append((A, B))

AB = sorted(AB, key=lambda x: x[0])

idx = 0
available = []
ans = 0
for d in range(1, M + 1):
    while idx < N and AB[idx][0] <= d:
        heapq.heappush(available, -AB[idx][1])
        idx += 1

    if len(available) != 0:
        ans += (-heapq.heappop(available))

print(ans)


Measured memory_bytes: 74456
#include<bits/stdc++.h>
using namespace std;
int main(){
    int r,g,b,n;
    cin>>r>>g>>b>>n;
    int cnt=0;
    for(int i=0;i<=n;i++){
        for(int j=0;j<=n;j++){
            int z=n-(i*r+j*g);
            if(0<=z && z%b==0)cnt++;
        }
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

typedef long long ll;

ll gcd(ll x, ll y) {
  while (y != 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

ll lcm(ll x, ll y) {
  return x/gcd(x, y)*y;
}

int main() {
  ll n; cin >> n;
  ll t, ans = 1;

  while (n--) {
    cin >> t;
    ans = lcm(ans, t);
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, K, *D = map(int, read().split())

    ng = [False] * 10
    for d in D:
        ng[d] = True

    for n in range(N, 10 ** 5):
        n = str(n)
        ok = True
        for d in n:
            if ng[int(d)]:
                ok = False
                break
        if ok:
            ans = n
            break

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9112
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = 0, b = 0, c = 0, m = 0;
		a = sc.nextInt();
		b = sc.nextInt();
		c = sc.nextInt();
		m = Math.max(a, b);
		m = Math.max(m, c);
		if (m == a + b + c - m) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


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

int n,m;
string s;
vector<int> ans;

int main()
{
	cin>>n>>m>>s;
	int j;
	for(int i=n;i>0;i-=j) {
		for(j=m;j>0;--j) {
			if(i-j<0||s[i-j]=='1') continue;
			ans.push_back(j);
			break;
		}
		if(j==0) {
			printf("-1");
			return 0;
		}
	}
	for(int i=ans.size()-1;i>-1;--i) printf("%d ",ans[i]);
}

Measured memory_bytes: 1144
/*
判断是否是凸包
*/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
using namespace std;
int num;
double x,yy1,yy2,yy3,yy4;
const double eps = 1e-8;
const double inf = 1e20;
const double pi = acos(-1.0);
const int maxp = 110;
int sgn(double x){
    if(fabs(x)<eps){
        return 0;
    }
    if(x<0){
        return -1;
    }else{
        return 1;
    }
}
struct Point{
    double x,y;
    Point(){}
    void input(){
        scanf("%lf%lf",&x,&y);
    }
    Point(double _x,double _y){
        x = _x;y = _y;
    }
    bool operator < (Point b)const{
        return sgn(x-b.x)==0?sgn(y-b.y)<0:x<b.x;
    }
    Point operator - (const Point &b)const{
        return Point(x-b.x,y-b.y);
    }
    double operator *(const Point &b)const{
        return x*b.x+y*b.y;
    }
    double operator ^(const Point &b)const{
        return x*b.y-y*b.x;
    }
    double distance(Point p){
        return hypot(x-p.x,y-p.y);
    }
};
struct Line{
    Point s,e;
    Line(){}
    Line(Point _s,Point _e){
        s  = _s;
        e = _e;
    }
};
struct polygon{
    int n;
    Point p[maxp];
    Line l[maxp];
    void input(int _n){
        n = _n;
        for(int i = 0;i < n;++i ){
            p[i].input();
        }
    }
    bool isconvex(){
        bool s[3];
        memset(s,false,sizeof(s));
        for(int i = 0;i < n;++i ){
            int j = (i+1)%n;
            int k = (j+1)%n;
            s[sgn((p[j]-p[i])^(p[k]-p[i]))+1] = true;
            if(s[0]&&s[2]){
                return false;
            }
        }
        return true;
    }
};
int main(){
    int N;
    scanf("%d",&N);
    polygon pp;
    pp.input(N);
    if(pp.isconvex()){
        printf("1\n");
    }else{
        printf("0\n");
    }

    return 0;
}


Measured memory_bytes: 3252
#include <iostream>
#include <algorithm>
using namespace std;
int a, b; bool prime[1111111];
int main() {
	fill(prime + 2, prime + 1000001, true);
	for (int i = 2; i <= 1000; i++) {
		if (!prime[i]) continue;
		for (int j = i * i; j <= 1000000; j += i) prime[j] = false;
	}
	while (cin >> a >> b, a | b) {
		int suma = 0, maxa = 0, sumb = 0, maxb = 0;
		for (int i = 2; i <= a; i++) {
			if (prime[i] && a % i == 0) suma += i, maxa = i;
		}
		for (int i = 2; i <= b; i++) {
			if (prime[i] && b % i == 0) sumb += i, maxb = i;
		}
		int reta = maxa * 2 - suma, retb = maxb * 2 - sumb;
		if (reta > retb) cout << "a" << endl;
		else cout << "b" << endl;
	}
	return 0;
}

Measured memory_bytes: 4060
# -*- coding: utf-8 -*-
import math
from operator import mul
from functools import reduce
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
import copy
sys.setrecursionlimit(10**6)

# lis_of_lis = [[] for _ in range(N)]


def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()[:-1]


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


s = S()
t = S()
S = s
T = t

min_ = 0
max_ = len(T)
# len(S) - len(T) + 1
for x in range(max_+1):
    # x文字置き換えて良い
    for i in range(len(S) - len(T) + 1):
        count = 0
        for (a, b) in zip(T, S[i:i + len(T)]):
            if (a == b):
                count += 1
        if (count+x >= len(T)):
            print(x)
            exit()


Measured memory_bytes: 69592
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
			　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <iostream>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <memory>
#include <iomanip>

#define rep(i, n) for(Int (i) = 0; (i) < (n); ++(i))
#define debug(var) cout << #var << ": " << var << endl
using namespace std;
using Int = int64_t;
using Uint = uint64_t;
constexpr Uint mod = 1e9 + 7;
constexpr Int INF = INT_MAX;
template<typename T>
using Grid = vector<vector<T>>; // 二次元配列。[y][x]
template<typename T, typename U>
using Umap = unordered_map<T, U>;
template<typename T>
using Uset = unordered_set<T>;
template<typename T>
using P = pair<T, T>;


void calc() {

	array<Int, 9> a{};
	rep(i, 9)cin >> a[i];
	Int N; cin >> N;
	vector<Int> b(N);
	rep(i, N)cin >> b[i];
	array<bool, 9> flag{}; //それがあるかどうか
	

	for (Int i = 0; i < 9; ++i) {
		for (Int j = 0; j < N; ++j) {
			if (a[i] == b[j])flag[i] = true;
		}
	}

	bool ans = false;

	for (Int i = 0; i < 3; ++i)if (flag[i * 3] && flag[i * 3 + 1] && flag[i * 3 + 2])ans = true; //横
	for (Int i = 0; i < 3; ++i)if (flag[i] && flag[i + 3] && flag[i + 6])ans = true; //縦
	if (flag[0] && flag[4] && flag[8])ans = true;
	if (flag[2] && flag[4] && flag[6])ans = true;
	//斜め

	if (ans)cout << "Yes";
	else cout << "No";

}


int main() {

	calc();

	return 0;
}

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

using namespace std;
int main() {
    int k, n, x, max = 0;
    cin >> k >> n;
    int a[n];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        
        if (i == n-1) {
            if (max < k - a[i] + a[0]) {
                max = k-a[i]+a[0];
            }
        } else if (max < abs(a[i] - a[i + 1])) max = abs(a[i] - a[i + 1]);
    }
    cout << k - max << endl;
}

Measured memory_bytes: 1024
import sys
from bisect import bisect_left
input = sys.stdin.readline

N = int(input())
L = list(map(int, input().split()))
L.sort()
ans = 0

for i in range(N-2):
    for j in range(i+1, N-1):
        search = L[i] + L[j]
        k = bisect_left(L, search)
        ans += k - j - 1
print(ans)


Measured memory_bytes: 3316
#include <iostream>
#include<cmath>
#include <math.h>
#include<iomanip>

int main(){
    int a,b,x;
    std::cin>>a>>b>>x;
    double tan=(2.0*(double)x)/(double)(a*b*b);
    if((double)b*tan<a){
    }
    else{
        tan=(double)(a*a*a)/(2.0*(double)(a*a*b-x));
    }
    double thita=std::atan(tan);
    double angle=90.0-thita*180.0/M_PI;
    std::cout<<std::fixed<<std::setprecision(10);
    std::cout<<angle;
    return 0;
}

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

double pi = 3.141592653589793238;
int main() {
  double a, b, h, m;
  cin >> a >> b >> h >> m;
  double theta = pi * (h+m/60.0) / 6.0 - pi * m / 30.0;
  double l2 = a * a + b * b - 2 * a * b * cos(theta);
  cout <<setprecision(12) << sqrt(l2) << endl;
  return 0;
}

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

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    char arr[3];
    string a="ABC";
    string b="ARC";
    cin>>arr;
    if(arr[1]=='R'){
       cout<<a; 
    }
  else{
    cout<<b; 
  }
    return 0;
}

Measured memory_bytes: 3612
//Do you like watching me?
#include<stdio.h>
int main(void){
  int n,Y;
  int x;
  int y;
  int z;
  int i=-1;
  int j=-1;
  int k=-1;
  int t;

  
  scanf("%d %d",&n,&Y);
  
for(x=0;x<=n;x++){
   for(y=0;y<=(n-x);y++){
       for(z=0;z<=(n-x-y);z++){
 			t=(x*10000+y*5000+z*1000);
      if(t==Y){
        if((x+y+z)==n){
        i=x;
        j=y;
        k=z;

        }
      }
    }
  }
}
  printf("%d %d %d",i,j,k);
  return 0;
}

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

typedef long long ll;
ll fs[110][20][20];
ll ps[110][20];

int main(void) {
  int n;
  scanf("%d", &n);
  REP(i, n) {
    REP(k, 2) {
      REP(j, 5) {
        scanf("%lld", &fs[i][j][k]);
      }
    }
  }
  REP(i, n) {
    REP(j, 11) {
      scanf("%lld", &ps[i][j]);
    }
  }
  ll res = -1e18;
  REP(pat, 1 << 10) {
    if(pat == 0) {
      continue;
    }
    ll cur = 0;
    REP(i, n) {
      int cnt = 0;
      REP(j, 5) {
        REP(k, 2) {
          if(fs[i][j][k] && (pat & (1 << (j*2+k)))) {
            ++cnt;
          }
        }
      }
      cur += ps[i][cnt];
    }
    res = max(res, cur);
  }
  printf("%lld\n", res);
  
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);srand(time(NULL));
#define ll long long int
#define ld long double
#define vec vector<ll>
#define pb push_back
#define mp make_pair
#define sz size()
#define ff first
#define ss second
#define yes cout<<"YES"<<"\n"
#define no cout<<"NO"<<"\n"
#define inf LLONG_MAX
#define f(i,a,b) for(i=a;i<b;i++)
const ll mod=1000000007; 
using namespace std;
ll lcm(ll n,ll m)
{
    return (n*m)/__gcd(n,m);
}
void solve()
{
    ll n,i;
    cin>>n;
    ll a[n+1]={0};
    f(i,1,n+1) cin>>a[i];
    ll dp[n+1]={0};
    for(i=2;i<=n;i++)
    {
        if(i==2)
        {
            dp[2]=abs(a[2]-a[1]);
        }
        else 
        {
            ll k=dp[i-1]+abs(a[i]-a[i-1]);
            k=min(k,dp[i-2]+abs(a[i]-a[i-2]));
            dp[i]=k;
        }
        // cout<<dp[i]<<" ";
    }
    cout<<dp[n];
}
int32_t main()
{
    fast
    ll q=1;
    // cin>>q;
    while(q--)solve();
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#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;
  rep(i,S.size()) {
    if (i%2==0 && S[i]=='L') {
      cout << "No" << endl;
      return 0;
    }
    else if (i%2!=0 && S[i]=='R') {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 3132
{-# LANGUAGE OverloadedStrings #-}
module Main where

import           Data.List
import           Control.Monad
import           Debug.Trace
import qualified Data.ByteString.Char8         as BC
import           Data.Maybe                     ( fromJust )
import qualified Data.Set                      as S
import qualified Data.IntMap.Strict            as IM
import qualified Data.Map.Strict               as M
import           Data.Char


readTuple2 :: IO (Int, Int)
readTuple2 = do
    [a, b] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b)

readTuple3 :: IO (Int, Int, Int)
readTuple3 = do
    [a, b, c] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b, c)

readInt :: IO Int
readInt = fst . fromJust . BC.readInt <$> BC.getLine

readInts :: IO [Int]
readInts = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

split :: (a -> Bool) -> [a] -> [[a]]
split f [] = []
split f as =
    let (fo, la) = span f as
        las      = case la of
            [] -> []
            xs -> split f $ tail xs
    in  case fo of
            [] -> las
            xs -> xs : las

isNum :: Int -> Bool
isNum a 
    | a `mod` 5 == 0 = False
    | a `mod` 3 == 0 = False
    | otherwise = True

lowerBound :: IM.IntMap Int -> Int -> Int -> Int -> Maybe Int
lowerBound m left right key 
        | satisfy leftVal = Just left
        | not $ satisfy rightVal = Nothing
        | right - left == 1 = Just right
        | otherwise = if satisfy (m IM.! mid) then lowerBound m left mid key else lowerBound m mid right key
        where
        leftVal = m IM.! left
        rightVal = m IM.! right
        satisfy val = val >= key
        mid = (right - left) `div` 2 + left

isKai :: String -> Bool
isKai s = reverse s == s

main = do
    s <- getLine
    let l = length s
    let fh = take ((l - 1) `div` 2) s
    let lh = drop (((l + 3) `div` 2) - 1) s
    putStrLn $ if isKai s && isKai fh && isKai lh then "Yes" else "No"





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

int main(){
    int mod=1000000007;
    int n,ans=0;
    char s[55];
    for (int i=0;i<55;i++) s[i]='X';
    scanf("%d",&n);
    scanf("%s",s);
    for (int i=0;i<n;i++) if (s[i]=='A' && s[i+1]=='B' && s[i+2]=='C') ans++;
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 3832
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <complex>
#include <vector>
#include <cstdio>
#include <cmath>
#include <time.h>
#define all(c) ((c).begin(),(c).end())
#define rall(c) (c).rbegin(),(c).rend()
#define sort(v,n) sort(v,v+n)
#define vsort(v) sort(v.begin(),v.end())
#define vvsort(v) sort(v.begin(),v.end(),greater<int>())
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
const ll MOD = 1e9 + 7;
const double PI = acos(-1.0);
//---------------------------------------------------------------------------------------------//
int n, a, b, c, x;
int y[101];
int main() {
	while (cin >> n >> a >> b >> c >> x) {
		for (int i = 0; i < n; i++) {
			cin >> y[i];
		}
		if (n == 0)return 0;
		int cont = 0, icont = 0;
		if (x == y[0])icont++;
		while (cont <= 10000 && icont<n) {
			x = (a*x + b) % c;
			if (x == y[icont]) {
				icont++;
			}
			cont++;
		}
		if (cont > 10000) {
			cout << -1 << endl;
		}
		else cout << cont << endl;
	}
}

Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

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

	vector<int> ans;
	for (int i = 0; i < N; ++i) {
		vector<bool> used(N, false);
		vector<int> prev(N);
		deque<int> que;
		que.emplace_back(i);
		used[i] = true;
		while (que.size()) {
			int u = que.front(); que.pop_front();
			for (auto v : g[u]) {
				if (v == i) {
					vector<int> tmp;
					tmp.emplace_back(v);
					while (u != i) {
						tmp.emplace_back(u);
						u = prev[u];
					}
					reverse(tmp.begin(), tmp.end());
					if (ans.size() == 0 || ans.size() > tmp.size()) {
						ans = tmp;
					}
					break;
				}
				if (used[v]) { continue; }
				used[v] = true;
				prev[v] = u;
				que.emplace_back(v);
			}
		}
	}
	if (ans.size() == 0) { 
		cout << -1 << endl;
	} else {
		cout << ans.size() << endl;
		for (auto v : ans) { cout << v + 1 << endl; }
	}

	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N, X;
    cin >> N >> X;
    vector<long long> L(N + 10), D(N + 10);
    D[0] = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> L[i];
    }
    for (int i = 0; i < N; i++)
    {
        D[i + 1] = D[i] + L[i];
    }
    int cnt = 0;
    for (int i = 0; i <= N; i++)
    {
        if (D[i] <= X)
            cnt++;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using static System.Console;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        int N = ReadLineParseInt();
        double[] p = ReadLine().Split(' ').Select(double.Parse).ToArray();
        double[] dp = new double[N + 1];
        dp[0] = 1;
        for (int i = 0; i < N; i++)
        {
            for (int j = N; j > 0; j--)
                dp[j] = dp[j - 1] * p[i] + dp[j] * (1d - p[i]);
            dp[0] *= 1d - p[i];
        }
        double ans = 0d;
        for (int i = N / 2 + 1; i <= N; i++)
            ans += dp[i];
        WriteLine(ans);
    }
    static int ReadLineParseInt() => int.Parse(ReadLine());
}

Measured memory_bytes: 13408
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    x = II()
    if x < 1200:
        print("ABC")
    else:
        print("ARC")
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()


Measured memory_bytes: 38512
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
#include <numeric>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
//#define int ll
typedef long long ll;

const int md = 1000000007;
const int INF = 1<<30;
using namespace std;

string yn(bool x){
    return x ? "YES" : "NO";
}

int main(){
    ll n,m;
    cin >> n >> m;

    cout << abs((n-2)*(m-2)) << endl;

    
}

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

b1=[0,0,1,1]
a1=[0,1,1,0]

def bb(n,a):
  n = 1 << n
  if a%n < n//2:
    return 0
  else:
    return 1 if a%2 else 0

def ba(n,a):
  n = 1 << n
  if a%n < n//2:
    return 0
  else:
    return 0 if a%2 else 1

c=0
n=b
while n>0:
  n = n >> 1
  c += 1

n=b1[a%4]^a1[b%4]
for i in range(2,c+1):
  n |= (ba(i,b)^bb(i,a)) << (i-1)

print(n)


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

int main(){

  int n;
  cin >> n;

  vector<double> v(n+1);
  for(int i = 0; i < n; i++) cin >> v[i+1];

  vector<vector<double>> dp(n+1, vector<double>(n+1, 0));
  dp[0][0] = 1;

  for(int i = 1; i <= n; i++){
    for(int j = 0; j < i; j++){
      dp[i][j]   = dp[i-1][j]*(1-v[i]) + dp[i-1][j-1]*v[i];
      dp[i][j+1] = dp[i-1][j]*v[i] + dp[i-1][j+1]*(1-v[i]);
    } 
  }

  /*
  for(int i = 1; i <= n; i++){
    for(int j = 0; j <= n; j++) cout << dp[i][j] << " ";
    cout << endl;
  }
  */

  double ans = 0;
  for(int i = n; i > n / 2; i--) ans += dp[n][i];
  printf("%.10f\n", ans);

  return 0;

}


Measured memory_bytes: 70656