akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
using namespace std;

int main () {
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for (int i=0; i<n; ++i) cin >> a[i];
  for (int i=0; i<n; ++i) cin >> b[i];
  long long psum = 0, msum = 0;
  for (int i=0; i<n; ++i)
  if (a[i] - b[i] < 0) msum += (b[i] - a[i]) >> 1;
  else psum += a[i] - b[i];

  cout << (msum >= psum ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 384
S = input()
T = input()

dict_st = {}
dict_go = {}

for x, y in zip(S,T):
  if x not in dict_st:
    dict_st[x] = y
  elif dict_st[x] != y:
    print("No")
    break
  
  if y not in dict_go:
    dict_go[y] = x
  elif dict_go[y] != x:
      print("No")
      break
else:
  print("Yes")

Measured memory_bytes: 3632
#include<stdio.h>
#include<string>
#include<stack>
#include<algorithm>
using namespace std;
int cur;
char ch[1010];
char in[3];
char op[20]="+-*/<>=&|^";
int rn[20];
char str[110];
int n;
string emp="";
string solve(int a){
	if(a==n){
		if(str[cur]=='('){
			cur++;
			string ret=solve(0);
			int now=0;
			bool ok=false;
			for(int i=0;i<ret.size()-1;i++){
				if(ret[i]=='(')now++;
				if(ret[i]==')')now--;
				if(now==0)ok=true;
			}
			cur++;
	//		printf("%d %d: %s\n",a,cur,ret.c_str());
			if(ok)return "("+ret+")";
			return ret;
		}else{
			cur++;
		//	printf("%d %d: %c\n",a,cur,str[cur-1]);
			return emp+str[cur-1];
		}
	}
	if(ch[a]=='L'){
		string ret=solve(a+1);
		while(1){
			bool ok=false;
			for(int i=0;i<10;i++)if(str[cur]==op[i]&&rn[i]==a)ok=true;
			if(!ok)break;
			char ad=str[cur];
			cur++;
			string tmp=solve(a+1);
			ok=false;
			int now=0;
			for(int i=0;i<ret.size()-1;i++){
				if(ret[i]=='(')now++;
				if(ret[i]==')')now--;
				if(now==0)ok=true;
			}
			if(ok)ret="("+ret+")";
			ok=false;
			now=0;
			for(int i=0;i<tmp.size()-1;i++){
				if(tmp[i]=='(')now++;
				if(tmp[i]==')')now--;
				if(now==0)ok=true;
			}
			if(ok)tmp="("+tmp+")";
			ret=ret+ad+tmp;
		}
		//printf("%d %d: %s\n",a,cur,ret.c_str());
		return ret;
	}else{
		stack<string>S;
		S.push(solve(a+1));
		stack<char>os;
		while(1){
			bool ok=false;
			for(int i=0;i<10;i++)if(str[cur]==op[i]&&rn[i]==a)ok=true;
			if(!ok)break;
			os.push(str[cur]);
			cur++;
			string tmp=solve(a+1);
			S.push(tmp);
		}
		string ret=S.top();
		S.pop();
		while(S.size()){
			string L=S.top();
			bool ok=false;
			int now=0;
			for(int i=0;i<L.size()-1;i++){
				if(L[i]=='(')now++;
				if(L[i]==')')now--;
				if(now==0)ok=true;
			}
			if(ok)L="("+L+")";
			ok=false;now=0;
			for(int i=0;i<ret.size()-1;i++){
				if(ret[i]=='(')now++;
				if(ret[i]==')')now--;
				if(now==0)ok=true;
			}
			if(ok)ret="("+ret+")";
			ret=L+os.top()+ret;
			S.pop();os.pop();
		}
		//printf("%d %d: %s\n",a,cur,ret.c_str());
		return ret;
	}
}
int main(){
	int T;scanf("%d",&T);
	bool bl=false;
	while(T--){
		if(bl)printf("\n");
		bl=true;
		int a;scanf("%d",&a);
		n=a;
		for(int i=0;i<a;i++){
			int p;
			scanf("%s%d",ch+i,&p);
			for(int j=0;j<p;j++){
				scanf("%s",in);
				for(int k=0;k<10;k++)if(in[0]==op[k])rn[k]=i;
			}
		}
		int b;scanf("%d",&b);
		for(int i=0;i<b;i++){
			cur=0;scanf("%s",str);
			string ret=solve(0);
			bool ok=false;
			int now=0;
			for(int j=0;j<ret.size()-1;j++){
				if(ret[j]=='(')now++;
				if(ret[j]==')')now--;
				if(now==0)ok=true;
			}
			if(ok)ret="("+ret+")";
			printf("%s\n",ret.c_str());
		}
	}
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;


int main(void){
    int n;
    vector<int> v;
    int tmp;
    cin >> n;
    rep(i,n){
        cin >> tmp;
        v.push_back(tmp);
    }
    vector<int> csum;
    rep(i,n){
        if(i==0){
            csum.push_back(abs(v[i]));
        }else{
            csum.push_back(csum[i-1]+abs(v[i-1]-v[i]));
        }
    }
    rep(i,n){
        if(i==0){
            cout << csum[n-1]-csum[1]+abs(v[1])+abs(v[n-1]) << endl;;
        }else if(i==n-1){
            cout << csum[n-2]+abs(v[n-2]) << endl;
        }else{
            cout << csum[n-1]-csum[i+1]+csum[i-1]+abs(v[i-1]-v[i+1])+abs(v[n-1]) << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 2168
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <iomanip>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

//冪乗(繰り返し2乗法) (x^n) % mod 
template<class Type>
Type pow(Type x,Type n,Type mod){
	Type res=1;
	while(n>0){
		if(n&1) res=res*x%mod;
		x=x*x%mod;
		n>>=1;
	}
	return res;
}

// (nCm) % mod fermat小
template<class Type>
Type combination(Type n,Type m,Type mod){
	if(m==0) return 1LL;
	Type nume=1; //分子
	for(Type i=0;i<m;i++) nume=nume*(n-i)%mod;
	Type deno=1; //分母
	for(Type i=1;i<=m;i++) deno=deno*i%mod;
	Type res=nume*pow(deno,mod-2,mod);
	res%=mod;
	return res;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll N,K,mod=1000000007;
	cin>>N>>K;
	ll R=N-K,B=K;

	for(ll i=1;i<=K;i++){
		ll tmp;
		tmp=combination(R+1,i,mod);
		tmp*=combination(B-1,i-1,mod);
		tmp%=mod;
		cout<<tmp<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100
#define INFTY (1<<21)
#define White 0
#define Gray 1
#define Black 2
int prim(void);

int n, M[MAX][MAX];

int main(){
  int i,j;
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      scanf("%d",&M[i][j]);
      if(M[i][j] == -1) M[i][j] = INFTY;
    }
  }
  printf("%d\n",prim());

  return 0;
}

int prim(){
  int color[MAX],d[MAX],p[MAX];
  int min,u,v,sum=0;
  int i;

  for(i = 0; i < n; i++){
    color[i] = White;
    d[i] = INFTY;
    p[i] = -1;
  }

  d[0] = 0;
  p[0] = -1;
  
  while(1){
    min = INFTY;
    for(i = 0; i < n; i++){
      if(color[i] != Black && d[i] < min){
	min = d[i];
	u = i;
      }
    }
    if(min == INFTY) break;
      color[u] = Black;
      
      for(v = 0; v < n; v++){
	if(color[v] != Black && M[u][v] != INFTY){
	  if(M[u][v] < d[v]){
	    d[v] = M[u][v];
	    p[v] = u;
	    color[v] = Gray;
	  }
	}
      }
  }
  for(i = 0; i < n; i++){
    if(p[i] != -1) sum += M[i][p[i]];
  }
  return sum;
}

Measured memory_bytes: 632
import java.util.*;
public class Main{
	public static void main(String[] args){
		int ans = 0;
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		
		if(n % 2 == 1){
			if((n+1)/2 >= k){
				System.out.println("YES");
			}
			else{
				System.out.println("NO");
			}
		}
		else{
			if(n/2 >= k){
				System.out.println("YES");
			}
			else{
				System.out.println("NO");
			}
		}
	}
}


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

int main () {
  int n , m ;
  cin >> n >> m ;
  
  int j = 0 ;
  
  for ( int i = n ; i <= m ; i++ ){
    int a , b , c , d , e ;
    a = i / 10000 ;
    b = ( i - 10000 * a) / 1000 ;
    c = ( i - 10000 * a - 1000 * b ) / 100 ;
    d = ( i - 10000 * a - 1000 * b - c * 100 ) / 10 ;
    e = ( i - 10000 * a - 1000 * b - c * 100 - d * 10 ) ;
    
    if ( a == e && b == d ) {
      j++;
    }
  } 
  cout << j << endl ;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int bubblesort(int a[],int n)
{
    int flag=1,times=0;
    /*
    while(flag)
    {
        flag=0;
        for(int j=n-1;j>=i+1;j--)
            if(a[j]<a[j-1])
            {
                swap(a[j],a[j-1]);
                times++;
                flag=1;
            }
        i++;
    }
    */
    for(int i=n-1;i>=0;i--)
        for(int j=0;j<i;j++)
            if(a[j]>a[j+1])
            {
                swap(a[j+1],a[j]);
                times++;
            }
    return times;
}
int main()
{
    int a[100],times;
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i];
    times=bubblesort(a,n);
    for(int i=0;i<n-1;i++)
        cout<<a[i]<<' ';
    cout<<a[n-1];
    cout<<endl;
    cout<<times<<endl;
    return 0;
}

Measured memory_bytes: 3092
n=int(input())
a=[[int(i)for i in input().split()]for i in range(n)]
import itertools as it
li=list(it.permutations(range(n)))
total=0
for i in li:
    tmp=0
    for j in range(n-1):
        x1,x2=a[i[j]][0],a[i[j+1]][0]
        y1,y2=a[i[j]][1],a[i[j+1]][1]
        tmp=(x1-x2)**2+(y1-y2)**2
        total+=tmp**0.5
print(total/len(li))

Measured memory_bytes: 8052
from string import ascii_lowercase
from functools import reduce
from operator import mul

# 入力
N = int(input())
S = input()

# 解は(各アルファベットの出現回数+1)の総積
ans = (
    reduce(
        mul,
        map(
            lambda c: S.count(c) + 1,
            ascii_lowercase
        )
    ) - 1
) % (10**9 + 7)

# 出力
print(ans)

Measured memory_bytes: 3964
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n;
    ll a,b;
    ll x,y;
    ll pos1;
    ll pos2;
    x=1;
    y=1;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a>>b;
        if(x%a)
        {
            pos1=x/a+1;
        }
        else
        {
            pos1=x/a;
        }
        if(y%b)
        {
            pos2=y/b+1;
        }
        else
        {
            pos2=y/b;
        }
        x=max(pos1,pos2)*a;
        y=max(pos1,pos2)*b;
    }
    cout<<x+y<<endl;
    return 0;
}


Measured memory_bytes: 256
// The very basic /////////////////////////////////////////////////////////////
#include <bits/stdc++.h>
using namespace std;
#define ALL_H 1

// Print elements of containers using << operator /////////////////////////////
// pair
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {
  return s << "(" << p.first << ", " << p.second << ")";}
// vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  for (auto &elem : v) {
    s << elem;
    if (&elem != &v.back()) s << " ";
  }
  return s;
}
// 2 dimentional vector
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  for (auto &elem : vv) {
    s << elem;
    if (&elem != &vv.back()) s << endl;
  }
  return s;
}
// map
template<typename T1, typename T2> ostream& operator<<(ostream& s, const map<T1, T2>& m) {
  s << "{" << endl;
  for (auto &elem: m) {
    s << " " << elem.first << " : " << elem.second << endl;
  }
  s << "}";
  return s;
}
//set
template<typename T> ostream& operator<<(ostream& s, const set<T>& m) {
  s << "{ ";
  for (auto &elem: m) {
    s << elem << " ";
  }
  s << "}";
  return s;
}

// Convenient macros //////////////////////////////////////////////////////////

// types
#define ll long long
#define ld long double
#define int ll
#define Pi pair<int, int>
#define Graph vector<vector<int>>
#define WeightGraph vector<vector<Pi>>

// other
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

#define MOD 1000000007
#define INF LLONG_MAX/100

// update max or min //////////////////////////////////////////////////////////

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

// gcd
int gcd(int a,int b){return b?gcd(b,a%b):a;}

// direction
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};


// Debug it by D(x) ///////////////////////////////////////////////////////////
#define DEBUG 1
#if DEBUG
#define D(x) x
#else
#define D(x)
#endif

///////////////////////////////////////////////////////////////////////////////
//                             Start Coding Here                             //
///////////////////////////////////////////////////////////////////////////////

signed main() {
  int N;
  cin >> N;
  vector<int> A(N); 
  rep(i, N) cin >> A[i];
  int ans = 0;
  int now = INF;
  rep(i, N) {
    if (chmin(now, A[i])) {
      ans++;
    } 
  }
  cout << ans << endl;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

typedef long long ll;

#define rep(i, a, n) for (ll i = a; i < (ll)n; ++i)
#define repd(i, n) for (ll i = (n)-1; i >= 0; --i)
#define INF 10e12
#define MOD 1000000000 + 7
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))

using namespace std;

int main(void)
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    s[k - 1] = s[k - 1] + 32;
    cout << s << endl;
}

Measured memory_bytes: 3544
N, A, B = map(int, input().split())
if A > B:
    print(0)
    exit()

if N == 1:
    if A == B:
        print(1)
    else:
        print(0)
    exit()


C = N - 2
l = A * C
h = B * C
print(h - l + 1)

Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

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

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 

void solve(){
   string s;
   cin >> s;
   int q;
   cin >> q;
   for(int i = 0; i < q; i++){
	  string a, input;
	  int x, y;
	  cin >> a;
	  if (a == "print"){
		  cin >> x >> y;
		  for(int i = x; i <= y; i++) cout << s[i]; 
		  cout << endl; 
		}
	  else if (a == "reverse"){
		  cin >> x >> y;
		  reverse(s.begin() + x, s.begin() + y + 1);  
		}
      else if (a == "replace"){
		 cin >> x >> y >> input;
		 int idx  = 0;
		 for(int i = x; i <= y; i++) {
			 s[i] = input[idx];
			 idx++;
		 }  
	   }   
	}
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}



Measured memory_bytes: 3228
#include <bits/stdc++.h>
#define ii pair < int , int >
#define fi first
#define se second

using namespace std;
const int N=1e5+55;
vector < int > vec[N];
bool in[N];
int dp[N];
int n,m;

int dfs(int u)
{
	int &ret=dp[u];
	if(ret!=-1)
		return ret;
	ret=0;
	for(auto v:vec[u])
		ret=max(ret,dfs(v)+1);
	return ret;
}

int main()
{
	ios::sync_with_stdio(false);
	memset(dp,-1,sizeof dp);
	cin>>n>>m;
	for(int i=1,u,v;i<=m;i++)
	{
		cin>>u>>v;
		in[v]=1;
		vec[u].push_back(v);
	}
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		if(!in[i])
			ans=max(ans,dfs(i));
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 9344
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;

void solve(){
    int n;
    cin>>n;
    cout<<(1000-(n%1000))%1000<<"\n";
}

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

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

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

public class Main{
    private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private static final PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    private static StringTokenizer st;

    private static int readInt() throws IOException {
        while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
        return Integer.parseInt(st.nextToken());
    }

    private static String readToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    public static void main(String[] args) throws IOException {
        int N = readInt();
        int ac = 0;
        int wa = 0;
        int tle = 0;
        int re = 0;
        for (int i = 0; i < N; i++) {
            String verdict = readToken();

            switch (verdict) {
                case "AC":
                    ac++;
                    break;
                case "WA":
                    wa++;
                    break;
                case "TLE":
                    tle++;
                    break;
                case "RE":
                    re++;break;
                default:
                    // Impossible
            }
        }

        pw.println("AC x " + ac
                + "\nWA x " + wa
                + "\nTLE x " + tle
                + "\nRE x " + re);
        pw.close();
    }
}


Measured memory_bytes: 48716
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
typedef long long ll;
int main() {
	string s; cin >> s;
	for (int i = 0; i < s.size(); i++)if (s[i] == '9') { cout << "Yes\n"; return 0; }
	cout << "No\n";
}


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


int main(){

int N;
cin >> N;
vector<int> vec(N);
for(int i=0; i<N ;i++)cin >> vec.at(i);

vector<int> res(110,0); //対応する数値の対象の数を収納

for(int i=0;i<N; i++){
    res.at(vec.at(i))++;
}

int count =0; //答え

for (int i = 1; i <= 100;i++){
    if(res.at(i)){
        ++count;
    }
}

    cout << count <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const ll INF = 1000000000;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c; cin >> a >> b >> c;
    int ans = (b>=c ? b+c : 2*b+min(a,c-b) + (a<c-b));
    cout << ans << endl;
    return 0;
}

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

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

  if(n==1){cout<<"! "<<1<<endl;  cout.flush();return 0;}  

  int idx = 0,dis = 0;
  for(int i=2;i<=n;i++){
    int d;
    cout<<"? "<<1<<" "<<i<<endl;  cout.flush();  
    cin>>d;
    if(d>dis) dis = d,idx = i;
  }
  
  
  int ans[20000];
  ans[1] = idx;
  for(int i=1;i<=n;i++){
    if(i==idx)continue;
    int d;
    cout<<"? "<<idx<<" "<<i<<endl;  cout.flush();  
    cin>>d;
    ans[d+1] = i;
  }
  
  cout<<"! ";
  for(int i=1;i<=n;i++){
      if(i!=1)cout<<" ";
      cout<<ans[i];
    }
  cout<<endl;
  cout.flush();  
  return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, s, low=101, ans=0;
  cin>>N;
  for(int i=0; i<N; i++){
    cin >>s;
    if(s%10!=0) low=min(low,s);
    ans+=s;
  }
  if(ans%10==0){
    if(low==101) ans=0;
    else ans-=low;
  }
  cout<<ans<<endl;
}

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

using namespace std;

typedef long long int ll;

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

  int n, k;
  cin >> n >> k;
  vector < int > a (n + 1);
  for (int i = 1; i <= n; i++) cin >> a[i];

  for (int i = k + 1; i <= n; i++) {
    cout << (a[i] > a[i - k] ? "Yes" : "No") << '\n';
  }
}


Measured memory_bytes: 3988
#include <stdio.h>

int main()
{
    int s,h,m;
    scanf("%d",&s);
    h=s/3600;
    printf("%d",h);
    printf(":");
    s%=3600;
    m=s/60;
    printf("%d",m);
    printf(":");
    s%=60;
    printf("%d",s);
    printf("\n");
    return 0;
}



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

int main()
{
	int x,n,y=0;
	cin>>x>>n;
	int a[n+1];
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n;i++)y+=a[i];
	if(y>=x)
	   cout<<"Yes";
	else
	   cout<<"No";
	return 0;
} 

Measured memory_bytes: 640
#include<cstdio>
#include<algorithm>
using namespace std;
int tate,yoko,jikosu,ans;
int jikoy,jikox,x,y;
int koko[41][41];
void fanc(int,int);
	int main(void){
		int j,i,z=0;
		while(1){
			ans=z;
		scanf("%d %d",&yoko,&tate);
		if(yoko==0&&tate==0)
			break;
		scanf("%d",&jikosu);
		for(i=0;i<41;i++){
			for(j=0;j<41;j++)
				koko[i][j]=0;
		}
		for(i=0;i<jikosu;i++){
			scanf("%d %d",&jikoy,&jikox);
			koko[jikox-1][jikoy-1]=1;
		}
		x=0;
		y=0;
		fanc(x, y);
		printf("%d\n",ans);
		}
		return 0;
	}
	void fanc(int x, int y){
		int i,j,a,b;
		if(x+1<tate){
			if(koko[x+1][y]==0){
				fanc(x+1,y);
			}
		}
		if(y+1<yoko){
			if(koko[x][y+1]==0){
				fanc(x,y+1);
			}
		}
		if(x==tate-1 && y==yoko-1){
			ans++;
		}
	}

Measured memory_bytes: 1032
#include <iostream>
#include <cstdio>
#include <vector>

using namespace std;

typedef long long ll;

ll n;
ll a[200005];
ll sz;
vector<ll> ve, vi;
bool v;
bool vv;

void g(ll p, ll q)
{
    ll now = p;
    while(1)
    {
        if(now == 0)
        {
            vv = true;
            return;
        }
        if(vi.back() == now)
        {
            if(ve.back() == q - 1) vi.pop_back(), ve.pop_back(), now--;
            else
            {
                ve.back()++;
                return;
            }
        }
        else
        {
            ve.push_back(1);
            vi.push_back(now);
            return;
        }
    }
}

bool f(ll p)
{
    ll now = 0;
    vv = false;
    ve.clear(), vi.clear();
    for(ll i = 0; i < n; i++)
    {
        if(a[i] > now)
        {
            now = a[i];
            continue;
        }
        now = a[i];
        while(!vi.empty() && vi.back() > now) ve.pop_back(), vi.pop_back();
        if(!vi.empty() && vi.back() == now) g(now, p);
        else ve.push_back(0), vi.push_back(now), g(now, p);
        if(vv) return false;
    }
    return true;
}

int main()
{
    scanf("%lld", &n);
    for(ll i = 0; i < n; i++)
    {
        scanf("%lld", &a[i]);
        if(i > 0 && a[i - 1] >= a[i]) v = true;
    }
    if(!v)
    {
        printf("1\n");
        return 0;
    }
    f(2);
    ll lt = 2, rt = 200000, mid, ans;
    while(lt <= rt)
    {
        mid = (lt + rt) / 2;
        if(f(mid)) ans = mid, rt = mid - 1;
        else lt = mid + 1;
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
using Graph = vector<vector<int>>;

int main() {
    // 頂点数と辺数
    int N, M;
    cin >> N >> M;
    int loc_light[N];
    for (int i = 0; i < N; ++i) {
        loc_light[i] = 0;
    }

    // グラフ入力受取 (ここでは無向グラフを想定)
    Graph G(N);
    for (int i = 0; i < M; ++i) {
        int a, b;
        cin >> a >> b;
        G[a-1].push_back(b-1);
        G[b-1].push_back(a-1);
    }

    // BFS のためのデータ構造
    vector<int> dist(N, -1); // 全頂点を「未訪問」に初期化
    queue<int> que;

    // 初期条件 (頂点 0 を初期ノードとする)
    dist[0] = 0;
    que.push(0); // 0 を橙色頂点にする

    // BFS 開始 (キューが空になるまで探索を行う)
    while (!que.empty()) {
        int v = que.front(); // キューから先頭頂点を取り出す
        que.pop();

        // v から辿れる頂点をすべて調べる
        for (int nv : G[v]) {
            if (dist[nv] != -1) continue; // すでに発見済みの頂点は探索しない

            // 新たな白色頂点 nv について距離情報を更新してキューに追加する
            dist[nv] = dist[v] + 1;
            loc_light[nv] = v;
            que.push(nv);
        }
    }

    // 結果出力 (各頂点の頂点 0 からの距離を見る)]
    cout << "Yes" << endl;
    for (int i = 1; i < N; ++i){
        cout << loc_light[i]+1 << endl;
    }
}


Measured memory_bytes: 10664
import bisect
a,b,q = (int(i) for i in input().split())
s = [int(input()) for s in range(a)]
t = [int(input()) for p in range(b)]
inf = 10**15
s = [-inf]+s+[inf]
t = [-inf]+t+[inf]
def distan(x,s,t):
  return(min(abs(x-s)+abs(s-t),abs(x-t)+abs(t-s)))

for i in range(q):
  x = int(input())
  sl = bisect.bisect_left(s,x)
  sr = bisect.bisect_right(s,x)
  if sl == sr:sl -= 1
  tl = bisect.bisect_left(t,x)
  tr = bisect.bisect_right(t,x)
  if tl == tr:tl -= 1
    
  sl = s[sl]
  sr = s[sr]
  tl = t[tl]
  tr = t[tr]
  ans = inf
  #1 x-sl-tl,x-tl-sl...
  print(min(distan(x,sl,tl),distan(x,sr,tl),distan(x,sl,tr),distan(x,sr,tr)))

  
  
  

Measured memory_bytes: 12836
#include <bits/stdc++.h>
#define F first
#define S second

using namespace std;
typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    string foo;
    for (int i = 0; i < n; ++ i) {
        foo.push_back(s[i]);
        foo.push_back(t[i]);
    }
    cout << foo;
    
}

Measured memory_bytes: 256
n = int(input().strip())
data = list(map(int, input().split()))

count = {-1: 3}
ans = 1
mod = 10 ** 9 + 7
for x in data:
  val = count.get(x-1, 0) - count.get(x, 0) 
  ans = (ans * val) % mod
  count[x] = count.get(x, 0) + 1
print (ans)


Measured memory_bytes: 18272
X = int(input())

if(X<600):
  print("8")
elif(X<800):
  print("7")
elif(X<1000):
  print("6")
elif(X<1200):
  print("5")
elif(X<1400):
  print("4")
elif(X<1600):
  print("3")
elif(X<1800):
  print("2")
else:
  print("1")

Measured memory_bytes: 9180
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#define SF scanf
#define PF printf
#define MAXN 30
using namespace std;
char s[MAXN];
bool used[MAXN];
int main(){
	SF("%s",s);
	int len=strlen(s);
	for(int i=0;i<len;i++)
		used[s[i]-'a']=1;
	for(int i=0;i<26;i++)
		if(used[i]==0){
			PF("%s%c",s,i+'a');
			return 0;
		}
	for(int i=len-2;i>=0;i--){
		int minid=-1;
		for(int j=i+1;j<len;j++)
			if(s[j]>s[i]&&(minid==-1||s[minid]>s[j]))
				minid=j;
		if(minid!=-1){
			for(int j=0;j<i;j++)
				PF("%c",s[j]);
			PF("%c",s[minid]);
			return 0;
		}
	}
	PF("-1");
}
 

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


int main()
{
	int n;
	cin >> n;
	double a=0.5;
	if (n % 2 == 1)
	{
		a = (n / 2 + 1) / double(n);
	}
	cout << a << endl;
}

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

void bubbleSort(int A[], int N) {
    bool  flag = 1;
    while(flag) {
        flag = 0;
        for(int i = N - 1; i > 0; i--) {
            if(A[i] < A[i - 1]) {
                swap(A[i], A[i - 1]);
                flag = 1;
            }
        }
    }
}

int main() {
    int N, A[20000];
    cin >> N;
    for(int i = 0; i < N; i++) cin >> A[i];

    long long total = 0;
    for(int i = 0; i < N; i++) {
        total += A[i];
    }

    bubbleSort(A, N);

    cout << A[0] << " " << A[N - 1] << " " << total << endl;

}


Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
int main(void){
 int a,b,c;
  cin>>a>>b>>c;
  if(a==b&&b==c) cout<<"1"<<endl;
  else if((a==b||a==c)||b==c) cout<<"2"<<endl;
  else cout<<"3"<<endl;
}

Measured memory_bytes: 256
n, a, b = map(int, input().split())

blue_ball = a
red_ball = b

n_bai = n // (a + b)
n_amari = n % (a + b)

balls = []
ans = 0

balls_sum = 0

while balls_sum < n_amari:
    balls.append(a)
    balls.append(b)
    balls_sum = sum(balls)

while n_amari > 0:
    if n_amari > blue_ball:
        ans += blue_ball
    else:
        ans += n_amari
    n_amari = n_amari - blue_ball - red_ball

ans += n_bai * blue_ball

print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define mp make_pair
#define fi first
#define se second
#define pb push_back

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    int n;
    ll a[112345], b[112345];
    pair<ll, int> c[112345];

    cin >>
        n;
    REP(i, n)
    {
        cin >> a[i] >> b[i];

        c[i] = make_pair(a[i] + b[i], i);
    }

    sort(c, c + n);

    ll res = 0;
    bool ba = true;

    for (int i = n - 1; i >= 0; i--)
    {
        if (ba)
            res += a[c[i].second];
        else
            res -= b[c[i].second];

        ba = !ba;
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 3712
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
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; }


using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    if (a >= b) {
        rep(i, a) {
            cout << b;
        }
        cout << endl;
    } else {
        rep(i, b) {
            cout << a;
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;
 
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;

int main() {

	string S; cin >> S;

	bool used[26];
	REP(i,26) used[i] = false;
	REP(i,S.size()) used[S[i] - 'a'] = true;

	int cnt = 0;
	REP(i,26) {
		if (used[i]) cnt++;
	}

	if (cnt < 26) {
		char t;
		REP(i,26) if (!used[i]) {
			t = (char)(i + 'a');
			break;
		}
		S.push_back(t);
		cout << S << endl;
	} else {
		string E = "zyxwvutsrqponmlkjihgfedcba";
		if (S == E) {
			cout << -1 << endl;
		} else {
			vector < int > arr, arr_t;
			REP(i,S.size()) arr.push_back(S[i] - 'a');
			arr_t = arr;
			next_permutation(arr.begin(), arr.end());
			int i = 0;
			while (i < 26) {
				cout << (char)('a' + arr[i]);
				if (arr[i] > arr_t[i]) break;
				i++;
			}
			cout << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<numeric>
#include<utility>
#include<unordered_map> //hash map
#include<cstring>
#include<cmath>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define MOD 1000000007

typedef  long long ll;

using namespace std;


void solve() {
   ll a,b,c;
   cin >> a >> b;
   int ans = 0;
   if(a == 3 || a == 1) ans += 300000/a;
   else if(a == 2) ans += 200000;
  
   else ans = 0;

   if(b == 3 || b == 1) ans += 300000/b;
   else if(b == 2) ans +=  200000;
   

   if(a == 1 && b == 1) cout << ans+400000 << endl;
   else cout << ans<< endl;
   /*
   cout << "Yes" << endl;
   */
}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
	return 0;
}



Measured memory_bytes: 256
local s = io.read()
local t = {}
local ret = 0
local cur = 0
for i = 1, #s do
  local ss = s:sub(i, i) == "0"
  if ss then
    if cur < 0 then
      cur = cur + 1
      ret = ret + 1
    else
      cur = cur + 1
    end
  else
    if 0 < cur then
      cur = cur - 1
      ret = ret + 1
    else
      cur = cur - 1
    end
  end
end
print(ret * 2)


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

int main() {
int A,B,C,D,E;
cin >> A >> B >> C >> D >> E;
if(A<0){
	cout << C*(0-A)+D+E*B << endl;
}
else if(A>0){
	cout << E*(B-A) << endl;
}
return 0;
}


Measured memory_bytes: 3120
import Text.Printf

solve1 a b = (d,r,f)
  where
    d = a `div` b
    r = a `mod` b
    f = (toDouble a) / (toDouble b)

toDouble :: Int -> Double
toDouble x = fromInteger $ toInteger x

main = do
  temp <- getLine
  let [a,b] = map read . words $ temp
      (d,r,f) = solve1 a b
  printf "%d %d %.10f\n" d r f



Measured memory_bytes: 4036
#include<iostream>
#include<cstdio>
#include<cmath>

using namespace std;

int main(){
    int n,A[1000];
    
    
    while(1){
        cin >> n;
        if(n==0) break;
    
    for(int i=0; i<n; i++) cin>>A[i];
    int sum=0;
    for(int i=0; i<n; i++) sum+=A[i];
    double avg= 1.0*sum / n;
    double dist =0.0;
    for(int i=0; i<n; i++){
        dist += (avg - A[i])*(avg -A[i]);
        
    }
    
    printf("%lf\n", sqrt(dist/n));
    }
    
}


Measured memory_bytes: 3148
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
// 
void yes(){
  cout <<"Yes"<<endl ;
}
void no(){
  cout <<"No"<<endl ;
}


//-------------------------------------------------
// メモ
/*






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


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n ;
  cin >> n ;
  vector<int> p(n) ;
  vector<int> q(n) ;
  REP(i,n){
    cin >> p[i] ;
  }
  REP(i,n){
    cin >> q[i] ;
  }
  bool pf = true ;
  bool qf = true ;
  int cntp = 1 ;
  int cntq = 1 ;
  vector<int> a(n) ;
  REP(i,n){
    a[i] = i+1 ;
  }
  do{
    if(a==p){
      pf = false ;
    }
    cntp++ ;
  }
  while(next_permutation(ALL(a)) && pf) ;
  
  
  REP(i,n){
    a[i] = i+1 ;
  }

  do{
    if(a==q){
      qf = false ;
    }
    cntq++ ;
  }
  while(next_permutation(ALL(a)) && qf) ;
  
  //cout << cntp <<" " <<cntq <<endl ;
    
  cout << abs(cntp - cntq) <<endl ;
  
  
  
  
  
  return 0 ;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
	public static void main(String[] $){
		System.err.println();
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		int[]a=new int[n];
		Arrays.setAll(a,i->s.nextInt());

		int r=0;
		for(int i=1;i<n-1;++i) {
			if(a[i-1]>a[i]&&a[i]>a[i+1])
				++r;
			if(a[i-1]<a[i]&&a[i]<a[i+1])
				++r;
		}
		System.out.println(r);
	}
}


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

typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

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 ll INF = 1e18;
const ll MOD = 998244353;
const ll MX = 1000001;

int A, B, C, D, E, F;
bool dp[3005]; 
set<int> pos;

long double dens = -1;
ll tot = 0, sug = 0;

void solve() {
    cin >> A >> B >> C >> D >> E >> F;
    A *= 100; B *= 100;
    
    // Precalc pos amount of sugar to add 
	dp[0] = true;
	pos.insert(0);
    for (int i = 0; i < 3005; i++) {
		if (i - C >= 0 && dp[i - C]) {
			dp[i] = true;
			pos.insert(i);
		} else if (i - D >= 0 && dp[i - D]) {
			dp[i] = true;
			pos.insert(i);
		}
	}
	
    for (int a = 0; a <= F / A; a++) {
		for (int b = 0; (b * B) + (a * A) <= F; b++) {
			int water = (b * B) + (a * A);
			// cout << a << " " << b << " " << water << "\n";
			int maxSugar = min(F - water, water / 100 * E);
			
			auto it = pos.lower_bound(maxSugar);
			if (it == pos.begin()) continue;
			if (it == pos.end() || *it != maxSugar) --it;
			// cout << *it << "\n";
			int sugar = *it;
			long double tmpD = ((long double)sugar / (long double)(water + sugar));
			// cout << sugar << " " << water << "\n";
			if (tmpD > dens) {
				dens = tmpD;
				tot = water + sugar;
				sug = sugar;
			}
		}
	}
	
	cout << tot << " " << sug;
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
    ll T = 1; // cin >> T;
    while (T--) solve();
    return 0;
    // You should actually read the stuff at the bottom
}

/* Stuff to Look For
 * -----------------
 * Int overflow, array bounds
 * Initializing all variables, avoid weird behavior
 * Edge cases(n = 0, n = 1)
 * Just return 0 after result
 */


Measured memory_bytes: 384
require 'prime'

class Integer
  # Reffered: http://simanman.hatenablog.com/entry/2014/07/08/164543
  def division_list
    return [] if self <= 0
    return [1] if self == 1
    pdl = Prime.prime_division(self)
    pdl.map{|e| [*(0..e.last)].map{|v| e.first ** v }}.inject{|res, e| res.map{|t| e.map{|v| t * v}}.flatten}.sort
  end
end

N = gets.chomp.to_i

def F(a, b)
  a.to_s.length > b.to_s.length ? a.to_s.length : b.to_s.length
end

if N.prime?
  puts F(N, 1)
  exit
end

res = nil
d = N.division_list
d.slice(0, d.length/2 + 1).each do |n|
  r = F(n, N/n)
  res = r if res.nil?
  res = r if r < res
end
puts res


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

#define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define I insert
#define endl '\n'

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

using vvll = vector< vector<ll> >;
using vll = vector<ll> ;

const ll maxs = 2e5+5;
const ll lmaxs = 20;
ll mod = 1e9+7;
ll oo = 1e15;


vll a;

void pre(){
    for(ll i=1;i<maxs;i++){
        ll val = i*(i+1)/2;
        a.pb(val);
    }    
}

bool get(ll x){
    
    ll cnt=0;
    for(ll i=2;i*i<=x;i++){
        if(x%i==0){
            cnt++;
            while(x%i==0)
                x/=i;
        }
        if(cnt > 1)
            return false;   
    }
    return true;
}

void solve(){
    
    ll n;
    cin >> n;
    ll cnt=0;
    for(ll i=2;i*i<=n;i++){
        if(n%i==0){
            ll c=0;
            while(n%i==0){
                c++;
                n /= i;
            }
            cnt += upper_bound(a.begin(),a.end(),c) - a.begin(); 
        }
    }

    if(n > 1)
        cnt++;

    cout << cnt << endl;

}

int main(){
    // #ifndef ONLINE_JUDGE
    // freopen("input00.txt","r",stdin);
    // #endif
    IOS;
    pre();
    ll T = 1;
    //cin>>T;
    while(T--){
        solve();   
    }
    return 0;
}

Measured memory_bytes: 5304
get_number(Number) :-
    get_string(String),
    number_string(Number, String).

get_string(String) :-
    current_input(Input),
    read_string(Input, ' \n', '', _, String).

/* memo
    string_code(1, S, C),
*/

main:-
    get_number(N),
    get_number(M),
    X is N * (N - 1) div 2,
    Y is M * (M - 1) div 2,
    R is X + Y,
    writeln(R).


Measured memory_bytes: 8176
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M; cin >> N >> M;
  vector<int> s(M, 0);
  vector<char> c(M, 0);
  REP(i, M){
    cin >> s[i] >> c[i];
    s[i]--;
  }
  int minN = 0, maxN = 999;
  if(N == 1){
    maxN = 9;
  }else if(N == 2){
    minN = 10; maxN = 99;
  }else{
    minN = 100;
  }
  for(int i = minN; i <= maxN; i++){
    string tmp = to_string(i);
    bool flag = true;
    REP(j, M){
      if(tmp[s[j]] != c[j]) flag = false;
    }
    if(flag){
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int n;
	cin >> n;
	
	bool flg1 = false, flg2 = false, flg3 = false;
	
	for(int i = 0; i < n; i++){
		int d1, d2;
		cin >> d1 >> d2;
		if(d1 == d2){
			if(!flg1) flg1 = true;
			else if(!flg2) flg2 = true;
			else flg3 = true;
		}
		else {
			flg1 = flg2 = false;
		}
	}
	if(flg3) cout << "Yes";
	else cout << "No";
	cout << endl;
}

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

void solve() {
    int H, W, K;
    cin >> H >> W >> K;
    vector<string> G(H);
    rep(i, H) cin >> G[i];
    vector<P> S;
    rep(i, H) rep(j, W) {
        if(G[i][j] == '#') S.emplace_back(i, j);
    }
    vector<vector<int>> A(H, vector<int>(W));
    int n = 0;
    for(auto &s : S) {
        int y = s.first, x = s.second;
        A[y][x] = ++n;
        for(int j = x - 1; j >= 0; --j) {
            if(G[y][j] == '#') break;
            A[y][j] = n;
        }
        for(int j = x + 1; j < W; ++j) {
            if(G[y][j] == '#') break;
            A[y][j] = n;
        }
    }
    for(int j = 0; j < W; ++j) {
        for(int i = 1; i < H; ++i) {
            if(A[i][j] == 0) A[i][j] = A[i - 1][j];
        }
        for(int i = H - 2; i >= 0; --i) {
            if(A[i][j] == 0) A[i][j] = A[i + 1][j];
        }
    }
    for(auto r : A) {
        for(auto p : r) printf("%d ", p);
        printf("\n");
    }
}

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


Measured memory_bytes: 1908
#include<iostream>
using namespace std;
#define rep(i,n) for(i = 0;i <= n;i++)

int num[2001];
int main(){
	int i,j,n;
	int count[1001] = {0},cor = 0;
	rep(i,1000){
		rep(j,1000){
			num[i+j]++;
		}
	}
	while(cin >> n){
		rep(i,2000){
			if(n-i < 0)break;
			if(n-i <= 2000)
				count[cor] += num[i]*num[n-i];
		}
		cor++;
	}
	rep(i,cor-1)
		cout << count[i] << endl;
	return 0;
}

Measured memory_bytes: 1172
#include <iostream>
using namespace std;
int main(){
	int a,b,i,x,y;
	cin>>a>>b;
	if((a==1)&&(b==1) || (a==b))
	cout<<"Draw";
	else if(a==1)
	cout<<"Alice";
	else if(b==1)
	cout<<"Bob";
	else if(a>b)
	cout<<"Alice";
	else cout<<"Bob";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#define ALL(x) (x).begin(), (x).end()
#define sz(a) int(a.size())
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define chu(x) cout<<"["<<#x<<" "<<(x)<<"]"<<endl
#define du3(a,b,c) scanf("%d %d %d",&(a),&(b),&(c))
#define du2(a,b) scanf("%d %d",&(a),&(b))
#define du1(a) scanf("%d",&(a));
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
ll powmod(ll a, ll b, ll MOD) { if (a == 0ll) {return 0ll;} a %= MOD; ll ans = 1; while (b) {if (b & 1) {ans = ans * a % MOD;} a = a * a % MOD; b >>= 1;} return ans;}
void Pv(const vector<int> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%d", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
void Pvl(const vector<ll> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%lld", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
inline long long readll() {long long tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
inline int readint() {int tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
const int maxn = 1000010;
const int inf = 0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/

int main()
{
    //freopen("D:\\code\\text\\input.txt","r",stdin);
    //freopen("D:\\code\\text\\output.txt","w",stdout);
    int a, b;
    a = readint();
    b = readint();
    if (a + b >= 10)
    {
        printf("error\n");
    } else
    {
        printf("%d\n", a + b );
    }
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fo(a,b,c) for (a=b; a<=c; a++)
#define fd(a,b,c) for (a=b; a>=c; a--)
#define min(a,b) (a<b?a:b)
#define max(a,b) (a>b?a:b)
#define ll long long
//#define file
using namespace std;

ll a[502][502],b[502][502],f[501][501],ans,sum;
int n,i,j,k,l;

int main()
{
	#ifdef file
	freopen("agc036d.in","r",stdin);
	#endif
	
	scanf("%d",&n);
	fo(i,1,n)
	{
		fo(j,1,n)
		if (i!=j)
		scanf("%lld",&a[i][j]),b[i][j]=a[i][j]*(i>j),a[i][j]*=(i<j);
	}
	fo(i,1,n) fo(j,1,n) a[i][j]+=a[i-1][j]+a[i][j-1]-a[i-1][j-1],b[i][j]+=b[i-1][j]+b[i][j-1]-b[i-1][j-1];
	
	memset(f,128,sizeof(f));
	fo(i,1,n)
	{
		f[i][0]=b[i][i];
		fo(j,0,i-1)
		{
			fo(k,i+1,n)
			f[k][i]=max(f[k][i],f[i][j]+(a[i][k]-a[i][i])+((b[k][k]-b[i][k])-(b[k][j]-b[i][j])));
		}
	}
	
	ans=0;
	fo(i,0,n-1) ans=max(ans,f[n][i]);
	ans=a[n][n]+b[n][n]-ans;
	printf("%lld\n",ans);
	
	fclose(stdin);
	fclose(stdout);
	return 0;
}

Measured memory_bytes: 9652
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 5LL << 60;
const ll mod = 1e9 + 7;

int main() {
	int H, W;
	cin >> H >> W;
	int a[H][W];
	for(int i = 0; i < H; i++)
		for(int j = 0; j < W; j++) cin >> a[i][j];

	vector<tuple<int, int, int, int>> v;
	for(int i = 0; i < H; i++) {
		for(int j = 0; j < W; j++) {
			if(a[i][j] % 2 == 0) continue;
			if(i == H - 1 && j == W - 1) continue;

			if(j == W - 1) {
				v.push_back(make_tuple(i + 1, j + 1, i + 2, j + 1));
				a[i + 1][j]++;
			} else {
				v.push_back(make_tuple(i + 1, j + 1, i + 1, j + 2));
				a[i][j + 1]++;
			}
		}
	}

	cout << v.size() << "\n";
	for(int i = 0; i < v.size(); i++) cout << get<0>(v[i]) << " " << get<1>(v[i]) << " " << get<2>(v[i]) << " " << get<3>(v[i]) << "\n";
	return 0;
}

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

int main() {
  int h,w;
  cin >> h >> w;
  vector<vector<char>>data(h,vector<char>(w,0));
  for(int i = 0;i < h;i++){
    for(int j = 0;j < w;j++){
      cin >> data.at(i).at(j);
    }
  }
  for(int i = 0;i < h;i++){
    for(int j = 0;j < w;j++){
      if(data.at(i).at(j) == '#'){
        if(i > 0 && data.at(i-1).at(j) == '#') continue;
        else if(i < h-1 && data.at(i+1).at(j) == '#') continue;
        else if(j > 0 && data.at(i).at(j-1) == '#') continue;
        else if(j < w-1 && data.at(i).at(j+1) == '#') continue;
        else{
          cout << "No" << endl;
          return 0;
        }
      }
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 256