akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static void main(String[] args) throws Exception {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        String arr01[] = mylist.get(0).split(" ");

        int a = Integer.valueOf(arr01[0]);
        int b = Integer.valueOf(arr01[1]);

        final double zeiritu8 = 0.08;
        final double zeiritu10 = 0.1;

        for (int i = 1; i <= 1000; i++) {

            double zei8 = i * zeiritu8;
            double zei10 = i * zeiritu10;

            //            System.out.println(i + " " + (int) zei8 + " " + (int) zei10);

            if ((int) zei8 == a && (int) zei10 == b) {
                System.out.println(i);
                return;
            }

        }

        System.out.println(-1);

    }

}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
    vector<int> siz; // 素集合のサイズを表す配列(1 で初期化)

    UnionFind(int N) : par(N), siz(N, 1){ //最初は全てが根であるとして初期化、頂点数N
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
        siz[ry] += siz[rx];
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

    int size(int x) { // 素集合のサイズ
        return siz[root(x)];
    }
};

int main(){
    int N,M,K;cin >> N >> M >> K;
    UnionFind uni(N);
    vector<vector<int>> blo(N);
    rep(i,M){
        int a,b;cin >> a >> b;
        a--;b--;
        blo[a].push_back(b);
        blo[b].push_back(a);        
        uni.unite(a,b);
    }
    rep(i,K){
        int c,d;cin >> c >> d;
        c--;d--;
        if(uni.same(c,d)){
            blo[c].push_back(d);
            blo[d].push_back(c);
        }
    }

    vector<int> ans(N);
    rep(i,N){
        int sz = uni.size(i);
        int bs = blo[i].size();
        int tmp = sz - bs -1;
        ans[i] = tmp;
    }


    rep(i,N)cout << ans[i] << endl;


}


Measured memory_bytes: 8824
#include <stdio.h>

int main(){
  int x,y,v;
  scanf("%d%d",&x,&y);
  if(y>x){
    v=x;
    x=y;
    y=v;
  }
  while(1){
    if((v=x%y)==0) break;
    x=y;
    y=v;
  }
  printf("%d\n",y);
  return 0;
}



Measured memory_bytes: 2084
suits=['S','H','C', 'D']
dic={'S':0,'H':1,'C':2, 'D':3}
orig_cards = set()
missing = set()

for i in range(52):
    orig_cards.add((i%4, i//4+1))

n = int(input())
for i in range(n):
    suit, rank = input().split()
    missing.add((dic[suit] , int(rank)))

l = sorted(orig_cards-missing)

for s,r in l:
    print(suits[s],r)


Measured memory_bytes: 5608
from itertools import permutations

def main():
    N, C = map(int, input().split())
    D = [list(map(int, input().split())) for _ in range(C)]
    c = [list(map(int, input().split())) for _ in range(N)]
    score = [[0] * 3 for _ in range(C)]
    for i in range(N):
        for j in range(N):
            for k in range(C):
                score[k][(i+j)%3] += D[c[i][j]-1][k]

    ans = float('inf')
    for balls in permutations(range(C),3):
        tmp = 0
        for i in range(3):
            tmp += score[balls[i]][i]
        ans = min(ans, tmp)
    print(ans)





if __name__ == "__main__":
    main()

Measured memory_bytes: 75176
A,B,C,D=map(int,input().split())
atA=0
atC=0
while(A>0):
    A-=D 
    atA+=1 
while(C>0):
    C-=B 
    atC+=1
#print(atA,atC)
if(atA>=atC):
    print('Yes')
else:
    print('No')

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

int main() {
  string s;cin>>s;
  vector<int> ans(26);
  rep(i,s.size()){
    ans[s[i]-'a']++;
  }
  rep(i,26){
    if(ans[i]==0){
      cout<<(char)('a'+i)<<endl;
      return 0;
    }
  }
  cout<<"None"<<endl;
}

Measured memory_bytes: 3732
#include<bits/stdc++.h>
using namespace std;
int n;
string s[103];
int main(){
	cin>>n;
	cin>>s[0];
	for(int i=1;i<n;i++)
	{
		cin>>s[i];
		if(s[i][0]!=s[i-1][s[i-1].size()-1])
		{
			cout<<"No";
			return 0;
		}
	}
	for(int i=0;i<n;i++)
		for(int j=i+1;j<n;j++)
			if(s[i]==s[j])
			{
				cout<<"No";
				return 0;
			}
	cout<<"Yes";
}

Measured memory_bytes: 256
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}

console.log(main());
function main(){
  var h = o.a();
  var w = o.a();
  var a = o.a();
  var b = o.a();
  var ans = xArray(0,h,w);
  var t = 0;
  for(var y = 0; y < h; y++){
    if(y === b)t = 1;
    for(var x = 0; x < w; x++){
      if(x >= a)ans[y][x] = 1;
      if(t)ans[y][x] ^= 1;
    }
  }
  return ans.map(a=>a.join("")).join("\n");
}

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

int main(){
  int N, K;
  cin >> N >> K;
  int answer = 1;
  for(int i=0;i<N;i++){
    if(answer < K){
      answer *= 2;
    }
    else{
      answer += K;
    }
  }
  cout << answer << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;cin>>n>>m;
  if(n>=m){
    cout <<0<<endl;
    return 0;
  }
  vector<int>x(m);
  for(int i=0;i<m;i++){
    cin>>x.at(i);
  }
  sort(x.begin(),x.end());
  vector<int>l(m-1);
  for(int i=0;i<m-1;i++){
    l.at(i)=abs(x.at(i+1)-x.at(i));
  }
  int ans=x.at(m-1)-x.at(0);
  sort(l.rbegin(),l.rend());
  for(int i=0;i<n-1;i++){
    ans-=l.at(i);
  }
  cout <<ans<<endl;
}

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

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

    string a,b;
    int n,ans;
    
    cin >> a >> b;
    
    n   = stoi(a+b);
    ans = sqrt((double)n);

    if(ans * ans == n) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::*;

fn read <T: FromStr>(s: &mut StdinLock) -> Option<T> {
    let s = s.by_ref().bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok()
}

pub fn main() {
    let stdin = stdin();
    let mut stdin = stdin.lock();

    let n: u32 = read(&mut stdin).unwrap();
    let x: u32 = read(&mut stdin).unwrap();

    let x = x / 1000;
    let mut res = (-1i32, -1i32, -1i32);
    for i in (0..(n + 1)).rev() {
        if res != (-1, -1, -1) {
            break;
        } else if 10 * i > x {
            continue;
        }

        for j in (0..(n + 1 - i)).rev() {
            if res != (-1, -1, -1) {
                break;
            } else if 10 * i + 5 * j > x {
                continue;
            }


            let k = x - 10*i - 5*j;
            if i + j + k == n {
                res = (i as i32, j as i32, k as i32);
            }
        }
    }

    println!("{} {} {}", res.0, res.1, res.2);
}


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

int dp[3005][3005],maxn;
pair<int,int> ar[3005];
vector<int> late;

int main(){
	int n,t;
	cin>>n>>t;
	for(int i=0;i<n;i++)
		cin>>ar[i].first>>ar[i].second;
	sort(ar,ar+n);
	for(int i=0;i<n;i++)
		for(int j=0;j<t;j++){
			if(j<t-ar[i].first){
				dp[i+1][j+ar[i].first]=max(dp[i][j]+ar[i].second,dp[i+1][j+ar[i].first]);
			}else maxn=max(maxn,dp[i][j]+ar[i].second);
			dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
		}
	cout<<maxn<<'\n';
}

Measured memory_bytes: 35584
n = int(input())
n_ = n

factors = []
while n%2 == 0:
    factors.append('2')
    n //= 2

for f in range(3, int(n**0.5) + 1, 2):
    while n%f == 0:
        factors.append(str(f))
        n //= f

if n > 1:
    factors.append(str(n))

print("{}: {}".format(n_, " ".join(factors)))




Measured memory_bytes: 5636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const ll INF=mod*mod;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
ll min(ll a,ll b){
  if(a>b){
    return b;
    }
      else{
        return a;
      }
  }
  
  ll max(ll a,ll b){
    if(a>b){
      return a;
    }
    else{
      return b;
    }
  }

ll power(ll a,ll b){
 ll ans=1;
 for(ll i=1;i<=b;i++){
ans*=a;
  }
  return ans;
}

 ll gcd(ll m,ll n){
 	if(n==0){
       return m;
     }
   return gcd(n,m%n);
 }
ll lcm(ll a,ll b){
  ll g=gcd(a,b);
  return a/gcd(a,b)*b;
		

}
int main(){
  ll N;
  cin>>N;
  
if(N%2==0){
  printf("%lf",0.5000000000);
}
else{
  printf("%.10f",(N/2+1)*1.0/N);
}
}


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

vector<int> C(26, 0); // C[i]
vector<vector<int> > S(365, vector<int>(26, 0)); // S[d][i]
int D;
int N;

int score(vector<int> V) {
	vector<int> c = C;
	int s = 0;
	for (int d = 0; d < D; d++) {
		c[V[d]] = 0;
		s += S[d][V[d]];
		s -= accumulate(c.begin(), c.end(), 0);
		for (int i = 0; i < N; i++) {
			c[i] += C[i];
		}
	}
	return s;
}

vector<int> findmin() {
	vector<int> V(D, 0);
	vector<int> c = C;
	int s = 0;
	for (int d = 0; d < D; d++) {
		int mi = 0;
		for (int i = 0; i < N; i++) {
			if (S[d][mi] + 10 * c[mi] < S[d][i] + 10 * c[i]) mi = i;
		}
		V[d] = mi;
		c[V[d]] = 0;
		s += S[d][V[d]];
		s -= accumulate(c.begin(), c.end(), 0);
		for (int i = 0; i < N; i++) {
			c[i] += C[i];
		}
	}
	return V;
}

int main() {
	cin >> D;
	N = 26;
	for (int i = 0; i < N; i++) {
		cin >> C[i];
	}
	for (int d = 0; d < D; d++) {
		for (int i = 0; i < N; i++) {
			cin >> S[d][i];
		}
	}
	vector<int> V(D, 0);
	for (int d = 0; d < D; d++) {
//		cin >> V[d];
//		V[d]--;
		int i = 0;
		for (int j = 1; j < N; j++) {
			if (S[d][i] < S[d][j]) i = j;
		}
		V[d] = i;
	}

	vector<int> sV = findmin();
	if (score(V) < score(sV)) V = sV;

	random_device seed_gen;
	mt19937 engine(seed_gen());
	uniform_real_distribution<> dist1(0.0, 1.0);

	vector<int> newV = V;
//	cout << "cur " << score(V);
//	for (int d = 0; d < D; d++) { cout << " " << V[d]+1; }
//	cout << endl;
	int ms = score(V);
	for (int j = 0; j < 100000; j++) {
		newV = V;
		for (int k = 0; k < 1; k++) {
			newV[int(dist1(engine) * D)] = int(dist1(engine) * N);
		}
		int ns = score(newV);
//		cout << "new " << ns;
//		for (int d = 0; d < D; d++) { cout << " " << newV[d]+1; }
//		cout << endl;
		if (ms < ns) V = newV;
	}

	for (int d = 0; d < D; d++) {
		cout << V[d] + 1 << endl;
	}
//	cerr << score(V) << endl;
  	return(0);
}


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


int main() {
    std::string squares;
    std::cin >> squares;
    
    int numOfMarble = 0;
    for(int i = 0; i < squares.length(); ++i) {
        if(squares.at(i) == '1') {
            ++numOfMarble;
        }
    }
    std::cout << numOfMarble << std::endl;
}

Measured memory_bytes: 3628
import java.util.Scanner;

/**
 * Main
 */
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String coffee = "coffee";
        int flag = 0;

        String S = sc.next();
        if(S.substring(2,3).equals(S.substring(3,4)) && S.substring(4,5).equals(S.substring(5,6))){
        }else{
            flag = 1;
        }
        if(flag == 1){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }
    }
}

Measured memory_bytes: 23764
#include <iostream>

int main() {
    int n,y;
    std::cin >> n >> y;
    int nn,nnn,yy,yyy;
    for(int i = 0; i <= y/10000 && i <= n; i++){
        nn = n - i;
        yy = y - 10000*i;
        for(int j = 0; j <= yy/5000 && j <= nn; j++){
            nnn = nn - j;
            if(10000*i + 5000*j + 1000*nnn == y){
                std::cout << i << " " << j << " " << nnn << std::endl;
                return 0;
            }
        }
    }
    std::cout << "-1 -1 -1" << std::endl;
}

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

int main(){
  int n;
  while(cin >> n){
    int s = 0;
    for(int a = 0; a<10; a++){
      for(int b = 0; b<10; b++){
	for(int c = 0; c<10; c++){
	  for(int d = 0; d<10; d++){
	    
	    if(a+b+c+d == n){
	      s++;
	    }
	   
	  }
	}
      }
    }
    cout<<s<<endl;

  }

  return 0;
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define pb push_back
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define mem(a,k) memset(a,k,sizeof(a))
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;

#define Pr(f,...) //fprintf(stderr,f,##__VA_ARGS__),fflush(stderr)

typedef long long ll;

template<typename T>
void read(T &x){
	x=0; 
	char c;
	for(c=getchar();!isdigit(c);c=getchar()); 
	for(;isdigit(c);c=getchar())x=x*10+c-'0'; 
}

const int N=1e5+50;

int n,p,a[N],L;

int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
	//freopen("dat.in","r",stdin);
	//freopen("my.out","w",stdout);
#endif
	read(n),read(L); 
	rep(i,1,n)read(a[i]);	
	rep(i,1,n-1)if(a[i]+a[i+1]>=L)p=i;
	if(!p){
		printf("Impossible\n");
		return 0; 
	}
	printf("Possible\n");
	
	rep(i,1,p-1)printf("%d\n",i);
	dec(i,n-1,p)printf("%d\n",i);
	return 0;
}

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"; return os;}
template<class T,size_t n> ostream& operator<<(ostream &os, const array<T,n> &t) {os<<"{"; rep(i,n) {os<<t[i]<<",";} os<<"}"; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

const ll MOD = 1e9+7;

ll modpow(ll n, int m){
	ll ret=1;
	if( m < 0 ) m = MOD-1 + m;
	for(int i=1; i<=m; i<<=1){
		if( m&i ) ret = ret * n % MOD;
		n = n*n % MOD;
	}
	return ret;
}


ll dp[50][1<<18];
int main(){
	int N, X[3];

	cin >> N;
	rep(i,3) cin >> X[i];

	ll check = 0, sum = 0;
	rep(i,3){
		sum += X[i];
		check |= (1 << (sum-1));
	}

	dp[0][0] = 1;
	rep(i,N) rep(k,1<<18){
		rep(j,10){
			ll shift = ( k==0 ? 0 : 32-__builtin_clz(k));
			ll add = (1<<(j+shift));
			ll nx = k + add;
			while( nx > (1<<sum) ) nx >>= (__builtin_ctz(nx) + 1);
			if( (nx & check) != check ){
				dp[i+1][nx] += dp[i][k];
				dp[i+1][nx] %= MOD;
			}
		}
	}

	ll dsum = 0;
	rep(k,1<<18) dsum = (dsum + dp[N][k]) % MOD;
	ll ans = (modpow(10, N) + MOD - dsum) % MOD;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 82176
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>

int result;

int main() {
	int n, m, a, b, c, s[150] = {}, s2[150] = {}, x, y, max = -105, min = 105;

	int result1[200005] = {};

	char str[200005], str2[200005];

	scanf("%s%s", str, str2);
	result = strlen(str);
	for (int i = 0; i <result; i++) {
		s[str[i]]++;

	}
	for (int i = 0; i <result; i++) {
		s2[str2[i]]++;
	}
	for (int i = 97; i <= 122; i++) {
		result1[s[i]]++;
		result1[s2[i]]--;

	}
	for (int i = 97; i <= 122; i++) {
		if(result1[s[i]]!=0){printf("No"); 
                            return 0;}
	
	}
	
	printf("Yes");
}

Measured memory_bytes: 1280
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var r = cin.ReadInt;
            Console.WriteLine(r * r);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}


Measured memory_bytes: 11220
//#define NDEBUG
#include <cstddef>
#include <cstdint>
#include <vector>

using i8 = ::std::int_least8_t;
using i32 = ::std::int_least32_t;
using i64 = ::std::int_least64_t;
using u8 = ::std::uint_least8_t;
using u32 = ::std::uint_least32_t;
using u64 = ::std::uint_least64_t;
using isize = ::std::ptrdiff_t;
using usize = ::std::size_t;

class rep {
	const usize f, l;

public:
	class itr {
		friend rep;
		usize i;
		itr(usize x) noexcept : i(x) {}

	public:
		void operator++() noexcept { ++i; }
		usize operator*() const noexcept { return i; }
		bool operator!=(const itr x) const noexcept { return i != x.i; }
	};
	rep(usize first, usize last) noexcept : f(first), l(last) {}
	itr begin() const noexcept { return itr(f); }
	itr end() const noexcept { return itr(l); }
};
class revrep {
	const usize f, l;

public:
	class itr {
		friend revrep;
		usize i;
		itr(usize x) noexcept : i(x) {}

	public:
		void operator++() noexcept { --i; }
		usize operator*() const noexcept { return i; }
		bool operator!=(const itr x) const noexcept { return i != x.i; }
	};
	revrep(usize first, usize last) noexcept : f(first), l(last) {}
	itr begin() const noexcept { return itr(l - 1); }
	itr end() const noexcept { return itr(f - 1); }
};
template <class T> bool maxi(T &a, const T &b) {
	return a <= b ? (a = b, 1) : 0;
}
template <class T> bool mini(T &a, const T &b) {
	return b <= a ? (a = b, 1) : 0;
}
template <class T> bool smaxi(T &a, const T &b) {
	return b <= a ? 0 : (a = b, 1);
}
template <class T> bool smini(T &a, const T &b) {
	return a <= b ? 0 : (a = b, 1);
}
template <class T> using vec_alias = ::std::vector<T>;
template <class T> auto md_vec(usize n, const T &value) {
	return ::std::vector<T>(n, value);
}
template <class... Args> auto md_vec(usize n, Args... args) {
	return ::std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> const T &as_const(const T &v) noexcept { return v; }

#include <algorithm>
#include <iostream>
#include <utility>
#include <string>
#include <functional>

u64 mm(const u64 a) {
	return a*a;
}

int main() {
	usize n;
	u64 c;
	::std::cin >> n >> c;
	::std::vector<u32> x(n);
	for (auto &e : x)
		::std::cin >> e;
	::std::function<u64(u32)> calc=[&](const usize width)->u64 {
		u64 ret = 0;
		usize cnt = 0;
		u64 cost = 0;
		for (const auto i : revrep(0, n)) {
			if (cnt < width)
				cost += 1;
			cost += mm(cnt / width + 2) - mm(cnt / width + 1);
			++cnt;
			ret += (cost + ::std::min(cnt, width))*(x[i] - (i ? x[i - 1] : 0));
		}
		return ret + c*(width + n);
	};
	u64 ans;
	if (n == 1) {
		ans = calc(1);
	}
	else if (n == 2) {
		ans = ::std::min(calc(1), calc(2));
	}
	else {
		usize low = 1, high = n;
		while (low + 3 <= high) {
			usize l = (low + low + high) / 3;
			usize r = (low + high + high) / 3;
			if (calc(l) < calc(r))
				high = r;
			else
				low = l;
		}
		ans = ::std::min({ calc(low),calc(low + 1),calc(low + 2) });
	}
	
	::std::cout << ans << ::std::endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <cmath>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>func(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p;
}

int main(){
  int N;
  cin>>N;
  int64_t sum=0;
  for(int i=1;i<=N;i++){
    int y=N/i;
   sum+=(int64_t)i*(y+1)*y/2;
  }
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 3536
/************************************************
*Author        :  lrj124
*Created Time  :  2019.08.04.20:11
*Mail          :  1584634848@qq.com
*Problem       :  c/c
************************************************/
#include <bits/stdc++.h>
using namespace std;
int n,x,last = -999;
int main() {
	//freopen("c/c.in","r",stdin);
	//freopen("c/c.out","w",stdout);
	scanf("%d",&n);
	for (int i = 1;i <= n;i++) {
		scanf("%d",&x);
		if (x > last)  x--;
		if (x < last) {
			printf("No");
			return 0;
		
		}
		last = x;
	}
	printf("Yes");
	//cerr << 1.0*clock()/CLOCKS_PER_SEC << endl;
	return 0;
}

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


int main(){
    int n, m, c;
    cin >> n >> m >> c;
    vector<vector<int>> a;
    vector<int> b;
    int i;
    rep(j, m){
        cin >> i;
        b.push_back(i);
    }
    int pass = 0;
    rep(j, n){
        int a_i = 0;
        rep(k, m){
            cin >> i;
            a_i += i * b[k];
        }
        a_i += c;
        if (a_i > 0) pass++;
    }
    cout << pass << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
typedef long long ll;
int main(){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    ll to[60][n];
    rep(i,n) {
        cin >> a[i];
        a[i]--;
        to[0][i] = a[i];
    }

    rep(i,59)rep(j,n) to[i+1][j] = to[i][to[i][j]];

    ll pos = 0;
    rep(i,60)if(k >> i & 1)pos = to[i][pos];
    cout << pos + 1 << endl;
    return 0;
}

Measured memory_bytes: 98540
#include <iostream>
using namespace std;
const int MAX = 100;
const int INFTY = 2000000;
const int WHITE = 0;
const int GRAY = 1;
const int BLACK = 2;

int n,M[MAX][MAX];

int prim (){
    int u,minv;
    int d[MAX],p[MAX],color[MAX];

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

    d[0] = 0;

    while(1){
        minv = INFTY;
        u = -1;
        for (int i = 0; i < n ; ++i) {
            if(minv > d[i] && color[i] != BLACK){
                u = i;
                minv = d[i];
            }
        }
        if( u == -1) break;
        color[u] = BLACK;
        for (int v = 0; v < n ; ++v) {
            if(color[v] != BLACK && M[u][v] != INFTY){
                if(d[v] > M[u][v]){
                    d[v] = M[u][v];
                    p[v] = u;
                    color[v] = GRAY;
                }
            }
        }
    }
    int sum = 0;
    for (int i = 0; i < n ; ++i) {
        if( p[i] != -1) sum += M[i][p[i]];
    }

    return sum;
}

int main(){
    cin >> n;

    for (int i = 0; i < n ; ++i) {
        for (int j = 0; j < n ; ++j) {
            int e; cin >> e;
            M[i][j] = (e == -1) ? INFTY : e;
        }
    }
    
    cout << prim () << endl;
    return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N=1e5+5;

int32_t main()
{
	IOS;
	int x, y, z;
	cin>>x>>y>>z;
	int ans=x*y/2;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
  
using namespace std;
  
int main(){
    int n,x;
    scanf("%d",&n);
  
    for(int i = 1; i<= n; i++)
    {
        if(i%3 == 0){
            printf(" %d",i);
        }else{
            x = i;
            do{
                if(x%10 == 3){
                    printf(" %d",i);
                    break;
                }
                x /=10;
            }while(x);
        }
    }
    printf("\n");
}


Measured memory_bytes: 2688
# Q_C
N = int(input())
a = list(map(int, input().split()))
d = [0] * N

result = 0
for i in range(N):
    tmp = a[i]
    while True:
        if tmp % 2 == 0:
            result += 1
            tmp = tmp // 2
        else:
            break

print(result)

Measured memory_bytes: 4148
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        int count = 0;
        for (int i = 0; i < 3; i++) {
            if (str.charAt(i) == '1') {
                count++;
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <limits.h>
using namespace std;


int main()
{
    int n, k;
    vector < int > x;
    cin >> n >> k;

    for (int i=0; i < n; ++i)
    {
        int tmp;
        cin >> tmp; 
        x.push_back(tmp);
    }
    int ans = INT_MAX;
    for(int i = 0; i + k <= n; ++i)
    {
        int l= x[i], r= x[i + k - 1];
        if ( l < 0  && r <= 0){
            ans = min(ans, -l);
        }else if( l < 0 && r > 0)
        {
            ans = min(ans, 2 * r -l);
            ans = min(ans, -2 * l + r);
        }else
            ans = min(ans,r);
        // cout << l << ' ' << r << ' ' << ans << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 892
# import time
# t1=time.time()
def LI():return list(map(int,input().split()))
def I(): return int(input())
from collections import deque, Counter, defaultdict
from heapq import heappop, heappush
# from pprint import pprint
# import numpy as np

n=I()
s=[input() for _ in range(n)]
sc=Counter(s)
print("AC x {}".format(sc["AC"]))
print("WA x {}".format(sc["WA"]))
print("TLE x {}".format(sc["TLE"]))
print("RE x {}".format(sc["RE"]))


Measured memory_bytes: 78748
import java.util.Scanner;

class C {
    public static void main(String... args) {
        final Scanner sc = new Scanner(System.in);
        final long K = sc.nextInt();
        final long A = sc.nextInt();
        final long B = sc.nextInt();
        System.out.println(B - A <= 2 || K <= A ? K + 1 : (K - A + 1) / 2 * (B - A) + A + (K - A + 1) % 2);
    }
}
public class Main {
    public static void main(String...args) {
        C.main();
    }
}


Measured memory_bytes: 22868
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

#include <set>
#include <vector>

using namespace std;

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

	int H, W;
	cin >> H >> W;

	vector<vector<int>> map_info(H, vector<int>(W, 0));
	for (int i = 0; i < H; i++)
	{
		string line;
		cin >> line;

		for (int j = 0; j < W; j++)
		{
			map_info[i][j] = (line[j] == '.');
		}
	}

	int limit = 0;
	while (limit < 200)
	{
		set<int> delete_row;
		for (int i = 0; i < map_info.size(); i++)
		{
			bool check = true;
			for (int j = 0; j < map_info[i].size(); j++)
			{
				if (map_info[i][j] != 1)
				{
					check = false;
					break;
				}
			}

			if (check) delete_row.insert(i);
		}

		set<int> delete_col;
		for (int j = 0; j < map_info[0].size(); j++)
		{
			bool check = true;
			for (int i = 0; i < map_info.size(); i++)
			{
				if (map_info[i][j] != 1)
				{
					check = false;
					break;
				}
			}

			if (check) delete_col.insert(j);
		}

		if (delete_row.size() == 0 && delete_col.size() == 0) break;

		vector<vector<int>> n_map_info(map_info.size() - delete_row.size(), vector<int>(map_info[0].size() - delete_col.size(), 0));
		int ni = 0;
		int nj = 0;
		for (int i = 0; i < map_info.size(); i++)
		{
			if (delete_row.find(i) != delete_row.end()) continue;
			for (int j = 0; j < map_info[i].size(); j++)
			{
				if (delete_col.find(j) != delete_col.end()) continue;

				n_map_info[ni][nj] = map_info[i][j];
				nj++;
			}
			ni++;
			nj = 0;
		}

		map_info = n_map_info;
	}

	for (int i = 0; i < map_info.size(); i++)
	{
		for (int j = 0; j < map_info[i].size(); j++)
		{
			if (map_info[i][j] == 1) cout << ".";
			else cout << "#";
		}
		cout << "\n";
	}

	return 0;
}


Measured memory_bytes: 384
import numpy as np

N,Q=list(map(int,input().split()))
S=input()
l=np.zeros(Q)
r=np.zeros(Q)
for i in range(Q):
    l[i],r[i]=list(map(int,input().split()))
l-=1
r-=1
    
acc=np.zeros(N)
count=0
for i in range(1,N):
    if S[i-1]=="A" and S[i]=="C":
        count+=1
    acc[i]=count
    
for i in range(Q):
    print(int(acc[int(r[i])]-acc[int(l[i])]))

Measured memory_bytes: 15836
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
//const int mod = ;

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, -1, 0, 1};
int n, m;

bool in(int i, int j) {
  return i >= 0 && j >= 0 && i < n && j < m;
}

int main() {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  cin >> n >> m;
  vs s(n);
  vii q; 
  vvi d(n, vi(m, 1e9));
  for (int i = 0; i < n; ++i) {
    cin >> s[i];
    for (int j = 0; j < m; ++j) {
      if (s[i][j] == '#') {
        q.emplace_back(i, j);
        d[i][j] = 0;
      }
    }
  }
  int it = 0, ma = 0;
  while (it < q.size()) {
    pii v = q[it];
    ++it;
    for (int dir = 0; dir < 4; ++dir) {
      int ni = v.first + dx[dir];
      int nj = v.second + dy[dir];
      int nd = d[v.first][v.second] + 1;
      if (in(ni, nj) && d[ni][nj] > nd) {
        q.emplace_back(ni, nj);
        d[ni][nj] = nd;
        ma = max(ma, nd);
      }
    }
  }
  cout << ma << endl;
  return 0;
}


Measured memory_bytes: 15212
N, M = map(int, input().split())
p = list(map(int, input().split()))


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.root = [-1] * (n + 1)
        self.rnk = [0] * (n + 1)

    def find_root(self, x):
        if self.root[x] < 0:
            return x
        else:
            self.root[x] = self.find_root(self.root[x])
            return self.root[x]

    def unite(self, x, y):
        x = self.find_root(x)
        y = self.find_root(y)
        if x == y:
            return
        elif self.rnk[x] > self.rnk[y]:
            self.root[x] += self.root[y]
            self.root[y] = x
        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            if self.rnk[x] == self.rnk[y]:
                self.rnk[y] += 1

    def isSameGroup(self, x, y):
        return self.find_root(x) == self.find_root(y)

    def size(self, x):
        return -self.root[self.find_root(x)]


UF = UnionFind(N)
for i in range(M):
    x, y = map(int, input().split())
    UF.unite(x, y)

ans = 0
for i in range(N):
    if UF.isSameGroup(i+1, p[i]):
        ans += 1

print(ans)


Measured memory_bytes: 93420
#include<bits/stdc++.h>
using namespace std;
bool comp(int a, int b) 
{ 
    return (a < b); 
} 
int main()
{
  int n;cin>>n;
  int arr[n][3];
  for(int i=0;i<n;i++)
  {
    cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
  }
  int dp[n][3];

  dp[0][0]=arr[0][0];dp[0][1]=arr[0][1];dp[0][2]=arr[0][2];
  
  for(int i=1;i<n;i++)
  {
  dp[i][0]=arr[i][0]+max(dp[i-1][1],dp[i-1][2]);
  dp[i][1]=arr[i][1]+max(dp[i-1][0],dp[i-1][2]);
  dp[i][2]=arr[i][2]+max(dp[i-1][1],dp[i-1][0]);
  
  }

  int mx;
  mx=max(dp[n-1][0],dp[n-1][1]);
  mx=max(mx,dp[n-1][2]);
  cout<<mx;
  return 0;
}

Measured memory_bytes: 2560
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())


from heapq import heappush, heappop


# 中央値以上と以下をheapで管理
upper_asc = []
lower_dsc = []

q = ni()
ans = 0

for i in range(q):
    query = list(map(int, ns().split()))
    if query[0] == 1:
        a, b = query[1], query[2]
        heappush(upper_asc, a)
        heappush(lower_dsc, -a)

        if i == 0:
            ans += b
            continue

        x, y = heappop(upper_asc), -heappop(lower_dsc)

        ans += (y - x) + b

        heappush(upper_asc, y)
        heappush(lower_dsc, -x)

    else:
        print(-lower_dsc[0], ans)



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

int main() {
 int n;
  string s;
  cin>>n>>s;
  int ans=0;
  for(int i=0;i<n-2;i++){
    if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C') ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {



	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		if (x%100 <= (x/100)*5) {
			System.out.println(1);
		} else {
			System.out.println(0);
		}

	}

}

Measured memory_bytes: 23252
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1LL << 60;
constexpr int INF = 3000000007;
const double INFD = 1e100;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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;
}
// ----------------------------------------------------------------------------

int main(){
  int N;
  cin >> N;
  int s1=0,s2=0;
  vector<int> W(N);
  for(int i=0; i<N; i++){
    cin >> W[i];
    s2 += W[i];
  }
  int ans=mod;
  for(int i=0; i<N; i++){
    s2 -= W[i];
    s1 += W[i];
    chmin(ans,abs(s2-s1));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
const ll INF = 1LL<<60;

int main(){
  int n; cin >> n;
  vector<ull> a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(), a.end());
  if(a[0] == 0){
    cout << 0 << endl;
    return 0;
  }
  ull ans = 1;
  for(int i = 0; i < n; i++){
    ull temp = ans;
    ans *= a[i];
    ull tt = ans / a[i];
    if(tt != temp){
      cout << -1 << endl;
      return 0;
    }
    if(ans > 1000000000000000000){
      cout << -1 << endl;
      return 0;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4048
#include <iostream>
#include <vector>
using namespace std;
using ll=long long;

int main(){
    ll N;
    cin >> N;
    string tmp;
    ll M = 0;
    ll A = 0;
    ll R = 0;
    ll C = 0;
    ll H = 0;
    for(ll i = 0; i < N; ++i){
        cin >> tmp;
        if(tmp.substr(0,1)=="M") M += 1;
        if(tmp.substr(0,1)=="A") A += 1;
        if(tmp.substr(0,1)=="R") R += 1;
        if(tmp.substr(0,1)=="C") C += 1;
        if(tmp.substr(0,1)=="H") H += 1;
    }
    ll zero = 0;
    if(M == 0) zero += 1;
    if(A == 0) zero += 1;
    if(R == 0) zero += 1;
    if(C == 0) zero += 1;
    if(H == 0) zero += 1;
    ll ans = M * A * R + M * A * C + M * A * H + C * M * R + H * M * R + M * C * H + C * A * R + H * A * R + C * A * H + H * C * R;
    //if(zero >= 3) cout << "0" << endl;
    //else 
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,h,w,c=0,a,b;
  cin>>n>>h>>w;
  for(int i=0;i<n;i++){
    cin>>a>>b;
    if(a>=h&&b>=w) c++;
  }
  cout<<c;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
clock_t time_p = clock();
void time()
{
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (double)(time_p)/CLOCKS_PER_SEC <<endl;
}
signed main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);
     int n,k;
     cin>>n>>k;
     vector<int>v;
     for(int i=0;i<n;i++)
     {
          int x;
          cin>>x;
          v.emplace_back(x);
     }
     sort(v.begin(),v.end());
     int res=0;
     for(int i=0;i<n-k;i++)
        res+=v[i];
      cout<<res<<endl;
      time();
      return 0;
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
int main(){
    // Your code here!
    int coins;
    cin>>coins;
    double p[coins];
    for(int i=0;i<coins;i++)
    {
        cin>>p[i];
    }
    double dp[coins+1][coins+1];
    for(int i=0;i<=coins;i++)
    {
        for(int j=0;j<=coins;j++)
        {
            dp[i][j]=0;
        }
    }
    dp[0][0]=1.0;
    for(int c=1;c<=coins;c++)
    {
        int i=c-1;
        dp[c][0]=(1-p[i])*dp[i][0];
        for(int heads=1;heads<=c;heads++)
        {
            dp[c][heads]=p[i]*dp[i][heads-1]+(1-p[i])*dp[i][heads];
        }
    }
    double ans=0;
    for(int h=coins/2+1;h<=coins;h++)
    {
        ans+=dp[coins][h];
    }
    cout<<fixed << setprecision(10)<<ans;
    return 0;
}


Measured memory_bytes: 70528
#!/usr/bin/env python3
#ABC52 C

from decimal import Decimal
import math
from collections import defaultdict

mod = 10**9+7
n = int(input())

#エラトステネスの篩
def prime(num):
    if n < 2:
        return []
    p_l = [i for i in range(num+1)]
    p_l[1] = 0
    num_s = math.sqrt(num)

    for p in p_l:
        if p == 0:
            continue
        if p > num_s:
            break

        for np in range(2*p,num,p):
            p_l[np] = 0

    return [p for p in p_l if p != 0]

def make(num):
    if num <= 1:
        return False
    else:
        num_s = math.floor(math.sqrt(num))
        p_l = prime(num_s)

        dict_counter = defaultdict(int)
        for p in p_l:
            while num % p == 0:
                dict_counter[p] += 1
                num //= p
        if num != 1:
            dict_counter[num] += 1

        dict_counter = dict(dict_counter)

        return dict_counter

if n == 1:
    print(1)
    quit()

sum = [0]*n
for i in range(2,n+1):
    x = list(make(i).items())
    for j,k in x:
        sum[j-1] += k

ans = 1
for i in sum:
    if i > 0:
        ans *= (i+1)
print(ans % mod)


Measured memory_bytes: 5204
/*

This Submission is to determine how many 120/240 min const. delivery point there are.

*/
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 1e18
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 1000000007
#define seg_size 262144
#define REP(a,b) for(long long a = 0;a < b;++a)
unsigned long xor128() {
	static unsigned long x = time(NULL), y = 362436069, z = 521288629, w = 88675123;
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
int main() {
	int a, b;
	cin >> a >> b;
	cout << max({ a + b,a - b,a * b }) << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFIMES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007;
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

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








int main(){
    int N; std::cin >> N;
    int ans(1000 - N % 1000);
    if(!(N % 1000)) ans = 0;
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 3624
x = input()
y = input()
hp = int(x.split()[0])
attack_num = int(x.split()[1])
attack_list = y.split(' ')
sum = 0

for i in attack_list:
    i = int(i)
    sum = sum + i
if sum >= hp:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 10552
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<utility>
#include<queue>
#include<cmath>
#include<cstdio>
using namespace std;
#define REP(i, a,b) for(i=a;i<b;i++) 
#define REP1(i,b,a) for(i=b-1;i>=a;i--)
#define output(x) cout<<x<<endl;
#define pb(x) push_back(x);
typedef long long int ll;
typedef pair<int, int> P;
int gcd(int a, int b) {
	if (b == 0) {
		return a;
	}
	return gcd(b, a % b);
}

int main() {
	ll i, j, k, l, m, n, sum, flag, cc, M, X, H, W, N, K, A, B;
	cin >> A >> B >> K;
	cc = 0;
	for(i=fmin(A,B);i>=1;i--){
		if (A%i == 0 && B%i == 0) {
			cc++;
			if (cc == K) {
				break;
			}
		}
	}
	output(i);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long int
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define pci pair<char,int
#define mii map<int,int>
#define mll map<long long int,long long int>
#define mci map<char,int>
#define umii unordered_map<int,int>
#define umll unordered_map<long long int,long long int>
#define umci unordered_map<char,int>
#define F first
#define S second
#define pb push_back
#define endl '\n'
  
using namespace std;
bool sortinrev(const pair<ll,ll> &a,  
               const pair<ll,ll> &b) 
{
       if(a.first!=b.first) return(a.first > b.first);
       else return (a.second<b.second);
} 
ll power(ll x,int n)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x);
        x=(x*x);
        n=n/2;
    }
    return result;
}

int main(){
    IOS;string s,t;
    cin>>s>>t;ll ans=0;
    for(ll i=0;i<s.size();i++){
        if(s[i]!=t[i]) ans++;
    }
    cout<<ans;
return 0;}


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

using namespace std;

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

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  
  int a, b, c, d;
  a = n % 10;
  b = n / 10 % 10;
  c = n / 100 % 10;
  d = n / 1000;

  string r; 
  if ((a == b && b == c && c == d) || (a == b && b == c) || (b == c && c == d))  {
    r = "Yes";
  } else {
    r = "No";
  }
  
  cout << r << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long Int;
const Int MOD = 1e9+7;
signed main() {
	string s;
	cin>>s;
	Int x=0,y=0,z=0,r=1;
	Int inv=(1+MOD)/3;
	for(char c:s) {
		Int f=c=='?';
		if(c=='C'||f) z+=y*(f?inv:1);
		if(c=='B'||f) y+=x*(f?inv:1);
		if(c=='A'||f) x+=1*(f?inv:1);
		if(f) r*=3;
		x%=MOD;
		y%=MOD;
		z%=MOD;
		r%=MOD;
	}
	cout<<z*r%MOD<<endl;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
using namespace std;
using ll=long long;

ll func(ll n, ll x){
    if (n == -1) return 0;
    else return n / x + 1;
}

int main(){
    ll a, b, x;
    cin >> a >> b >> x;
    ll ans = func(b,x) - func(a-1,x);
    cout << ans << endl;
    return 0;
}

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

long Npate(int N, long X) {
	long lnm1 = pow(2,N+1)-3;
	long pnm1 = pow(2,N)-1;
	if (N==0) {
		if (X>=1) return 1;
		else return 0;
	}
	if (X<=1) return 0;
	else if (X>=1+lnm1+1) {
		return pnm1+1+Npate(N-1, X-(1+lnm1+1));
	} else {
		return Npate(N-1, X-1);
	}
}

int main() {
	long N,X;
	cin >> N >> X;

	cout << Npate(N,X) << endl;

	return 0;
}


Measured memory_bytes: 640