akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main()
{
    int n;
    cin >> n;
    if(n==7)
    {
        cout << "Yes\n";
        return 0;
    }
    for(int i=4; i<=n; i+=4)
    {
        for(int s=0; s<=n; s+=7)
        {
            if(n-(i+s)==0)
            {
                cout << "Yes\n";
                return 0;
            }
        }
    }
    cout << "No\n";
    return 0;
}

Measured memory_bytes: 256
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n = ii()

def factor(x):
    i = 2
    l = []
    while i**2 <= x:
        y = 0
        while x%i == 0:
            x/=i
            y+=1
        if y != 0:
            l.append([i,y])
        i+=1
    
    if x != 1:
        l.append([x,1])
    return l

l = factor(n)
# print(l)

ans = 0
for i in l:
    p = i[0]
    c = i[1]
    b = 1
    while c >= b:
        ans += 1
        c -= b
        b += 1

print(ans)

Measured memory_bytes: 63572
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
#include<bitset>
#include<map>

#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)

using namespace std;

typedef long long LL;
typedef double db;

int get(){
	char ch;
	while(ch=getchar(),(ch<'0'||ch>'9')&&ch!='-');
	if (ch=='-'){
		int s=0;
		while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
		return -s;
	}
	int s=ch-'0';
	while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
	return s;
}

const int N = 17;
const int L = 32800;
const int mo = 1e9+7;

LL f[L];
int t[L];
int co[N],cu[N];
int n,m;
LL c0[N],c1[N];
LL mi[300];
int cnt[L];
int s1[14350000],s2[14350000];
int it[N],sit[L];

inline LL add(LL x,LL y){
	return x+y>=mo?x+y-mo:x+y;
}

inline int trs(int x,int y){
	int ct=0;
	fo(i,0,n-1){
		ct=ct*3;
		if ((x&(1<<i))>0)ct=ct+1;
		if ((y&(1<<i))>0)ct=ct+2;
	}
	return ct;
}

int main(){
	n=get();m=get();
	fo(i,1,m){
		int x=get(),y=get();
		co[y]|=(1<<(x-1));
		cu[x]|=(1<<(y-1));
		it[y]++;
	}
	mi[0]=1;
	fo(i,1,m)mi[i]=mi[i-1]*2%mo;
	fo(i,1,(1<<n)-1)cnt[i]=cnt[i-(i&-i)]+1;
	fo(i,0,(1<<n)-1){
		for(int x=i;x<(1<<n);x=((x+1)|i)){
			int x_=x^i;
			int now=trs(i,x_);
			//s1
			fo(t,1,n)
			if (((1<<(t-1))&i)>0)s1[now]=s1[now]+cnt[cu[t]&x_];
			s1[now]=mi[s1[now]];
			//s2
			s2[now]=1;
			fo(t,1,n)
			if (((1<<(t-1))&x_)>0)s2[now]=1ll*s2[now]*(mi[cnt[cu[t]&i]]+mo-1)%mo;
		}
		fo(x,1,n)
		if ((i&(1<<(x-1)))>0)sit[i]+=it[x];
	}
	
	LL ans=0;
	fo(i,1,(1<<n)-1){
		f[i]=s2[trs(i,((1<<n)-1)^i)];
		if ((i&3)==3)ans=add(ans,f[i]*mi[m-sit[i]]%mo);	
	}
	fo(i,0,(1<<n)-1)
	if (f[i])
	for(int x=(i+1)|i;x<(1<<n);x=((x+1)|i)){
		int x_=i^x;
		int t1=trs(i,x_),t2=trs(x_,((1<<n)-1)^x);
			LL tmp=f[i]*s1[t1]%mo*s2[t2]%mo;
			f[x]=add(f[x],tmp);
			if ((i&3)==0&&(x&3)==3)ans=add(ans,tmp*mi[m-sit[x]]%mo);
	}
	ans=(mi[m]+mo-ans)%mo;
	printf("%lld\n",ans);
	return 0;
}

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

using namespace std;

static const int mod = 1000000007;

int main (void) {
    int N;
    cin >> N;
    vector<long long> A(N);
    for ( int i = 0; i < N; i++ ) {
        cin >> A.at(i);
    }

    long long ans = 0;
    for ( int i = 0; i < 60; i++ ) {
        long long n_one = 0;
        for ( int j = 0; j < N; j++ ) {
            if ( (A.at(j) >> i) & 1 ) {
                n_one++;
            }
        }
        long long now = (n_one * (N - n_one)) % mod;
        for ( int j = 0; j < i; j++ ) {
            now = (now * 2) % mod;
        }
        ans += now;
        ans %= mod;
    }

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


Measured memory_bytes: 5528
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
template<typename T>
struct BIT {
  int n;
  vector<T> d;
  BIT(int n=0):n(n),d(n+1) {}
  void add(int i, T x=1) {
    for (i++; i <= n; i += i&-i) {
      d[i] += x;
    }
  }
  T sum(int i) {
    T x = 0;
    for (i++; i; i -= i&-i) {
      x += d[i];
    }
    return x;
  }
  T sum(int l, int r) {
    return sum(r-1) - sum(l-1);
  }
};
int main() {
  int N;
  cin >> N;
  vector<P> B(N);
  ll cnt[51][51];
  ll ans = 0;
  for (int i = 0; i <= 50; i++) {
    for (int j = 0; j <= 50; j++) {
      cnt[i][j] = 0;
    }
  }
  for (int i = 0; i < N; i++) {
    string S; cin >> S;
    ll a = 0;
    for (int j = 0; j < (int)S.size(); j++) {
      if (S[j] != '.') {
        ll c = S[j] - '0';
        a = (a * 10) + c;
      }
    }
    int s = 0;
    for (int j = 0; j < (int)S.size(); j++) {
      if (S[j] == '.') {
        s = S.size() - j - 1;
        break;
      }
    }
    ll cnt2 = 0;
    ll cnt5 = 0;
    while (a % 2 == 0) {
      cnt2++;
      a /= 2;
    }
    while (a % 5 == 0) {
      cnt5++;
      a /= 5;
    }
    for (int j = 0; j <= 50; j++) {
      for (int k = 0; k <= 50; k++) {
        if (min(cnt2 - s + j - 25,cnt5 - s + k - 25) >= 0) {
          ans += cnt[j][k];
        }
      }
    }
    cnt[cnt2 + 25 - s][cnt5 + 25 - s]++;
  }
  cout << ans << endl;
  return 0;
}

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

long f(long x) {
    long res;
    if (x % 4 == 0) {
        res = 0;
    } else if (x % 4 == 1) {
        res = 1;
    } else if (x % 4 == 2) {
        res = 1;
    } else {
        res = 0;
    }

    if (x % 2 == 0) {
        res ^= x;
    }
    return res;
}

int main() {
    long a, b;
    cin >> a >> b;
    cout << (f(a - 1) ^ f(b)) << endl;
    return 0;
}

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

typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int H, A;

int main(){
   cin >> H >> A;
  if(H % A == 0){
    cout << H / A <<endl;
  }else{
    cout << H/A + 1 <<endl;
  }
}

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

int main()
{
	string S;

	cin >> S;

	for ( int i = 0; i < S.size(); i++ ) {
		if ( S[i] == '1' ) {
			cout << "9";
		} else {
			cout << "1";
		}
	}
	cout << endl;

	return ( 0 );
}


Measured memory_bytes: 256
def main():
    n = int(input())
    point_t = 0
    point_h = 0
    for _ in range(n):
        t, h = input().split()
        if t == h:
            point_t += 1
            point_h += 1
        elif t > h:
            point_t += 3
        else:
            point_h += 3

    print(point_t, point_h)

if __name__ == "__main__":
    main()

Measured memory_bytes: 5600
#include <bits/stdc++.h>
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n, x, m;
    cin >> n >> x >> m;
    vector<ll> mod(m, -1);
    vector<ll> s;
    x = x % m;
    mod[x] = 0;
    s.push_back(0);
    s.push_back(x);
    ll sum = x;
    ll cir, pr;
    for (int i = 1; i < n; i++) {
        ll t = x * x;
        t = t % m;
        x = t;
        if (mod[t] != -1) {
            cir = i - mod[t];
            pr = mod[t];
            ll cirs = s[i] - s[pr];
            sum += ((n - i) / cir) * cirs;
            sum += s[((n - i) % cir) + pr] - s[pr];
            break;
        } else {
            sum += t;
            s.push_back(sum);
            mod[t] = i;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 4584
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#define Inf 1000000000
#define nmax_def 110000
#define mod 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;

vl fact;
vl fact_back;
ll N;
void fact_ini() {
	fact[0] = 1;
	rep(i, nmax_def - 1) {
		fact[i + 1] = fact[i] * (i + 1);
		fact[i + 1] %= mod;
	}
	fact_back[N] = 1;
	for (int i = N; i > 1; i--) {
		fact_back[i - 1] = fact_back[i] * (i - 1);
		fact_back[i - 1] %= mod;
	}
	fact_back[0] = fact_back[1];
}

int main() {
	fact.resize(nmax_def);
	fact_back.resize(nmax_def);
	cin >> N;
	fact_ini();
	vl x(N);
	rep(i, N) {
		cin >> x[i];
	}
	vl xdiff(N-1);
	rep(i, N - 1) {
		xdiff[i] = x[i + 1] - x[i];
	}
	ll anstmp = fact[N - 1];
	ll ans = anstmp * xdiff[0];
	rep(i, N-2) {
		ll ansadd = fact[i + 1] * fact_back[i + 3];
		ansadd %= mod;
		anstmp += ansadd;
		anstmp %= mod;
		ans += (anstmp * xdiff[i + 1]);
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3584
#include<stdio.h>
#define rep(i,n) for(i=0; i<n; i++)
long long int choose2(long long int r){
	return r*(r-1)/2;
}

int main(void){
	long long int n, i=0;
	long long int total, ans=0;
	scanf("%lld", &n);
	long long int a[n], cut[n];

	rep(i,n){
		scanf("%lld",&a[i]);
		a[i]--;
		cut[i]=0;
	}
	rep(i,n) cut[a[i]]++;
	rep(i,n) ans += choose2(cut[i]);
	total = ans;
	rep(i,n){
		ans = total;
		ans -= choose2(cut[a[i]]);
		ans += choose2(cut[a[i]]-1);
		printf("%lld\n", ans);
	}
	return 0;
}

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


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	long long x;
	cin>>x;
	
	long long y = 100,z,ans = 0;
	
	while(y<x){
		z = y/100;
		y+=z;
		ans++;
	}
	
	cout<<ans<<"\n";
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
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; }
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int n;

void dfs(string s, char mx){
    if (s.length() == n) {
        printf("%s\n", s.c_str());
    } else {
        for (char c = 'a'; c <= mx; c++) {
            dfs(s+c, ((c==mx) ? (char)(mx+1) : mx));
        }
    }
}

int main() {

    cin >> n;
    dfs("", 'a');
    return 0;
}

Measured memory_bytes: 1536
#include<stdio.h>
#include<stdlib.h>
#define len 100005
typedef struct pp{
	char name[100];
	int t;
}p;
p q[len];
int head,tail,n;

void enqueue(p x){
q[tail]=x;
tail=(tail+1)%len;
} 
p dequeue(){
	p x=q[head];
	head=(head+1)%len;
	return x;
}
int min(int a,int b){
	return a<b?a:b;
}
int main(){
	int elaps=0,c;
	int i,e;
	p u;
	scanf("%d %d",&n,&e);
	for(i=1;i<=n;i++)
	{
		scanf("%s",q[i].name);
		scanf("%d",&q[i].t);
	}
	head=1;tail=n+1;
	while(head!=tail){
		u=dequeue();
		c=min(e,u.t);
		u.t-=c;
		elaps+=c;
		if(u.t>0) enqueue(u);
		else{
			printf("%s %d\n",u.name,elaps);
		}		
	}
	return 0;
}


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

int main() {
    uint N;
    cin >> N;
    vector<int> freq(1000000+1, 0);

    for (size_t i=0; i<N; ++i) {
        uint bin;
        cin >> bin;
        ++bin;  // add offset. -1->0, 0->1, 1->2...
        ++freq[bin-1];
        ++freq[bin];
        ++freq[bin+1];
    }
    auto maxIter = max_element(freq.begin(), freq.end());
    cout << *maxIter << endl;
    // size_t d = distance(freq.begin(), maxIter);
    // cout << ans << endl;
}


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

typedef long long ll;
#define REP(i, n, m) for(int i = n; i < m; i++)
#define REPR(i, n, m) for(int i = n; i >= m; i--)
#define LREP(i, n, m) for(ll i = n; i < m; i++)
#define LREPR(i, n, m) for(ll i = n; i >= m; i--)

#define P pair<int, int >


const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;



//---functions---//
int gcd(int a, int b){
    if(a < b) swap(a, b);
    return b?gcd(b, a%b):a;
}

int s2i(string num){stringstream ss; ss << num << flush; int n; ss >> n; return n;}
string i2s(int n){stringstream ss; ss << n << flush; return ss.str();}

bool firstCompare(const P& firstElof, const P& secondElof){
    return firstElof.first < secondElof.first;
}
bool secondCompare(const P& firstElof, const P& secondElof){
    return firstElof.second < secondElof.second;
}
//---------------//

double W, H, x, y;
int main(){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    cin >> W >> H >> x >> y;
    double area;
    int method;
    area = W * H / 2;
    if(x == W / 2 && y == H / 2) method = 1;
    else method = 0;
    cout << area << " " << method << '\n';
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const ll INF = (ll)(1e18);

int main(void){
  string s;
  cin >> s;
  ll n = s.size();
  ll ans = n;
  REP(i, n-1){
    if(s[i] != s[i+1]) chmin(ans, max(i+1, n-i-1));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 512
number = input()
length = len(number)
t = True
ans = 0
for i in range(length):
    if i > 0 and number[i] != '9':
        t = False
    if i == 0:
        ans += int(number[i])
    else:
        ans += 9

if t:
    print(ans)
else:
    print(ans-1)

Measured memory_bytes: 38256
N, M = map(int, input().split())
A = [-int(x) for x in input().split()]

import heapq
heapq.heapify(A)

for i in range(M) :
    amax = - heapq.heappop(A)
    amax //= 2
    heapq.heappush(A, -amax)

print(-sum(A))


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

int main() {
  int ans = 0,R,G,B,N;
  cin >> R >> G >> B >> N;
  for (int i = 0; i < N/R+1; i++){
    if (i*R>N){
      break;
    }
    for (int j = 0; j < N/G+1; j++){
      if (i*R+j*G>N){
        break;
      }
      if (R*i+G*j <= N and (N-R*i-G*j)%B==0){
        ans++;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

struct UnionFind{
    v: Vec<usize>
}

impl UnionFind{
    fn new(n: usize) -> UnionFind{
        let mut v: Vec<usize> = Vec::new();
        for i in 0..n{
         v.push(i);
        }
        UnionFind{v:v}
    }

    fn find(&mut self, i: usize) -> usize{
        if self.v[i] == i{
            i
        }else{
            let ni = self.v[i];
            self.v[i] = self.find(ni);
            self.v[i]
        }
    }

    fn union(&mut self, i: usize, j: usize){
        let root_i = self.find(i);
        let root_j = self.find(j);
        self.v[root_i] = root_j;
    }

}

struct CombMod{
    fac: Vec<u64>,
    inv: Vec<u64>,
    finv: Vec<u64>,
    mmod: u64,
}

impl CombMod{
    pub fn new(max: u64, m: u64) -> CombMod{
        let max: usize = max as usize;
        let mut fac: Vec<u64> = vec![0;max+1];
        let mut finv: Vec<u64> = vec![0;max+1];
        let mut inv: Vec<u64> = vec![0;max+1];

        fac[0] = 1;
        fac[1] = 1;
        finv[0] = 1;
        finv[1] = 1;
        inv[1] = 1;

        for i in 2..max+1{
            fac[i] = fac[i-1] * i as u64 % m;
            inv[i] = m - inv[m as usize %i] * (m/(i as u64)) % m;
            finv[i] = finv[i-1] * inv[i] % m;
        }

        CombMod{
            fac: fac,
            finv: finv,
            inv: inv,
            mmod: m,
        }
    }

    fn get(&self, n: u64, m: u64) -> u64{
        assert!(n >= m && n != 0 && m != 0);
        self.fac[n as usize] * self.finv[m as usize] % self.mmod
            * self.finv[(n-m) as usize] % self.mmod
    }
}

fn main(){
    let n = read_as_vec::<usize>()[0];

    let d = read_as_vec::<u64>();

    let mut ans = 0;
    for i in 0..d.len(){
        for j in i+1..d.len(){
            ans += d[i]*d[j];
        }
    }

    println!("{}", ans);

}


Measured memory_bytes: 4352
#include <stdio.h>

int main(void){
	int c,i,j,n,A[100],min,flag;
	
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		scanf("%d",&A[i]);
	}
	
	flag=0;
	
	for(i=0;i<n;i++){
		min=i;
		for(j=i;j<n;j++){
			if(A[j]<A[min]){
				min=j;
			}
		}
		c=A[i];
		A[i]=A[min];
		A[min]=c;
		if(A[min]!=A[i]){
			flag++;
		}
	}
	
	for(i=0;i<n;i++){
		if(i>0){
			printf(" ");
		}
		printf("%d",A[i]);
		if(i==n-1){
			printf("\n%d\n",flag);
		}
	}
	
	return 0;
}


Measured memory_bytes: 2092
#include <cstdio>
#define maxn 100010
using namespace std;
int n,c[maxn],ans;
int main() {
	scanf("%d",&n);
	for (int i=1;i<=n;i++) {
		int a;
		scanf("%d",&a);
		c[a]++;
	}
	int min=1;
	while (c[min]<=1&&min<=100000)
		min++;
	int max=100000;
	while (c[max]<=1&&max>=1)
		max--;
	ans=n;
	while (min<=max) {
		if (min==max&&c[min]==2) {
			ans-=2;
			break;
		}
		ans-=2;
		c[min]--; c[max]--;
		while (c[min]<=1&&min<=100000)
			min++;
		while (c[max]<=1&&max>=1)
			max--;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 512
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();
        int [] h = new int [N];
        for(int i=0; i<N; i++){
            h[i] = sc.nextInt();
        }
        Arrays.sort(h);
        long min = 0;
        long max = 1000000000;
        long mid = 0;
        while(max-min>1){
            mid = min+(max-min)/2;
            if(judge(mid,h,N,B,A-B)){
                max = mid;
            }else{
                min = mid;
            }
        }
        if(!judge(mid,h,N,B,A-B))mid++;
        System.out.println(mid);
    }
    static boolean judge(long mid, int[]h, int N, int B, double C){
        long Z=0;
        for(int i=N-1; i>=0; i--){
            long tmp = h[i]-mid*B;
            if(tmp>0){
                Z+=((long)(Math.ceil(tmp/C)));
            }else{
                break;
            }
        }
        if(Z>mid)return false;
        return true;
    }
}

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

int main() {
	int n, a, b, c = 1, x = 0;
	cin >> n >> a;
	for (int i = 1; i < n; i++) {
		cin >> b;
		if (b == a) continue;
		if (x != 0) {
			if (x == 1 && b<a || x == -1 && b>a) {
				x = 0;
				c++;
			}
		}
		else x = b > a ? 1 : -1;
		a = b;
	}
	cout << c << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair < int , pair < int , int > > mp;

#define rep(i , j , n) for(long long i = j ; i <= n ; i++)
#define per(i , j , n) for(long long i = j ; i >= n ; i--)
 
const ll N = 123456;
const ll mod = 1e9 + 7;
const ld eps = 1e-6;
const ld pi = 3.1415926535;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    cout << fixed << setprecision(12);

    string s , t;

    cin >> s >> t;

   	int cnt = 0;

   	rep(i , 0 , s.length() - 1) 
   	{
   		if(s[i] == t[i]) {
   			cnt++;
   		}
   	}

   	cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

ll X[311];
int p[7] = {2,3,5,7,11,13,17};
int pw[7];
int F[311][7];
int P[311];
int SC[311];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	for(int i=0;i<n;i++)
	{
		int u,v; cin>>u>>v;X[u]=v;
	}
	int prod=1;
	for(int i=0;i<7;i++)
	{
		int cur=300;
		while(cur>=p[i])
		{
			cur/=p[i];
			pw[i]++;
		}
		pw[i]++;
		prod*=pw[i];
	}
	for(int i=1;i<=300;i++)
	{
		int cur=i;
		for(int j=0;j<7;j++)
		{
			while(cur%p[j]==0)
			{
				cur/=p[j];
				F[i][j]++;
			}
		}
		P[i] = cur;
	}
	ll res=0;
	for(int z=0;z<prod;z++)
	{
		int cur=z;
		int v[7]={0,0,0,0,0,0,0};
		memset(SC,0,sizeof(SC));
		for(int j=0;j<7;j++)
		{
			v[j] = cur%pw[j];
			cur/=pw[j];
		}
		ll sum=0;
		for(int i=1;i<=300;i++)
		{
			bool pos=1;
			for(int j=0;j<7;j++)
			{
				if(v[j]<F[i][j])
				{
					pos=0; 
				}
			}
			if(pos)
			{
				if(P[i]==1) sum+=X[i];
				else SC[P[i]]+=X[i];
			}
			/*
			if(P[i]==1)
			{
				sum+=X[i];
			}
			else
			{
				SC[P[i]]+=X[i];
			}
			*/
		}
		for(int i=1;i<=300;i++)
		{
			if(SC[i]>=0) sum+=SC[i];
		}
		res=max(res,sum);
	}
	//cerr<<mf.maxflow(s,e)<<'\n';
	cout<<res<<'\n';
}	


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

using namespace std;

const int N = 100005;

int hp[N], sp[N];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k, q;
    cin >> n >> k >> q;
    for(int i = 1; i <= n; ++i) hp[i] = k;
    for(int i = 1; i <= q; ++i) {
        int x;
        cin >> x;
        sp[1] -= 1;
        sp[x] += 1;
        sp[x + 1] -= 1;
    }
    int cnt = 0;
    for(int i = 1; i <= n; ++i) {
        cnt += sp[i];
        hp[i] += cnt;
    }
    for(int i = 1; i <= n; ++i)
        cout << ((hp[i] > 0) ? "Yes\n" : "No\n");
    return 0;
}


Measured memory_bytes: 1408
object Main {
  trait Monoid[A]{
    def op(a1: A, a2: A): A
    def zero: A
  }

  class SegmentTree[A](val numOfNode: Int, val M: Monoid[A]){

    sealed trait Tree{ val value: A }
    case object Leaf extends Tree{ val value: A = M.zero }
    case class Node(value: A, left: Tree, right: Tree) extends Tree
    object Node {
        def apply(value: A) = new Node(value, Leaf, Leaf)
        def apply(l: Tree, r: Tree) = new Node(M.op(l.value,r.value),l,r)
    }

    private val empty: Node = Node(M.zero,Leaf,Leaf)
    private[this] var root: Tree = empty

    private def updateRec(id: Int, x:A, l: Int = 0, r: Int = numOfNode, t: Tree = root): Tree = {
        def branch(now: Node): Node = {
            val m = (l + r)/2
            if(r-l<=1)Node(x)
            else if(id < m)Node(updateRec(id,x,l,m, now.left), now.right)
            else Node(now.left,updateRec(id,x,m,r,now.right))
        }
        t match {
            case now: Node => branch(now)
            case now: Tree => branch(empty)
            case _ => empty
        }
    }

    def update(id: Int, x: A): Unit = {
        root = updateRec(id, x)
    }

    def query(a: Int, b: Int, l: Int = 0, r: Int = numOfNode, t: Tree = root): A = {
      val m = (l + r)/2
      t match {
        case now: Node =>
          if(b<=l || r<=a)M.zero
          else if(a<=l && r<=b)now.value
          else M.op(query(a,b,l,m,now.left),query(a,b,m,r,now.right))
        case _ => M.zero
      }
    }
  }

  def main(args: Array[String]): Unit = {
    val line = scala.io.StdIn.readLine.split(" ").map(_.toInt)
    val n = line(0)
    val q = line(1)
    val m = new Monoid[Int]{
        def op(a1: Int, a2: Int): Int = a1 min a2
        def zero: Int = Int.MaxValue
    }

    val segtree = new SegmentTree[Int](n,m)

    for(i <- 1 to q){
        val input = scala.io.StdIn.readLine.split(" ").map(_.toInt)
        val x = input(1)
        val y = input(2)
        if(input(0)==0)segtree.update(x,y)
        else println(segtree.query(x,y+1))
    }
  }
}

Measured memory_bytes: 193652
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FScanner sc = new FScanner();
		int N = sc.nextInt();
		int[] vary = new int[N];
		for (int i = 0; i < N; i++) {
			vary[i] = sc.nextInt();
		}
		Arrays.sort(vary);
		double ret = (double) (vary[0] + vary[1]) / 2;
		for (int i = 2; i < N; i++) {
			ret = (double) (ret + vary[i]) / 2;
		}
		System.out.println(ret);

	}

}

class FScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

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

Measured memory_bytes: 21332
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

sosuu=[]
for i in range(1,10**5,2):
  if is_prime(i):
    if is_prime((i+1)//2):
      sosuu.append(i)
sosuu1=[0]*(10**5+1)
for i in range(2,10**5):
  sosuu1[i]=sosuu1[i-1]
  if i in sosuu:
    sosuu1[i]+=1
N = int(input())
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]
for i in range(N):
  print(sosuu1[y[i]]-sosuu1[x[i]-2])

Measured memory_bytes: 63588
(defvar *N* nil)
(setf *N* (read))

(defvar *count* *N*)
(defvar *list1* (list nil))
(dotimes (x 10)
  (declare (ignore x))
  (if (= (mod *count* *N*) 0)
      (push *count* *list1*))
  (setq *count* (+ *count* *N*)))

(setq *list1* (cdr (reverse *list1*)))

(setq *count* *N*)
(defvar *list2* (list nil))
(dotimes (x 10)
  (declare (ignore x))
  (when (= (mod *count* 2) 0)
      (push *count* *list2*))
  (setq *count* (+ *count* *N*)))

(setq *list2* (cdr (reverse *list2*)))


(dolist (x *list1*)
  (dolist (y *list2*)
    (if (= x y)
        (progn (format t "~d~%" x)
               (sb-ext:quit)))))



Measured memory_bytes: 16100
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")

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

#define pb push_back
#define F first
#define S second
#define f(i,a,b)  for(int i = a; i < b; i++)

using ll = long long;
using db = long double;
using ii = pair<int, int>;

const int N = 1e6 + 5, LG = 19, MOD = 1e9 + 7;
const int SQ =225;
const long double EPS = 1e-7;

ll XL, XR;
ll L, R;

int dp[66][2][2];

int solve(int i, bool f2, bool f3){
  if(i < 0)
    return 1;
  int &ret = dp[i][f2][f3];
  if(~ret)
    return ret;
  ret = 0;
  int val = (XR >> i & 1);
  int val2 = (XL >> i & 1);
  f(a,0,2)
    f(b,a,2){
      if(a <= val2 || f3){
        if(b <= val || f2){
          ret += solve(i - 1, f2 | (b < val), f3 | (a < val2));
          if(ret >= MOD)ret -= MOD;
        }
      }
    }
  return ret;
}

int solve(ll x1,ll x2){
  memset(dp, -1, sizeof dp);
  XL = x1;
  XR = x2;
  bool ok = false;
  bool ok2 = false;
  int ret = 0;
  for(int i = 59; i >= 0; --i){
    if(XL >> i & 1 || ok){
      ret += solve(i-1,ok2,ok);
      if(ret >= MOD)ret -= MOD;
    }
    ok |= (XL >> i & 1);
    ok2 |= (XR >> i & 1);
  }
  return ret;
}

int32_t main(){
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
//  cout << solve(R,R) << '\n';
  cin >> L >> R;
  cout << (solve(R,R) - solve(L-1,R) + MOD) % MOD << '\n';

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int x,y,z;
int main() {
  scanf("%d%d%d",&x,&y,&z);
  if (x%2==0 || y%2==0 || z%2==0) puts("0"); else
    if (x>=y && x>=z) printf("%lld\n",1LL*y*z); else
      if (y>=x && y>=z) printf("%lld\n",1LL*x*z); else printf("%lld\n",1LL*x*y);
  return 0;
}


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

#define Need_For_Speed ios_base::sync_with_stdio;cin.tie(NULL);cout.tie(NULL);

#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define sz size()
#define fi first
#define se second

#define batr ONLINE_JUDGE
#define all(x) (x).begin(),(x).end()
#define skip continue

using namespace std;

string s, r;
map <char, bool> used, used2;

int dp[34];

int main () {
	Need_For_Speed;
	cin >> s;
	for (int i = 0; i < s.sz; i++) {
		used[s[i]] = 1;
	}
	if (s.sz < 26) {
		for (char a = 'a'; a <= 'z'; a++) {
			if (!used[a]) {
				cout << s << a;
				return 0;
			}
		}
	}
	for (int i = s.sz - 1; i >= 0; i--) {
		int h = -1;
		for (int j = s[i] - 'a' + 1; j < 26; j++) {
			if (!used[j + 'a']) {
				h = j;
				break;
			}
		}
		if (h != -1) {
			for (int j = 0; j < i; j++) {
				cout << s[j];
			}
			cout << char(h + 'a');                
			return 0;
		}
		used[s[i]] = 0;
	}
	cout << -1;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  using namespace std;
  const int maxn = 500000;
  struct arc {
      int u,v,w;
      bool used,mark,del;
      arc(int x = 0,int y = 0,int z = 0) {
          u = x;
         v = y;
         w = z;
         mark = del = used = false;
     }
     bool operator<(const arc &tmp) const {
         return w < tmp.w;
     }
 } e[maxn];
 int uf[maxn],n,m,cnt;
 bool nui[maxn];
 int Find(int x) {
     return uf[x] = uf[x] == x?uf[x]:Find(uf[x]);
 }
 int kruskal(bool &Unique,bool first) {
     int ans = cnt = 0;
     for(int i = 0; i <= n; ++i) uf[i] = i;
     for(int i = 0; i < m; ++i) {
        if(!first && e[i].del) continue;
        int fx = Find(e[i].u);
         int fy = Find(e[i].v);
       if(fx == fy) continue;
       uf[fx] = fy;
       ans += e[i].w;
       if(first) {
           e[i].used = true;
           if(e[i].mark) Unique = false;
       }
         if(++cnt == n-1) return ans;
     }
     return ans;
 }
 int main() {
     int u,v,w;
     while(~scanf("%d %d",&n,&m)) {
         for(int i = 0; i < m; ++i) {
             scanf("%d %d %d",&u,&v,&w);
             e[i] = arc(u,v,w);
         }
         memset(nui,false,sizeof(nui));
         sort(e,e+m);
         for(int i = 1; i < m; ++i)
             if(e[i].w == e[i-1].w) e[i].mark = e[i-1].mark = true;
         bool Unique = true;
         int MST = kruskal(Unique,true);
         if(Unique) printf("%d %d\n",n-1,MST);
         else {
             int mst = 0,ne = 0;
             for(int i = 0; i < m; ++i) {
                 if(e[i].used && e[i].mark) {
                     e[i].del = true;
                     int tmp = kruskal(Unique,false);
                     if(tmp == MST && cnt == n-1) nui[i] = true;
                     e[i].del = false;
                 }
               if(e[i].used && !nui[i]) {
                     ne++;
                     mst += e[i].w;
                 }
             }
             printf("%d %d\n",ne,mst);
        }
     }
     return 0;
 }

Measured memory_bytes: 9888
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
using graph = vector<vector<ll>>;


int main() {
	ll n;
	cin >> n;
	n = n % 10;
	if (n == 3) {
		cout << "bon" << endl;
	}
	else if (n == 0 || n == 1 || n == 6 || n == 8) {
		cout << "pon" << endl;
	}
	else {
		cout << "hon" << endl;
	}
	return 0;
}

Measured memory_bytes: 3676
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


typedef pair<ll,ll> P;

ll N,K;
ll dp[105][70000];
vector<P> V;
map<ll,ll> MAP;


int main(){

	scanf("%lld %lld",&N,&K);

	for(ll i = 1; i*i <= N; i++){

		V.push_back(P(i,0));
		V.push_back(P(N/i,0));
	}
	sort(V.begin(),V.end());
	V.erase(unique(V.begin(),V.end()),V.end());

	for(ll i = 0; i < V.size()-1; i++){

		ll left = N/V[i+1].first+1;
		ll right = N/V[i].first;

		V[i].second = right-left+1;	//区間長
	}
	V.back().second = 1; //1

	for(ll i = 0; i < V.size(); i++){

		MAP[V[i].first] = i;
	}

	for(ll i = 0; i <= K; i++){
		for(ll a = 0; a < V.size(); a++){

			dp[i][a] = 0;
		}
	}

	dp[0][MAP[N]] = 1; //dp[数列の長さ][N/xの値] = 場合の数

	for(ll i = 0; i < K; i++){
		//累積和
		for(ll p = V.size()-2; p >= 0; p--){

			dp[i][p] += dp[i][p+1];
			dp[i][p] %= MOD;
		}
		for(ll p = 0; p < V.size(); p++){ //p:遷移先

			ll loc = MAP[N/V[p].first]; //loc:遷移元

			dp[i+1][p] += (dp[i][loc]*V[p].second)%MOD;
			dp[i+1][p] %= MOD;
		}
	}

	ll ans = 0;
	for(ll i = 0; i < V.size(); i++){

		ans += dp[K][i];
		ans %= MOD;
	}

	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 60276
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
	int R,G,B,N;
	cin>>R>>G>>B>>N;

	int ans=0;
	int NR=N/R+1;
	int NG=N/G+1;
	int NB=(N-R-G)/B+1;
	for (int r=0;r<=NR;r++){
		if (R*r>N){
			break;
		}
		for (int g=0;g<=NG;g++){
			if (R*r+G*g>N){
				break;
			}
			int b=(N-R*r-G*g)/B;
			int N1=R*r+G*g+B*b;
			if (N1==N){
				ans++;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<functional>

using namespace std;
typedef pair<int, int> P;
int n, m;
vector<vector<P>> E;//to cost

int djk(int s, int e) {
	int d[20];
	for (int i = 0; i < n; i++)d[i] = 1000000000;
	d[s] = 0;
	priority_queue<P, vector<P>, greater<P>> pq;
	pq.emplace(0, s);
	while (pq.size()) {
		P tmp = pq.top(); pq.pop();
		int t = tmp.second;
		if (d[t] < tmp.first)continue;
		for (int i = 0; i < E[t].size(); i++) {
			if (d[E[t][i].first] > d[t] + E[t][i].second) {
				d[E[t][i].first] = d[t] + E[t][i].second;
				pq.emplace(d[E[t][i].first], E[t][i].first);
			}
		}
	}
	return d[e];
}

int main() {
	cin >> n >> m;
	E.resize(n);
	for (int i = 0; i < m; i++) {
		char ch;
		int a, b, c, d;
		cin >> a >> ch >> b >> ch >> c >> ch >> d;
		a--, b--;
		E[a].push_back(make_pair(b, c));
		E[b].push_back(make_pair(a, d));
	}
	int a, b, c, d;
	char ch;
	cin >> a >> ch >> b >> ch >> c >> ch >> d;
	a--, b--;
	cout << c - d - djk(a, b) - djk(b, a) << endl;
	return 0;
}

Measured memory_bytes: 3004
from collections import Counter

n,k = map(int,input().split())
A = list(map(int,input().split()))

D = Counter(A)
K = []
for key in D.keys():
    K.append(key)
if len(set(K)) <= k:
    print(0)
else:
    V = []
    for v in D.values():
        V.append(v)
    V.sort(reverse=True)
    print(n-sum(V[:k]))

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

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

    vector<int> l(Q), r(Q);
    for (int i = 0; i < Q; i++){
        cin >> l[i] >> r[i];
    }

    vector<int> sum(N + 1, 0);

    for (int i = 1; i < N; i++){
        if(S[i-1] == 'A' && S[i] == 'C'){
            sum[i+1] = sum[i] + 1;
        }else{
            sum[i+1] = sum[i];
        }
    }

    for (int i = 0; i < Q; i++){
        int ans = sum[r[i]]-sum[l[i]];
        cout << ans << endl;
    }
    
}

Measured memory_bytes: 2176
#include <stdio.h>
#include <math.h>
#include <string.h>
int main(void){
  char s[10100];
  int n=0,so=0,w=0,e=0;
  scanf("%s",s);
  int len=strlen(s);
  for(int i=0;i<len;i++){
    if(s[i]=='N') n=1;
    else if(s[i]=='S') so=1;
    else if(s[i]=='W') w=1;
    else if(s[i]=='E') e=1;
  }
  if(so==1&&n==0) printf("No");
  else if(so==0&&n==1) printf("No");
  else if(e==0&&w==1) printf("No");
  else if(w==0&&e==1) printf("No");
  else printf("Yes");
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);};};
const ll MOD = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<62;


int main(void) {

    int x,y;
    cin>>x>>y;
    ll ans=0;

    if(x==1)ans+=300000;
    else if(x==2)ans+=200000;
    else if(x==3)ans+=100000;

    if(y==1)ans+=300000;
    else if(y==2)ans+=200000;
    else if(y==3)ans+=100000;

    if(x==y&&x==1)ans+=400000;
    fin(ans);
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include<climits>
#include<stack>
#include<queue>
#include<unordered_map>
#include<map>
#include<set>

#define loopi(x,y) for(int i = x;i<(y);i++)
#define rloopi(x,y) for(int i = x;i>=(y);i--)
#define rloopj(x,y) for(int j = x;j>=(y);j--)
#define loopj(x,y) for(int j = x;j<(y);j++)


#define nl cout<<"\n";
#define ll long long int
using namespace std;
#define mod  1000000007


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

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	char a;
	cin >> a;

	if (a <= 90)
		cout << "A";
	else
		cout << "a";

	return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(),(x).end()
using ll = long long;
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 int M = 1000005;

int main() {
	ll n; cin >> n;
	
	vector<ll> a(n), b(0); rep(i,n) cin >> a[i];
	sort(all(a));
	
	vector<int> cnt(M, 0);
	
	rep(i,n){
		
		if(cnt[a[i]]){
			cnt[a[i]] = 2;
			continue;
		}
		
		for(int j = a[i]; j < M; j += a[i]) cnt[j]++;
	}
	
	int ans = 0;
	
	rep(i,n) if(cnt[a[i]] == 1) ans++;
	
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 8796
import java.util.*;

public class Main {	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		HashMap<Character, Integer> table = new HashMap<Character, Integer>();
		table.put('I',1);
		table.put('V',5);
		table.put('X',10);
		table.put('L',50);
		table.put('C',100);
		table.put('D',500);
		table.put('M',1000);
		while(sc.hasNext()){
			String line = sc.nextLine();
			StringBuilder sb = new StringBuilder(line);
			int result=0 , sum , nowNum , nextNum;
			sum = table.get(sb.charAt(0));
			for(int i=0; i<sb.length()-1; i++){
				nowNum = table.get(sb.charAt(i));
				nextNum = table.get(sb.charAt(i+1));
				if ( nowNum == nextNum )
					sum += nowNum;
				else if ( nowNum > nextNum ) {
					result += sum;
					sum = nextNum;
				} else {
					result += nextNum - sum;
					sum = 0;
				}
			}
			result += sum != 0 ? sum : 0;
			System.out.println(result);
		}
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;
ll L[100];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int N;
    cin >> N;
    for(int i = 0; i < N; i++) cin >> L[i];
    int ans = 0;
    for(int i = 0; i < N; i++){
        for(int j = i+1; j < N; j++){
            for(int k = j+1; k < N; k++){
                vector<int> v;
                v.push_back(L[i]);
                v.push_back(L[j]);
                v.push_back(L[k]);
                sort(v.begin(), v.end());
                if(v[0] == v[1]) continue;
                if(v[1] == v[2]) continue;
                if(v[0]+v[1] > v[2]) ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3644
#include<map>
#include<ctime>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define mp make_pair
using namespace std;

map<pair<int,int>,int> m;

struct dsu
{
    int fa[200010],rank[200010];
    
    void init(int n)
    {
        for(int i=1;i<=n;i++)
        {
            fa[i]=i;
        }
    }
    
    int find(int x)
    {
        if(fa[x]==x)
        {
            return x;
        }
        return fa[x]=find(fa[x]);
    }
    
    void union_(int x,int y)
    {
        int fx=find(x);
        int fy=find(y);
        if(fx==fy)
        {
            return ;
        }
        if(rank[fx]<rank[fy])
        {
            fa[fx]=fy;
        }
        else
        {
            fa[fy]=fx;
            if(rank[fx]==rank[fy])
            {
                rank[x]++;
            }
        }
    }
    
    int same(int x,int y)
    {
        return find(x)==find(y);
    }
}a,b;

int main()
{
    //give the fucking vjudge a flying fucking
    int n,x,y;
    scanf("%d%d%d",&n,&x,&y);
    a.init(n);
    b.init(n);
    int from,to;
    for(int i=1;i<=x;i++)
    {
        scanf("%d%d",&from,&to);
        a.union_(from,to);
    }
    for(int i=1;i<=y;i++)
    {
        scanf("%d%d",&from,&to);
        b.union_(from,to);
    }
    for(int i=1;i<=n;i++)
    {
        m[mp(a.find(i),b.find(i))]++;
    }
    for(int i=1;i<=n;i++)
    {
        printf("%d ",m[mp(a.find(i),b.find(i))]);
    }
}

Measured memory_bytes: 15104
N = gets.to_i
S = gets

str = S.split('')
m = 0

N.times do |n|
  x = str[0..n]
  y = str[n+1..N]
  s = (x.to_a.uniq & y.to_a.uniq).size
  m = [s, m].max
end

puts m


Measured memory_bytes: 3836
#include <stdio.h>

int main(void)
{
	int count=0;
	int i,a,b,c;
	scanf("%d %d %d", &a, &b, &c);
	
	for (i=a; i<=b; i++){
		if (c%i==0){
			count++;
		}
	}
	printf("%d\n", count);
	
	return 0;
}

Measured memory_bytes: 596
N=int(input())
P=list(map(int,input().split()))
I=[0]*N
for i,p in enumerate(P):
    I[N-p]=i
class BIT:
    def __init__(self,size):
        self.N=size
        self.v=[0]*(self.N+1)
    def add(self,i,x):
        i+=1
        while i<=self.N:
            self.v[i]+=x
            i+=i&-i
    def sum(self,a,b=0):
        if a>b:
            a,b=b,a
        if a>0:
            r=self.sum(b)-self.sum(a)
        else:
            r=0
            i=b
            while i>0:
                r+=self.v[i]
                i-=i&-i
        return r
    def right(self,x):
        a,b=x+1,self.N
        while a+1<b:
            t=(a+b)//2
            if self.sum(a,t)>0:
                b=t
            else:
                a=t
        return a 
    def left(self,x):
        a,b=0,x
        while a+1<b:
            t=(a+b)//2
            if self.sum(t,b)>0:
                a=t
            else:
                b=t
        return a
b=BIT(2**17)
b.add(0,N+1)
b.add(1,N+1)
b.add(N+2,N+1)
b.add(N+3,N+1)
a=0
p=N
for i in I:
    l=b.left(i+2)
    ll=b.left(l)
    r=b.right(i+2)
    rr=b.right(r)
    if 1<l and r<N+2:
        a+=((l-ll)*(r-i-2)+(rr-r)*(i+2-l))*p
    elif 1<l:
        a+=(l-ll)*(N-i)*p
    elif r<N+2:
        a+=(rr-r)*(i+1)*p
    b.add(i+2,p)
    p-=1
print(a)

Measured memory_bytes: 61964
// 有點不耐煩會破壞偉大的計劃

#include <bits/stdc++.h>

#define append push_back

using namespace std;
using ll = long long;

const int N = 1e5 + 3;
const int M = 1e6 + 7;
const long long MOD = 1e9 + 7;
const long long INF = 1e14 + 9;
const int SM = 1e3 + 5;
const int logN = 22, BL = 400;
const double EPS = 1e-9, PI = acos(-1);
const int dx[] = {1, 0, 0, -1, -1, 1, -1, 1};
const int dy[] = {0, 1, -1, 0, -1, 1, 1, -1};

void debug() {
	cerr << "\n";
}
template<typename Type1, typename... Type2>
void debug(Type1 a, Type2... b) {
    cerr << a << " ";
    debug(b...);
}

long long n, k, q, p[N];

int main() {
//    freopen(".in", "r", stdin);
//    freopen(".out", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    cin >> n >> k >> q;

    while(q--) {
        long long x; cin >> x;

        if(x > 1) {
            p[1]--;
            p[x]++;
        }

        if(x < n) {
            p[x + 1]--;
            p[n + 1]++;
        }
    }

    for(long long i = 1; i <= n; i++) {
        p[i] += p[i - 1];

        if(p[i] + k > 0) cout << "Yes\n";
        else cout << "No\n";
    }

    return 0;
}


Measured memory_bytes: 4420
/*
 * author :Sadik Hassan(_sad_)
 *
*/
#include "bits/stdc++.h"
using namespace std;
using   ll       =    long long;
using   ld       =    long double;
#define nl            "\n"
#define pb            push_back
#define fi            first
#define se            second
#define MP            make_pair
#define PI            (acos(-1.0))
#define rep1(i,n)     for(int i=1;i<=n;i++)
#define rep(i,n)      for(int i=0;i<n;i++)
#define SZ(s)         (int)s.size()
#define all(x)        (x).begin(), (x).end()
#define rall(x)       (x).rbegin(), (x).rend()
#define w(t)          int t;cin>>t;while(t--)
#define TSU(s)        transform(s.begin(),s.end(),s.begin(),::toupper);
#define TSL(s)        transform(s.begin(),s.end(),s.begin(),::tolower);
#define _SAD()     	  ios::sync_with_stdio(0),cin.tie(0),cout.tie(0),cout<<fixed<<setprecision(15);

typedef vector<int>vi;
typedef vector<ll>vii;
typedef set<int>si;
typedef set<ll>sii;
/*---------------------------------------------------------------------*/

const int N = (int)1e6+1;
const ll MOD =(ll)1e9+1147483647;
const ll INF = (ll)1e18+5;

int main()
{
    _SAD()
    int x;
    cin>>x;
    if(x<=599)cout<<8<<nl;
    else if(x<=799)cout<<7<<nl;
    else if(x<=999)cout<<6<<nl;
    else if(x<=1199)cout<<5<<nl;
    else if(x<=1399)cout<<4<<nl;
    else if(x<=1599)cout<<3<<nl;
    else if(x<=1799)cout<<2<<nl;
    else if(x<=1999)cout<<1<<nl;
    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <queue>
#include <list>
#include <cstdlib>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <cstring>
#include <cmath>
//#include<bits/stdc++.h>
using namespace std;

const int INF=0x3f3f3f3f;
const int SIZE=100005;

vector<int> mp[SIZE];
int color[SIZE],dist[SIZE],dist2[SIZE];

void bfs(int s,int dist[]){
	queue<int> que;
	que.push(s);
	while(!que.empty()){
		int u=que.front();
		que.pop();
		for(int i=0;i<mp[u].size();i++){
			int t=mp[u][i];
			if(dist[t] || t==s) continue;
			dist[t]=dist[u]+1;
			que.push(t);
		}
	}
}

int main(){
	int n;
	cin>>n;
	for(int i=0,a,b;i<n-1;i++){
		cin>>a>>b;
		a--;
		b--;
		mp[a].push_back(b);
		mp[b].push_back(a);
	}
	bfs(0,dist);
	bfs(n-1,dist2);
	int s=0,f=0;
	for(int i=0;i<n;i++){
		if(dist[i]<=dist2[i]) f++; else s++;
	}
	if(s>=f){
		cout<<"Snuke\n";
	}
	else{
		cout<<"Fennec\n";
	}
	return 0;
}


Measured memory_bytes: 6656