akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
  string a, b;
  
  cin >> a >> b;
  
  int i = 0;
  
  string res;
  for (int i = 0; i < b.size(); ++i)
  {
  	if (b[i] != ' ')
    {
    	res += b[i];
    }
  }
  
  for (int i = 0; i < a.size(); ++i)
  {
  	if (a[i] != ' ')
    {
    	res += a[i];
    }
  }
  
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<string>
#include<vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
using namespace std;


int main()
{
	int d, n;
	cin >> d >> n;
	int t = 1;
	for (int i = 0; i < d; i++) t *= 100;
	cout << t * (n + (n==100)) << endl;
}

Measured memory_bytes: 256
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
typedef long long ll;
const int N=1e5+5;
int a[N],n,m,p,v,l,r,mid,ans;
bool ck(){
	if(mid<=p)return true;if(a[mid]+m<a[p])return false;
	if(p-1+n-mid+1>=v)return true;
	R ll res=0;
	fp(i,p,mid-1)res+=a[mid]+m-a[i];
	return res>=1ll*(v-(p-1+n-mid+1))*m;
}
int main(){
//	freopen("testdata.in","r",stdin);
	scanf("%d%d%d%d",&n,&m,&v,&p);
	fp(i,1,n)scanf("%d",&a[i]);
	sort(a+1,a+1+n,[](const int &x,const int &y){return x>y;});
//	mid=6;
//	printf("%d\n",ck());
	l=1,r=n,ans=0;
	while(l<=r){
		mid=(l+r)>>1;
		ck()?(ans=mid,l=mid+1):r=mid-1;
	}
	printf("%d\n",ans);
	return 0;
}

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

public class Main {
    public static void main(String[] args) throws IOException {

        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(f.readLine());
        int n = Integer.parseInt(st.nextToken());


        int[] h = new int[n]; // nums
        st = new StringTokenizer(f.readLine());
        for (int i = 0; i < n; i++) {
            h[i] = Integer.parseInt(st.nextToken());
        }


        int[] min_cost = new int[n];

        // 2 <= N <= 10^5
        min_cost[0] = 0;
        min_cost[1] = Math.abs(h[1] - h[0]);

        for (int i = 2; i < min_cost.length; i++) {

            min_cost[i] = Math.min( min_cost[i - 2] + Math.abs( h[i - 2] - h[i] ) ,
                    min_cost[i - 1] + Math.abs( h[i-1] - h[i] ) );
        }

        /*for (int i : min_cost) {
            System.out.print(String.valueOf(i) + " ");
        }*/
        // System.out.println();

        System.out.println(min_cost[min_cost.length - 1]);
    }
}

Measured memory_bytes: 29824
N = int(input())

A = list(map(int, input().split()))
B = list(map(int, input().split()))

cnt = 0
for a, b in zip(A, B):
    if a > b:  # 特殊操作（他のaの力が）が必要な場合
        cnt -= a-b
    if a < b:  # 他のaに力を貸せる場合
        cnt += int((b-a)/2)

if cnt >= 0:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 4596
n, m = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
ans = 0
dis = []
for i in range(m-1):
    dis.append(x[i+1] - x[i])
dis.sort()
#print(dis)
for i in range(len(dis)):
    if i < m - n:
        ans += dis[i]
    else:
        break
print(ans)

Measured memory_bytes: 13960
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
#include <vector>
#include <chrono>
#include <cstdlib>
using namespace std;

int main(){
    string s;
    cin >> s;
    int count = 0;
    string a = "CODEFESTIVAL2016";
    for(int i = 0; i < 16; i++){
        if(s[i] != a[i]) count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using PII = pair<int, int>;
const int INF = numeric_limits<int>::max();

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

int main()
{
    ll n; cin >> n;
    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        ans += (i * (n/i) * (n/i + 1)) / 2;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
const int mxN=1e3+10;
int n,m,a,b,k;
int vis[mxN],pai[mxN];
vector<int>adj[mxN];
vector<int>resp;

void bfs(int x){
    queue<int>fila;
    fila.push(x);
    vis[x]=1;

    while(!fila.empty()){
        int u=fila.front();
        fila.pop();
        for(int v:adj[u])   {
            if(!vis[v]){
                vis[v]=1;
                pai[v]=u;
                fila.push(v);

            }
            if(v==x){
                vector<int>ans;
                while(u!=v){
                    ans.push_back(u);
                    u=pai[u];
                }
                ans.push_back(u);
                if(resp.size()==0 || ans.size()< resp.size())resp=ans;
                return;
            }
        }

    }
}

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

    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>a>>b;
        adj[a].push_back(b);
    }

    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            pai[j]=-1;
            vis[j]=0;            
        }
        bfs(i);       
    }
    if(resp.size()){
        cout<<resp.size()<<"\n";
        for(auto x:resp){
            cout<<x<<"\n";
        }
        return 0;
    }
    cout<<-1<<"\n";

     

}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n,a,b;
	cin >> n >> a >> b;
	if ((b-a)%2 == 1) {
		cout << "Borys" << endl;
	}
	else {
		cout << "Alice" << endl;
	}
	return 0;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl

#define MOD 1000000007

int b,w;
/*
P1(x) := x-times, all white is eaten
P2(x) := x-times, all black is eaten
ans(x) = P1(x) * 1 + (1 - P1(x) - P2(x)) * 0.5

x-times is the first time that all white is eaten
-> (b,w) -> (y,1) -> (y,0)
comb(i-1,w-1)
*/

ll modinv(ll a){
	ll b=MOD-2, r=1;
	while(b){
		if(b&1)r=r*a%MOD;
		a=a*a%MOD;
		b>>=1;
	}
	return r;
}

ll fact[252521];
ll ifact[252521];

int main(){
	scanf("%d%d",&b,&w);
	fact[0] = 1;
	FOR(i,1,252521)fact[i] = fact[i-1]*i%MOD;
	ifact[252521-1] = modinv(fact[252521-1]);
	FORR(i,1,252521)ifact[i-1] = ifact[i]*i%MOD;
	ll p1 = 0, p2 = 0;
	ll inv2 = (MOD+1)/2;
	ll pow2 = 1;
	FOR(i,1,b+w+1){
		ll ans = (1+p1-p2+MOD)*inv2%MOD;
		printf("%lld\n",ans);
		pow2 = pow2*inv2%MOD;
		if(i>=w){
			p1 += fact[i-1]*ifact[w-1]%MOD*ifact[i-w]%MOD*pow2%MOD;
			p1 %= MOD;
		}
		if(i>=b){
			p2 += fact[i-1]*ifact[b-1]%MOD*ifact[i-b]%MOD*pow2%MOD;
			p2 %= MOD;
		}
	}
	return 0;
}


Measured memory_bytes: 6144
#include <iostream>

using namespace std;
int a,b,c,d,Max,sa,sc;
int main()
{
    cin>>a>>b>>c>>d;
    sa=a+b;
    sc=d+c;
    Max=max(sa,sc);
    if(sa==sc) cout<<"Balanced\n";
    else if(Max==sa)cout<<"Left\n";
    else cout<<"Right\n";

    return 0;
}


Measured memory_bytes: 256
#include<iostream> 
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++) 

int main() {
    char S[11];
    char T[12];
    cin >> S >> T;
    int Counter1 = 0;
    int Counter2 = 0;
    int Counter3 = 0;
    for (int i = 0; S[i] != '\0'; i++) {
        Counter1 += 1;
    }
    
    for (int i = 0; T[i] != '\0'; i++) {
        Counter2 += 1;
    }
    for (int i = 0; S[i] != '\0'; i++) {
        if (S[i] == T[i]) {
            Counter3 += 1;
        }
    }

    if (Counter3 == Counter1 && Counter2-Counter1 == 1) {
        cout << "Yes" << endl;
    } else cout << "No" << endl;
}

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

typedef long long int ll;

int n;
int l[102];
  
void solve() {
	int ans = 0; // 答え
	// 棒を重複して選ばないようi < j < kとなるようにしている
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			for (int k = j + 1; k < n; k++) {
              	if(l[i] < l[j] && l[i] < l[k] && l[j] < l[k]){
                    int len = l[i] + l[j] + l[k]; // 周長
                    int ma = max(l[i], max(l[j], l[k])); // 最も長い棒の長さ
                    int rest = len - ma; // 他の2本の棒の長さの和
                    if (ma < rest) {
                        // 三角形が作れるので、答えを更新できれば更新
                        ans++;
                    }
                }
			}
		}
	}
  	cout << ans;
}

int main(void){
    
  cin >> n;
  for(int i=0; i<n; i++)
  {
    cin >> l[i];
  }
  
  sort(l, l+n );
  
//  copy(l, l+n, ostream_iterator<int>(cout, "\n"));
  
  solve();
  
  return 0;
}


Measured memory_bytes: 3636
#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;
typedef pair<int, int> pii;
vector<pii> ans;
int main(void) {
	int n, k; scanf("%d %d", &n, &k);
	int maxv = (n - 2)*(n - 1) / 2;
	if (maxv < k) return !printf("-1\n");
	int x = maxv - k;
	printf("%d\n", x + n - 1);
	for (int i = 2; i <= n; i++) {
		printf("%d %d\n", 1, i);
	}
	for (int i = 2; i <= n; i++) {
		for (int j = i + 1; j <= n; j++) {
			ans.push_back({ i, j });
		}
	}
	for (int i = 0; i < x; i++) {
		printf("%d %d\n", ans[i].first, ans[i].second);
	}
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); ++i)
#define FOR(i, s, n) for(int i=(int)(s); i<(int)(n); ++i)
#define ALL(n) (n).begin(), (n).end()
#define pb push_back

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> mat;

const ll MAX_V = 100000;
const ll INF = 1e9;
const ll MOD = 998244353;

int main(){
    int a, b, c; cin >> a >> b >> c;
    int ans = max({a, b, c}) - min({a, b, c});
    cout << ans << endl;
}

Measured memory_bytes: 256
S = list(input())
T = list(input())

T_length = len(T)
max_count = 0

for i in range(len(S)-T_length+1):
  count = 0
  for j in range(T_length):
    if S[i:i + T_length][j] == T[j]:
      count += 1
  else:
    if max_count < count:
      max_count = count

print(T_length - max_count)


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

// limit
#define oo 1000000007
#define OO 1000000000000000007LL
#define maxN 507

// loop
#define fto(i, x, y) for(int i = (x); i <= (y); ++i)
#define fdto(i, x, y) for(int i = (x); i >= (y); --i)
#define ftoa(i, x, y, a) for(int i = (x); i <= (y); i += a)
#define fdtoa(i, x, y, a) for(int i = (x); i >= (y); i -= a)
#define ftosqrt(i, x, y) for(int i = (x); i*i <= (y); ++i)
#define ftoit(it, var) for (__typeof(var.begin()) it = var.begin(); it != var.end(); ++it)
#define fdtoit(rit, var) for (__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); ++rit)

// debug
#define debug cout << "*" << endl;
#define bug1d(a, x, y) { cout << #a << ": "; fto(_, x, y) cout << a[_] << ' '; cout << endl; }
#define bug2d(a, x, y, u, v) { cout << #a << ": " << endl; fto(i, x, y) {fto(j, u, v) cout << a[i][j] << ' '; cout << endl;}; cout << endl;}
#define bug(a) cout << #a << " = " << a << endl;
#define bug2(a, b) cout << #a << " = " << a << "; "; cout << #b << " = " << b << endl;
#define bug3(a, b, c) cout << #a << " = " << a << "; "; cout << #b << " = " << b << "; "; cout << #c << " = " << c << endl;

// operation
#define mp make_pair
#define pb push_back
#define pf push_front
// structure
#define ii pair<int, int>
#define iii pair<ii, int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>

// get value
#define FF first
#define SS second

// data type
#define ll long long
#define ull unsigned long long

// function
#define lb lower_bound
#define ub upper_bound

// const value
#define pi 3.14159265358979323846264338327950288419716939937510

using namespace std;

template <class T>
T min(T a, T b, T c) {
    return min(a, min(b, c));
}

template <class T>
T min(T a, T b, T c, T d) {
    return min(a, min(b, min(c, d)));
}

template <class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

template <class T>
T max(T a, T b, T c, T d) {
    return max(a, max(b, max(c, d)));
}

bool cmp(const int& a, const int& b) {return a > b;}

int main() {
    ll n, a, b;
    cin >> n >> a >> b;

    cout << max(0LL, b*(n-2)-a*(n-2)+1LL) << endl;
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef unsigned  uint;
typedef unsigned long long int ull;
typedef pair<ll,ll> P;
typedef pair<P,long double> Pi;
typedef pair <long double,int> Pd;
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=1000000007;
const uint mod=998244353;
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
int n,a,b;
cin>>n>>a>>b;
cout<<min(a,b)<<" "<<max(0,a+b-n)<<endl;
}

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

const int MOD = 1000000007;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<ll> b(n + 1, 0);  // 累積和テーブル
  rep(i, 0, n) {
    cin >> a[i];
    b[i + 1] = b[i] + a[i];
  }

  ll ans = 0;

  // i について全探索する
  rep(i, 0, n) {
    // 累積和を使って a[i+1] + ... + a[n] を求める
    ll tot = (b[n] - b[i + 1]) % MOD;
    ans += a[i] * tot;
    ans %= MOD;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 5524
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
#define MOD 1000000007LL
#define endl "\n"
#define fst first
#define snd second
const ll UNDEF = -1;
const ll INF=1e18;
template<typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; }
template<typename T> inline bool chkmin(T &aa, T bb) { return aa > bb ? aa = bb, true : false; }
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef vector<int> vi;
bool solve(int xlim, int ylim, vector<string> s){
	for (auto &x:s) for (auto &y:x) y-='a';
	int sz=(xlim+1)/2;
	for (int z=0;z<(1<<xlim);z++) {
		if (__builtin_popcount(z)!=sz) continue;
		vector<int> vx,ox;
		for (int x=0;x<xlim;x++) {
			if (z&(1<<x)) vx.PB(x);
			else ox.PB(x);
		}
		do {
			map<ll,int> h;
			map<ll,int> g;
			for (int y=0;y<ylim;y++) {
				ll got=0;
				for (int i=0;i<sz;i++) {
					got*=26;
					got+=s[vx[i]][y];
				}
				for (int i=0;i<ox.size();i++) {
					got*=26;
					got+=s[ox[i]][y];
				}
				ll rev=0;
				for (int i=ox.size()-1;i>=0;i--) {
					rev*=26;
					rev+=s[ox[i]][y];
				}
				for (int i=sz-1;i>=0;i--) {
					rev*=26;
					rev+=s[vx[i]][y];
				}
				if (got!=rev) {
					++h[got];
					--h[rev];
				}
				else {
					++g[got];
				}
			}
			int odd=0;
			for (auto &w:h) {
				if (w.snd) odd=1e9;
			}
			for (auto &w:g) {
				odd+=(w.snd&1);
			}
			if (odd<=1)return true;
		} while(next_permutation(vx.begin(),vx.end()));
	}
	return false;
}

int main(){	
	ios_base::sync_with_stdio(false); cin.tie(0);
	long long H;
	long long W;
	cin>>H;
	vector<string> S(H-1+1);
	cin>>W;
	for(int i = 0 ; i <= H-1 ; i++){
		cin >> S[i];
	}
	bool ans=solve(H, W, S);
	if (ans) printf("YES\n");
	else printf("NO\n");
	return 0;
}



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

int main(){
  int N,M,a[1000]={},countr=0,countb=0,count=0,mx=0;
  cin >> N;
  vector<string>s(N);
  for(int i=0; i<N; i++){
    cin >> s[i];
  }cin >> M;
  vector<string>t(M);
  for(int i=0; i<M; i++){
    cin >> t[i];
  }for(int i=0; i<N; i++){
    countr=0;
    countb=0;
    string b=s[i];
    for(int j=0; j<N; j++){
      if(b == s[j]){
        countb+=1;
      }
    }for(int j=0; j<M; j++){
      if(b == t[j]){
        countr+=1;
      }
    }
    count=countb-countr;
    mx=max(mx,count);
  }
  if(mx >-1){
  cout << mx << endl;
  }else{
    cout << '0' << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

string S;
int D[4002], P[4002], n[4002], press[4002];
pair<int, int> E[4002];
int H[4002];

void dfs(int A, int from, int head) {
	if (D[head]) return;
	int ret1 = 0;
	int ret2 = 0;
	int ret3 = 0;
	int saidai = 0;
	for (int i = H[A]; i; i = E[i].second) {
		if (E[i].first != from) {
			dfs(E[i].first, A, i);
			ret1 += P[i] + n[i];
			ret2 += n[i];
			saidai = max(saidai, 2 * (P[i] + n[i]) - 2 * press[i]);
		}
	}
	if (saidai - ret1 < 0) ret3 = ret1 / 2;
	else ret3 = ret1 - saidai / 2;
	if (S[A - 1] == '1') ret2++;

	D[head] = 1;
	P[head] = ret1;
	n[head] = ret2;
	press[head] = ret3;
}

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


	int N;
	cin >> N;
	cin >> S;

	int kazu = 0;
	rep(i, N) if (S[i] == '1') kazu++;
	if (kazu == 1) {
		co(0);
		return 0;
	}

	int EN[2001] = {};
	for (int i = 1; i < 2 * N - 2; i += 2) {
		int a, b;
		cin >> a >> b;
		EN[a]++;
		EN[b]++;
		E[i] = mp(a, H[b]);
		H[b] = i;
		E[i + 1] = mp(b, H[a]);
		H[a] = i + 1;
	}

	bool OK = 0;
	int saishou = 1e9;
	rep1(j, N) {
		if (EN[j] > 1) {
			int p = 0;
			int saidai = 0;
			for (int i = H[j]; i; i = E[i].second) {
				dfs(E[i].first, j, i);
				p += P[i] + n[i];
				saidai = max(saidai, 2 * (P[i] + n[i]) - 2 * press[i]);
			}
			if (saidai <= p && p % 2 == 0) {
				OK = 1;
				saishou = min(saishou, p / 2);
			}
		}
	}

	if (OK) co(saishou);
	else co(-1);

	Would you please return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int N,A,s1=0,s2=0;
	cin>>N;
	for(int i=1;i<=N;i++)
	{
		cin>>A;
		if(A%2==0)
		{
		s1++;
		if(A%3==0||A%5==0)
		s2++;
		}
	}
	if(s1==s2)
	cout<<"APPROVED";
	else
	cout<<"DENIED";
	return 0;
}

Measured memory_bytes: 256
MOD=10**9+7

def nCr(n,r):
    """組み合わせ"""
    res=1
    fac=1
    for i in range(r):
        res *= n-i
        res %= MOD
        fac *= i+1
        fac %= MOD
    return res*pow(fac, MOD-2, MOD)%MOD

def main():
    X,Y=map(int,input().split())
    flag=0
    if (X+Y)%3!=0:
        flag=1
    n=(2*Y-X)//3
    m=(2*X-Y)//3
    if n<0 or m<0:
        flag=1
    if flag:
        print(0)
        exit()
    print(nCr(n+m,min(n,m)))

main()


Measured memory_bytes: 3064
#include<stdio.h>
#include<math.h>
int P_num(int);

int main(){
  int x,i,num,count=0;
  scanf("%d",&x);
  for(i=0;i<x;i++){
    scanf("%d",&num);
    if(P_num(num))count++;
  }
  printf("%d\n",count);
  return 0;
}

int P_num(int x){
  int i;
  for(i=2;i<=sqrt(x);i++){
    if(i==x)break;
    if(x%i==0)return 0;
  }
  return 1;
}



Measured memory_bytes: 2080
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>

using namespace std;

int main() {

    int N;
    cin >> N;

    vector<long> hs;
    long H;

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

    reverse(hs.begin(), hs.end());

    vector<int> ts;
    ts.push_back(0);
    for (int i = 1; i < N; ++i) {
        if (hs[i - 1] <= hs[i]) {
            ts.push_back(ts[i - 1] + 1);
        } else {
            ts.push_back(0);
        }
    }

    cout << *max_element(ts.begin(), ts.end()) << endl;

    return 0;
}


Measured memory_bytes: 1908
#include "bits/stdc++.h"
#define ll long long
#define mp(a, b) make_pair(a, b)
using namespace std;
typedef pair<ll, ll> pairs;
typedef pair<ll, pairs> tpl;
ll c[4];
double dp[301][301][301];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n, a;
    cin >> n;
    for (ll i = 0; i < n; i++)
        cin >> a, c[a]++;
    dp[0][0][0] = 0;
    for (ll i = 0; i <= n; i++)
    {
        for (ll j = 0; j <= n; j++)
        {
            for (ll k = 0; k <= n; k++)
            {
                double z = n - (i + j + k), val = 1;
                if (z == n)
                    continue;
                if (i + j + k > n)
                    continue;
                if (i > 0)
                    val += (1.0 * i / n) * dp[i - 1][j + 1][k];
                if (j > 0)
                    val += (1.0 * j / n) * dp[i][j - 1][k + 1];
                if (k > 0)
                    val += (1.0 * k / n) * dp[i][j][k - 1];
                if (z > 0)
                    val /= (1.0 - 1.0 * z / n);
                dp[i][j][k] = val;
            }
        }
    }

    cout << setprecision(9) << fixed << dp[c[3]][c[2]][c[1]];
}

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

class BIT{
private:
  int n;
  vector<LL> bit;
public:
  BIT(int n_){
	n = n_;
	bit.assign(n+1, 0);
  }

  LL max(int i){
	LL s = 0;
	while(i > 0){
	  maxi(s, bit[i]);
	  i -= i & -i;
	}
	return s;
  }

  void add(int i, LL x){
	while(i <= n){
	  maxi(bit[i], x);
	  i += i & -i;
	}
  }
};

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

  LL N;
  cin >> N;
  VL xs(N);
  REP(i,N) cin >> xs[i];

  BIT bit(N+1);
  LL ans = 0;
  REP(i,N){
	LL t = xs[i] + bit.max(xs[i]);
	maxi(ans, t);
	bit.add(xs[i], t);
  }
  cout << N * (N+1) / 2 - ans << endl;

  return 0;
}

Measured memory_bytes: 4404
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define SZ(x) (int)((x).size())
#define xx first
#define yy second
#define pii pair<int, int>

const int N = 3e3 + 1;

int r, c, k;
ll v[N][N], memo[4][N][N];

ll dp(int x, int y, int z) {
    if (x >= r || y >= c)
        return 0;
    if (memo[z][x][y] != -1)
        return memo[z][x][y];
    ll ans = max(dp(x + 1, y, 0), dp(x, y + 1, z));
    if (z < 3) {
        ll take = max(dp(x + 1, y, 0), dp(x, y + 1, z + 1));
        ans = max(ans, v[x][y] + take);
    }
    return memo[z][x][y] = ans;
}

void solve() {
    cin >> r >> c >> k;
    for (int i = 0; i < r; i++)
        fill(v[i], v[i] + c, 0);
    for (int i = 0; i < k; i++) {
        int x, y, z;
        cin >> x >> y >> z;
        --x, --y;
        v[x][y] = z;
    }
    for (int i = 0; i < 4; i++)
        for (int j = 0; j < r; j++)
            fill(memo[i][j], memo[i][j] + c, -1);
    ll ans = dp(0, 0, 0);
    cout << ans << '\n';
}
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    // int _; cin >> _; while (_--)
    solve();
    return 0;
}


Measured memory_bytes: 355796
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};

int main(void){
    int A[3][3];
    rep(i,3) rep(j,3) cin >> A[i][j];
    bool ok[3][3]={};
    int N;
    cin >> N;
    rep(i,N){
        int B;
        cin >> B;
        rep(j,3) rep(k,3) if(A[j][k]==B) ok[j][k]=true;
    }
    bool ans=false;
    rep(i,3){
        if(ok[i][0] && ok[i][1] && ok[i][2]) ans=true;
    }
    rep(i,3){
        if(ok[0][i] && ok[1][i] && ok[2][i]) ans=true;
    }
    if(ok[0][0] && ok[1][1] && ok[2][2]) ans=true;
    if(ok[0][2] && ok[1][1] && ok[2][0]) ans=true;
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
// n がnの各位の和で割り切れるかを判定
// string で受け取るか、10で割っていくかの２択
int main(){
  int k;
  cin >> k;
  int n = k;
  int ans = 0;
  while (true){
    if (n / 10 == 0){
      ans += n;
      break;
    }
    else{
      ans += n%10;
    }
    n /= 10;
  }
  //cout << ans << endl;
  if ((k % ans) == 0 ){
    cout << "Yes" << endl;
  }
  else cout << "No" << endl;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int N,K,ans=0;

int main(){
    cin>>N>>K;
    int h;
    rep(i,N){
        cin>>h;
        if(h>=K)ans++;
    }
    out(ans);
    
    
}


Measured memory_bytes: 256
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]

ans = 0
for i in range(N):
    ans += min(A[i], B[i])
    B[i] -= min(A[i], B[i])
    ans += min(A[i+1], B[i])
    A[i+1] -= min(A[i+1], B[i])

print(ans)

Measured memory_bytes: 18624
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
    for(auto i=begin(v); i != end(v); ++i){
        if(i !=begin(v)) os << ' ';
        os << *i;
    }
    return os;
}

vector<vector<ll>> E(10007);  //各点の持つ子の情報
ll color[10007];              //訪れ所の
bool B[100007];
list<ll> out;                 //トポロジカルソート済みの配列を入れる
ll N,M,a,b;                   //N:頂点数　M:エッジ数
ll indeg[100007];             //各点の入次数。訪問した回数だけ減っていく。

void bfs(ll s){
    queue<ll> Q;
    Q.push(s);
    B[s]=true;
    while(!Q.empty()){
        ll u=Q.front();
        Q.pop();
        out.pb(u);
        rep(i,E[u].size()){
            ll v=E[u][i];
            indeg[v]--;
            if(indeg[v]==0 && !B[v]){
                B[v]=true;
                Q.push(v);
            }
        }
    }
}

void topological_sort(){
    rep(i,N){     // 初期化
        indeg[i]=0;
    }
    rep(i,N){
        rep(j,E[i].size()){    //  入次数を持たせる
            indeg[E[i][j]]++;
        }
    }

    rep(i,N){
        if(indeg[i]==0 && !B[i]){
            bfs(i);
        }
    }
}

int main(){
    cin >> N >> M;
    rep(i,N){
        B[i]=false;
    }
    rep(i,M){
        cin >> a >> b;
        E[a].pb(b);
    }

    topological_sort();

    for(list<ll> :: iterator it=out.begin();it != out.end();it++){  // 出力
        cout << *it << endl;
    }
}


Measured memory_bytes: 4064
n, k = [int(e) for e in input().split(' ')]
h_list = [int(e) for e in input().split(' ')]

dp_list = [0]

for i in range(1, n):
    dist_min = float("inf")
    for j in range(max(0, i - k), i):
        dist = abs(h_list[i] - h_list[j]) + dp_list[j]
        dist_min = min(dist_min, dist)
    dp_list.append(dist_min)

print(dp_list[-1])  # 出力


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


int main(){
    string s; cin >> s;
    int n = s.size();
    ll now = 0;
    ll ans = 0;
    ll a[n+1]; rep(i,n+1) a[i] = 0LL;
    bool small_flag = true; // 前の項がsmallerだったか
    int bigcnt = 0;
    rep(i,n){
        if(s[i] == '<'){
            if(small_flag){
                a[i] = now;
                ++now;
            }else{
                now = 0;
                a[i] = 0;
                now++;
                // 遡及して更新
                if(bigcnt != 0){
                    rep(j,bigcnt) a[i-j-1] = a[i-j]+1;
                    if(i >= bigcnt+1 && a[i-bigcnt] <= a[i-bigcnt-1]) a[i-bigcnt] = a[i-bigcnt-1]+1;
                }
            }
            bigcnt = 0;
            small_flag = true;
        }else{
            now = 0;
            small_flag = false;
            bigcnt++;
        }
    }
    if(s[n-1] == '<') a[n] = a[n-1]+1;
    else{
        a[n] = 0;
        rep(j,bigcnt) a[n-j-1] = a[n-j]+1;
        if(n >= bigcnt+1 && a[n-bigcnt] <= a[n-bigcnt-1]) a[n-bigcnt] = a[n-bigcnt-1]+1;
    }
    rep(i,n+1) ans += a[i];
    cout << ans << endl;
}


Measured memory_bytes: 4740
x=int(input())
sosu=0
import math
for a in range(x,10**5+10):
    root_a=int(math.sqrt(a))
    for i in range(2,root_a+1):
        if a % i == 0:
            a=1
    if a!=1:
        sosu=a
        break
print(sosu)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <queue>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
#define MAX_N 100100
#define MOD 1000000007
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
// 四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

void  base_num(ll data,ll base){
    if(data==0) return;
    ll next=abs(data)%abs(base);
    if(data<0) next=(abs(base)-next)%abs(base);
    base_num((data-next)/base,base);
    cout << next;
}


int main(){
    ll n,ans=0;
    cin >> n;
    ll a[n*3];
    for (ll i=0;i<(n*3);i++){
        cin >> a[i];
    }
    sort(a,a+(n*3));
    for (ll i=n*3-2;i>=n;i-=2){
        ans+=a[i];
    }
    cout << ans << endl;
    return 0;
}
 
 


Measured memory_bytes: 2560
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>

using namespace std;

int main(){
  int a, b;
  cin >> a >> b;
  int cnt = 0;
  int now = 1;
  while(now < b){
    cnt++;
    now += a-1;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
#include <queue>
#include <map>
#include <set>
using namespace std;
using ll = long long;
const ll INF = 1<<30;
const ll MOD = (ll)1e9 + 7;
const ll MAX_N = (ll)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(ll i = 0; i < (ll) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

void solve()
{
    ll n; cin >> n;
    vector<ll> A(n + 1);
    for(ll i = 1; i <= n; i++) cin >> A[i];
    map<ll, pair<ll, ll>> mp;
    for(ll i = 1; i <= n; i++)
    {
        ll tmp = i + A[i];
        mp[tmp].first++;
    }
    ll ans = 0;
    for(ll i = 1; i <= n; i++)
    {
        ll tmp = i - A[i];
        mp[tmp].second++;
    }
    for(auto& x : mp)
    {
        ll cnt = x.second.first * x.second.second;
        ans += cnt;
    }
    cout << ans << endl;
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

Measured memory_bytes: 27308
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int N = sc.nextInt();
		int W = sc.nextInt();
		int[] a = new int[N * 2 + 1];
		a[1] += W / 2;
		for (int i = W / 2 + 1; i < W; ++i) {
			a[1]++;
			for (int j = i; j <= N; j += i) {
				if (j > i * 2) a[j - W + 1]++;
				a[j + 1]--;
			}
		}
		for (int i = W; i <= N; ++i) {
			a[i - W + 1]++;
			a[i + 1]--;
		}
		StringBuilder sb = new StringBuilder();
		for (int i = 1; i <= N - W + 1; ++i) {
			a[i] += a[i - 1];
			if (i != 1) sb.append(" ");
			sb.append(a[i]);
		}
		System.out.println(sb);
	}
}

Measured memory_bytes: 25948
local s=io.read()
local n=#s
local sum=0
for bit=0,(1<<(n-1))-1 do
    local tmp=0
    for i=1,n-1 do
        tmp=tmp*10
        tmp=tmp+s:byte(i)-48
        if bit&(1<<(i-1))>0 then
            sum=sum+tmp
            tmp=0
        end
    end
    tmp=tmp*10
    tmp=tmp+s:byte(n)-48
    sum=sum+tmp
end
print(sum)

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

string number[10] = {
    "0111111",
    "0000110",
    "1011011",
    "1001111",
    "1100110",
    "1101101",
    "1111101",
    "0100111",
    "1111111",
    "1101111"
};

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

    int n;
    while(cin >> n && n != -1){
        int prev = 0;
        for(int i = 0; i < n; ++i){
            int a;
            cin >> a;
            if(i == 0){
                cout << number[a] << endl;
            }
            else {
                for(int j = 0; j < 7; ++j){
                    if(number[prev][j] == number[a][j])
                        cout << 0;
                    else
                        cout << 1;
                }
                cout << endl;
            }
            prev = a;
        }
    }

   return 0;
}

Measured memory_bytes: 1212
#include<cstdio>

int main() {
    int d;

    scanf("%d", &d);

    if (d == 25) printf("Christmas\n");
    else if (d == 24) printf("Christmas Eve\n");
    else if (d == 23) printf("Christmas Eve Eve\n");
    else printf("Christmas Eve Eve Eve\n");

    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#define MIN(a,b) ((a<b)?(a):(b))
#define MAX(a,b) ((a>b)?(a):(b))
 
int main() {
    int n, k, sk, i;
    char s[20];
    scanf("%d %s %d", &n, s, &k);

    sk = s[k-1];
    for (i = 0; s[i]; i++) {
        if (s[i] != sk) {
            s[i] = '*';
        }
    }

    printf("%s", s);
    
    return 0;
}


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

int main()
{
  string s,t,u;
  int a, b;
  cin >> s >> t;
  cin >> a >> b;
  cin >> u;
  
  if (u == s)
  {
    a--;
  }
  else
  {
    b--;
  }
  
  cout << a << " " << b;
  return 0;
}


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

#define pb push_back
#define ff first
#define ss second

typedef long long ll;
typedef pair<int, int> pii;

const int mod = 1e9 + 7;

ll n, a[26], ans = 1;
string s;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n >> s;
	for (auto i : s)
		a[i - 'a']++;
	for (int i = 0; i ^ 26; i++)
		ans = (ans * (a[i] + 1)) % mod;
	cout << (ans - 1 + mod) % mod << endl;
	return 0;
}


Measured memory_bytes: 512
from collections import defaultdict
import numpy as np

N, M = map(int, input().split())
H = np.array(list(map(int, input().split())))
AB = []
dic = defaultdict(list)
for _ in range(M):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1  # 0-indexed
    AB.append((a, b))
    dic[a].append(b)
    dic[b].append(a)
# print('dic', dic)

ans = 0
for i in range(N):
    if dic.get(i, None) is None:
        ans += 1
        continue
    if H[i] > (H[[dic[i]]]).max():
        ans += 1
print(ans)


Measured memory_bytes: 53156
#include <bits/stdc++.h>
#define ii pair <int , int>
#define is pair <int, string>
#define ic pair <int, char>
#define ll long long
#define mx 100000
#define sf scanf
#define sf(n) scanf("%d",&n)
#define pf printf
using namespace std;
vector <int> v;

/*int intConvert(string s){
    int n;
    stringstream geek(s);
    geek >> n;
    return n;
}*/

/*string strConvert(int n){
    string s;
    stringstream ss;
    ss << n;
    s=ss.str();
    return s;
}*/


int main(){
    int n,m;
    sf(n);

    while(n--){
        int a;
        sf(a);
        v.push_back(a);
    }
    int len=v.size();
    int cnt=0;

    sf(m);
    while(m--){
        int a;
        sf(a);

        for(int i=0; i<len; i++){
            if(v[i]==a){
                cnt++;
                break;
            }
        }
    }
    pf("%d\n",cnt);

    return 0;
}



Measured memory_bytes: 3296
n, m = map(int, input().split())

limit = int(m**(0.5))
ans = 1
for d in range(1, limit+1):
    if m % d == 0:
        if m>=d*n:
            ans = max(ans,d)
        if m>=(m//d)*n:
            ans=max(ans,(m//d))

print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int H, W;
string a[110];
int cnt[26];

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> H >> W;
  for (int i = 0; i < H; i++) {
    cin >> a[i];
    for (int j = 0; j < W; j++) {
      cnt[a[i][j] - 'a']++;
    }
  }
  int g4 = (H / 2) * (W / 2);
  int g2 = (H * W - g4 * 4) / 2;
  int g1 = (H % 2) * (W % 2);
  for (int i = 0; i < 26; i++) {
    int tmp = min(g4, cnt[i] / 4);
    cnt[i] -= tmp * 4;
    g4 -= tmp;
  }
  for (int i = 0; i < 26; i++) {
    int tmp = min(g2, cnt[i] / 2);
    cnt[i] -= tmp * 2;
    g2 -= tmp;
  }
  for (int i = 0; i < 26; i++) {
    int tmp = min(g1, cnt[i]);
    cnt[i] -= tmp;
    g1 -= tmp;
  }
  cout << (g4 == 0 && g2 == 0 && g1 == 0 ? "Yes" : "No") << endl;

  return 0;
}

Measured memory_bytes: 256
n = int(input())
il = list(map(int, input().split()))
ans = 0
cnt = 0
for i in range(1, n):
    if il[i-1] >= il[i]:
        cnt += 1
    else:
        ans = max(ans, cnt)
        cnt = 0
ans = max(ans, cnt)
print(ans)


Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define sz size()
#define ll long long
#define all(_v) _v.begin(), _v.end()
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pvllvll pair <vector <ll>, vector <ll> >
#define ld long double
#define veci vector <int>
#define vecll vector <ll>


const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
const double PI = 3.1415926535897932384626433832795;
const double eps = 1e-9;
const int MOD1 = 1e9 + 7;
const int MOD2 = 998244353;

int p[(int)1e5+10];

int get(int v) {
    if(p[v] == v) return v;
    else return p[v] = get(p[v]);
}

void unite(int v, int u) {
    v = get(v), u = get(u);
    if(v == u) return;
    if(rand() & 1) p[v] = u;
    else p[u] = v;
}

void solve() {
    int n, m;
    cin >> n >> m;
    for(int i = 1; i <= n; ++i) p[i] = i;
    for(int i = 1; i <= m; ++i) {
        int u, v;
        cin >> u >> v;
        unite(u, v);
    }
    set <int> st;
    for(int i = 1; i <= n; ++i) st.insert(get(i));
    cout << (int)st.sz - 1;
}


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int T = 1;
    ///cin >> T;
    while(T--) solve(), cout << '\n';
    return 0;
}


Measured memory_bytes: 7840
#include<cstdio>
#include<vector>
#include<utility>
#define RI register int
#define CI const int&
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair <int,int> pi;
const int N=2005;
struct edge
{
	int to,nxt;
}e[N<<1];
int n,m,x,y,head[N],cnt,p[N][N],fa[N][N],ans,q[N]; bool g[N][N];
inline void addedge(CI x,CI y)
{
	e[++cnt]=(edge){y,head[x]}; head[x]=cnt;
	e[++cnt]=(edge){x,head[y]}; head[y]=cnt;
}
#define to e[i].to
inline void DFS(CI now,int* fa)
{
	for (RI i=head[now];i;i=e[i].nxt) if (to!=fa[now]) fa[to]=now,DFS(to,fa);
}
inline void insert(CI x,CI y)
{
	if (p[x][y]==y||p[y][x]==x) return;
	if (p[x][y]) return insert(p[x][y],y);
	if (p[y][x]) return insert(p[y][x],x);
	RI H=0,T=1,i; vector <pi> tp;
	g[x][y]=1; p[x][y]=y; q[1]=y;
	while (H<T)
	{
		int now=q[++H]; for (i=head[now];i;i=e[i].nxt) if (to!=fa[x][now])
		{
			if (!p[x][to]) p[x][to]=y,q[++T]=to; else 
			if (g[x][to]) g[x][to]=g[to][x]=0,tp.pb(mp(y,to));
		}
	}
	H=0,T=1; g[y][x]=1; p[y][x]=x; q[1]=x;
	while (H<T)
	{
		int now=q[++H]; for (i=head[now];i;i=e[i].nxt) if (to!=fa[y][now])
		{
			if (!p[y][to]) p[y][to]=x,q[++T]=to; else 
			if (g[y][to]) g[y][to]=g[to][y]=0,tp.pb(mp(x,to));
		}
	}
	for (vector <pi>:: iterator it=tp.begin();it!=tp.end();++it)
	insert(it->first,it->second);
}
inline void travel(CI now,int lst,int* fa)
{
	if (p[lst][now]==now) ++ans,lst=now;
	for (RI i=head[now];i;i=e[i].nxt) if (to!=fa[now]) travel(to,lst,fa);
}
int main()
{
	RI i,j; for (scanf("%d%d",&n,&m),i=1;i<n;++i)
	scanf("%d%d",&x,&y),addedge(x,y);
	for (i=1;i<=n;++i) DFS(i,fa[i]); for (i=1;i<=m;++i)
	scanf("%d%d",&x,&y),insert(x,y);
	for (j=1;j<=n;++j) for (i=head[j];i;i=e[i].nxt) travel(to,j,fa[j]);
	return printf("%d",ans>>1),0;
}

Measured memory_bytes: 38796
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
typedef long long ll;
using namespace std;

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


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<map>
#define int long long
using namespace std;
const int N=4e5+10;
map<int,int> Map;
int n,k,a[N],t[N],f[N],A[N],B[N],L[N],R[N],cc,ans=1e18,tt,rk[N];
void pushdown(int x) {if(t[x]) t[x<<1]=t[x<<1|1]=t[x],t[x]=0;}
void Cover(int x,int l,int r,int gl,int gr,int w)
{
	if(l>r||gl>gr) return;
	if(l>=gl&&r<=gr) {t[x]=w;return;}
	int mid=(l+r)>>1;pushdown(x);
	if(gl<=mid) Cover(x<<1,l,mid,gl,gr,w);
	if(gr>mid) Cover(x<<1|1,mid+1,r,gl,gr,w);
}
int Query(int x,int l,int r,int p)
{
	if(l==r) return t[x];
	int mid=(l+r)>>1;pushdown(x);
	return p<=mid?Query(x<<1,l,mid,p):Query(x<<1|1,mid+1,r,p);
}
int query(int x)
{
	int d=Query(1,1,tt,x);
	return !d?0:f[d]+((rk[L[d]]-rk[x])%k+k)%k;
}
signed main()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i]>>B[i],A[i]=A[i-1]+a[i];
		if(B[i]==1) L[++cc]=(-2*A[i-1]%k+k)%k,R[cc]=(-2*A[i]%k+k)%k;
		if(B[i]==1&&2*a[i]>k) return puts("-1"),0;
	}
	for(int i=1;i<=cc;i++) B[++tt]=L[i],B[++tt]=R[i];
	sort(B+1,B+tt+1);tt=unique(B+1,B+tt+1)-B-1;
	for(int i=1;i<=tt;i++) rk[i]=B[i],Map[B[i]]=i;
	for(int i=1;i<=cc;i++) L[i]=Map[L[i]],R[i]=Map[R[i]];
	for(int i=cc;i>=1;i--)
	{
		f[i]=query(L[i]);
		if(L[i]>R[i]) Cover(1,1,tt,R[i]+1,L[i]-1,i);
		else Cover(1,1,tt,1,L[i]-1,i),Cover(1,1,tt,R[i]+1,tt,i);
	}
	for(int i=1;i<=tt;i++) ans=min(ans,query(i));
	cout<<ans+2*A[n]<<endl;
}


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

using namespace std;

#define IO ios_base::sync_with_stdio(0);cin.tie(0);

int main()
{
  IO;
  string s; cin >> s;
  if (s.substr(0, 4) == "YAKI")
  cout << "Yes" << endl;
  else cout << "No" << endl;


  return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  map<int, int> mp;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    mp[x]++;
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    if (!mp.count(x) || mp[x] == 0) {
      cout << "NO" << endl;
      return 0;
    } else {
      mp[x]--;
    }
  }
  cout << "YES" << endl;
  return 0;
}

Measured memory_bytes: 9600