akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repr(i, s, e) for(int i=s; i>=e; i--)
#define reps(i, s, e) for(int i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define sz(x) x.size()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
#define enl << endl
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T &a, T b){ if(a<b){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){ a=b; return true; } return false; }
template<typename T> T gcd(T a, T b){ if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b){ return a*(b/gcd(a, b)); }
template<typename T> void vdebug(vector<T> v){ for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> void adebug(T arr[], int n){ rep(i, n){ cout << arr[i] << " "; } cout << endl; }
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int keta(ll num){ int k=0; while(num>0){ num/=10; k++; } return k; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};



const int MAX = 100010;

class UnionFind {
public:
    ll par[MAX];
    ll num[MAX];

    UnionFind(int n){
        rep(i, n){
            par[i] = i;
            num[i] = 1;
        }
    }

    ll find(ll x){
        if(par[x] == x) return x;
        else return par[x] = find(par[x]);
    }

    void unite(ll x, ll y){
        x = find(x);
        y = find(y);
        if(x == y) return;
        par[x] = y;
        num[y] += num[x];
    }

    bool same(ll x, ll y){
        return find(x) == find(y);
    }

    ll size(ll x){
        return num[find(x)];
    }
};

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

    ll n, m;
    vector<pair<ll, ll>> ab;
    vector<ll> res;
    cin >> n >> m;

    ll a, b;
    rep(i, m){
        cin >> a >> b;
        ab.push_back(make_pair(a, b));
    }

    UnionFind tree(n+1);
    res.push_back(n*(n-1)/2);
    repr(i, m-1, 0){
        ll aa = ab[i].first;
        ll bb = ab[i].second;
        auto last = res.back();

        if(tree.same(aa, bb)){
            res.push_back(last);
        }else{
            res.push_back(last - tree.size(aa)*tree.size(bb));
        }
        //cout << tree.size(aa) sp tree.size(bb) << endl;
        tree.unite(aa, bb);
    }

    repr(i, res.size()-2, 0){
        cout << res[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 6256
#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)

#define INF (1e5)
typedef long long unsigned int ll;


int main()
{
	string n;
	cin >> n;
	if(n=="A"){
		cout << "T" << endl;
	}else if(n=="T"){
		cout << "A" << endl;
	}else if(n=="C"){
		cout << "G" << endl;
	}else if(n=="G"){
		cout << "C" << endl;
	}
	return 0;
}

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

typedef pair<int, int> Pii;

void readint(int N, vector<int> &a);
void readdouble(int N, vector<double> &a);
void readindex(int N, vector<int> &a);



signed main(){

    int N, X;
    cin >> N >> X;
    vector<int> m(N);

    int sumv = 0;
    REP(i, N){
        cin >> m[i];
        sumv += m[i];
    }

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

    int ans = N + (X - sumv) / m[0]; 
    
    cout << ans;

    return 0;
}








void readint(int N, vector<int> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atoi(s.c_str());
    }
    getline(cin, s, '\n');
    a[N - 1] = atoi(s.c_str());
}
void readdouble(int N, vector<double> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atof(s.c_str());
    }
    getline(cin, s, '\n');
    a[N - 1] = atof(s.c_str());
}
void readindex(int N, vector<int> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atoi(s.c_str()) - 1;
    }
    getline(cin, s, '\n');
    a[N - 1] = atoi(s.c_str()) - 1;
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: i64,
        k: i64
    }
    let m = n % k;
    use std::cmp;
    println!("{}", cmp::min(cmp::min(k-m, m),n));
}


Measured memory_bytes: 4352
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a


a1, b, c, d = map(int, input().split())
a = a1 - 1
Sa = a - a//c - a//d + a//(c*d//gcd(c, d))
Sb = b - b//c - b//d + b//(c*d//gcd(c, d))
print(int(Sb - Sa))

Measured memory_bytes: 3060
import math
import sys


def solve(inp):
    N = int(inp.readline())

    r = len(str(N))
    for i in range(2, int(math.sqrt(N)) + 1):
        if N % i == 0:
            m = max(len(str(i)), len(str(int(N / i))))
            r = min(r, m)

    return str(r)


def main():
    result = solve(sys.stdin)
    if result:
        print(result)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
 
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
 
 
int main(){
  long long n,a,b;
  cin>>n>>a>>b;
  long long ans=modpow(2,n,MOD)-1;
  
  long long aa=1,bb=1,am=1,bm=1;
  for(int i=0;i<a;i++){
  	aa*=(n-i);
    aa%=MOD;
  }
  for(int i=0;i<a;i++){
  	am*=(a-i);
    am%=MOD;
  }
  am=modpow(am,MOD-2,MOD);
  aa=aa*am%MOD;
    
  for(int i=0;i<b;i++){
  	bb*=(n-i);
    bb%=MOD;
  }
  for(int i=0;i<b;i++){
  	bm*=(b-i);
    bm%=MOD;
  }
  bm=modpow(bm,MOD-2,MOD);
  bb=bb*bm%MOD;
  
   if(aa<0) aa+=MOD;
 if(bb<0) bb+=MOD;
  
  ans=ans-aa-bb;
  ans%=MOD;
  
  if(ans<0) ans+=MOD;
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAXN 100000
using namespace std;
int H[MAXN+2];


int main() {
	int n, cnt=0, maxCnt=INT_MIN;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>H[i];
	}
	for(int i=0;i<n-1;i++){
		if(H[i+1]<=H[i]){
			cnt++;
		}
		else{
			maxCnt = max(maxCnt,cnt);
			cnt=0;
		}
	}
	maxCnt = max(maxCnt,cnt);
	printf("%d\n",maxCnt);
}

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

using namespace std;

void Main() {
    int H, W;
    cin >> H >> W;
    vector<vector<int> > A(H, vector<int>(W, 0));
    int nbBlack = 0;
    queue<pair<int, int> > nextQue;
    for (int i = 0; i < H; ++i) {
        string s;
        cin >> s;
        for (int j = 0; j < W; ++j) {
            if (s[j] == '#') {
                A[i][j] = 1;
                ++nbBlack;
                nextQue.push(make_pair(i, j));
            }
            else {
                A[i][j] = 0;
            }
        }
    }

    int ans = 0;
    while (nbBlack < H * W) {
        ++ans;
        queue<pair<int, int> > que = nextQue;
        queue<pair<int, int> >().swap(nextQue);
        while (!que.empty()) {
            int i = que.front().first;
            int j = que.front().second;
            que.pop();

            if (i < H - 1 && A[i + 1][j] == 0) {
                nextQue.push(make_pair(i + 1, j));
                A[i + 1][j] = 1;
                ++nbBlack;
            }
            if (i > 0 && A[i - 1][j] == 0) {
                nextQue.push(make_pair(i - 1, j));
                A[i - 1][j] = 1;
                ++nbBlack;
            }
            if (j < W - 1 && A[i][j + 1] == 0) {
                nextQue.push(make_pair(i, j + 1));
                A[i][j + 1] = 1;
                ++nbBlack;
            }
            if (j > 0 && A[i][j - 1] == 0) {
                nextQue.push(make_pair(i, j - 1));
                A[i][j - 1] = 1;
                ++nbBlack;
            }
        }
    }

    cout << ans << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 13952
#include <cstdio>
#include <algorithm>
using namespace std;

int main() {
    int n;
    scanf("%d", &n);
    int x[n], xAscend[n];
    for (int i = 0; i < n; i++) {
        scanf("%d", &x[i]);
        xAscend[i] = x[i];
    }

    sort(xAscend, xAscend + n);
    int medianLeft = xAscend[n/2-1], medianRight = xAscend[n/2];
    if (medianLeft == medianRight) {
        for (int i = 0; i < n; i++) {
            printf("%d\n", medianLeft);
        } 
    } else {
        for (int i = 0; i < n; i++) {
            if (x[i] <= medianLeft) {
                printf("%d\n", medianRight);
            } else {
                printf("%d\n", medianLeft);
            }
        } 
    }
    
    return 0;
}

Measured memory_bytes: 3712
/*************************************************************************
>>> Author: WindCry1
>>> Mail: lanceyu120@gmail.com
>>> Website: https://windcry1.com
>>> Date: 12/30/2019 11:03:37 PM
*************************************************************************/
//#pragma GCC optimize(3)
//#pragma GCC diagnostic error "-std=c++11"
#include <cstring>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <iostream>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <stack>
#include <bitset>
#include <iomanip>
#include <list>
#include <sstream>
#include <fstream>
#if __cplusplus >= 201103L
#include <unordered_map>
#include <unordered_set>
#endif
#define endl '\n'
#define ll long long
#define ull unsigned long long
#define DEBUG(x) cout<<#x<<" : "<<x<<endl;
#define lowbit(x) x&(-x)
#define ls u<<1
#define rs u<<1|1
using namespace std;
template<typename T> inline T MIN(const T &a,const T &b) {return a<b?a:b;}
template<typename T> inline T MAX(const T &a,const T &b) {return a>b?a:b;}
template<typename T,typename ...Args> inline T MIN(const T &a,const T &b,Args ...args) {return MIN(MIN(a,b),args...);}
template<typename T,typename ...Args> inline T MAX(const T &a,const T &b,Args ...args) {return MAX(MAX(a,b),args...);}
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
const double eps = 1e-8;
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const int dir[4][2]={-1,0,1,0,0,-1,0,1};
ll a[100010];
int main(){
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#ifdef WindCry1
	freopen("C:\\Users\\LENOVO\\Desktop\\in.txt","r",stdin);
#endif
	int n,m;cin>>n>>m;
	ll gcd;
	ll now=1;
	for(int i=1;i<=n;i++) {
		cin>>a[i];a[i]/=2;
		now=now/__gcd(now,a[i])*a[i];
	}
	for(int i=1;i<=n;i++){
		if(now/a[i]%2==0) {
			cout<<0<<endl;
			return 0;
		}
	}
	cout<<(m+now)/(now*2)<<endl;
	
	return 0;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ll long long
#define M 1000000007
#define sz(a) (ll)a.size()
#define pll pair<ll,ll>
#define rep(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define sep(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define mll map<ll,ll>
#define vl vector<ll>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(),a.end()
#define F first
#define S second
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    map<string,ll>m;
    rep(i,0,n)
    {
        string s;
        cin>>s;
        m[s]++;
    }
    cout<<"AC x "<<m["AC"]<<"\n";
    cout<<"WA x "<<m["WA"]<<"\n";
    cout<<"TLE x "<<m["TLE"]<<"\n";
    cout<<"RE x "<<m["RE"]<<"\n";
}


Measured memory_bytes: 3652
#![allow(dead_code)]
#![allow(unused_variables)]

use std::io::stdin;
use std::str::FromStr;
use std::process::exit;

fn read<T: FromStr>() -> T {
    let mut str = String::new();
    stdin().read_line(&mut str).ok();
    str.trim().parse().ok().unwrap()
}

fn read_vec<T: FromStr>() -> Vec<T> {
    let mut str = String::new();
    stdin().read_line(&mut str).ok();
    str.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn read_n_vec<T: FromStr>(n: u32) -> Vec<Vec<T>> {
    let mut v_outer = Vec::new();
    for _ in 0..n {
        let v_inner = read_vec();
        v_outer.push(v_inner);
    }
    v_outer
}

fn main() {
    let mut line: Vec<u32> = read_vec();
    let n = line[0];
    let m = line[1];

    line = read_vec();
    line.sort();
    line.reverse();

    let mut sum: f64 = 0f64;
    for item in &line {
        sum += *item as f64;
    }

    for i in 0..m {
        if (line[i as usize] as f64) < sum / (4 as f64 * m as f64) {
            println!("No");
            exit(0);
        }
    }

    println!("Yes");
}

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

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

int main(){
	int H,W;
	cin >> H >> W;

	vector<string> G(H);
	rep(i,H)cin >> G[i];

	vector<vector<int>> L(H,vector<int>(W+1));
	vector<vector<int>> R(H,vector<int>(W+1));
	for(int i=0; i<H; i++){
	  for(int j=0; j<W; j++){
	  	if(G[i][j]=='#')L[i][j+1] = 0;
	  	else L[i][j+1] = L[i][j-1+1]+1;

	  	if(G[i][W-j-1]=='#')R[i][W-j-1]=0;
	  	else R[i][W-j-1] = R[i][W-j]+1;
	  }
	}

	vector<vector<int>> U(H+1,vector<int>(W));
	vector<vector<int>> D(H+1,vector<int>(W));
	for(int i=0; i<W; i++){
	  for(int j=0; j<H; j++){
	  	if(G[j][i]=='#')U[j+1][i] = 0;
	  	else U[j+1][i] = U[j-1+1][i]+1;

	  	if(G[H-j-1][i]=='#')D[H-j-1][i]=0;
	  	else D[H-j-1][i] = D[H-j][i]+1;
	  }
	}
	int ans = 0;
	for(int i=0; i<H; i++){
		for(int j=0; j<W; j++){
			ans = max(ans, L[i][j+1]+R[i][j]+U[i+1][j]+D[i][j]-3);
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 67328
N = int(input())
A = list(map(int, input().split()))

ans = 0
r = 0
xor_A = 0
for l in range(N):
    while (r < N and (xor_A ^ A[r]) == (xor_A + A[r])):
        xor_A += A[r]
        r += 1
    ans += r - l
    if l == r:
        r += 1
    else:
        xor_A -= A[l]
print(ans)


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

const double eps = 1e-6;

int main()
{
    long long x, y, z;
    cin >> x >> y >> z;
    if (z - x - y <= 0)
        cout << "No";
    else
    {
        z = (z - x - y) * (z - x - y);
        if (z > 4 * x * y)
            cout << "Yes";
        else
            cout << "No";
    }
    return 0;
}


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

int main() {
	string s;
	cin >> s;

	string cur = "";
	vector <string> vec;

	for (int i = 0; i < s.size(); ++i) {
		if (s[i] == 'A') {
			cur += 'A';
		} else if (s[i] == 'B') {
			if (i == s.size() - 1 || s[i+1] != 'C') {
				if (cur != "") vec.push_back(cur);
				cur = "";
			} else {
				++i;
				cur += 'B';
			}
		} else { // s[i] == 'C'
			if (cur != "") vec.push_back(cur);
			cur = "";
		}
	}

	if (cur != "") vec.push_back(cur);

	long long res = 0;

	for (auto &t : vec) {
		int cntA = 0;
		for (int i = 0; i < t.size(); ++i) {
			if (t[i] == 'A') ++cntA;
			else res += cntA;
		}
	}

	cout << res << endl;
}

Measured memory_bytes: 3196
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val N, M, K = sc.nextInt()
  val as = Array.fill(N)(sc.nextLong()).scanLeft(0L)(_ + _)
  val bs = Array.fill(M)(sc.nextLong()).scanLeft(0L)(_ + _)
  var j = M
  val result = (0 to N).foldLeft(0) { (acc, i) =>
    if (as(i) <= K) {
      while (bs(j) > K - as(i)) j -= 1
      Math.max(acc, i + j)
    } else acc
  }
  println(result)
}


Measured memory_bytes: 65476
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rrep(i,n) for(int i=(int)n-1;i>=0;--i)
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T& a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U& u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U& u,const V... v){for(auto& e:u)fill_v<T>(e,v...);}

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

    int n;
    cin >> n;
    vector<int> cnt(13);
    rep(i, n) {
        int d;
        cin >> d;
        cnt[d]++;
    }
    map<int, int> ones;
    int idx = 0;
    rep(i, 13) {
        if ((i == 0 && cnt[i] >= 1) || (i == 12 && cnt[i] >= 2) || cnt[i] >= 3) {
            cout << 0 << endl;
            return 0;
        } else if (cnt[i] == 1 && i != 12) ones[i] = idx++;
    }
    int ans = 0;
    rep(bit, 1<<idx) {
        vector<int> time;
        time.push_back(0);
        rep(i, 13) {
            if (ones.count(i)) {
                if (bit >> ones[i] & 1) time.push_back(i);
                else time.push_back(24 - i);
            } else {
                rep(j, cnt[i]) time.push_back(j % 2 == 0 ? i : 24 - i);
            }
        }
        time.push_back(24);
        sort(time.begin(), time.end());
        int s = 100;
        rep(i, time.size() - 1) chmin(s, time[i+1] - time[i]);
        chmax(ans, s);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3656
#include <iostream>

int main()
{
    int a, b;
    std::cin >> a >> b;

    if (a == b) {
        std::cout << "Draw" << std::endl;
    } else if (a == 1 || (b != 1 && a > b)) {
        std::cout << "Alice" << std::endl;
    } else {
        std::cout << "Bob" << std::endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    long x = sc.nextLong();
    long a=0,b=0;
    for(;;b++){
      long bf = five(b);
      a = isfive(bf+x);
      if(a!=-1){break;}
      a = isfive(-bf+x);
      if(a!=-1){b*=-1;break;}
    }
    pl(a+" "+b);
  }

  public static long five(long a){
    long k=a*a;
    return k*k*a;
  }

  public static long isfive(long a){
    for(long i=0;;i++){
      long k=five(i);
      if(k==a){
        return i;
      }else if(k>a){
        break;
      }
    }
    return -1;
  }

  public static void pr(String str){
    System.out.print(str);
  }
  public static void pl(String str){
    System.out.println(str);
  }
}


Measured memory_bytes: 38856
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric>

#define size_t int

using namespace std;
typedef long l;
typedef long long ll;

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

  string w;
  std::cin >> w;
  int alpha[26] = {};
  if(w.size()%2 == 0){
    for (size_t i = 0; i < w.size(); i++) {
      alpha[(w[i] - 97)]++;
    }
    for (size_t i = 0; i < 26; i++) {
      if(alpha[i]%2 != 0){
        std::cout << "No" << '\n';
        return 0;
      }
    }
    std::cout << "Yes" << '\n';
  }else{
    std::cout << "No" << '\n';
  }

  return 0;
}


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

int main() {
	ll n,k,cnt=0;
	cin>>n>>k;
	vector<ll>v(n);
	for(ll i=0;i<n;i++){
		cin>>v.at(i);
	}
	sort(v.begin(),v.end(),greater<ll>());
	for(ll i =k;i<n;i++){
		cnt+=v.at(i);
	}
	cout<<cnt<<endl;
	return 0;

}



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

map <int,int> m;

void primeFactors(long long int n)  
{  
    while (n % 2 == 0)  
    {  
        m[2]++;  
        n = n/2;  
    }  
  

    for (int i = 3; i <= sqrt(n); i = i + 2)  
    {  
        while (n % i == 0)  
        {  
            m[i]++;
            n = n/i;  
        }  
    }  
  
    if (n > 2)  
    m[n]++;
}  

int main(){

	ios::sync_with_stdio(0);
	cin.tie(0);

	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	
	long long int n,ans = 0;
	cin>>n;

	primeFactors(n);

	for(auto it=m.begin();it!=m.end();++it){
		//cout<<it->second<<endl;
		int j = 1;
		while(it -> second != 0){
			ans++;
			it -> second -= j;
			j++;
			if(it -> second < j)
			break;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3696
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll MOD = 1e9 + 7;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)
#define INF INT_MAX/2

int main() {
	string s;

	cin >> s;

	if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3]) {
		cout << "Bad" << endl;
	}
	else {
		cout << "Good" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import numpy as np
NM= list(map(int,input().split()))
N = NM[0]
M = NM[1]

k = []
S = []
for i in range(M):
    kS = list(map(int,input().split()))
    k.append(kS[0])
    S.append(kS[1:])

P = list(map(int,input().split()))
Pt = np.zeros((len(P),1))
for i in range(len(P)):
    Pt[i,0]=P[i]

ta = np.zeros((M,N))
for i in range(M):
    for j in range(len(S[i])):
        ta[i,S[i][j]-1]=1

sta = np.zeros((N,1))

count = 0
def func(k):
    global count
    global sta
    global ta
    global Pt
    global N
    for i in range(2):
        sta[k]=i
        if k+1 < N:
            func(k+1)
        if (np.dot(ta,sta)%2==Pt).all() and k==N-1:
            count+=1

func(0)
print(int(count))

Measured memory_bytes: 14536
#include <iostream>  // cin,cout
#include <stdio.h>   // printf,scanf (standard input/output)
#include <cmath>     // abs(x),pow(x,2)
#include <string>
#include <string.h>  // strlen, strcmp
#include <algorithm> // min,max, sort(v.begin(),v.end())
#include <vector>
#include <time.h>
using namespace std;

struct Data{
    int A;
    string S;
    
    bool operator<( const Data& right ) const {
        return A == right.A ? S < right.S : A < right.A;
        //return A < right.A;
    }
};

int Func(){
    int x = 0;
    return x;
}

int main(){
    int N;
    char S[200100];
    
    // 入力
    cin >> N;
    for(int i=0;i<N;i++) {
        cin >> S[i];
    }
    
    int black = 0;
    int white = 0;
    for (int i=0;i<N;i++) {
        if (S[i]=='.') {
            white += 1;
        }
    }
    int result = white + black;
    
    for (int i=0;i<N;i++) {
        if (S[i]=='.') {
            white -= 1;
        }
        else {
            black += 1;
        }
        result = min(result,white+black);
    }
    cout << result << endl;

    
    
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int N;
  cin >> N;
  vector<int> v;
  rep(i,N){
    int a;
    cin >> a;
    v.push_back(a);
  }
  
  ll ret = 0;
  map<int,int> memo;
  for(int i=N-1; i>=0; i--){
    int x = (i+1) + v[i];
    ret += memo[x];

    int y = (i+1) - v[i];
    memo[y]++;
  }  

  cout << ret << endl;
  
  return 0;
}



Measured memory_bytes: 21036
def main():
    x, y = map(int, input().split())
    group = [0, 1, 2, 1, 3, 1, 3, 1, 1, 3, 1, 3, 1]
    if group[x] == group[y]:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()


Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
 
#define int long long
#define pb push_back 
#define pf push_front 
#define mp make_pair
#define fr first
#define sc second
#define Rep(i, n) for ( int i = 0 ; i < (n); i++ )
#define All(v) v.begin(), v.end()
 
typedef pair<int, int> Pii; typedef pair<int, Pii> Pip;
const int INF = 1107110711071107;
 
 
signed main() {
  string S, T;
  cin >> S >> T;
 
  bool flag = true;
  int s = 0, t = 0, p = 0;;
  while ( 1 ) {
    if ( p == S.size() ) break;
    if ( flag ) {
      if ( s == S.size() ) break;
      while ( 1 ) {
    if ( S[s] == S[p] ) {
      s++; p++;
      break;
    }
    s++;
    if ( s == S.size() ) break;
      }
      flag = false;
    } else {
      if ( t == T.size() ) break;
      while ( 1 ) {
    if ( T[t] == S[p] ) {
      t++; p++;
      break;
    }
    t++;
    if ( t == T.size() ) break;
      }
      flag = true;
    }
  }
 
  if ( p == S.size() ) {
    cout << "Yes" << endl;
    return 0;
  }
 
   
  flag = false;
  s = 0; t = 0; p = 0;;
  while ( 1 ) {
    if ( p == S.size() ) break;
    if ( flag ) {
      if ( s == S.size() ) break;
      while ( 1 ) {
    if ( S[s] == S[p] ) {
      s++; p++;
      break;
    }
    s++;
    if ( s == S.size() ) break;
      }
      flag = false;
    } else {
      if ( t == T.size() ) break;
      while ( 1 ) {
    if ( T[t] == S[p] ) {
      t++; p++;
      break;
    }
    t++;
    if ( t == T.size() ) break;
      }
      flag = true;
    }
  }
   
  if ( p == S.size() ) {
    cout << "Yes" << endl;
    return 0;
  }
 
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3204
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

typedef long long ll;

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

const int INF = 1e9;
const ll INFLL = 1e18;
const ll MOD = 1e9+7;
const double PI = acos(-1.0);

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

/*------------------------------------/
for library*/

/*------------------------------------*/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int N,x0,y0,h0;
    cin>>N;
    //vector<vector<int>> H(110,vector<int>(110,-1));
    vector<int> x(N),y(N),h(N);
    rep(i,N){
        cin>>x[i]>>y[i]>>h[i];
        if(h[i] > 0){
            x0 = x[i];
            y0 = y[i];
            h0 = h[i];
        }
    }
    rep(Cx,101)rep(Cy,101){
        int H0 = h0 + abs(x0 - Cx) + abs(y0 - Cy);
        bool f = true;
        rep(i,N){
            if(H0-abs(x[i]-Cx)-abs(y[i]-Cy) < 0){
                if(h[i] !=0){
                    f = false;
                }
            }
            else if(H0 != h[i] + abs(x[i]-Cx) + abs(y[i]-Cy)){
                f = false;
            }
        }
        if(f){
            cout<<Cx<<" "<<Cy<<" "<<H0<<endl;
            return 0;
        }
    }
}


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



string solve(string str)
{	
	int c = 0;
	int len = str.length();
	for(int i=0;i<len;i++) {
		if(i == 0) {
			if(str[i] != 'A') {
				return "WA";
			}
		} else {
			if(str[i] == 'C') {
				if(c != 0) {
					return "WA";
				}
				//cout << i << endl;
				if(i < 2 || i > len-2) {
					return "WA";
				} else {
					c++;
				}
			} else {
				if(str[i] != tolower(str[i])) {
					return "WA";
				}
			}
		}
	}
	
	if(c == 0) {
		return "WA";
	}
	return "AC";
	
}
			
		

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	string str;
	cin >> str;
	cout << solve(str) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const int mod=1e9+7;
using LL=long long;
using namespace std;
namespace ndifix{
long long pow(int base,int exp){
    long long ret=1;
    std::vector<long long> buf(32);buf[0]=base;
    for(int i=1;i<32;i++)buf[i]=buf[i-1]*buf[i-1];
    for(int i=0;(1<<i)<=exp;i++)if(exp & (1<<i))ret*=buf[i];
    return ret;
}//高速二乗和
}//end of namespace ndifix

int main(){
  string s;cin>>s;
  reverse(s.begin(),s.end());

  int size=s.size();
  vector<int> buf(size);
  buf[0]=1;
  for(int i=1;i<size;i++)buf[i]=(buf[i-1]*10)%13;

  vector<vector<LL>> dp;
  dp.resize(size);for(int i=0;i<size;i++)dp[i].resize(13);
  for(int i=0;i<size;i++)for(int j=0;j<13;j++)dp[i][j]=0;
  if(s[0]=='?')for(int i=0;i<10;i++)dp[0][i]=1;
  else dp[0][s[0]-'0']=1;

  for(int i=1;i<size;i++){
    //for(int k=0;k<13;k++)cout<<dp[i-1][k]<<" ";cout<<endl;
    if(s[i]=='?'){
      for(int j=0;j<13;j++)for(int k=0;k<10;k++){dp[i][(j+k*buf[i])%13]+=dp[i-1][j];}
      for(int j=0;j<13;j++)dp[i][j]%=mod;
    }
    else{
      for(int j=0;j<13;j++)dp[i][(j+(s[i]-'0')*buf[i])%13]+=dp[i-1][j];
      for(int j=0;j<13;j++)dp[i][j]%=mod;
    }
  }
  //for(int k=0;k<13;k++)cout<<dp[size-1][k]<<" ";cout<<endl;
  cout<<dp[size-1][5]<<endl;
  return 0;
}


Measured memory_bytes: 14080
#include <iostream>
using namespace std;
int main(){
    int tc;cin>>tc;
    int acCount,waCount,tleCount,reCount;
    acCount = waCount = tleCount = reCount = 0;
    while(tc > 0){
        char arr[4];
        cin>>arr;
        if(arr[0] == 'A' && arr[1] == 'C')
            acCount++;
        else if(arr[0] == 'W' && arr[1] == 'A')
            waCount++;
        else if(arr[0] == 'R' && arr[1] == 'E')
            reCount++;
        else
            tleCount++;
        tc--;
    }
    cout<<"AC x "<<acCount<<"\n";
    cout<<"WA x "<<waCount<<"\n";
    cout<<"TLE x "<<tleCount<<"\n";
    cout<<"RE x "<<reCount<<"\n";
    return 0;
}


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

using namespace std;

int main()
{
	int A, B, T, num = 0;
	
	cin >> A >> B >> T;
	
	for (int i = 0; i < (int)((T + 0.5) / A); i++) {
		num += B;
	}
	
	cout << num << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int n;
    while(cin >> n) {
        int cnt = 0;
        for(int i = 0; i <= 9; ++i)
            for(int j = 0; j <= 9; ++j)
                for(int k = 0; k <= 9; ++k)
                    for(int l = 0; l <= 9; ++l)
                        if(i+j+k+l == n) ++cnt;
        cout << cnt << endl;
    }
    return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define For(i,a,b) for(register int i=a;i<=b;++i)
#define FOR(i,a,b) for(register int i=a;i>=b;--i)
#define ll long long
using namespace std;
const int maxn=1e5+10;
ll f[maxn],ff[maxn],a[maxn],c;
ll ans,vs[maxn],vss[maxn];
int s[maxn],ss[maxn];
int n,v[maxn];

int main()
{
	scanf("%d%lld",&n,&c);
	For(i,1,n)
		scanf("%lld%d",&a[i],&v[i]);
	For(i,1,n)
		vs[i]=vs[i-1]+v[i];
	FOR(i,n,1)
		vss[i]=vss[i+1]+v[i];
	For(i,1,n)
	{
		s[i]=i;
		if(f[i-1]>=vs[i]-a[i])
			f[i]=f[i-1],s[i]=s[i-1];
		else
			f[i]=vs[i]-a[i];
	}
		//f[i]=max(f[i-1],vs[i]-a[i]);
	FOR(j,n,1)
	{
		ss[j]=j;
		if(ff[j+1]>=vss[j]-(c-a[j]))
			ff[j]=ff[j+1],ss[j]=ss[j+1];
		else
			ff[j]=vss[j]-(c-a[j]);
	}
		//ff[j]=max(ff[j+1],vss[j]-(c-a[j]));
	For(i,0,n)
		if(f[i]+ff[i+1]>ans)
		{
			ans=max(ans,f[i]+ff[i+1]-min(c-a[ss[i+1]],a[s[i]]));
			ans=max(ans,f[i]);
			ans=max(ans,ff[i+1]);
		}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 5376
#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>
#include <queue>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define pb push_back
#define mp make_pair

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

const int mod = 1000000007;

string s;

int main() {
  cin >> s;
  LL a = 0, b = 0, c = 0;
  LL cnt = 1;
  rep(i,0,s.size()) {
    if(s[i] == 'A') {
      a = (a + cnt) % mod;
    } else if(s[i] == 'B') {
      b = (b + a) % mod;
    } else if(s[i] == 'C') {
      c = (c + b) % mod;
    } else {
      c = (3 * c + b) % mod;
      b = (3 * b + a) % mod;
      a = (3 * a + cnt) % mod;
      cnt = (cnt * 3) % mod;
    }
  }
  P((int)c);
  return 0;
}


Measured memory_bytes: 512
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args)
    {
        Scanner s = new Scanner(System.in);
        String S = s.nextLine();
        if(S.substring(2,3).equals(S.substring(3,4)) && S.substring(4,5).equals(S.substring(5,6)))
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}


Measured memory_bytes: 21844
fn main() {
    let stdin = std::io::stdin();
    let mut sc = Scanner::new(stdin.lock());
    loop {
        let n: usize = sc.read();
        if n == 0 {
            break;
        }
        let a: Vec<usize> = sc.read_vec(n);
        let sum = a.iter().sum::<usize>();
        let answer = a.iter().filter(|&x| x * n <= sum).count();
        println!("{}", answer);
    }
}

pub struct Scanner<R> {
    reader: R,
}

impl<R> Scanner<R> {
    pub fn new(reader: R) -> Scanner<R> {
        Scanner { reader }
    }
}

fn is_whitespace(b: u8) -> bool {
    b == b' ' || b == b'\n' || b == b'\r' || b == b'\t'
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        let buf = std::io::Read::bytes(self.reader.by_ref())
            .map(|b| b.expect("Read failed"))
            .skip_while(|&b| is_whitespace(b))
            .take_while(|&b| !is_whitespace(b))
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error")
    }

    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn read_chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}



Measured memory_bytes: 5040
#!/usr/bin/env python3
import sys

def main():
    N, Q = map(int, input().split())
    S = input()
    ans = [None] * N
    ans[0] = S.count('AC')
    for i in range(1,N):
        ans[i] = ans[i-1]
        if S[i-1:i+1] == 'AC':
            ans[i] -= 1

    for i in range(Q):
        l, r = map(int, input().split())
        print(ans[l-1] - ans[r-1])

if __name__ == '__main__':
    main()


Measured memory_bytes: 6140
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cstdlib>

using namespace std;
//DP用
template<class T> inline bool chmin(T& a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
const long long INF = 1LL << 60;

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

int main() {
    int n,k;
    cin >> n >> k;
    int count = 0;
    while(n/k != 0) {
        n = n/k;
        count += 1;
    }
    cout << count+1;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cmath>
#define pb push_back
#define ld long double
#define mp make_pair
#define vl vector<ll> 
#define vd vector<double>
#define vld vector<long double>
#define ll long long int
#define pl pair<ll, ll>
#define all(a) a.begin(), a.end()
#define forr(i, n) for(ll i=0; i<n; i++) 
#define forr1(i, n) for(ll i=1; i<=n; i++)
using namespace std;
const ld PI =3.1415926535897923846;
const ll MOD = 1000000007;
const ll N=998244353;
ll power(ll x,ll n){ll res=1;while(n>0){if(n&1) res=res*x%MOD;x=x*x%MOD;n>>=1;}return res;}
ll modinverse(ll a){return power(a, MOD-2);}
void solve()
{
    ll n, k, rr, ss, pp;
    cin>>n>>k>>rr>>ss>>pp;
    string str;
    cin>>str;
    vl a(n);
    if(str[0]=='r')
    	a[0]=pp;
    else if(str[0]=='p')
    	a[0]=ss;
    else
    	a[0]=rr;
    vector<bool> fuck(k, true);
    forr1(i, n-1)
    {
    	if(i<k)
    	{
    		if(str[i]=='r')
		    	a[i]+=(pp+a[i-1]);
		    else if(str[i]=='p')
		    	a[i]+=(ss+a[i-1]);
		    else
		    	a[i]+=(rr+a[i-1]);
    	}
    	else
    	{
    		if(str[i]=='r')
		    {
		    	if(str[i-k]=='r')
		    	{
		    		if(fuck[i%k]==true)
		    			a[i]=a[i-1], fuck[i%k]=false;
		    		else 
		    		{
		    			fuck[i%k]=true;
		    			a[i]+=pp+a[i-1];
		    		}
		    	}
		    	else
		    	{
		    		a[i]+=(pp+a[i-1]);
		    		fuck[i%k]=true;
		    	}
		    }
		    else if(str[i]=='p')
		    {
		    	if(str[i-k]=='p')
		    	{
		    		if(fuck[i%k]==true)
		    			a[i]=a[i-1], fuck[i%k]=false;
		    		else 
		    		{
		    			fuck[i%k]=true;
		    			a[i]+=ss+a[i-1];
		    		}
		    	}
		    	else
		    	{
		    		a[i]+=(ss+a[i-1]);
		    		fuck[i%k]=true;
		    	}
		    }
		    else
		    {
		    	if(str[i-k]=='s')
		    	{
		    		if(fuck[i%k]==true)
		    			a[i]=a[i-1], fuck[i%k]=false;
		    		else 
		    		{
		    			fuck[i%k]=true;
		    			a[i]+=(rr+a[i-1]);
		    		}
		    	}
		    	else
		    	{
		    		a[i]+=(rr+a[i-1]);
		    		fuck[i%k]=true;
		    	}
		    }	
    	}
    }
    /*forr(i, n)
    	cout<<a[i]<<' ';*/
    cout<<a[n-1]<<endl;
}
int main()
{
	#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll test=1;
    //cin>>test;
    while(test--)
    {
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

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

int main() {
    std::string str;
    std::cin >> str;
    if(str == "AAA" || str == "BBB")
    {
        std::cout<< "No" <<std::endl;
    }
    else
    {
        std::cout << "Yes" << std::endl;
    }
}

Measured memory_bytes: 3116
# coding: utf-8
from math import sqrt


def solve(*args: str) -> str:
    n = int(args[0])

    ret = 0
    i = 2
    sqrt_n = -int(-sqrt(n))
    P = [True]*(sqrt_n+1)
    P[0] = False
    P[1] = False

    for i in range(2, len(P)):
        if P[i]:
            for j in range(i+i, len(P), i):
                P[j] = False

    Q = []
    for p, is_prime in enumerate(P):
        if is_prime and n % p == 0:
            t = p
            while t <= n:
                Q.append(t)
                t *= p
    if not Q and 1 < n:
        Q.append(n)

    Q.sort()
    for q in Q:
        if n % q == 0:
            n //= q
            ret += 1

    for p, is_prime in enumerate(P):
        while is_prime and n % p == 0:
            n //= p
    if 1 < n:
        ret += 1

    return str(ret)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))


Measured memory_bytes: 16840
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7



n = int(input())
tot_l = [[None]*3 for _ in range(n)]
for i in range(n):
    s, p = input().split()
    tot_l[i][0] = s
    tot_l[i][1] = int(p)
    tot_l[i][2] = i
tot_l.sort( key = lambda x: (x[0], -x[1]))
for i in range(n):
    print(tot_l[i][2]+1)



Measured memory_bytes: 13684
#include<iostream>
#include<cstdio>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<map>
#include<numeric>
#include<stack>
#include<queue>
#include<functional>
#include<cassert>
#include<set>
#include<numeric>
#define rep(a,b) for(ll a=0;a<b;++a)
#define REP(a,b,c,d) for(ll a=b;a<c;a+=d)
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl
#define mod 1000000007
using namespace std;
using ll = long long;
using p_ll = pair<ll, ll>;
int main() {
	int N, K, Q; cin >> N >> K >> Q;
	vector<int> A(Q), ans(N);
	rep(i, Q) {
		cin >> A[i];
		++ans[A[i] - 1];
	}

	rep(i, N) {
		if (K-(Q-ans[i]) > 0)yes;
		else no;
	}
}

Measured memory_bytes: 1408
# -*- coding: utf-8 -*-


def main():
    h, w = list(map(int, input().split()))
    removed = list()

    for i in range(h):
        ai = input()

        if ai.count('.') != w:
            removed.append(ai)

    ans = list()
    count = 0

    for j in range(len(removed[0])):
        is_black = False

        for i in range(len(removed)):
            if removed[i][j] == '#':
                is_black = True

        if is_black:
            for i in range(len(removed)):
                ans.append(removed[i][j])

            count += 1

    for m in range(len(ans) // count):
        result = ''

        for k in range(m, len(ans), len(ans) // count):
            result += ans[k]

        print(result)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
using System;
using System.Collections.Generic;//list用
using System.Text;//StringBuilder用
using System.Collections;
using System.Linq;
class Program
{
    static List<int> A = new List<int>();
      static List<int> B = new List<int>();
    static decimal result;
static Hashtable ht=new Hashtable();
static StringBuilder sb = new StringBuilder();
static int N,M,K;
static long[,] table;
    static void Main()
    {
PriorityQueue<int,int> pr = new PriorityQueue<int,int>();//優先度付キュー★Add(key,value)で格納、Dequeue()で取りだし。keyが小さいものから取り出す。

Read1();
    Read5();  
//後ろから見ていく。
      int limit=0;
      for(int i=0;i<N;i++){pr.Add(-B[i],i);}
      for(int i=0;i<N;i++){
      int tmp=pr.Dequeue().Value;
        if(i==0){limit=B[tmp];}
        if(result<limit-B[tmp]){result=limit-B[tmp];}
      result+=A[tmp];
        if(result>limit){      Console.WriteLine("No");return;}
      }
        

      Console.WriteLine("Yes");
    }


    static void Read1()//1項
    {
        string tmp = Console.ReadLine();
        N = int.Parse(tmp);
    }
 
    static void Read5()//N行K項
    {
for(int i=0;i<N;i++){
        string[] tmp = Console.ReadLine().Split(' ');
       A.Add(int.Parse(tmp[0]));
       B.Add(int.Parse(tmp[1]));
}
    }


}

class PriorityQueue<TKey, TValue>
{
    SortedDictionary<TKey, Queue<TValue>> dict = new SortedDictionary<TKey, Queue<TValue>>();
    int count = 0;

    public int Count
   {
        get
       {
            return count;
       }
   }

   public void Add(TKey key, TValue value)
   {
       if (!dict.ContainsKey(key))
       {
           dict[key] = new Queue<TValue>();
       }
 
       dict[key].Enqueue(value);
       count++;
   }

    public KeyValuePair<TKey, TValue> Dequeue()
    {
        var queue = dict.First();
       if (queue.Value.Count <= 1)
        {
           dict.Remove(queue.Key);
        }
        count--;
        return new KeyValuePair<TKey, TValue>(queue.Key, queue.Value.Dequeue());
    }
}


Measured memory_bytes: 49664
#include <bits/stdc++.h>
using namespace std;
int main () {
    long long k, a, b;
    cin >> k >> a >> b;
    if (b-a <= 2 || k < a) {
        cout << k + 1 << endl;
        return 0;
    }
    k -= a - 1;
    long long  x = a;
    x += (b - a) * (k / 2);
    if (k % 2) {
        x++;
    }
    cout << x << endl;
}

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

// マクロ
// forループ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(ll)(b);i--)
// xにはvectorなどのコンテナ
#define ALL(x) (x)begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
// 出力
#define PRINT(x) cout<<(x)<<endl
#define PRINTA(x,n) REP(i,n)PRINT(x[i])
// 定数
#define INF 1000000000000 // 10^12
#define MOD 1000000007 // 10^9+7
// 略記
#define PB push_back
#define MP make_pair

const int MAX_N = 100000;
const int MAX_M = 100000;

int N, M, p[MAX_N], x[MAX_M], y[MAX_M];

struct UnionFind {
    vector<int> par;

    UnionFind(int N) : par(N) {
        REP(i, N) par[i] = i;
    }

    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
        return;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main() {
    cin >> N >> M;
    REP(i, N) {
        cin >> p[i];
        p[i]--;
    }
    REP(i, M) {
        cin >> x[i] >> y[i];
        x[i]--;
        y[i]--;
    }

    UnionFind tree(N);

    REP(i, M) tree.unite(x[i], y[i]);

    int ans = 0;
    REP(i, N) {
        if (tree.same(p[i], i)) ans++;
    }
    PRINT(ans);
    return 0;
}

Measured memory_bytes: 1792