akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T>bool even(T n) { return ! (n & 1); }
template<class T>bool odd(T n) { return n & 1; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;}
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll N;
        cin >> N;
        vll T(N), A(N);
        rep(i, 0, N) cin >> T[i] >> A[i];

        ll l, r;
        l = r = 1;
        rep(i, 0, N) {
                ll tmp = max(ceil((ld)l/T[i]), ceil((ld)r/A[i]));
                l = tmp * T[i];
                r = tmp * A[i];
        }
        cout << l + r << endl;
}



Measured memory_bytes: 3604
# ダサい解き方だが桁上がり等を考えてややこしい実装をして間違うよりは良い

# def check_digit(v, d):
#     if v in d:
#         # if v == '9':            
#         return check_digit(str(int(v) + 1), d)
#     else:
#         return v

n, k = input().split()
d = input().split()
ans = []
while True:
    if all(map(lambda x: x not in d, n)):
        print(n)
        break
    else:
        n = str(int(n) + 1)
# for v in sorted(n, reverse=True):
#     ans.append(check_digit(v, d))

# print(''.join(ans))

Measured memory_bytes: 2940
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <numeric>
#include <ctype.h>


using namespace std;


int main() 
{
	string input;

	getline(cin, input);

	for (int i = 0; i < input.size(); i++)
	{
		if (isupper(input[i]))
			input[i] += 32;
		else if (islower(input[i]))
			input[i] -= 32;
	}

	cout << input << endl;
	return 0;
}

Measured memory_bytes: 3192
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def main():
	n = int(input())
	#b , c = tin()
	#s = input()
	al=lin()
	al.sort(reverse=True)
	return sum(al)-(2*sum(al[1::2]))
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 62108
def slove():
    import sys
    input = sys.stdin.readline
    a, b, c = list(map(int, input().rstrip('\n').split()))
    if a == b == c:
        if a % 2 == 0:
            print(-1)
        else:
            print(0)
    else:
        cnt = 0
        while True:
            if a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
                a, b, c = (a + b) // 2, (b + c) // 2, (a + c) // 2
                cnt += 1
            else:
                print(cnt)
                exit()


if __name__ == '__main__':
    slove()


Measured memory_bytes: 38256
#include <cstdio>
#include <algorithm>
#include <vector>
#include <utility>
#include <map>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <stack>
#include <queue>
#include <cstring>
#include <iterator>

#define FOR(n) for(int cnt=0;cnt<(n);++cnt)
#define FOR_R(it,cont) for(auto it=rbegin(cont);it!=rend(cont);++it)
#define FOR_F(it,cont) for(auto it=begin(cont);it!=end(cont);++it)
#define ALL(cont) begin(cont), end(cont)
#define LB(b,e,v) lower_bound(b,e,v)
#define UB(b,e,v) upper_bound(b,e,v)

using namespace std;
typedef pair<int,int> P;
struct Circle {
  int x,y,r;
};
P s,t;
int N;
Circle circles[1010];

struct Dijkstra {
  typedef double COST;
  static const int MAX_V = 1010;
  const COST INF = 1e15;
  struct Edge{int to;COST cost;};
  vector<Edge> edges[MAX_V];
  COST dist[MAX_V];
  void addEdge(int from, int to, COST cost) {
    edges[from].push_back({to,cost});
  }
  void solve(int start) {
    for(int i=0;i<MAX_V;++i) {
      dist[i] = INF;
    }
    dist[start] = 0;
    typedef pair<COST, int> QP;
    priority_queue<QP, vector<QP>, greater<QP> > Q;
    Q.push(QP(0,start));
    while(!Q.empty()) {
      QP cur = Q.top();Q.pop();
      if (cur.first > dist[cur.second]) continue;
      for(int i=0;i<edges[cur.second].size();++i) {
        Edge e = edges[cur.second][i];
        COST tcost = dist[cur.second] + e.cost;
        if (tcost < dist[e.to]) {
          dist[e.to] = tcost;
          Q.push(QP(tcost, e.to));
        }
      }
    }
  }
};

double distDouble(double x1, double y1, double x2, double y2) {
  double dx = x2-x1,dy = y2-y1;
  return sqrt(dx*dx+dy*dy);
}

Dijkstra dijkstra;

int main() {
  scanf("%d%d%d%d", &s.first, &s.second, &t.first, &t.second);
  scanf("%d", &N);
  FOR(N) {
    int x,y,r;
    scanf("%d%d%d", &x, &y, &r);
    circles[cnt].x=x;circles[cnt].y=y;circles[cnt].r=r;
  }
  circles[N] = {s.first,s.second,0};
  circles[N+1] = {t.first,t.second,0};
  N=N+2;
  for(int i=0;i<N;++i) {
    for(int j=i+1;j<N;++j) {
      Circle c1 = circles[i],c2 = circles[j];
      double dist = distDouble(c1.x,c1.y,c2.x,c2.y);
      dist -= (1.0*c1.r + 1.0*c2. r);
      if (dist <= 0) dist = 0;
      dijkstra.addEdge(i,j,dist);
      dijkstra.addEdge(j,i,dist);
    }
  }
  dijkstra.solve(N-2);
  printf("%.15f\n", dijkstra.dist[N-1]);
  return 0;
}


Measured memory_bytes: 22292
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication5
{
    class Program
    {
        static void Main()
        {
            int n, a, b, c;
            int[] topping;
            while (int.TryParse(Console.ReadLine(), out n))
            {
                string[] input = Console.ReadLine().Split(' ');
                a = int.Parse(input[0]); b = int.Parse(input[1]);
                c = int.Parse(Console.ReadLine());
                double cal = c/ a;
                int calSum = c;
                int money = a;
                topping = new int[n];
                for (int i = 0; i < n; i++)
                {
                    topping[i] = int.Parse(Console.ReadLine());
                }
                topping.OrderByDescending((i) => i)
                    .ToList()
                    .ForEach((i) =>
                    {
                        double tmp;
                        if (cal <= (tmp = (double)(calSum += i) / (double)(money += b)))
                            cal = tmp;
                        else return;
                    });
                Console.WriteLine((int)cal);
            }
        }
    }
}

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

vector<pair<long long,int>> f(long long N){
  vector<pair<long long ,int>> ans(1,{0,0});
  long long n=N;
  for(int i=2;i<=sqrt(n);i++){
    if(N%i==0){
      N/=i;
      if(ans.at(ans.size()-1).first==i){
        ans.at(ans.size()-1).second++;
      }
      else{
        ans.push_back({i,1});
      }
      i--;
    }
    if(N==1){
      break;
    }
  }
  if(N!=1){
    ans.push_back({N,1});
  }
  auto itr1=ans.begin();
  ans.erase(itr1);
  return ans;
}

int main() {
  long long N,c=0,i=2;
  cin>>N;
  while(c<N){
    if(f(i).at(0).first==i&&i%5==1){
      cout<<i<<" ";
      c++;
    }
    i++;
  }
  
}


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

YES = "YES"  # type: str
NO = "NO"  # type: str


def solve(S: str):

    N = len(S)
    if any([(S[0:i]+S[i+N-7:N]) == 'keyence' for i in range(N)]):
        print(YES)
    else:
        print(NO)


    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
function main(input) {
  input = input.split(' ');
  var N = parseInt(input[0]);
  var A = parseInt(input[1]);
  var B = parseInt(input[2]);
  if(N * A <= B){
    console.log(N*A);
  } else {
    console.log(B);
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 7372
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

const int MOD = 1000000007, INF = 1111111111;
using namespace std;
using lint = long long;

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (int i = 0; i < vec.size(); i++) {
		os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	}
	return os;
}

#ifdef _DEBUG
template <class Head>
void dump(const char* str, Head &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + 1, t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int A, B, C, D;
	cin >> A >> B >> C >> D;

	int sum = A + B - C - D;

	if (sum > 0) cout << "Left" << "\n";
	else if (sum == 0) cout << "Balanced" << "\n";
	else cout << "Right" << "\n";

	return 0;
}

Measured memory_bytes: 256
use std::cmp::{max,min};
fn main() {
    let (n,t) = {
        let s = rv::<usize>();
        (s[0],s[1])
    };
    let mut ab = Vec::with_capacity(n);
    for _ in 0..n {
        let (a,b) = {
            let s = rv::<usize>();
            (s[0],s[1])
        };
        ab.push((a,b));
    }
    let mut dpl = vec![vec![0;t];n+1];
    for (i,&(a,b)) in ab.iter().enumerate() {
        for j in 0..min(t,a) {
            dpl[i+1][j] = dpl[i][j];
        }
        for j in 0..t-min(t,a) {
            dpl[i+1][j+a] = max(dpl[i][j+a],dpl[i][j]+b);
        }
    }
    let mut dpr = vec![vec![0;t];n+1];
    for (i,&(a,b)) in ab.iter().enumerate().rev() {
        for j in 0..min(t,a) {
            dpr[i][j]=dpr[i+1][j];
        }
        for j in 0..t-min(t,a) {
            dpr[i][j+a] = max(dpr[i+1][j+a],dpr[i+1][j]+b);
        }
    }
    let mut s = 0;
    for (i,(_,b)) in ab.into_iter().enumerate() {
        for j in 0..t {
            s = max(s,dpl[i][j]+dpr[i+1][t-1-j]+b);
        }
    }
    println!("{}",s);
}
fn rl() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s
}
fn rv<T>() -> Vec<T>
  where T: std::str::FromStr, T::Err: std::fmt::Debug, {
    rl().split_whitespace().map(|x|x.parse::<T>().unwrap()).collect()
}

Measured memory_bytes: 176380
import sys
input = sys.stdin.readline

# B - Touitsu
N = int(input())
words = [input() for i in range(3)]
ans = 0

for i in range(N):
	dic = dict()
	
	for w in words:
		if w[i] in dic.keys():
			dic[w[i]] += 1
		else:
			dic[w[i]] = 1
	
	ans += (len(dic) - 1)

print(ans)

Measured memory_bytes: 3064
input_conditions = input().split()

price_a = int(input_conditions[0])
price_b = int(input_conditions[1])
price_ab = int(input_conditions[2])
required_a = int(input_conditions[3])
required_b = int(input_conditions[4])

price_1 = price_a * required_a + price_b * required_b

if required_a > required_b:
    price_2 = price_ab * required_b * 2 + price_a * (required_a - required_b)
else:
    price_2 = price_ab * required_a * 2 + price_b * (required_b - required_a)

price_3 = price_ab * max(required_a, required_b) * 2

print(min(price_1, price_2, price_3))


Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <algorithm>

using namespace std;

int main()
{
    int N, M;
    cin >> N >> M;

    vector<int> H(N+1);
    for (int i = 1; i <= N; i++)
    {
        cin >> H[i];
    }

    vector<int> A(M+1), B(M+1);
    for (int i = 1; i <= M; i++)
    {
        cin >> A[i] >> B[i];
    }
    
    set<int> notgood;
    set<int> c;
    for (int i = 1; i <= M; i++)
    {
        if(H[A[i]] > H[B[i]])
        {
            swap(A[i], B[i]);
        }
        notgood.insert(A[i]);
        if (H[A[i]] == H[B[i]])
        {
            notgood.insert(B[i]);
        }
    }
    cout << N - notgood.size() << endl;
    return 0;
}


Measured memory_bytes: 7144
// 3人でカードゲームイージー
#include <iostream>
#include <string>
using namespace std;
int main(){
    int num[3],num2[3]={};
    string S[3];
    for(int i=0;i<3;i++){
        cin>>S[i];
        num[i]=S[i].size();
    }
    int i=0;
    while(num[i]!=num2[i]){
        num2[i]++;
        i=int(S[i][num2[i]-1]-'a');
    }
    cout<<char(i+'A')<<endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class392
    {
        static void Main()
        {
            var ST = Console.ReadLine().Split();
            Console.WriteLine(ST[1]+ST[0]);
        }
    }
}


Measured memory_bytes: 25628
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;

const int INF = INT_MAX;
const long long INFL = 1LL<<40;
const double PI = atan(1)*4;
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}

vector<int> solve;

int main() {
    int n;cin>>n;
    solve.resize(n+1);
    rep(i,n+1) solve[i]=0;
    
    int sum = 0;
    int p = -1;
    for(auto i = 1; i<=n; i++){
        
        sum += i;
        
        if(sum>n) {
            sum-=i;
            p = i-1;
            break;
        }
        solve[i] = 1;
        
    }
    
    /// 1 ... pまで入れれいて、n-sum足りない。n-sum <= p
    /// p+1の方向にn-sum個ずらせばいい。p-(n-sum)は前から
    
    if(n == 1){
        cout<<1<<endl;
        return 0;
    }
    
    for(auto i = 1; i<=p - (n-sum) ; i++){
        cout<<i<<endl;
    }
    
    for(auto i = p-(n-sum)+1; i<= p; i++){
        cout<<i+1<<endl;
    }
    

    
    return 0;
}












Measured memory_bytes: 39296
xy = input().split()
x = int(xy[0])
y = int(xy[1])

result = 0

if x == 1:
    result =result+ 300000
if y == 1:
    result =result+ 300000

if x == 2:
    result =result+ 200000
if y == 2:
    result =result+ 200000

if x == 3:
    result =result+ 100000
if y == 3:
    result =result+ 100000

if x == 1 and y==1:
    result =result+ 400000

print(result)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define dup(x,y) (((x)+(y)-1) / (y)) //整数型のまま切り上げ演算する
#define PI 3.14159265359
typedef long long LL;
template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> inline T gcd(T x, T y) { if (y == 0) { return x; } else if (x == 0) { return y; }return gcd(y, x % y); }
template<class T> inline T lcm(T x, T y) { return (x * y) / gcd(x, y); }
template<class T> inline vector<T> convert_to_binary_number(T x) { vector<T> binary_num; while (x != 1) { binary_num.push_back(x % 2); x /= 2; } binary_num.push_back(1); return binary_num; }
template<class T> inline void print_vector(vector<T> vec) { for (int i = 0; i < vec.size(); i++) { cout << vec[i] << " "; } cout << endl;}
vector<LL> make_divisors(LL n){vector<LL> divisors;for(int i = 1; i <= sqrt(n); i++) {if(n%i == 0){divisors.push_back(i);if(i != n/i){divisors.push_back(n / i);}}}return divisors;}
const LL MOD = 1e9 + 7;
const LL INF = 1LL << 60;

int main(void){
    int N;
    cin >> N;

    vector<int> L(N);
    rep(i, N) cin >> L[i];

    int ans = 0;
    sort(ALL(L));
    for (int a = 0; a < N-1; a++)
    {
        for (int b = a+1; b < N; b++)
        {
            int right = lower_bound(ALL(L),L[a]+L[b]) - L.begin();
            int left = b;

            ans += right - left - 1;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#define _USE_MATH_DEFINES
#include<cmath>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<cstdint>
#include<unordered_map>
#include<sstream>
#include<boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define vi vector<int>
#define vll vector<ll>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pb push_back

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;

typedef pair<int, int> P;

bool ps1(const P& element1, const P& element2)
{//first昇順
	return element1.first < element2.first;
}
bool ps2(const P& element1, const P& element2)
{//first降順
	return element1.first > element2.first;
}
bool ps3(const P& element1, const P& element2)
{//second昇順
	return element1.second < element2.second;
}
bool ps4(const P& element1, const P& element2)
{//second降順
	return element1.second > element2.second;
}

ll combination(ll n, ll r) {
	if (r * 2 > n) r = n - r;
	ll dividend = 1;
	ll divisor = 1;
	for (ll i = 1; i <= r; ++i) {
		dividend *= (n - i + 1);
		divisor *= i;
	}
	return dividend / divisor;
}
int main() {
	int a, b;
	cin >> a >> b;
	int k = min(a,b);
	int dis = max(a, b) - min(a,b);
	if (dis % 2 == 0) {
		cout << k + dis / 2 << endl;
	}
	else {
		cout << "IMPOSSIBLE" << endl;
	}

}

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

int main(){

  string a, b;
  cin >> a;
  cin >> b;
  if (a[0] > b[0]) printf(">\n");
  if (a[0] < b[0]) printf("<\n");
  if (a[0] == b[0]) printf("=\n");

  return 0;
}


Measured memory_bytes: 256
// C++ program to find count of divisors in n!
#include<bits/stdc++.h>
using namespace std;
//typedef unsigned long long int ull;
 
// allPrimes[] stores all prime numbers less
// than or equal to n.
vector<long long> allPrimes;
 
// Fills above vector allPrimes[] for a given n
void sieve(int n)
{
    // Create a boolean array "prime[0..n]" and
    // initialize all entries it as true. A value
    // in prime[i] will finally be false if i is
    // not a prime, else true.
    vector<bool> prime(n+1, true);
 
    // Loop to update prime[]
    for (int p=2; p*p<=n; p++)
    {
        // If prime[p] is not changed, then it
        // is a prime
        if (prime[p] == true)
        {
            // Update all multiples of p
            for (int i=p*2; i<=n; i += p)
                prime[i] = false;
        }
    }
 
    // Store primes in the vector allPrimes
    for (int p=2; p<=n; p++)
        if (prime[p])
            allPrimes.push_back(p);
}
 
// Function to find all result of factorial number
long long factorialDivisors(long long n)
{
	long long MOD = 1000000007;
    sieve(n);  // create sieve
 
    // Initialize result
    long long result = 1;
 
    // find exponents of all primes which divides n
    // and less than n
    for (int i=0; i < allPrimes.size(); i++)
    {
        // Current divisor
        long long p = allPrimes[i];
 
        // Find the highest power (stored in exp)'
        // of allPrimes[i] that divides n using
        // Legendre's formula.
        long long exp = 0;
        while (p <= n)
        {
            exp = exp + (n/p);
            p = p*allPrimes[i];
        }
 
        // Multiply exponents of all primes less
        // than n
        result = (result*(exp+1))%MOD;
    }
 
    // return total divisors
    return result;
}
 
// Driver program to run the cases
int main()
{
	int n;
	cin >> n;
    cout << factorialDivisors(n);
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

#define int long long

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

    int a, s;
    cin >> a >> s;

    if (a == s)
    {
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int K, S; cin >> K >> S;

	int cnt = 0;	
	for (int X = 0; X <= K; ++X){
		for (int Y = 0; Y <= K; ++Y){
			int Z = S - (X + Y);
			cnt += (int)(Z >= 0 && Z <= K);
		} // end for
	} // end for

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 256
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def cmb(n,m):
    ans=1
    for i in range(n,n-m,-1):
        ans*=i
    for i in range(1,m+1):
        ans //=i
    return ans





def resolve():
    N,M=map(int,input().split())
    ans=1
    md=10**9+7
    if M==1:
        print(1)
        return
    for i in factorization(M):
        nn=i[1]+N-1
        ans *= cmb(nn,i[1])
        ans %=  md

    print(ans)
if __name__ == "__main__":
    resolve()

Measured memory_bytes: 3064
#include <iostream>
#include <queue>
#include <vector>
#include <cstdio>

#define reep(i,n,m) for(int i=(n);i<(m);i++)
#define rep(i,n) reep(i,0,n)

using namespace std;

class Edge{
public:
    int to;
    int cost;
    Edge(int to,int cost):to(to),cost(cost){}
};

class Node{
public:
    int distance;
    int num;
    int ticket;
    Node(){}
    Node(int distance, int num,int ticket):distance(distance),num(num),ticket(ticket){}
    bool operator<(const Node &b)const{
        return distance > b.distance;
    }
};

vector<Edge> edge[101];
bool flg[101][11];

void init(){
    rep(i,101){
        edge[i].clear();
        rep(k,11){
            flg[i][k] = 0;
        }
    }
}

int main(){
    int c,n,m,s,d;
    while(cin >> c >> n >> m >> s >> d,!m==0){
        init();
        rep(i,m){
            int a,b,c;
            cin >> a >> b >> c;
            edge[a].push_back(Edge(b,c));
            edge[b].push_back(Edge(a,c));
        }
        priority_queue<Node> Q;
        Q.push(Node(0,s,0));
        int ans = 1000000;
        while(!Q.empty()){
            Node node = Q.top();Q.pop();
            if(flg[node.num][node.ticket]){
                continue;
            }
            flg[node.num][node.ticket] = true;
            //printf("num->%d cost->%d ticket->%d\n",node.num,node.distance,node.ticket);
            if(node.num == d){
                ans = min(ans,node.distance);
            }

            rep(i,edge[node.num].size()){
                Edge e = edge[node.num][i];
                int cost = node.distance + e.cost;
                Q.push(Node(cost,e.to,node.ticket));
                if(node.ticket < c){
                    int cost = node.distance + e.cost/2;
                    Q.push(Node(cost,e.to,node.ticket+1));
                }
            }
        }
        cout << ans << endl;
    }
}

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

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

ll perm(ll a) {
    if(MOD<=a) return 0;
    ll ans0 = 1, ans1 = 1;
    for (ll i = 1; i < a/2; ++i) {
        ans0 = (ans0 * (2*i)) % MOD;
        ans1 = (ans1 * (2*i+1)) % MOD;
    }
    ans0 = (ans0 * a) % MOD;
    if (a % 2 && a != 1){
        ans0 = (ans0 * (a-1)) % MOD;
    }
    return (ans0 * ans1) % MOD;
}

int main() {
    ll n, m;
    cin >> n >> m;
    if(abs(n-m)>1){
        cout << 0 << "\n";
        return 0;
    }
    cout << (perm(n)*perm(m)*(n == m ? 2 : 1))%MOD << "\n";
    return 0;
}


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

#define F(i,a,b) for(int i=(a);i<=(b);++i)
#define R(i,n) for(int i=(0);i<(n);++i)
#define fill(a,b) memset(a,b,sizeof a);

const int maxn = 1e5 + 10;
int n,k,ans,a[maxn];
vector<int> G[maxn];

int dfs(int u)
{
	int cur = 1;
	R(i,G[u].size())
	{
		int v = G[u][i];
		cur = max(cur,dfs(v)+1);
	}
	if(cur == k && a[u] != 1)
	{
	//	printf("%d %d\n",u,cur);
		cur = 0;
		++ans;
	}
	return cur;
}

int main()
{
	//freopen("test.txt","r",stdin);
	scanf("%d %d",&n,&k);
	ans = 0;
	scanf("%d",a+1);
	if(a[1] != 1) ++ans;
	a[1] = 1;
	F(i,2,n)
	{
		scanf("%d",a+i);
		G[a[i]].push_back(i);
	}
	dfs(1);
	printf("%d\n",ans);
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int h = 0;
  ll ans = 0;
  rep(i,n) {
    h = max(h,a[i]);
    ans += h-a[i];
  }
  cout << ans << endl;
  return 0;
}

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

#define vi vector<int>
#define vii vector<vector<int> >
#define vi_(n) vector<int>((n))
#define vii_(n,m) vector<vector<int> >((n), vector<int>((m)))
#define vi__(n, def) vector<int>((n), (def))
#define vii__(n, m, def) vector<vector<int> >((n), vector<int>((m), (def)))

#define rep(i, n) for(int i=0; i < (n); ++i)
#define per(i, n) for(int i=(n)-1 i >= 0; --i)

int main(){
	int A, B;
	cin >> A >> B;
	if((A+B)&1 != 0){
		cout << "IMPOSSIBLE" << endl;
	}
	else{
		cout << (A+B)/2 << endl;
	}

}


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

int main(){
  //ifstream fin("C/in/1_14.txt");
  string s; cin >> s;

  string rw = "";
  for(auto c : s) if(c != 'x') rw += c;

  string rrw = rw;
  reverse(rrw.begin(), rrw.end());
  if(rw != rrw){
    cout << -1 << endl;
    return 0;
  }

  string hw = rw.substr(0, (int)ceil(rw.size()/2.));
  int ans = 0, i = 0, j = s.size()-1;
  for(const auto c : hw){
    int l = 0, r = 0;
    while(s[i] != c){
      i++;
      l++;
    }

    while(s[j] != c){
      j--;
      r++;
    }

    ans += abs(l-r);
    i++; j--;
  }

  cout << ans << endl;

  return 0;
}


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

#define rep(i, n)     for(int i = 0;      i < int(n); ++i)
#define rep3(i, a, b) for(int i = int(a); i < int(b); ++i)
#define all(x)        (x).begin(),(x).end()
#define sz(x)         int(x.size())
#define mp            make_pair
#define pb            push_back


typedef long long ll;

using namespace std;

int main(){
  vector<vector<int> > Cs(26), Ct(26);
  string s, t;
  cin >> s >> t;

  rep(i, 26){
    Cs[i].pb(0);
    Ct[i].pb(0);
    char c = 'a'+i;
    rep(j, sz(s)){
      if(s[j] == c){
        Cs[i][0]++;
        Cs[i].pb(j);
      }
      if(t[j] == c){
        Ct[i][0]++;
        Ct[i].pb(j);
      }
    }
  }

  sort(all(Cs));
  sort(all(Ct));

  rep(i, 26){
    bool flag = false;
    rep(j, 26){
      if(Cs[i] == Ct[j]){
        flag = true;
        break;
      }
    }
    if(flag == false){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;

  return 0;
}


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

class Knapsack{
public:
	int* weight;
	int* value;
	int U;
	int N;
	int** memo;
	int** dp;
	bool** done;

	Knapsack();
	~Knapsack();

	int full_search(int i, int U);
	int Dynamic_Programming(int i, int U);
	int Memoization(int i, int U);
};

Knapsack::Knapsack(){
	cin >> N >> U;
	weight = new int[N];
	value = new int[N];
	for (int i = 0; i < N; i++){
		cin >> value[i] >> weight[i];
	}
	memo = new int*[N];
	done = new bool*[N];
	for (int i=0; i < N; i++){
		memo[i] = new int[U+1];
		done[i] = new bool[U+1];
		for (int j = 0; j < U + 1; j++){
			memo[i][j] = 0;
			done[i][j] = false;
		}
	}

	dp = new int*[N + 1];
	for (int i = 0; i < N+1; i++){
		dp[i] = new int[U + 1];
		for (int j = 0; j < U + 1; j++){
			dp[i][j] = 0;
		}
	}

	
}

Knapsack::~Knapsack(){
	delete[] weight;
	delete[] value;
	for (int i=0; i < N; i++){
		delete[] memo[i];
		delete[] done[i];
	}
	for (int i = 0; i < N + 1; i++){
		delete[] dp[i];
	}
	delete[] dp;
	delete[] memo;
	delete[] done;
}


int Knapsack::full_search(int i, int U){
	if (i == N)return 0;
	else if (U < weight[i])return full_search(i + 1, U);
	else{
		int res1 = full_search(i + 1, U);
		int res2 = full_search(i + 1, U - weight[i]) + value[i];
		return max(res1, res2);
	}
}

int Knapsack::Memoization(int i, int U){
	if (i == N)return 0;
	if (done[i][U])return memo[i][U];

	int res;
	if (U < weight[i])return Memoization(i + 1, U);

	int res1 = Memoization(i + 1, U);
	int res2 = Memoization(i + 1, U - weight[i]) + value[i];
	res = max(res1, res2);

	done[i][U] = true;
	memo[i][U] = res;
	return res;
}

int Knapsack::Dynamic_Programming(int k, int U){
	for (int u = 0; u <= U; u++)dp[N][u] = 0;

	for (int i = N - 1; i >= 0; i--){
		for (int u = 0; u <= U; u++){
			if (u < weight[i]) dp[i][u] = dp[i + 1][u];
			else dp[i][u] = max(dp[i + 1][u], dp[i + 1][u - weight[i]] + value[i]);

		}
	}
	return dp[0][U];
}

int main(){
	Knapsack *solve = new Knapsack;
	cout << solve->Dynamic_Programming(0, solve->U) << endl;
	delete solve;
}

Measured memory_bytes: 9984
import java.util.*;

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

        //初期処理
        Scanner sc=new Scanner(System.in);
        // int n=Integer.parseInt(sc.nextLine());
        // String[] sArray = sc.nextLine().split(" ");
        // int[] array=Arrays.stream(sArray).mapToInt(Integer::parseInt).toArray();

        int n = Integer.parseInt(sc.nextLine());
        String[] S = sc.nextLine().split(" ");
        int q = Integer.parseInt(sc.nextLine());
        String[] T = sc.nextLine().split(" ");
        int answer = 0;
        
        for (int i=0;i<T.length;i++){
            ArrayList<String> SwithSentinel=new ArrayList<>(Arrays.asList(S));
            SwithSentinel.add(T[i]);
            int j=0;
            while (!T[i].equals(SwithSentinel.get(j)) ) {
                j++;
            }
            if (j==n) {
                continue;
            } else {
                answer++;
            }
        }

        

            System.out.println(answer);
        // String[] sArray2 = Arrays.stream(array).mapToObj(Integer::toString).toArray(s->new String[s]);
        // System.out.println(String.join(" ", sArray2));
        // System.out.println(count);
    }
}



Measured memory_bytes: 43700
fun main(args: Array<String>) {
    abc144d()
}

fun abc144d() {
    val (a, b, x) = readLine()!!.split(" ").map { it.toDouble() }

    val answer = if (a * a * b / 2 <= x) {
        // 45度以下のパターン
        val c = (b - (x / a) / a) * 2
        Math.toDegrees(Math.atan(c / a))
    } else {
        // 45度より大きいパターン
        val d = x / (a * b / 2)
        Math.toDegrees(Math.atan(b / d))
    }

    println(answer)
}


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

int main(){
  vector<int> a(3);
  std::cin >> a[0] >> a[1] >> a[2];
  sort(a.begin(), a.end());
  for (int i = 0; i < 3; i++) {
    if(i != 2)std::cout << a[i] << " ";
    else std::cout << a[i] << std::endl;
  }
  return 0;
}

Measured memory_bytes: 1208
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <complex>

#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

#include <stdexcept>

using namespace std;

// type alias
using ll = long long;
using ull = unsigned long long;
using comp = complex<double>;

const ll MOD = 1000000007LL;
const double PI = 3.14159265358979323846;

//conversion
//------------------------------------------
inline int toint(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class t> inline string tostring(t x) { ostringstream sout; sout << x; return sout.str(); }

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl
#define DEBUG(x) cerr << #x << " = " << (x) << " (l" << __line__ << ")" << " " << __file__ << endl

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

	ll K;
	cin >> K;

	if (K < 10) {
		cout << K << endl;
		return 0;
	}

	ll k;
	vector<vector<ll>> dps(32, vector<ll>(12, 0));
	ll num, digit;
	num = 0;
	for (digit = 0; digit < 10; ++digit) {
		ll idx = digit + 1;
		auto val = 1;
		dps[num][idx] = val;
	}
	++num;
	k = 9;

	for (; num < 32; ++num) {
		for (digit = 0; digit < 10; ++digit) {
			ll idx = digit + 1;
			auto val = dps[num - 1][idx - 1] + dps[num - 1][idx] + dps[num - 1][idx + 1];
			dps[num][idx] = val;
			if (digit != 0) {
				if (k + val < K) {
					k += val;
				}
				else {
					goto loop_end;
				}
			}
		}
	}
loop_end:
	ll res, pow = 1;
	for (ll i = 0; i < num; ++i) {
		pow *= 10LL;
	}
	res = digit * pow;
	pow /= 10LL;

	ll lunlun_count = K - k;
	for (; num > 0; --num) {
		for (ll i = 0; i < 3; ++i) {
			ll curr_digit = digit + i - 1;
			ll curr_idx = curr_digit + 1;
			if (lunlun_count <= dps[num - 1][curr_idx]) {
				digit = curr_digit;
				res += digit * pow;
				pow /= 10;
				break;
			}
			lunlun_count -= dps[num - 1][curr_idx];
		}
	}

	cout << res << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 32MB stack
        Thread thread = new Thread(null, new Main(), "", 32 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    static void solve(Scanner scanner) {
        String s = scanner.next();
        int min = Integer.MAX_VALUE;
        for (int i = 0; i + 3 <= s.length(); i++) {
            min = Math.min(min, Math.abs(753 - Integer.parseInt(s.substring(i, i + 3))));
        }
        System.out.println(min);
    }

}



Measured memory_bytes: 23636
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		boolean b = true;
		Set<Integer> set = new HashSet<Integer>();//HashSetで空の箱を作る
		for(int  i=0; i<N; i++) {
			int a= sc.nextInt();
			b =	set.add(Integer.valueOf(a));//set.addで空の箱に重複を除いたaを追加する
			//bがfalse(重複があるとき)はNO
			if(!b){
				System.out.println("NO");
				return;
			}
		}
		//最後まで重複しなかった場合
		System.out.println("YES");
	}		
}

Measured memory_bytes: 98828
def factorization(n):
    res = set()
    tmp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if tmp % i == 0:
            while tmp % i == 0:
                tmp //= i
            res.add(i)
    res.add(tmp)
    if not res:
        res.add(n)
    return res

a, b = map(int,input().split())
ans = factorization(a) & factorization(b) | {1}
print(len(ans))


Measured memory_bytes: 3064
import sys
from collections import deque

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


class UnionFindWeighted:
    # Reference: https://note.nkmk.me/python-union-find/
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
        self.weight = [0] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            root = self.find(self.parents[x])
            self.weight[x] += self.weight[self.parents[x]]
            self.parents[x] = root
            return root

    def union(self, x, y, w):
        rx = self.find(x)
        ry = self.find(y)

        if rx == ry:
            return

        if self.parents[rx] > self.parents[ry]:
            x, y, rx, ry, w = y, x, ry, rx, -w

        self.parents[rx] += self.parents[ry]
        self.parents[ry] = rx
        self.weight[ry] = self.weight[x] - self.weight[y] - w

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def diff(self, x, y):
        return self.weight[x] - self.weight[y]


def main():
    N, M, *LRD = map(int, read().split())

    uf = UnionFindWeighted(N)
    for l, r, d in zip(*[iter(LRD)] * 3):
        l -= 1
        r -= 1
        if uf.same(l, r) and uf.diff(l, r) != d:
            print('No')
            return
        else:
            uf.union(l, r, d)

    print('Yes')
    return


if __name__ == '__main__':
    main()


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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

signed main(){

	lli n;
	cin>>n;
	vector<lli> a(n);

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

	lli startM=0;
	REP(i,0,n){
		if(i%2==0)startM += a[i];
		else startM -= a[i];
	}

	cout<<startM<<" ";
	lli beforeM = startM;
	REP(i,1,n){
		lli nextM = 2*a[i-1] - beforeM;
		cout<<nextM<<" ";
		beforeM = nextM;
	}
	cout<<endl;

	return 0;
}

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

int main(){
  int a,b,c;
  cin >>a >>b >>c;
  int M = max(a,b);
  int m = min(a,b);
  if(M>=c && m<=c) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
import numpy as np

N = int(input())
X = np.array(list(map(int, input().split())))
s = np.sort(X)
m1 = s[N//2-1]
m2 = s[N//2]
for x in X:
    if x <= m1:
        print(m2)
    else:
        print(m1)

Measured memory_bytes: 34168
#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#include<algorithm>
#include<cmath>
#include<queue>
using namespace std;
#define MAXN 120000
int n;
char s[MAXN+5],t[MAXN+5];
int maxx;
int main()
{
    scanf("%d",&n);
    scanf("%s%s",s+1,t+1);
    for(int p=1;p<=n;p++)
    {
        bool flag=0;
        for(int i=1;i<=p;i++)
        if(t[i]!=s[n-p+i])flag=1;
        if(flag==0)maxx=max(maxx,p);
	}
    printf("%d",n*2-maxx);//
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int n;
	int d;
	scanf("%d",&n);
	scanf("%d",&d);
	int x = n/(2*d+1);
	if((n%(2*d+1))==0){
		printf("%d",x);
	}else{
		printf("%d",x+1);
	}
	
	
}

Measured memory_bytes: 128
import queue

A = queue.Queue()

k = int(input())

if k < 9:
    print(k)

else:
    cou = 9
    for i in range(1, 10):
        A.put(i)

    while(cou < k):
        tmp = A.get()
        if (tmp % 10) == 0:
            cou += 2
            if cou == k:
                print(tmp * 10 + (tmp % 10) + 1)
                break
            elif k == cou - 1:
                print(tmp * 10 + (tmp % 10))
                break
            else:
                A.put(tmp * 10 + (tmp % 10))
                A.put(tmp * 10 + (tmp % 10) + 1)
            

        elif (tmp % 10) == 9:
            cou += 2
            if cou == k:
                print(tmp * 10 + (tmp % 10))
                break
            elif k == cou - 1:
                print(tmp * 10 + (tmp % 10) - 1)
                break
            else:
                A.put(tmp * 10 + (tmp % 10) - 1)
                A.put(tmp * 10 + (tmp % 10))

        else:
            cou += 3
            # print(cou)
            if cou == k:
                print(tmp*10 + (tmp % 10) + 1)
                break
            elif cou - 1 == k :
                print(tmp * 10 + (tmp % 10))
                break
            elif cou - 2 == k:
                print(tmp * 10 + (tmp % 10) - 1)
                break

            else:
                A.put(tmp * 10 + (tmp % 10) - 1)
                A.put(tmp * 10 + (tmp % 10))
                A.put(tmp * 10 + (tmp % 10) + 1)

 


Measured memory_bytes: 6728
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  lines.push(line);
});
reader.on('close', () => {
    const n = lines[0]-0;
    console.log(Math.pow(n,3));
});

check = (a)=>{
    return a.toString()===a.toString().split("").reverse().join("")?1:0;
}


Measured memory_bytes: 30012
N = int(input())
A = input().split()
X = 1000000000
count = 0
for i in range(N):
  t = int(A[i])
  while t % 2 == 0:
    t = t//2
    count +=1
  if count < X:
    X = count
  count =0
print(X)

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

#define ll long long int 

int main()
{int n,x;
ll sum=0;
cin>>n;
// for(int i=n+1;i>0;i--)
// 	{  if(i%3==0 && i%5==0)
// 	       { //cout<<i<<endl;  
// 	       	if(i>x)
// 	       	   {x=i;}
	        

// 	        }  
// 	    }


//cout<<x<<endl;
for(int i=1;i<=n;i++)
{  if(i%3 !=0 && i%5 !=0)
        {   sum+=i;   }
}

cout<<sum;


}


Measured memory_bytes: 3640
using System;
public class Program
{
    public static void Main(string[] args)
    {
        var A_B = Console.ReadLine().Split(' ');
        var A = int.Parse(A_B[0]);
        var B = int.Parse(A_B[1]);
        var kuchi = 1;
        var tap = 0;

        while (kuchi < B)
        {
            kuchi--;
            kuchi += A;
            tap++;
        }

        Console.WriteLine(tap);
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k;
  	cin>>n>>k;
  vector<int>vec(n);
  for(int i=0;i<n;i++){
  	cin>>vec[i];
  }
  	vector<int>vec2(200001);
  set<int>s;
  for(int i=0;i<n;i++){
  	vec2[vec[i]]++;
    s.insert(vec[i]);
  }
  int d=s.size()-k;
  sort(vec2.begin(),vec2.end());
  int ans=0;
  for(int i=1;i<=200001;i++){
  	if(vec2[i]!=0){
    	for(int j=i;j<i+d;j++){
      	ans=ans+vec2[j];
 
        }
      	break;
    }
  }
  cout<<ans<<endl;
  
}

Measured memory_bytes: 11136
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DIslandsWar solver = new DIslandsWar();
        solver.solve(1, in, out);
        out.close();
    }

    static class DIslandsWar {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();

            Pair[] pairs = new Pair[m];
            for (int i = 0; i < m; i++) {
                int from = in.nextInt() - 1;
                int to = in.nextInt() - 1;
                pairs[i] = new Pair(from, to);
            }
            Arrays.sort(pairs);

            int count = 0;
            int now = -1;
            for (int i = 0; i < m; i++) {
                if (now < pairs[i].x) {
                    count++;
                    now = pairs[i].y - 1;
                }
            }

            out.println(count);
        }

        public class Pair implements Comparable<Pair> {
            int x;
            int y;

            Pair(int x, int y) {
                this.x = x;
                this.y = y;
            }

            public int compareTo(Pair p) {
                return y != p.y ? y - p.y : x - p.x;
            }

        }

    }

    static class InputReader {
        private BufferedReader br;
        private StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
            st = new StringTokenizer("");
        }

        public String nextString() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

    }
}



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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

const string YES = "";
const string NO  = "";

typedef long long ll;

void solve() {

}

int main() {
  int n,d;
  cin >> n >> d;
  int v = n / ( 2 * d + 1 );
  if( n % ( 2 * d + 1 ) ) ++v;
  cout << v << endl;
  return 0;
}


Measured memory_bytes: 256