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

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;++i)
#define REP(i,s,n) for(int i=(s);i<(n);++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define REPR(i,s,n) for(int i=(s);i>=(n);--(i))
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define DOUBLE fixed << setprecision(10)
#define fi first
#define se second
const double pi = acos(-1.0);
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef deque<ll> dll;
typedef pair<ll, ll> P;
typedef vector<P> vP;
const ll mod = 1e9 + 7;
ll dx[4] = { 1,0,-1,0 };
ll dy[4] = { 0,1,0,-1 };
template <typename T>
bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
};
template <typename T>
bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
};
void Pvll(vll v) {
	cout << "------------------------------------------------\n";
	rep(i, v.size()) cout << v[i] << " ";
	cout << endl;
	cout << "------------------------------------------------\n";
}
void Pvvll(vvll v) {
	cout << "------------------------------------------------\n";
	rep(i, v.size()) {
		rep(j, v[i].size()) {
			cout << v[i][j] << " ";
		}
		cout << endl;
	}
	cout << "------------------------------------------------\n";
}

void Ps(string s) {
	cout << "------------------------------------------------\n";
	rep(i, s.size()) cout << s[i] << " ";
	cout << endl;
	cout << "------------------------------------------------\n";
}

void Pvs(vs s) {
	cout << "------------------------------------------------\n";
	rep(i, s.size()) {
		rep(j, s[i].size()) {
			cout << s[i][j] << " ";
		}
		cout << endl;
	}
	cout << "------------------------------------------------\n";
}

void Yes(bool x) {
	if (x) cout << "Yes\n";
	else cout << "No\n";
}

void YES(bool x) {
	if (x) cout << "YES\n";
	else cout << "NO\n";
}

void yes(bool x) {
	if (x) cout << "yes\n";
	else cout << "no\n";
}

void Yay(bool x) {
	if (x) cout << "Yay!\n";
	else cout << ":(\n";
}


ll  n, m, r, l, k, h, ans = 0, ret = M;
bool flag = false, flag2 = false, flag3 = false;
string s,t;

void INIT() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << DOUBLE;
}

vector<bool> IsPrime;

void sieve(ll max) {
	if (max + 1 > IsPrime.size()) {     // resizeで要素数が減らないように
		IsPrime.resize(max + 1, true); // IsPrimeに必要な要素数を確保
	}
	IsPrime[0] = false; // 0は素数ではない
	IsPrime[1] = false; // 1は素数ではない

	for (ll i = 2; i*i <= max; ++i) // 0からsqrt(max)まで調べる
		if (IsPrime[i]) // iが素数ならば
			for (ll j = 2; i*j <= max; ++j) // (max以下の)iの倍数は
				IsPrime[i*j] = false;      // 素数ではない
}


int main() {
	INIT();
	cin >> n;
	rep(i, n) {
		s = to_string(i + 1);
		if (s.size() % 2 == 1) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;string x="No";cin>>N;
  for(int i=1;i<10;i++){
    for(int j=i;j<10;j++){
      if(i*j==N)x="Yes";
    }
  }
  cout<<x<<endl;
}

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

int main(){
  int result[26]={};
  string str;
  while(!getline(cin,str).eof()){
    for(int i=0; i<(int)str.length(); i++){
      if(65<=str[i]&&str[i]<=90){
	str[i] += 32;
      }
      if(97<=str[i]&&str[i]<=122){
	result[str[i]-'a'] ++;
      }
    }
  }

  for(int i=0; i<26; i++){
    printf("%c : %d\n",i+'a',result[i]);
  }

  return 0;
}



Measured memory_bytes: 3252
from sys import stdin


def main():
    n = int(input())

    p = [int(x) for x in stdin.readline().split()]
    count = 0

    for i in range(1 , n-1):
        if p[i-1] > p[i] >p[i+1] or p[i-1] < p[i] < p[i+1]:
            count +=1
    
    print(count)


if __name__ == "__main__":
    main()

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

vector<P>E[100000];
int d[100000],b[100000],cnt[200001],u[200000],v[200000],r[200000];
int main(){
	int n,m,q;scanf("%d%d%d",&n,&m,&q);
	rep(i,m){
		scanf("%d%d",&u[i],&v[i]);u[i]--;v[i]--;r[i]=q;
	}
	rep(i,q){
		int a;scanf("%d",&a);r[a-1]=i;
	}
	rep(i,m){
		E[u[i]].emplace_back(P(v[i],r[i]));E[v[i]].emplace_back(P(u[i],r[i]));
	}
	d[0]=1;b[0]=q;
	queue<int>que;que.emplace(0);
	while(!que.empty()){
		int p=que.front();que.pop();
		for(auto&v:E[p]){
			if(d[v.first]==0){
				d[v.first]=d[p]+1;que.emplace(v.first);
			}
			if(d[v.first]==d[p]+1)
				b[v.first]=max(b[v.first],min(b[p],v.second));
		}
	}
	rep(i,n)cnt[b[i]]++;
	int ans=0;
	rep(i,q){
		ans+=cnt[i];
		printf("%d\n",ans);
	}
}

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

//#include<vector>
//#include<iterator>
//#include<utility>
//#include<algorithm>
//#include<cmath>
using namespace std;


#define ll long long
#define fr(m) for(int i=0; i<m; i++)
#define frj(m) for(int j=0; j<m; j++)
#define frr(n) for(int i=n; i>=0; i--)
#define pb push_back
#define orr ||
#define nl \n
#define sci(n) scanf("%lld ", &n)
#define pri(n) printf("%d", n)
#define prl(n) printf("%lld", n)
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl


int main()
{

    string a;
    cin>>a;
    ll flag=1, arr[26]={0};
    for(char b:a){
        arr[b-97]++;
    }
    fr(26){
        if(arr[i]%2==1) {flag=0; break;}
    }
    if(flag) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
char St[305];
int n,m,i,j,S[605][605],A[605][605],k,rez,sum;

int nr(int i1, int j1, int i2, int j2)
{
    i1--;
    j1--;
    i1=max(i1,0);
    i2=max(i2,0);
    j2=max(j2,0);
    j1=max(j1,0);
    i1=min(i1,n);
    i2=min(i2,n);
    j2=min(j2,n);
    j1=min(j1,n);
    if(i1>i2 || j1>j2)
        return 0;
    return (S[i2][j2]-S[i1][j2]-S[i2][j1]+S[i1][j1]);
}

int main()
{
    ios::sync_with_stdio(false);
    cin>>n>>m;
    for(i=1; i<=n; i++)
    {
        cin>>St;
        for(j=1; j<=m; j++)
            A[i-j+m][i+j]=(St[j-1]=='#');
    }
    n+=m;
    for(i=0; i<=n; i++)
        for(j=0; j<=n; j++)
        {
            sum=A[i][j];
            if(i>=1)
                sum+=S[i-1][j];
            if(j>=1)
                sum+=S[i][j-1];
            if(i>=1 && j>=1)
                sum-=S[i-1][j-1];
            S[i][j]=sum;
        }
    for(i=0; i<=n; i++)
        for(j=2; j<=n; j++)
            if(A[i][j])
            {
                for(k=j+2; k<=n; k+=2)
                    if(A[i][k])
                    {
                        rez=rez+nr(i+(k-j),j,i+(k-j),k);
                        rez=rez+nr(i-(k-j),j,i-(k-j),k);
                    }
                for(k=i+2; k<=n; k+=2)
                    if(A[k][j])
                    {
                        rez=rez+nr(i+1,j+(k-i),k-1,j+(k-i));
                        rez=rez+nr(i+1,j-(k-i),k-1,j-(k-i));
                    }
            }
    cout<<rez<<"\n";
    return 0;
}


Measured memory_bytes: 3072
#include<bits/stdc++.h>
using namespace std;
#define f first
#define s second
int a[7],n,m,x;
pair<pair<int,int>,int>t[11];
void dfs(int d){
  
  if(d==n){int c=0;
    for(int i=0;i<m;i++){int s=0;
      for(int j=t[i].f.f;j<=t[i].f.s;j++){
	s+=a[j];
      }
      if(s!=t[i].s)c++;
    }
    if(!c){
      for(int k=0;k<n;k++){
	if(k)cout<<' ';
	cout<<a[k];
      }cout<<endl;
      exit(0);
    }
  }
  
  else{
    for(int i=x;i>=0;i--){
      a[d]=i;
      dfs(d+1);
    }
  }
  if(d==0)cout<<-1<<endl;
  return;
}
int main(){
  cin>>n>>x>>m;
  for(int i=0;i<m;i++){
    int w,q,e;
    cin>>w>>q>>e;w--;q--;
    t[i].f.f=w;
    t[i].f.s=q;
    t[i].s=e;
  }
  dfs(0);
}

Measured memory_bytes: 3112
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 100005;

vector<int> G[MAX_N];
int mn[MAX_N],mx[MAX_N];

bool dfs(int u,int p,int d,const int sval)
{
    int a = mn[u],b = mx[u];
    if(a == b && (sval+d)%2 != a%2){
        return false;
    }
    rep(i,len(G[u])){
        if(G[u][i] != p){
            if(!dfs(G[u][i],u,d+1,sval)){
                return false;
            }
            cmx(a,mn[G[u][i]]-1);
            cmn(b,mx[G[u][i]]+1);
        }
    }
    if(a > b){
        return false;
    }else{
        if(a == b && (sval+d)%2 != a%2){
            return false;
        }
        mn[u] = a,mx[u] = b;
        return true;
    }
}

void redfs(const int st,int u,int p,int pre,vi& ans)
{
    if(u == st){
        ans[u] = mn[u];
    }else{
        if(mn[u] <= pre - 1){
            ans[u] = pre-1;
        }else{
            ans[u] = pre+1;
        }
    }
    rep(i,len(G[u])){
        if(G[u][i] != p){
            redfs(st,G[u][i],u,ans[u],ans);
        }
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    rep(i,n-1){
        int a,b;
        cin >> a >> b;
        --a,--b;
        G[a].pb(b),G[b].pb(a);
    }
    rep(i,n){
        mn[i] = -INF,mx[i] = INF;
    }
    int K;
    cin >> K;
    int st;
    rep(i,K){
        int a,b;
        cin >> a >> b;
        --a;
        if(i == 0){
            st = a;
        }
        mn[a] = mx[a] = b;
    }
    if(dfs(st,-1,0,mn[st])){
        cout << "Yes\n";
        vector<int> ans(n);
        redfs(st,st,-1,-1,ans);
        rep(i,len(ans)){
            cout << ans[i] << "\n";
        }
    }else{
        cout << "No\n";
    }
    return 0;   
}

Measured memory_bytes: 17024
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

class UnionFind {
private:
	unsigned size_; 
	std::vector<unsigned> par, rank;
public:
	UnionFind() : size_(0), par(std::vector<unsigned>()), rank(std::vector<unsigned>()) {};
	UnionFind(unsigned size__) : size_(size__) {
		par.resize(size_); rank.resize(size_);
		for (unsigned i = 0; i < size_; i++) par[i] = i, rank[i] = 0;
	}
	unsigned size() { return size_; }
	//unsigned root(unsigned x) { return par[x] == x ? x : par[x] = root(par[x]); }
	unsigned root(unsigned x)
	{
		while(par[x] != x)
		{
			par[x] = par[par[x]];
			x = par[x];
		}
		return x;
	}
	bool same(unsigned x, unsigned y) { return root(x) == root(y); }
	void unite(unsigned x, unsigned y) {
		x = root(x), y = root(y);
		if (x == y) return;
		if (rank[x] < rank[y]) par[x] = y;
		else if (rank[x] == rank[y]) par[y] = x, rank[x]++;
		else par[y] = x;
	}
	bool operator==(const UnionFind &u) { return par == u.par; }
	bool operator!=(const UnionFind &u) { return par != u.par; }
};

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	ll N; 
	cin >> N;

	ll total = 0;
	ll A[N+1], B[N];
	rep(i , N + 1)
	{
		cin >> A[i];
	}
	
	rep(i , N)
	{
		cin >> B[i];
	}

	rep(i, N)
	{
		ll tmp = A[i] - B[i];
		if (tmp < 0)
		{
			//cout << 1 << ":" << total<< endl;
			total+= A[i];
			B[i] -= A[i];
			A[i] = 0;
		}
		else
		{
			//cout << 2<< ":" << total<< endl;
			total+=B[i];
			A[i] = tmp;
			B[i] = 0;
		}
		
		if (B[i] > 0)
		{
			//cout << 3<< ":" << total << endl;
			tmp = B[i] - A[i+1];
			if (tmp >= 0)
			{
				//cout << 4<< ":" << total << endl;
				total+= A[i+1];
				B[i]-= A[i+1];
				A[i+1] = 0;
			}
			else
			{

				//cout << 5<< ":" << total << endl;
				total += B[i];
				A[i+1] = A[i+1] - B[i];
				B[i] = 0;  
			}
		}
	}
	if (B[N-1] >=0 )
	{

		//cout << 6 << ":" << total<< endl;
		total+=min(B[N-1], A[N]);
	}
	cout << total << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string s;
    int cnt=0;
    cin>>s;
    if (s[0]=='1'){
        cnt+=1;
    }
    if (s[1]=='1'){
        cnt+=1;
    }
    if (s[2]=='1'){
        cnt+=1;
    }

    cout<<cnt<<endl;
}

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

int main(){
    int W, a, b;

    cin >> W >> a >> b;

    if( b > a+W ){
        cout << b-(a+W) << endl;        
    }else if( b>=a && b <= a+W ){
        cout << 0 << endl;
    }else if( b<a && b+W >=a ){
        cout << 0 << endl;
    }else if( b+W < a ){
        cout << a-(b+W) << endl;
    }

    return 0;
}

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

int main(){
  int n;
  cin>>n;
  vector<int> a(n),b(n),c(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=0;i<n;i++){
    cin>>b[i];
  }
  for(int i=0;i<n;i++){
    c[i]=a[i]-b[i];
  }
  int  ans=0;
  for(int i=0;i<n;i++){
    if(c[i]>0){
      ans+=c[i];
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace cswork
{
    class Program
    {
        class Scanner
        {
            string[] s;
            int i;

            char[] cs = new char[] { ' ' };

            public Scanner()
            {
                s = new string[0];
                i = 0;
            }

            public string next()
            {
                if (i < s.Length) return s[i++];
                string st = Console.ReadLine();
                while (st == "") st = Console.ReadLine();

                s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
                i = 0;
                return next();
            }

            public int nextInt()
            {
                return int.Parse(next());
            }

            public long nextLong()
            {
                return long.Parse(next());
            }

            public double nextDouble()
            {
                return double.Parse(next());
            }
        }

        public Program() { }

        static void Main(string[] args)
        {
            new Program().Omame();
        }

        Scanner cin;
        const int MAXIN = 1024;
        bool[] used = new bool[MAXIN];
        int[] perm = new int[MAXIN];

        List<int[]> permList = new List<int[]>();

        public void Permutation(int pos, int n, int length)
        {
            if (pos == n)
            {
                permList.Add((int[])perm.Clone());
            }

            for (int i = 0; i < n; i++)
            {
                if (!used[i])
                {
                    perm[pos] = i;
                    used[i] = true;
                    Permutation(pos + 1, n, length);
                    used[i] = false;
                }
            }
        }

        void Omame()
        {
            cin = new Scanner();
            string N = cin.next();

            for (int i = 0; i < N.Length; i++)
            {
                if(N[i] == '7')
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }
            Console.WriteLine("No");
        }

    }
}


Measured memory_bytes: 25976
def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    W, a, b = read_ints()
    if a+W <= b:
        return abs(a+W-b)
    if b+W <= a:
        return abs(b+W-a)
    return 0


if __name__ == '__main__':
    print(solve())


Measured memory_bytes: 61888
N, K = map(int, input().split())
h = []
for i in range(N):
  h.append(int(input()))
h2 = sorted(h)
ans = 10**9
for i in range(N-K+1):
  if h2[i+K-1] - h2[i] < ans:
    ans = h2[i+K-1] - h2[i]
print(ans)

Measured memory_bytes: 8280
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
using namespace std;
void read(int &x){
    char ch;bool ok;
    for(ok=0,ch=getchar();!isdigit(ch);ch=getchar())if(ch=='-')ok=1;
    for(x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());if(ok)x=-x;
}
#define rg register
const int maxn=4e5+10,mod=998244353,g=3,gi=332748118;
int n,ans,a[maxn],t[maxn],mx;
int mi(int a,int b){
    int ans=1;
    while(b){
	if(b&1)ans=1ll*ans*a%mod;
	b>>=1,a=1ll*a*a%mod;
    }
    return ans;
}
int main(){
    read(n);
    for(rg int i=1;i<=n;i++)read(a[i]),t[a[i]]++,mx=max(mx,a[i]);
    if(t[0]!=1||a[1]!=0)return printf("0\n"),0;
    ans=1;
    for(rg int i=1;i<=mx;i++){
	ans=1ll*ans*mi(t[i-1],t[i])%mod;
    }
    printf("%d\n",ans);
}


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

int main() {
  long int H, i, ans;
  cin >> H;
  
  i = 1;
  ans = 0;
  while(1){
    if(H != 1){
  		H = H / 2;
  		ans += i;
   		i *= 2;
    }
    else {
      ans += i;
      break;
    }
  }
  cout << ans << endl;
  
  
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n)for(int i=0;i<(int)(n);i++)
#define PI 3.141592653589793
//vector < vector<int>>a(0, vector<int>(0));二次元配列宣言


int main()
{
	int a[3][3];
	int b[3][3] = { 0 };
	int n;

	int i, j, k;
	for (i = 0; i < 3; i++)
	{
		for (j = 0; j < 3; j++)
		{
			cin >> a[i][j];
		}
	}
	int sum = 0;
	cin >> n;
	vector<int>c(n);
	for (i = 0; i < n; i++)
		cin >> c[i];
	for (k = 0; k < n; k++)
	{
		for (i = 0; i < 3; i++)
		{
			for (j = 0; j < 3; j++)
			{
				if (a[i][j] == c[k])
					b[i][j] = 1;
			}
		}
	}
	for (i = 0; i < 3; i++)
	{
		sum += (b[0][i] * b[1][i] * b[2][i]);
		sum += (b[i][0] * b[i][1] * b[i][2]);
	}
	sum += (b[0][0] * b[1][1] * b[2][2]);
	sum += (b[0][2] * b[1][1] * b[2][0]);
	if (sum >= 1)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
 
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define popcount(x) __builtin_popcountll(x)
 
const long double PI = acos(-1);
 
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}

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

  ll n;
  cin >> n;
  vector<ll> a(n);
  map<ll, ll> mp;
  for(ll i = 0; i < n; i++){
    cin >> a[i];
    mp[a[i]]++;
  }

  ll ans = 1;
  if(n % 2 == 0){
    for(ll i = 1; i < n; i += 2){
      if(mp[i] != 2){
        cout << 0 << endl;
        return 0;
      }else{
        ans *= 2;
        ans %= mod;
      }
    }
  }else{
    if(mp[0] != 1){
      cout << 0 << endl;
      return 0;
    }
    for(ll i = 2; i < n; i += 2){
      if(mp[i] != 2){
        cout << 0 << endl;
        return 0;
      }else{
        ans *= 2;
        ans %= mod;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4992
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int MOD = (int)1e9 + 7;

int n,m,h[101],hnum[101],dh[101];
LL dp[101][101];

int pow_(int x,int y) {///快速幂求 x的y次方
    int ans = 1;
    if(y > 0) {
        while(y) {
            if(y % 2)ans = (LL)ans * x % MOD;
            x = (LL)x * x % MOD;
            y /= 2;
        }
    }
    return ans;
}

int main() {
    scanf("%d",&n);
    for(int i = 1;i <= n;i ++) {
        scanf("%d",&h[i]);
        dh[++ m] = h[i];
    }
    sort(dh + 1,dh + m + 1);///高度排序
    m = unique(dh + 1,dh + m + 1) - dh - 1;///离散化 m是离散化后的长度
    for(int i = 1;i <= n;i ++) {
        hnum[i] = lower_bound(dh + 1,dh + m + 1,h[i]) - dh;
    }
    dp[0][0]=1;
    for(int i = 1;i <= n;i ++) {
        for(int j = hnum[i] + 1;j <= hnum[i - 1];j ++)
            (dp[i][0] += dp[i - 1][j] * 2 % MOD) %= MOD;

        (dp[i][0] += dp[i - 1][0] * 2 % MOD) %= MOD;///交叉或者不交叉

        int d = pow_(2,h[i] - h[i - 1]);
        for(int j = 1;j <= min(hnum[i - 1],hnum[i]);j ++) {
            dp[i][j] = dp[i - 1][j] * d % MOD;
        }
        for(int j = hnum[i - 1] + 1;j <= hnum[i];j ++) {///比前一列高出的部分
            if(j > 1)(dp[i][j] += dp[i - 1][0] * (pow_(2,dh[j] - dh[j - 1]) - 1) % MOD * 2 % MOD * pow_(2,h[i] - dh[j]) % MOD) %= MOD;
            else (dp[i][1] += dp[i - 1][0] * (pow_(2,dh[1]) - 2) % MOD * pow_(2,h[i] - dh[1]) % MOD) %= MOD;///上一列中无重复相同的乘上化不超过上一列高度中有重复的
        }
    }
    LL ans = 0;
    for(int i = 0;i <= hnum[n];i++)
        (ans += dp[n][i]) %= MOD;
    printf("%lld",ans);
    return 0;
}


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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> res(9);
	for (int i = 0; i < n; ++i) {
		int a; cin >> a;
		res[min(a / 400, 8)]++;
	}
	int ans = 0;
	for (int i = 0; i < 8; ++i) {
		if (res[i] > 0) ans++;
	}
	cout << (ans + (ans == 0 && res[8] > 0 ? 1 : 0)) << ' ' << (ans + res[8]) << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner; public class Main { public static final int DICE_NUM = 6; public static void main(String[] args) { Scanner scan = new Scanner(System.in); String[] input = scan.nextLine().split(" "); String[] input2 = scan.nextLine().split(" "); int[] face1 = new int[6]; int[] face2 = new int[6]; for (int i = 0; i < 6; i++) { face1[i] = Integer.parseInt(input[i]); face2[i] = Integer.parseInt(input2[i]); } Dice dice1 = new Dice(face1); Dice dice2 = new Dice(face2); if (dice1.checkSameDice(dice2)) { System.out.println("Yes"); } else { System.out.println("No"); } } } class Dice{ int NORTH = 4; int SOUTH = 1; int WEST = 3; int EAST = 2; int TOP = 0; int BOTTOM = 5; int[] face = new int[6]; Dice(int[] face){ this.face = face; } void setFront(int front){ while(face[SOUTH] != front){ turnRight(); } } void setTop(int top, int bottom){ int cnt = 0; while((face[TOP] != top || face[BOTTOM] != bottom) && cnt < 4){ turnSouth(); cnt++; } cnt = 0; while((face[TOP] != top || face[BOTTOM] != bottom) && cnt < 4){ turnEast(); cnt++; } } void turnRight(){ turnEast(); turnSouth(); turnWest(); } void turnEast(){ int bottom = face[BOTTOM]; int west = face[WEST]; face[BOTTOM] = face[EAST]; face[EAST] = face[TOP]; face[WEST] = bottom; face[TOP] = west; } void turnWest(){ int bottom = face[BOTTOM]; int east = face[EAST]; face[BOTTOM] = face[WEST]; face[WEST] = face[TOP]; face[EAST] = bottom; face[TOP] = east; } void turnNorth(){ int bottom = face[BOTTOM]; int south = face[SOUTH]; face[BOTTOM] = face[NORTH]; face[NORTH] = face[TOP]; face[SOUTH] = bottom; face[TOP] = south; } void turnSouth(){ int bottom = face[BOTTOM]; int north = face[NORTH]; face[BOTTOM] = face[SOUTH]; face[SOUTH] = face[TOP]; face[NORTH] = bottom; face[TOP] = north; } int getFace(int index){ return face[index]; } int getFront(){ return face[SOUTH]; } int getTop() { return getFace(TOP); } boolean checkSameDice(Dice dice2){ int top1 = getTop(); int bottom1 = getFace(BOTTOM); dice2.setTop(top1, bottom1); int[] side1 = new int[8]; int[] side2 = new int[4]; for (int i = 0; i < 4; i++) { side1[i] = getFront(); side1[i+4] = getFront(); side2[i] = dice2.getFront(); turnRight(); dice2.turnRight(); } for (int i = 0; i < 4; i++) { if (side1[0+i] == side2[0] && side1[1+i] == side2[1] && side1[2+i] == side2[2] && side1[3+i] == side2[3]) { return true; } } return false; } }


Measured memory_bytes: 26284
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k; cin >> n >> k;
    vll a(n);
    for (int i = 0; i < n; i++) cin >> a[i];

    for (int i = k; i < n; i++) {
        if (a[i - k] < a[i]) cout << "Yes\n";
        else cout << "No\n";
    }
    return 0;
}


Measured memory_bytes: 4776
def stack():
    A = list(input().split())
    lst = []
    
    def add(a, b):
        return b + a
    
    def sub(a, b):
        return b - a
        
    def mul(a, b):
        return b * a
    
    def div(a, b):
        return b / a
        
    def calc(lst, f):
        return lst.append(f(lst.pop(), lst.pop()))
    
    for i in A:
        if i == '+':
            calc(lst, add)
        elif i == '-':
            calc(lst, sub)
        elif i == '*':
            calc(lst, mul)
        elif i == '/':
            calc(lst, div)
        else: 
            lst.append(int(i))
    
    print(*lst)
    
stack()

Measured memory_bytes: 7768
import java.util.*;

public class Main {
	public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int X = sc.nextInt();

    for(int i=-K+1; i<0; i++){
        System.out.print(X+i +" ");
}
    for(int j=0; j<K; j++){    
		System.out.print(X+j +" ");	    
	}
}
}

Measured memory_bytes: 22732
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds; 
using namespace std;
using   ll=long long;
using   ld=long double;

#define fast        	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ordered_set 	tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>

#define endl        	"\n"
#define pb          	push_back
#define mp          	make_pair
#define F           	first
#define S           	second
#define int             long long int

#define ALL(v)      	v.begin(),v.end()
#define ALLR(v)     	v.rbegin(),v.rend()
#define pii         	3.14159265358979323
#define inf     		LLONG_MAX
#define ones(x)     	__builtin_popcount(x)
#define fill(a,b)   	memset(a,b,sizeof(a))
#define mod 			998244353

ll mod_pow(ll a,ll b) 
{
    ll res = 1;
    while(b)	
    {
        if(b&1) 	
        {
        	res=(res*a)%mod;
        }
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}

ll mod_inverse(ll a) 
{
	return mod_pow(a , mod-2);
}

const int m = 1000005;

int frq[m];

int take[m];

void sieve() {
	
	for(int i = 1; i < m; ++i) {
		
		if(frq[i] > 0 && take[i] == 1) {
			
			for(int j = 2*i; j < m; j += i) {
				take[j] = 0;
			}
			
			if(frq[i] > 1) {
				take[i] = 0;
			}
		}
	}
}

void solve()
{
	int n;
	
	cin >> n;
	
	int a[n];
	
	for(int i = 0; i < m; ++i) {
		frq[i] = 0;
	}
	
	for(int i = 0; i < m; ++i) {
		take[i] = 1;
	}
	
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
		
		frq[a[i]]++;
	}
	
	sieve();
	
	int tot = 0;
	
	for(int i = 0; i < n; ++i) {
		if(take[a[i]] > 0) {
			tot++;
		}
	}
	
	cout << tot;
}

signed main() {
    fast;
    
    int t = 1;
    
    //cin >> t;
    
    while(t--) {
        solve();
    }
 
    return 0;
}


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

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

    vector<string> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    vector<string> B(M);
    for (int i = 0; i < M; i++) {
        cin >> B[i];
    }

    bool flag = false;
    for (int i = 0; i < N - M + 1; i++) {
        for (int j = 0; j < N - M + 1; j++) {
            if (A[i].substr(j, M) == B[0]) {
                for (int k = 0; k < M; k++) {
                    if (A[i + k].substr(j, M) != B[k]) {
                        break;
                    }
                    else if (A[i + k].substr(j, M) == B[k] && k == M - 1) {
                        flag = true;
                    }
                }
            }
        }
    }

    if (flag) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
$<.map{|i|a=i.chop.split(?,).map(&:to_i).sort;b=a.uniq.map{|j|a.count(j)}.max;s=a.uniq.size;puts b>3?"four card":b>2?s>2?"three card":"full house":b>1?s>3?"one pair":"two pair":a[4]-a[0]<5||a[1]>9?:straight: :null}

Measured memory_bytes: 8584
#include<cmath>
#include<cstdio>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD = int(1E9) + 7;
const int MAXN = 200000;
ll fact[MAXN + 5], inv[MAXN + 5];
ll pow_mod(ll b, int p) {
	ll ret = 1;
	while( p ) {
		if( p & 1 ) ret = ret * b % MOD;
		b = b * b % MOD;
		p >>= 1;
	}
	return ret;
}
void init() {
	fact[0] = 1;
	for(int i=1;i<=MAXN;i++)
		fact[i] = fact[i-1] * i % MOD;
	inv[MAXN] = pow_mod(fact[MAXN], MOD-2);
	for(int i=MAXN-1;i>=0;i--)
		inv[i] = inv[i+1] * (i+1) % MOD;
}
ll Function(int N, int M) {
	return fact[N+M-1] * inv[N-1] % MOD * inv[M] % MOD;
}//C(N+M-1, N-1)
int main() {
	init(); int N, M;
	scanf("%d%d", &N, &M);
	int lim = sqrt(M);
	ll ans = 1;
	for(int i=2;i<=lim;i++) {
		if( M % i == 0 ) {
			int cnt = 0;
			while( M % i == 0 ) {
				cnt++;
				M /= i;
			}
			ans = ans * Function(N, cnt) % MOD;
		}
	}
	if( M != 1 )
		ans = ans * N % MOD;
	printf("%lld\n", ans);
}


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

string s;
void prians(bool answer) {
  if(answer)
    cout << "AC" << endl;
  else
    cout << "WA" << endl;
}

int main() {
  bool ans = 1, ans2 = 0;
  int i = 0;
  cin >> s;
  if(s[0] != 'A') ans = 0;
  for(i = 2; i < s.size() - 1; ++i) {
    if(s[i] == 'C') break;

    if(i == s.size() - 2) ans = 0;
  }
  for(i = 1; i < s.size(); ++i) {
    if(i == 1 && s[i] >= 'A' && s[i] <= 'Z') ans = 0;
    if(ans2 == 0 && s[i] == 'C') {
      ans2 = 1;
      continue;
    }
    if(s[i] >= 'A' && s[i] <= 'Z') ans = 0;
  }
  prians(ans);
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>


int main()
{

int a,k,b,s,w ;
   char ch,p,x ;
   float g,h ;
  int st[100001],ara[3352] ;
scanf("%d %d",&s,&w) ;
if(s>w)
    printf("safe") ;
else
    printf("unsafe") ;


    return 0 ;

}


Measured memory_bytes: 1728
N = int(input())
H = list(map(int, input().split()))
result = 'Yes'
flag = False
if N == 1:
    print(result)
else:
    for i in range(N):
        if i == N - 1:
            break
        if H[N - i - 2] <= H[N - i - 1]:
            continue
        elif H[N - i - 2] - 1 == H[N - i - 1]:
            H[N - i - 2] = H[N - i - 2] - 1
        else:
            result = 'No'
            break
    print(result)


Measured memory_bytes: 14396
from collections import defaultdict
N = int(input())
D = defaultdict(int)
for i in range(N):
    S = ''.join(sorted(input()))
    D[S] += 1

ans = 0
for key in D:
    M = D[key]
    if M >= 2:
        ans += M*(M-1)//2
    
print(ans)

Measured memory_bytes: 62168
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cout<<#x<<" "<<x<<"\n";
#define lli long long int
int main()
{
   lli a,x;
   long double b,ans;
    cin>>a>>b;
    ans=a*b;
    x=ans;
    cout<<x<<endl;;
    return 0;
}


Measured memory_bytes: 3732
#!/usr/bin/env python3
def findSumOfDigits(num):
    num = int(num)
    sum = 0

    while True:
        sum += num % 10
        num //= 10
        if num <= 0:
            break

    return sum


def main():
    # n = int(input())
    # i = list(map(int,input().split()))
    # j = list(map(int,input().split()))

    n, a, b = map(int, input().split())
    total = 0

    for i in range(n+1):
        #print(i,end=" =")
        check = int(findSumOfDigits(i))
        #print(check)

        if (check >= a) and (check <= b):
            total += i
            #print(i, check, total, sep=' ')

    print(total)

main()


Measured memory_bytes: 3060
#include<stdio.h>
int main(){
	int i,n,x=0,m=0;
	char s[105];
	scanf("%d",&n);
	scanf("%s",s);
	for(i=0;i<n;i++){
		if(s[i]=='I')
			x++;
		else if(s[i]=='D')
			x--;
		if(x>m)
			m=x;
	}
	printf("%d\n",m);
	return 0;
}

Measured memory_bytes: 128
import java.util.*;
import java.lang.Integer; 

public class Main {
  public static void main(String[] args){
    
    // 入力
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
 	// 結果用
    Set<Integer> aSet = new HashSet<Integer>();
    // 削除用
    Set<Integer> dSet = new HashSet<Integer>();
    while(sc.hasNext()){
      Integer a = Integer.valueOf(sc.nextInt());
      if(aSet.contains(a)){
        dSet.add(a);
      }else{
        aSet.add(a);
      }
    }
    List<Integer> aList = new ArrayList<Integer>(aSet);
    
    // ソート
    Collections.sort(aList);
    
    Integer ae = aList.get(aList.size()-1);
    // 検索
    for(Integer al:aList) {
      if(al*Integer.valueOf(2).compareTo(ae) > 0){
        // 終了条件
        break;
      }
      Integer j = 2;
      if(aSet.contains(al)){          
        Integer ai = al;
        while(ai <= ae){
          // 倍数
          ai = al * j;
          if(aSet.contains(ai)){
            // セットにある場合、倍数を削除
            aSet.remove(ai);
          }
          j++;
        }
      }
    }
    // 同じ数字が複数存在する場合は削除
    aSet.removeAll(dSet);
    // 出力
    System.out.println(aSet.size());
  }
}


Measured memory_bytes: 73272
package main

import (
        "fmt"
        "io"
        "os"
)

func main() {
        fmt.Printf("%d\n", resolve(parseProblem(os.Stdin)))
}

func parseProblem(r io.Reader) (n int, s string) {
        fmt.Fscanf(r, "%d\n%s", &n, &s)
        return n, s
}

func resolve(n int, str string) int {
        var count int
        for i := 0; i < 10; i++ {
                for j := 0; j < 10; j++ {
                        for k := 0; k < 10; k++ {
                                if find(i, j, k, str) {
                                        count++
                                }
                        }
                }
        }
        return count
}

func find(i, j, k int, str string) bool {
        target := []int{i, j, k}
        tIdx := 0
        for idx := 0; idx < len(str); idx++ {
                if int(str[idx]-'0') == target[tIdx] {
                        tIdx++
                }
                if tIdx == len(target) {
                        return true
                }
        }
        return false
}

Measured memory_bytes: 768
#include <cstdio>

typedef long long LL;
const int MN = 200005, Sig = 26;

char s[MN];
int buk[Sig];
LL Ans;

int main() {
	scanf("%s", s + 1);
	for (int i = 1; s[i]; ++i)
		Ans += i - ++buk[s[i] - 'a'];
	printf("%lld\n", Ans + 1);
	return 0;
}

Measured memory_bytes: 1876
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> pll;
void read(int& x){ scanf("%d",&x); }
void read(ll& x){ scanf("%lld",&x); }
template<typename T,typename... Args>
void read(T& a,Args&... b){ read(a); read(b...); }
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
#define x first
#define y second

char s[100010];
char tmp[100010];
int n;

int main()
{
	scanf("%s", s+1); n = strlen(s+1);
	int tn = 0;
	for(int i=1; i<=n; ++i) if(s[i] != 'x') tmp[tn++]=s[i];
	string S(tmp);
	if(S != string(S.rbegin(), S.rend())){
		puts("-1");
		return 0;
	}
	if(S.length() % 2){
		vector<int> v;
		int p=1;
		int sl=S.length();
		for(int i=0; i<sl; ++i){
			int cnt=0;
			while(s[p] != S[i]) ++cnt, ++p;
			v.pb(cnt);
			++p;
		}
		v.pb(n+1-p);
		
		int ans=0;
		int l=0, r=v.size()-1;
		while(l < r){
			ans += abs(v[l]-v[r]);
			++l; --r;
		}
		
		printf("%d\n", ans);
	} else {
		vector<int> v;
		int p=1;
		int sl=S.length();
		for(int i=0; i<sl; ++i){
			int cnt=0;
			while(s[p] != S[i]) ++cnt, ++p;
			v.pb(cnt);
			++p;
		}
		v.pb(n+1-p);
		
		int ans=0;
		int l=0, r=v.size()-1;
		while(l < r){
			ans += abs(v[l]-v[r]);
			++l; --r;
		}
		
		printf("%d\n", ans);
	}
	return 0;
}


Measured memory_bytes: 1148
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define F first
#define S second
//#define biGinf 9e+18
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define inpv(v) for(auto &x:v) cin>>x
#define otpv(v) for(auto &x:v) cout<<x<<nwl
#define otpv2(v) for(auto &x:v) cout<<x<<" "
#define CASES int tt;cin>>tt; while(tt--)
#define for0(i,n) for(int i=0; i<n; i++)
#define for1(i,n) for(int i=1; i<=n; i++)
#define sz(v) (int)(v).size()
#define vec(x) vector < x >
using vi = vector < int >;
using vvi = vector < vi >;
using pii = pair < int , int >;
using vpii = vector < pii >;
using int64 = long long;
//const int64 biGinf = 9e+18;
//const string yo = "YES", no = "NO";
const int inf = 2e9 + 7;
const char nwl = '\n';

int main() {
// #ifndef ONLINE_JUDGE
// 	if (fopen("input.txt", "r")) {
// 		freopen("input.txt", "r", stdin);
// 		freopen("output.txt", "w", stdout);
// 	}
// #endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//ur code
	//AC, WA, TLE, or RE
	int n;
	cin >> n;
	int ar[4] = {0};
	for0(i, n) {
		string s;
		cin >> s;
		if (s == "AC") ar[0]++;
		else if (s == "WA") ar[1]++;
		else if (s == "TLE") ar[2]++;
		else ar[3]++;
	}
	cout << "AC x " << ar[0] << nwl;
	cout << "WA x " << ar[1] << nwl;
	cout << "TLE x " << ar[2] << nwl;
	cout << "RE x " << ar[3] << nwl;



	return 0;
}

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

using namespace std;


#define ss second
#define ff first
#define int long long
//#define double long double
#define pb push_back

const int N = 1e6 + 1, MOD = 1e9 + 7, mod = 998244353, INF = 3e18;

mt19937 Flash_new_51(51515);

using vi = vector <int>;
using vp = vector <pair <int, int>>;


signed main() {
   cin.tie(0);
   ios_base::sync_with_stdio(0);
   int n, A, B;
   cin  >> n >> A >> B;
   if (A == B) {
      cout << 1;
      return 0;
   } 
   if (n == 1 || B < A) {
      cout << 0;
      return 0;
   }
   n-= 2;
   cout << n* B - n * A + 1;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
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; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;


map<int, int> enumpr(int n) {
    map<int, int> V;
    for(int i = 2; 1LL * i * i <= n; i++) {
        while(n % i == 0) {
            V[i]++;
            n /= i;
        }
    }
    if (n > 1) V[n]++;
    return V;
}

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

    map<int, int> sm;
    REP(i, 1, n + 1) {
        auto ep = enumpr(i);
        for (auto p : ep) {
            sm[p.first] += p.second;
        }
    }

    int ans = 0;

    REP(a, 2, n + 1) if (74 <= sm[a]) ans++;

    REP(a, 2, n + 1) REP(b, 2, n + 1) if (a != b and 14 <= sm[a] and 4 <= sm[b]) ans++;

    REP(a, 2, n + 1) REP(b, 2, n + 1) if (a != b and 24 <= sm[a] and 2 <= sm[b]) ans++;

    REP(a, 2, n + 1) REP(b, 2, n + 1) REP(c, b + 1, n + 1) {
        if (a != b and a != c and 2 <= sm[a] and 4 <= sm[b] and 4 <= sm[c]) ans++;
    }

    cout << ans << endl;

    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
    int h, w, bh, bw;
    cin >> h >> w >> bh >> bw;
    cout << (h - bh) * (w - bw) << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<vector>
#include<iostream>
using namespace std;
#define df 0
#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
typedef long int li;

char rot(char c,int n){
  int a=c-'A';
  (a+=n)%=26;
  return a+'A';
}

int main(){
  if(df) printf("*debug mode*\n");
  int n; cin >>n;
  string s; cin >>s;
  rep(i,s.size()) cout << rot(s.at(i),n);
}

/// confirm df==0 ///


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>

using namespace std;

typedef long long ll;

typedef std::pair<int, int> ipair;
bool lessPair(const ipair& l, const ipair& r){return l.second < r.second;}
bool morePair(const ipair& l, const ipair& r){return l.second > r.second;}

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

const ll MOD = 1e9 + 7;
// const long long INF = 1LL<<60;
void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; }
void sub(long long &a, long long b) { a -= b; if (a < 0) a += MOD; }
void mul(long long &a, long long b) { a *= b; a %= MOD; }
ll llmin(ll a, ll b) { if (a < b) return a; else return b; }
ll llmax(ll a, ll b) { if (a < b) return b; else return a; }
ll llabs(ll a) { if (a >= 0) return a; else return - a; }
ll llmodpow(ll a, ll n) {
   if (n == 0) return 1;
   ll tmp = llmodpow(a, n / 2);
   mul(tmp, tmp);
   if (n & 1) mul(tmp, a);
   return tmp;
}

int main() {
   int r;
   cin >> r;
   cout << 3 * r * r << endl;
   return 0;
}


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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;
const int MAX_N = 100010;
const double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/
	
	int n, q;
	string str;
	cin >> n >> q;
	cin >> str;

	vector<int> s(n + 1, 0);
	for (int i = 0; i < n; i++) {
		if (i + 1 < n &&
			str[i] == 'A' && str[i + 1] == 'C') {
			s[i + 1] = s[i] + 1;
		}
		else {
			s[i + 1] = s[i];
		}
	}

	for (int i = 0; i < q; i++) {
		int l, r;
		cin >> l >> r;
		l--; r--;
		cout << s[r] - s[l] << endl;
	}

	return 0;
}

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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main()
{
  int N;
  cin >> N;
  vector<int> A(N);
  set<int> st;
  REP(i, N)
  {
    cin >> A[i];
    st.insert(A[i]);
  }
  // カードの種類をKとすると，答えは
  // Kが奇数の時はK，偶数の時はK-1
  int K = st.size();
  cout << (K & 1 ? K : K - 1) << endl;
  return 0;
}

Measured memory_bytes: 5376
#include <iostream>
using namespace std;
int main(void){
    int N;
    
    cin >> N;
    int A[N];
    
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    
    long dai = 0;
    int max = A[0];
    
    for(int i = 1; i < N; i++){
        if(A[i] < max){
            dai += max - A[i];
        }else{
            max = A[i];
        }
    }
    
    cout << dai << endl;
    
}

Measured memory_bytes: 3972
#include <iostream>

using namespace std;

int main() {
    int i,a,b,c,y;
    y = 0;
    cin>>a>>b>>c;
    for(i=a;i<=b;i++)
    {
        if(c%i == 0)
        y = y + 1;
    }
    cout<<y<<endl;
}


Measured memory_bytes: 3096
#include<stdio.h>
#include<stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
ll a[20010];
int main(){
	ll n;
	scanf("%lld",&n);
	a[0]=3;
	ll s=3;
	ll cnt=1;
	for(ll num=0;cnt<n-3&&num+25<=30000;num+=30){
		a[cnt++]=num+ 5;
		a[cnt++]=num+25;
		s+=num*2+30;
	}
	for(ll num=9;cnt<n-3&&num+6<=30000;num+=12){
		a[cnt++]=num;
		a[cnt++]=num+6;
		s+=num*2+6;
	}
	for(ll num=2;cnt<n-1;num+=2){
		a[cnt++]=num;
		s+=num;
	}
	//sは必ず奇数
	//2,3,5いずれの倍数でもないkであって、s+kが30の倍数かつkの倍数となるようなものが存在すれば良い
	//a[cnt-1]≦26002を大きな偶数に取り替えることでsは30000-a[cnt-1]まで大きくできるので
	//[s,s+30000-a[cnt-1]]にあるssであってとk=30x-ss%30であって、ssがkの倍数であるようなものが存在すれば良い
	//ssの候補が2000個くらい、各ssに対しkの候補が1000個くらいあるので、大丈夫そう
	
	ll ss=s;
	while(1){
		while(ss%3==0||ss%5==0)ss+=2;
		for(ll k=30-ss%30;k<=30000;k+=30)if(k!=1&&ss%k==0){
			rep(i,0,n-2)printf("%d ",a[i]);
			printf("%d %d\n",a[cnt-1]+(ss-s),k);
			return 0;
		}
		ss+=2;
	}
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 1000000007
#define inf 1000000000000000007
#define eps 0.000001
#define pi 3.141592653589793
#define pii pair<int , int>
#define pdd pair<ld,ld>
#define pll pair<ll,ll>
#define ff first
#define ss second
#define vii vector<int>
#define vpl vector<pll>
#define vll vector<ll>
#define sti stack <int>
#define stll stack <ll>
#define mseti set <ll>
#define msetd multiset <ll, greater <ll> >
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound 
#define stp setprecision(20)//use fixed before stp
#define endl '\n'
int main()
{  
    FAST
    ll n,k;
    cin>>n>>k;
    ll a[n][n];
    ll ans[n][n];
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<n;j++)
        {
            cin>>a[i][j];
            ans[i][j]=0;
            if(i==j)
                ans[i][j]=1;
        }
    }
    ll b[n][n];
    while(k!=0)
    {
        if(k&1)
        {
            for(ll i=0;i<n;i++)
            {
                for(ll j=0;j<n;j++)
                {
                    b[i][j]=0;
                    for(ll z=0;z<n;z++)
                    {
                        b[i][j]+=(ans[i][z]*a[z][j]);
                        b[i][j]%=mod;
                    }
                }
            }
            for(ll i=0;i<n;i++)
            {
                for(ll j=0;j<n;j++)
                {
                    ans[i][j]=b[i][j];
                }
            }
        }
        k>>=1;
        for(ll i=0;i<n;i++)
        {
            for(ll j=0;j<n;j++)
            {
                b[i][j]=0;
                for(ll z=0;z<n;z++)
                {
                    b[i][j]+=(a[i][z]*a[z][j]);
                    b[i][j]%=mod;
                }
            }
        }
        for(ll i=0;i<n;i++)
        {
            for(ll j=0;j<n;j++)
            {
                a[i][j]=b[i][j];
            }
        }
    }
    ll res=0;
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<n;j++)
        {
            res+=ans[i][j];
            res%=mod;
        }
    }
    cout<<res;
}

Measured memory_bytes: 384