akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int(i)=0;i<(n);i++)
const long long MOD = 1000000007;

int main(){
  int n,r=0,b=0,g=0;cin>>n;
  vector<int> a(n,0);
  REP(i,n) cin>>a.at(i);
  long long ans=1;
  REP(i,n){
    long long tmp=0;
    int f=0;
    if(a.at(i)==r){
      tmp++;
      r++;
      f=1;
    }
    if(a.at(i)==b){
      tmp++;
      if(!f){
        b++;
        f=1;
      }
    }
    if(a.at(i)==g){
      tmp++;
      if(!f) g++;
    }
    ans*=tmp;
    ans%=MOD;
  }
  cout<<ans;
}

Measured memory_bytes: 640
#include <iostream>
#include <math.h>
#include <vector>
#include <cstdlib>

using namespace std;

int main(int argc, const char * argv[]) {
	int A, B, C;
	int ans;

	cin >> A;
	cin >> B;
	cin >> C;

	ans = C - (A - B);
	if(ans < 0){ ans = 0;}

	cout << ans <<endl;

	return 0;
}


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



int main() {
	int  h, n;
	cin >> h >> n;
	for(int i = 0; i < n ; i++ )
	{
		int a;
		cin >> a;
		h -= a;
	}

	if(h<=0) printf("Yes");
	else printf("No");

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using i64 = int_fast64_t;
#define repeat(i, a, b) for(int i = (a); (i) < (b); ++(i))
#define rep(i, n) repeat(i, 0, n)

struct Point {
    i64 x, y;
};

void solve() {
    int n, k;
    std::cin >> n >> k;
    std::vector<Point> points(n);
    rep(i, n) {
        std::cin >> points[i].x >> points[i].y;
    }
    std::vector<i64> vx, vy;
    rep(i, n) {
        vx.push_back(points[i].x);
        vy.push_back(points[i].y);
    }
    std::sort(vx.begin(), vx.end());
    std::sort(vy.begin(), vy.end());
    i64 ans = 1LL << 62;
    rep(lx, n) {
        rep(ly, n) {
            repeat(rx, lx, n) {
                repeat(ry, ly, n) {
                    int cnt = 0;
                    rep(i, n) {
                        if(points[i].x >= vx[lx] and points[i].x <= vx[rx] and points[i].y >= vy[ly] and points[i].y <= vy[ry]) {
                            cnt++;
                        }
                    }
                    if(cnt >= k) {
                        ans = std::min<i64>(ans, (vx[rx] - vx[lx]) * (vy[ry] - vy[ly]));
                    }
                }
            }
        }
    }
    std::cout << ans << std::endl;
}

int main() {
    // std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    solve();
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  int s[101]={};
  for (int i = 0; i < n; ++i)
  {
    int t,su=0;
    for (int j = 0; j < m; ++j)
    {
      cin>>t;
      cout<<t<<" ";
      su+=t,s[j]+=t;
    }
    cout<<su<<endl;
  }
  for (int i = 0; i < m; ++i) cout<<s[i]<<" ",s[m]+=s[i];
  cout<<s[m]<<endl;
}


Measured memory_bytes: 3096
from fractions import gcd
from functools import reduce
n=int(input())
a=list(map(int,input().split()))
def lcm(a,b):
  return a*b//gcd(a,b)
l=reduce(lcm,a)
mod=pow(10,9)+7
ans=0
for x in a:
  ans+=l//x
print(ans%mod)

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


char a[100005];
char b[100005];
char c[100005];
int sum1,sum2;


int main()
{
	scanf("%s%s",a,b);
	scanf("%d%d",&sum1,&sum2);
	scanf("%s",c);
	if(strcmp(c,a)==0)
	{
		--sum1;
	}
	if(strcmp(c,b)==0)
	{
		--sum2;
	}
	printf("%d %d",sum1,sum2);
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

S = input()

if S == 'RRR':
    print(3)
elif S[:2] == 'RR' or S[1:3] == 'RR':
    print(2)
elif S.count('R') != 0:
    print(1)
else:
    print(0)

Measured memory_bytes: 9068
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265359;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };


signed main() {
	int n, k, maxn = 0;
	vector<int>list;

	cin >> n >> k;

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

	int m = min(n, k);

	for (int l = 0; l <= m; l++) {
		for (int r = 0; r <= m - l; r++) {

			int sum = 0;
			vector<int>x;
			for (int i = 0; i < n; i++) {
				if (l <= i && (n - r - 1) >= i) continue;
				x.push_back(list[i]);
				sum += list[i];
			}

			sort(x.begin(), x.end());

			for (int i = 0; i < min((int)x.size(), k - r - l) && x[i] < 0; i++){
				sum -= x[i];
			}

			maxn = max(maxn, sum);
		}
	}


	cout << maxn << endl;


	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(void){
    string S;
    cin>>S;
    for(int i=0;i<4;i++){
        if(S[i]=='A' && S[i+1]=='C'){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}

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

using namespace std;

int a[107];

int main()
{
//    freopen("TEST.INP", "r", stdin);
    int n, m, sum = 0;
    cin >> n >> m;
    for (int i = 1; i <= n; ++i) cin >> a[i], sum += a[i];
    sort(a + 1, a + n + 1, greater <int> ());
    if ((double)a[m] < (double)sum / (m + m + m + m)) puts("No");
    else puts("Yes");
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int a,b;
  scanf("%d%d",&a,&b);
  if(a<=9 && a>=1 && b<=9 && b>=1)
  {
    printf("%d",a*b);
  }
  else 
    printf("-1");
  
return 0;  
}

Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>

int main(int argc, char *argv[]) {
  int n;
  std::cin >> n;
  std::vector<int> p(n), q(n), r(n);
  for (int i = 0; i < n; ++i)
    std::cin >> p.at(i);
  for (int i = 0; i < n; ++i)
    std::cin >> q.at(i);
  for (int i = 0; i < n; ++i)
    r.at(i) = i + 1;

  int i = 0, a = -1, b = -1;
  while (std::next_permutation(r.begin(), r.end())) {
    if (std::equal(p.begin(), p.end(), r.begin(), r.end()))
      a = i;
    if (std::equal(q.begin(), q.end(), r.begin(), r.end()))
      b = i;
    if (a >= 0 && b >= 0)
      break;
    ++i;
  }

  std::cout << abs(a - b) << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c,d,e;
    cin>>a>>b>>c>>d>>e;
  if(a==0){
    cout<<1<<endl;
  }
   if(b==0){
    cout<<2<<endl;
  }
   if(c==0){
    cout<<3<<endl;
  }
   if(d==0){
    cout<<4<<endl;
  }
   if(e==0){
    cout<<5<<endl;
  }
}

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

int main() {
    // 制約見て！！！デカかったらlong longにすること！
    int N;
    cin >> N;
    int a;
    rep(i, N) {
        scanf("%d",&a);
        if(a % 2 == 0) {
            if(a % 5 != 0 && a % 3 != 0) {
                cout << "DENIED" << endl;
                return 0;
            }
        }
    }
    cout << "APPROVED" << endl;
    return 0;
}

Measured memory_bytes: 3744
#include<stdio.h>
int main()
{
	int h, w,n;
	int i=1, j=1,x;
	int m[101][101],a;
	while (scanf("%d %d", &h, &w) != EOF)
	{
		scanf("%d", &n);
		for (x = 1; x <= n; x++)
		{
			scanf("%d", &a);
			while (a--)
			{
				m[i][j] = x;
				if (i % 2 == 1 && j < w)
				{
					j++;
				}
				else if (i % 2 ==1 && j == w)
				{
					i++;
				}
				else if (i % 2 == 0 &&j>1)
				{
					j--;
				}
				else
				{
					i++;
				}

			}
		}
		for (i = 1; i <= h; i++)
		{
			for (j = 1; j <= w; j++)
			{
				if (j != w )
				{
					printf("%d ", m[i][j]);
				}
				else
				{
					printf("%d\n", m[i][j]);
				}
			}
		}
	}
	return 0;
}

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

int main() {
  int H,h,M,m,K;
  cin >> H >> M >> h >> m >> K;
  cout << (h - H -1 )*60 + (60 - M) + m - K << endl;
}

Measured memory_bytes: 3636
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

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

    int N, D;
    cin >> N >> D;
    int dist = D * 2 + 1;
    if (N % dist == 0)
        cout << (N / dist) << endl;
    else
        cout << (N / dist + 1) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; scanf("%lld", &x);
#define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);
 
//int dxy[5] = {0, 1, 0, -1, 0};
// assign
 
signed main()
{
    int n, c, k;
    cin >> n >> c >> k;
    vi data(n);

    rep(i, n) {
        cin >> data[i];
    }

    sort(all(data));
    int ans = 0;

    int bus = 0, st = -1;

    rep(i, n) {
        if (st == -1) {
            bus++;
            st = data[i];
        } else if (st + k >= data[i] && bus < c) {
            bus++;
        } else {
            ans++;
            bus = 1;
            st = data[i];
        }
    }
    if (bus) {
        ans++;
    }
    cout << ans << endl;


    return 0;
}



Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

struct Combination {
    vector<ll> fac, finv, inv;

    Combination(ll maxN) {
        maxN += 100; // for safety
        fac.resize(maxN + 1);
        finv.resize(maxN + 1);
        inv.resize(maxN + 1);
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (ll i = 2; i <= maxN; ++i) {
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
    }
    ll operator()(ll n, ll k) {
        if (n < k)
            return 0;
        if (n < 0 || k < 0)
            return 0;
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }
};


int main() {
    ll x, y;
    cin >> x >> y;
    ll xy = x + y;
    if (xy % 3 != 0) {
        cout << 0 << "\n";
        return 0;
    }
    x -= xy/3;
    y -= xy/3;
    if (x < 0 || y < 0) {
        cout << 0 << "\n";
        return 0;
    }
    Combination nCk(1000000);
    cout << nCk(x+y, y) << "\n";
    return 0;
}

Measured memory_bytes: 23680
#include <iostream>
#include <iomanip>
/*cout <<setprecision(11)<<ret<<endl;で、数字部分を計11桁表示*/
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
//Shift+Command+bでデバッグ
//その後ターミナルで./a.outを実行
//入力を貼り付ける

//////////////////
//  A
/*int main(void){
    int a,b;
    cin >>a>>b;
    if(a<=5) cout<< 0<<endl;
    else if(a<=12) cout<<(b/2)<<endl;
    else cout<<b<<endl;
    return 0;
}*/
//////////////////
//  B
/*int main(void){
    int r,D,x;
    cin>>r>>D>>x;
    long long int x_tmp=r*x-D;
    for(int i=1;i<=10;i++){
        cout<<x_tmp<<endl;
        x_tmp=r*x_tmp-D;
    }
    return 0;
}*/
//////////////////
//  C  //解けなかったので解説みた
int main(void){
    int n,m;
    cin>>n>>m;
    int ret=0;
    int lmax=0,rmin=n;
    for(int i=0;i<m;i++){
        int l,r;
        cin >>l>>r;
        if(lmax<l)lmax=l;
        if(r<rmin)rmin=r;
    }

    if(rmin<lmax) ret=0;
    else ret=rmin-lmax+1;

    cout<<ret<<endl;
    return 0;
}
//////////////////
//  D
/*int main(void){

    return 0;
}*/
//////////////////
//  E
/*int main(void){

    return 0;
}*/
//////////////////
//  F
/*int main(void){

    return 0;
}*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ld = long double;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const long double PI = acos(-1.0L);
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
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; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b, c;
  cin >> a >> b >> c;
  if (a+b >= c)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

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

int min(int a, int b) { return a < b ? a : b; }

int main() {

    int n;
    cin >> n;
    int p[101] = {0};
    for (int i = 1; i <= n; ++i) {
        cin >> p[i - 1] >> p[i];
    }

    int m[101][101] = {0};
    for (int l = 2; l <= n; ++l) {
        for (int i = 1; i <= n - l + 1; ++i) {
            int j = i + l - 1;
            m[i][j] = (1 << 21);
            for (int k = i; k <= j - 1; ++k) {
                m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j]);
            }
        }
    }

    cout << m[1][n] << endl;
    return 0;
}

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

#define Fast            ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define LL              long long
#define ff              first
#define ss              second
#define pb              push_back
#define pii             pair<int,int>
#define all(a)          a.begin(),a.end()
#define FOR(i,a,b)      for(LL i=a;i<=b;i++)
#define ROF(i,a,b)      for(LL i=a;i>=b;i--)
#define REP(i,b)        for(LL i=0;i<b;i++)

const LL mod=1e9+7;
LL bigmod(LL b, LL p){
    LL ret=1;
    while(p){
        if(p & 1) ret=(ret*b)%mod;
        b=(b*b)%mod;
        p/=2;
    }
    return ret;
}

const LL N=200005;
LL fact[N];
void Fact(){
    fact[0]=1;
    FOR(i,1,N-1) fact[i]=(fact[i-1]*i)%mod;
}

LL nCr(LL n,LL r){
    LL up=fact[n];
    LL down=(fact[r]*fact[n-r])%mod;
    down=bigmod(down,mod-2);
    return (up*down)%mod;
}

int main()
{
    Fact();
    LL n,m;
    scanf("%lld %lld",&n,&m);
    LL ans=1;
    for(LL i=2;i*i<=m;i++){
        if(m%i==0){
            LL cnt=0;
            while(m%i==0){
                m/=i;
                cnt++;
            }
            ans=(ans*nCr(n+cnt-1,cnt))%mod;
        }
    }
    if(m>1) ans=(ans*nCr(n,1))%mod;
    printf("%lld",ans);
}

Measured memory_bytes: 1792
S = int(input())

X1 = 0
Y1 = 0
X2 = 1000000000
Y2 = 1
X3 = S % 1000000000
Y3 = S // 1000000000
if (X3 != 0):
    Y3 += 1
    X3 = X2 - X3
print(X1, Y1, X2, Y2, X3, Y3)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N; cin >> N;
  int ans=0;
  for(int i=1;i<=N;i++){
    if(i*i<=N){
      ans=i*i;
    }
    else break;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

    static int N;
    static int M;
    static long[] X;
    static long[] Y;

    static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        N = sc.nextInt();
        M = sc.nextInt();
        X = sc.nextLongArray(N);
        Y = sc.nextLongArray(M);

        System.out.println( solve() );
    }

    private static long solve() {
        long x_sum = 0;
        for (int i = 0; i < N-1; i++) {
            int times = pascally(N-1, i+1);
            long x = (X[i+1] - X[i]) * times % MOD;
            x_sum = (x_sum + x) % MOD;
        }
        long y_sum = 0;
        for (int i = 0; i < M-1; i++) {
            int times = pascally(M-1, i+1);
            long y = (Y[i+1] - Y[i]) * times % MOD;
            y_sum = (y_sum + y) % MOD;
        }

        return x_sum * y_sum % MOD;
    }

    static int pascally(int n, int a) {

        int x = n - a + 1;
        int y = n + 1 - x;

        return (int)((long)x * y % MOD);
    }

    static class FastScanner {

        private BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}



Measured memory_bytes: 43780
#include <iostream>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <float.h>
#include <limits>
#include <vector> 
#include <string.h>
#include <iomanip>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define INF 2147483647
#define ll long long
#define asort(a) sort(a.begin(),a.end());//昇順ソート
#define usort(a) sort(a.rbegin(),a.rend());//降順ソート

using namespace::std;

int jo(ll int a, ll int b){//累乗
    ll int num=1;
    rep(i,0,b) num=num*a;
    return num;
}
char tobig(char s){//char大文字化
  return (s-0x20);
}
char tolow(char s){//char小文字化
  return (s+0x20);
}
int ctoi(char a){//char->int
  if('0'<=a&&a<='9') return (a-'0');
  return -1;
}

int gcd(ll int a,ll int b) {//最大公約数
  if(a<b) return gcd(b,a);
  int c;
  while ((c=a%b)) {
    a=b;
    b=c;
  }
  return b;
}
int lcm(ll int a,ll int b){//最小公倍数
 return (a*b)/gcd(a,b);
}


int main(){
  string A,B; cin>>A;
  B="CODEFESTIVAL2016";
  int count=0;
  rep(i,0,A.length()){
    if(A[i]!=B[i]) count++;
  }
  cout<<count;
  
}




// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//cout<<fixed<<setprecision(n);  //小数点n桁まで表示

//  vector<pair<int,int>> data(N);  //2つのデータを格納、.first/.secondで参照
// pairのソートはfirst優先の昇順


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <stdio.h>
#include <cstring>
#include <string.h>
#include <string>
#include <sstream>
#include <iomanip>

using namespace std;

int main (void)
{
	long a,b,c;

	cin >> a >> b >> c;

	if (a >= c)
	{
		cout << "0" << endl;
	}
	else
	{
		if (a + b < c)
		{
			cout << "NA" << endl;
		}
		else
		{
			cout << c - a << endl;
		}
	}
}



Measured memory_bytes: 3096
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#include <bits/stdc++.h>
using namespace std;
const long long mod=1000000007;
map<long long,long long> f;
long long dp(long long l)
{
    if(!f[l])
		f[l]=((dp(l/2)+dp((l-1)/2)+dp((l-2)/2)))%mod;
    return f[l];
}
int main()
{
	ios::sync_with_stdio(false);
	long long n;
	cin>>n;
	f[0]=1;
	f[1]=2;
	cout<<dp(n)<<endl;
	return 0;
}

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

#define SIZE 100;

int main() {
    int N;
    cin >> N;
    int a;
    bool flg = true;
    for(int i = 0 ; i < N ; ++i) {
        cin >> a;
        if (a % 2 == 0) {
            if (a % 3 != 0 && a % 5 !=0) {
                flg = false;
                break;
            }
        }
    }
    if (flg) {
        cout << "APPROVED" << endl;
    } else {
        cout << "DENIED" << endl;
    }
    return 0;
}


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

int main() {
    for (int i = 1; i <= 9; ++i) {
        for (int j = 1; j <= 9; ++j) {
            cout << i << 'x' << j << '=' << i * j << endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 3064
from bisect import bisect_right

A,B,Q = map(int,input().split())
INF = 10**18
s = [-INF] + [int(input()) for _ in range(A)] + [INF]
t = [-INF] + [int(input()) for _ in range(B)] + [INF]

for _ in range(Q):
    x = int(input())
    b,d = bisect_right(s,x), bisect_right(t,x)

    res = INF
    for S in [s[b-1], s[b]]:
        for T in [t[d-1], t[d]]:
            d1,d2 = abs(S-x) + abs(T-S), abs(T-x) + abs(S-T)
            res = min(res, d1, d2)
    
    print(res)

Measured memory_bytes: 12804
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
using namespace std;

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

    if (d == 22) {
        cout << "Christmas Eve Eve Eve" << endl;
    }else if (d == 23) {
        cout << "Christmas Eve Eve" << endl;
    }else if (d == 24) {
        cout << "Christmas Eve" << endl;
    }else if (d == 25) {
        cout << "Christmas" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
using namespace std;
 
 
int main() {
    long n,k;
    cin >> n >>k;
    vector<long> pos,neg;
    for(long i=0;i<n;i++){
        long s;
        cin >> s;
        if(s>=0) pos.push_back(s);
        else neg.push_back(s);
    }
    
    sort(pos.begin(),pos.end());
    sort(neg.begin(),neg.end());
    
    //二分探索
    
    long l = -1e+18;
    long r = 1e+18;
    
    long p =pos.size();
    long ne=neg.size();
    
    while(l<r){
        long m=l+(r-l)/2;
        //m>0
        long f = 0;//m以下の組の個数数える
        if(m>=0){
            
            //しゃくとり法 pos
            long lp = 0;
            long rp = pos.size()-1;;
            while(lp<rp){
                if(pos[lp]*pos[rp]<=m){
                    f += rp-lp;
                    lp++;
                }
                else rp--;
            }
            
            //しゃくとり法 ng
            lp = 0;
            rp = neg.size()-1;
            while(lp<rp){
                if(neg[lp]*neg[rp]<=m){
                    f += rp-lp;
                    rp--;
                }
                else lp++;
            }
            
            f +=p*ne;
        }
        
        else{
            long posrp=pos.size()-1;
            long neglp=neg.size()-1;
            
            while(posrp>=0 && neglp >=0){
                if(pos[posrp]*neg[neglp]<=m){
                    f +=neglp+1;
                    posrp--;
                }
                else neglp--;
            }
        }
        
        if(f>=k) r=m;
        else l=m+1;
    }
    
    cout << (l+r)/2 << endl;
}
 


Measured memory_bytes: 2548
#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;

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

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


  cin >> n;
  vector<int> a(n);
  REP(i, n) cin >> a[i];

  vector<int> l(n + 1, 0), r(n + 1, 0);
  REP(i, n) {
    l[i + 1] = gcd(l[i], a[i]);
  }

  RREP(i, n) {
    r[i] = gcd(r[i + 1], a[i]);
  }

  int ans = 0;
  REP(i, n) {
    int le = l[i];
    int ri = r[i + 1];

    ans = max(ans, gcd(le, ri));
  }


  cout << ans << endl;
}


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

#define ll long long

int main()
{
    ll n,w;
    cin>>n>>w;
    ll wt[n+5],vl[n+5],sum=0;
    for(int i=1; i<=n; i++)
    {
        cin>>wt[i]>>vl[i];
        sum+=vl[i];
    }
    ll dp[n+5][sum+5];
    for(int i=0; i<=n; i++)
    {
        for(int j=0; j<=sum; j++)
            dp[i][j]=INT_MAX;
    }
    for(int i=0; i<=n; i++)
        dp[i][0]=0;
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=sum; j++)
        {
            if(vl[i]<=j)
                dp[i][j]=min(dp[i-1][j],wt[i]+dp[i-1][j-vl[i]]);
            else
                dp[i][j]=dp[i-1][j];
        }
    }
    ll ans=0;
    for(int i=1; i<=sum; i++)
    {
        if(dp[n][i]<=w)
            ans=i;
    }
    cout<<ans<<endl;
}


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

int main(){
    int n, k;
    cin >> n >> k;
    vector <int> h(n);
    for (int tsumugi = 0; tsumugi < n; tsumugi++){
        cin >> h[tsumugi];
    }

    int ans = 0;
    for (int karen = 0; karen < n; karen++){
        if (h[karen] >= k){
            ans++;
        }
    }

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

Measured memory_bytes: 640
def main():
    n, a, b = map(int, input().split())
    p = 10 ** 9 + 7
    r = pow(2, n, p) - 1
    if (n - a) < a:
        a = n - a
    if (n - b) < b:
        b = n - b
    fac_na = 1
    for i1 in range(n, n - a, -1):
        fac_na = (fac_na * i1) % p
    fac_nb = 1
    for i1 in range(n, n - b, -1):
        fac_nb = (fac_nb * i1) % p
    fac_a = 1
    for i1 in range(1, a+1):
        fac_a = (fac_a * i1) % p
    fac_b = 1
    for i1 in range(1, b+1):
        fac_b = (fac_b * i1) % p

    an = fac_na * pow(fac_a, p-2, p)
    bn = fac_nb * pow(fac_b, p-2, p)
    an = an % p
    bn = bn % p
    r -= an
    if r < 0:
        r += p
    r -= bn
    if r < 0:
        r += p
    if r < 0:
        r += p
    print(int(r))


if __name__ == '__main__':
    main()

Measured memory_bytes: 9132
#include<stdio.h>

int main(){
  long n,d,ans=0;
  scanf("%ld %ld",&n,&d);
  long x[n+1],y[n+1];
  for(int i=1;i<=n;i++){
    scanf("%ld %ld",&x[i],&y[i]);
    if(x[i]*x[i]+y[i]*y[i]-d*d<=0)ans+=1;
  }
  printf("%ld",ans);
  return 0;
}

Measured memory_bytes: 5236
#include<stdio.h>
#include<bits/locale_facets.h>
#include<algorithm>
using namespace std;
const int s=101;
int l[s],r[s],ls,rs;
long long input();
void output(long long value);
int main()
{
	int dep=100;
	ls=rs=0;
	for(long long n=input()+1;n!=1;)
	{
		if(n&1)n--,l[++ls]=dep--;
		n>>=1,r[++rs]=dep--;
	}
	output((ls+rs)<<1),putchar('\n');
	for(int i=1;i<=ls;i++)
	output(l[i]-dep),putchar(' ');
	for(int i=rs;i;i--)
	output(r[i]-dep),putchar(' ');
	dep=100-dep;
	for(int i=1;i<dep;i++)
	output(i),putchar(' ');
	output(dep),putchar('\n');
	return 0;
}
long long input()
{
	long long value=0,positive=1;
	char digit=getchar();
	for(;!isdigit(digit);digit=getchar())
	if(digit=='-')positive=-positive;
	for(;isdigit(digit);digit=getchar())value=(value<<3)+(value<<1)+digit-'0';
	return positive*value;
}
void output(long long value)
{
	if(value<0)
	{
		putchar('-');
		value=-value;
	}
	if(value>=10)output(value/10);
	putchar(value%10+'0');
}

Measured memory_bytes: 128
#include<stdio.h>
int main(){
	int N,M,i,i2,A[200],k=0,toread;
	scanf("%d%d",&N,&M);
	for(i=0;i<N;i++){
		scanf("%d",&A[i]);
	}
	for(i=1;i<=M;i++){
		for(i2=0;i2<N-1;i2++){
			if(A[i2]%i>A[i2+1]%i){
				toread=A[i2];
				A[i2]=A[i2+1];
				A[i2+1]=toread;
			}
		}
	}
	for(i=0;i<N;i++){
		printf("%d\n",A[i]);
	}
	return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
#define ll long long
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
ll a,b,q;ll s[114514],t[114514],x[114514];
signed main(){
	cin>>a>>b>>q;
	rep(i,a)cin>>s[i];
	rep(i,b)cin>>t[i];
	rep(i,q)cin>>x[i];
	rep(i,q){
		ll memoa=min(max((ll)(lower_bound(s,s+a,x[i])-s)+1,(ll)2),a);
		ll memob=min(max((ll)(lower_bound(t,t+b,x[i])-t)+1,(ll)2),b);
		ll memoc=max((ll)1,memoa-1);
		ll memod=max((ll)1,memob-1);
		cout<<min({min(abs(x[i]-t[memod-1]),abs(x[i]-s[memoc-1]))+abs(t[memod-1]-s[memoc-1]),abs(t[memob-1]-s[memoa-1])+min(abs(s[memoa-1]-x[i]),abs(t[memob-1]-x[i])),abs(s[memoa-1]-t[memod-1])+min(abs(x[i]-t[memod-1]),abs(s[memoa-1]-x[i])),abs(s[memoc-1]-t[memob-1])+min(abs(x[i]-s[memoc-1]),abs(x[i]-t[memob-1]))})<<endl;
	}
	return 0;
}



Measured memory_bytes: 3712
#include<bits/stdc++.h>
#define MAXN 5005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n,a,b;
int dp[MAXN][MAXN][2];
int s[MAXN][MAXN],diag[MAXN][MAXN];
void add(int &a,int b) {a+=b; if(a>=MOD) a-=MOD;}
void dec(int &a,int b) {a-=b; if(a<0) a+=MOD;}
int get_sum(int l1,int r1,int l2,int r2)
{
    int x=s[r1][r2];
    dec(x,s[l1-1][r2]);
    dec(x,s[r1][l2-1]);
    add(x,s[l1-1][l2-1]);
    return x;
}
int get_diag(int x,int y)
{
    return diag[x][y];
}
int main()
{
    scanf("%d%d%d",&n,&a,&b);
    if(a>b) swap(a,b);
    dp[0][0][1]=1; 
    diag[0][0]=1;
    for(int j=0;j<=n;j++) s[0][j]=1;
    for(int i=1;i<=n;i++)
    {
        dp[i][0][0]=get_sum(max(0,i-a+1),i-1,0,b-1);
        for(int j=1;j<=n;j++)
        {
            dp[i][j][1]=dp[i-1][j-1][1];
            add(dp[i][j][1],dp[i-1][j-1][0]);
            if(i>=a&&j>=a) add(dp[i][j][0],get_diag(i-a,j-a));
            if(j>=b) add(dp[i][j][0],get_sum(max(0,i-a+1),i-1,j,j));
        }
        for(int j=0;j<=n;j++)
        {
            s[i][j]=s[i-1][j];
            add(s[i][j],dp[i][j][1]);
            if(j) 
            {
                add(s[i][j],s[i][j-1]);
                dec(s[i][j],s[i-1][j-1]);
            }
            diag[i][j]=dp[i][j][1];
            if(j) add(diag[i][j],diag[i-1][j-1]);
        }
    }
    int ans=0;
    for(int i=b;i<=n;i++) 
    {
        add(ans,dp[n][i][0]);
        add(ans,dp[n][i][1]);
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 394888
#include <cstdio>
#include <cstring>

#define maxn 100010
char S[maxn], T[maxn];
int s[maxn], t[maxn];
int main()
{
	scanf("%s%s", S + 1, T + 1);
	int q; scanf("%d", &q);
	int n = strlen(S + 1), m = strlen(T + 1);
	for (int i = 1; i <= n; ++i) s[i] = s[i - 1] + (S[i] == 'A' ? 1 : -1);
	for (int i = 1; i <= m; ++i) t[i] = t[i - 1] + (T[i] == 'A' ? 1 : -1);
	for (; q; --q)
	{
		int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d);
		puts(((s[b] - s[a - 1]) % 3 + 3) % 3 == ((t[d] - t[c - 1]) % 3 + 3) % 3 ? "YES" : "NO");
	}
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <unordered_map>
#include <iostream>
#include <stdio.h>
using namespace std;


int main(void)
{
    int w, h, x, y;

    cin >> w >> h >> x >> y;

    if (w == x * 2 && h == y * 2)
    {
        cout << (double)(w)*double(h) / 2.0 << " " << 1 << endl;
    }
    else
    {
        cout <<  (double)(w)*double(h)/ 2.0 << " " << 0 << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

int main(){
    int a,b;cin>>a>>b;
    if(a*b%2==0)cout<<"Even"<<endl;
    else cout<<"Odd"<<endl;
}


Measured memory_bytes: 3580
#require 'prime'
MOD=10**9+7;  cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.chomp.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def ar2(s1,s2,de=nil) Array.new(s1){Array.new(s2,de)} end
def ar3(s1,s2,s3,de=nil) Array.new(s1){Array.new(s2){Array.new(s3,de)}} end

def desc(ar) ar.sort!{|x,y| y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end
def ceil(a,b) (a.to_f/b).ceil end

def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end
def rui(ar) s=[0]; ar.size.times{|i| s<<s[-1]+ar[i]}; s end
def rev_rui(ar) s=[0]; ar.size.times.reverse_each{|i| s<<s[-1]+ar[i]}; s end

def puts_yesno(b) puts(b ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def pu(h) begin; require './../nemi_lib/debug.rb'; puts_val(h); rescue LoadError; end; end
########### ( ˘ω˘ )ｽﾔｧ… ###########
k=gi
a=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
puts a[k-1]

Measured memory_bytes: 1788
#include<iostream>
#include<string>

using namespace std;

int main () {

    while (1) {
        string card;

        cin >> card;

        if (card[0] == '-') {
            break;
        }

        int m;
        cin >> m;
        for (int i = 0; i < m; i++) {
            
            int h;
            cin >> h;

            string tmp;
            tmp = card.substr(0, h);

            // cout << tmp << endl;

            // int gomi;
            // cin >> gomi;

            int cnt = 0;
            for (int j = h; card[j] != 0; j++) {
                card[j - h] = card[j];
                cnt++;
            }
            for (int j = cnt; card[j] != 0; j++) {
                card[j] = tmp[j - cnt];
            }

        }

        cout << card << endl;
    }
    return 0;
}


Measured memory_bytes: 3180
#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-10;
const double pi = acos(-1);//3.1415926535897932384626433832795028...
const ll SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
ll fac[200005], finv[200005], inv[200005];
vector<ll>dij;
struct edge { ll to, cost; };
vector<vector<edge> >G;

ll mod_pow(ll a, ll b) {
	ll res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}
	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T & t, const V & v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T & t, const V & v) {
	for (auto& e : t) fill_v(e, v);
}

template<typename T>
void outp(vector<T>v) {
	for (int i = 0; i < v.size(); ++i) {
		cout << v[i];
		if (i != v.size() - 1) { cout << " "; }
	}
}

double add(double a, double b) {
	if (abs(a + b) < EPS * (abs(a) + abs(b))) { return 0; }
	return a + b;
}

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

vector<ll> divisor(ll n) {
	vector<ll> res;
	for (ll i = 1; i * i <= n; ++i) {
		if (n % i == 0) {
			res.push_back(i);
			if (i * i != n) {
				res.push_back(n / i);
			}
		}
	}
	sort(all(res));
	return res;
}

bool is_prime(ll x) {
	for (ll i = 2; i * i <= x; ++i) {
		if (x % i == 0) {
			return false;
		}
	}
	return true;
}


ll a, b, ans;
int main() {
	cin >> a >> b;
	ll mon = gcd(a, b);
	auto v = divisor(mon);

	for (auto i : v) {
		if (is_prime(i)) {
			++ans;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 384
#include<cstdio>
#include<string.h>
#include<algorithm>

int k[1001];
int t[1001];
long long dp[1001][1001];

int main() {

	int n, m;

	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; i++) scanf("%d", &k[i]);
	for (int i = 0; i < m; i++) scanf("%d", &t[i]);

	memset(dp, 0x7f, sizeof(dp));
	dp[0][0] = 0;
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j < m; j++) {
			dp[i+1][j + 1] = std::min(dp[i][j] + k[i] * t[j],dp[i+1][j+1]);
			dp[i][j + 1] = std::min(dp[i][j],dp[i][j+1]);
			
		}
	}
	
	printf("%lld\n", dp[n][m]);
	return 0;
}



Measured memory_bytes: 10556
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		for (; solver.hasNext();) {
			solver.readBody(in.readLine());
		}
		solver.solve();
	}
}

class Solver {
	int N;
	int cnt;

	public void init() {
		N = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		String[] strArr = str.split(" ");
		N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		h = new int[N];
	}

	public boolean hasNext() {
		// return cnt < N;
		return cnt < 1;
	}

	public void readBody(String str) {
		// System.out.println(str);
		cnt++;
		String[] strArr = str.split(" ");
		for (int i = 0; i < N; i++)
			h[i] = Integer.parseInt(strArr[i]);

	}

	int[] h;

	public void solve() {
		int ans = 0;
		for (;;) {
			// for (int i = 0; i < N; i++)
			// System.out.print(" " + h[i]);
			// System.out.println();

			int l = 0;
			for (; l < N && h[l] <= 0; l++) {
			}
			if (l >= N)
				break;

			ans++;
			for (int r = l; r < N; r++) {
				if (h[r] > 0)
					h[r]--;
				else
					break;
			}

		}

		System.out.println(ans);
	}
}


Measured memory_bytes: 23380
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
int const M=2e3+10,inf=1e9+10,mod=1e9+7;
int cnt;
vector<int>adj[M];
int a[M],b[M],c[M],d[M];
int match[M],match2[M];
bool mark[M];
bool dfs(int v)
{
	mark[v]=1;
	for(int i=0;i<adj[v].size();i++)
	{
		int u=adj[v][i];
		if(!match[u] || (!mark[match[u]] && dfs(match[u])))
		{
			match[u]=v;
			match2[v]=u;
			return 1;
		}
	}
	return 0;
}
main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i]>>b[i];
	}
	for(int i=1;i<=n;i++)
	{
		cin>>c[i]>>d[i];
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			if(a[i]<c[j] && b[i]<d[j])adj[i].pb(j);
		}
	}
	while(true)
	{
		for(int i=1;i<=n;i++)mark[i]=0;
		bool fin=0;
		for(int i=1;i<=n;i++)
		{
			if(!match2[i] && !mark[i])
			{
				if(dfs(i))fin=1;
			}
		}
		if(!fin)break;
	}
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		if(match2[i])ans++;
	}
	cout<<ans;
}

Measured memory_bytes: 384
import sys
import itertools
input = sys.stdin.readline

def main():
    N = int(input())
    P = tuple(map(int, input().split()))
    Q = tuple(map(int, input().split()))

    permutations = list(itertools.permutations(range(1, N+1)))
    
    print(abs(permutations.index(P) - permutations.index(Q)))


if __name__ == "__main__":
    main()

Measured memory_bytes: 8052
n=int(input())
A=list(map(int,input().split()))
C=[]
for i in range(n):
    C.append([i+A[i],0])
    C.append([i-A[i],1])
C.sort()
now=C[0][0]
c0=0
c1=0
ans=0
for c in C:
    if now==c[0]:
        if c[1]==0:
            c0+=1
        else:
            c1+=1
    else:
        ans+=c0*c1
        c0=0
        c1=0
        if c[1]==0:
            c0+=1
        else:
            c1+=1
        now=c[0]
ans+=c0*c1
print(ans)

Measured memory_bytes: 68044
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int MAX_N = 100010;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}
using Graph = vector<vector<int>>;
Graph G;
/*------------------------------------------------------------------*/
int main(){
    ll n; cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    ll q; cin >> q;
    vector<ll> b(q), c(q);
    rep(i, q) cin >> b[i] >> c[i];

    vector<ll> cou(100001, 0);
    rep(i, n) cou[a[i]]++;

    ll sum = 0;
    rep(i, n) sum += a[i];
    ll allsum = sum;
    rep(i, q){
        //cout << cou[b[i]] << " " << cou[c[i]] << endl;
        sum -= b[i] * cou[b[i]];
        sum += c[i] * cou[b[i]]; 
        cout << sum << endl;
        cou[c[i]] += cou[b[i]];
        cou[b[i]] = 0;
        //cout << " " << cou[b[i]] << " " << cou[c[i]] << endl;
    }
}

Measured memory_bytes: 6424
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define INF 1e9
#define all(v) v.begin(), v.end()
typedef long long ll;

int main(){
  vector<int> a(5);
  rep(i, 5) cin >> a[i];
  int k;
  cin >> k;

  rep(i, 4){
    REP(j, i+1, 5){
      if(a[j]-a[i] > k){
        cout << ":(" << endl;
        return 0;
      }
    }
  }

  cout << "Yay!" << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.math.BigDecimal;
import java.math.RoundingMode;

class Main{
    public static void main(String args[])throws IOException{
        try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))){
            double input = Double.parseDouble(br.readLine());

            BigDecimal num = new BigDecimal(input);
            BigDecimal three = new BigDecimal(3);
            BigDecimal x = num.divide(three, 6, RoundingMode.HALF_UP);
            BigDecimal answer = x.multiply(x).multiply(x);

            double result = answer.doubleValue();

            System.out.println(result);
        }
   
    }
}

Measured memory_bytes: 21460
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <valarray>
#include <vector>

#define EPS 1e-9
#define INF 1070000000LL
#define MOD 1000000007LL
#define fir first
#define foreach(it,X) for(__typeof((X).begin()) it=(X).begin();it!=(X).end();it++)
#define ite iterator
#define mp make_pair
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define pb push_back
#define sec second
#define sz(x) ((int)(x).size())

using namespace std;

struct timer{
	time_t start;
	timer(){start=clock();}
	~timer(){cerr<<1.*(clock()-start)/CLOCKS_PER_SEC<<" secs"<<endl;}
};

typedef istringstream iss;
typedef long long ll;
typedef pair<int,int> pi;
typedef stringstream sst;
typedef vector<int> vi;



int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	
	int Q;
	cin>>Q;
	while(Q--){
		int N;
		cin>>N;
		rep(i,INF){
			sst st;
			st<<N;
			string s=st.str();
			if(sz(s)==1){
				cout<<i<<endl;
				break;
			}
			int next=0;
			rep(i,sz(s)-1){
				string t=s.substr(0,i+1);
				string u=s.substr(i+1);
				iss is1(t),is2(u);
				int T,U;
				is1>>T;
				is2>>U;
				next=max(next,T*U);
			}
			N=next;
		}
	}
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
using namespace std;
using llong = long long;

void fnInput(int& rnNumA, int& rnNumB)
{
  cin >> rnNumA >> rnNumB;
}

llong fnLCMGet(int nNumA, int nNumB)
{
  int nDividend = max(nNumA, nNumB);
  int nDivisor  = min(nNumA, nNumB);

  while (nDividend % nDivisor != 0)
  {
    int nRemain = nDividend % nDivisor;
    nDividend = nDivisor;
    nDivisor  = nRemain;
  }

  int nGCD = nDivisor;
  int nQuotA = nNumA / nGCD;
  int nQuotB = nNumB / nGCD;
  return ((llong)nGCD * nQuotA * nQuotB);
}

int main()
{
  int nNumA, nNumB;

  fnInput(nNumA, nNumB);
  cout << fnLCMGet(nNumA, nNumB) << endl;

  return 0;
}

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

int main(){
    int S , h , m , s ;
    cin >> S;
    h = S / 3600;
    S = S - h * 3600;
    m = S / 60;
    S = S - m * 60;
    s = S;
    cout << h << ":" << m << ":" << s << endl;


    return 0;
}



Measured memory_bytes: 3092