akhauriyash/Code-Regression huggingface dataset:
class Node(object):
    def __init__(self, num, prv = None, nxt = None):
        self.num = num
        self.prv = prv
        self.nxt = nxt
 
 
class DoublyLinkedList(object):
    def __init__(self):
        self.start = self.last = None
 
    def insert(self, num):
        new_elem = Node(num)
 
        if self.start is None:
            self.start = self.last = new_elem
        else:
            new_elem.nxt = self.start
            self.start.prv = new_elem
            self.start = new_elem
 
    def delete_num(self, target):
        it = self.start
        while it is not None:
            if it.num == target:
                if it.prv is None and it.nxt is None:
                    self.start = self.last = None
                else:
                    if it.prv is not None:
                        it.prv.nxt = it.nxt
                    else:
                        self.start = self.start.nxt
 
                    if it.nxt is not None:
                        it.nxt.prv = it.prv
                    else:
                        self.last = self.last.prv
                break
            it = it.nxt
 
    def delete_start(self):
        if self.start is self.last:
            self.start = self.last = None
        else:
            self.start.nxt.prv = None
            self.start = self.start.nxt
 
    def delete_last(self):
        if self.start is self.last:
            self.start = self.last = None
        else:
            self.last.prv.nxt = None
            self.last = self.last.prv
 
    def get_content(self):
        ret = []
        it = self.start
 
        while it is not None:
            ret.append(it.num)
            it = it.nxt
 
        return ' '.join(ret)
 
 
def _main():
    from sys import stdin
 
    n = int(input())
 
    lst = DoublyLinkedList()
     
    for _ in range(n):
        cmd = stdin.readline().strip().split()
        if cmd[0] == 'insert':
            lst.insert(cmd[1])
        elif cmd[0] == 'delete':
            lst.delete_num(cmd[1])
        elif cmd[0] == 'deleteFirst':
            lst.delete_start()
        elif cmd[0] == 'deleteLast':
            lst.delete_last()
 
    print(lst.get_content())
 
 
if __name__ == '__main__':
    _main()



Measured memory_bytes: 227600
def is_even(num):
    return num % 2 == 0

A, B = map(int, input().split())
# 1, 2, 3で繰り返す
for C in range(1, 3):
    if not is_even(A*B*C):
        print('Yes')
        # exitでプログラムを終わらせる
        exit()
# 'Yes'の場合ここまで到達しない
print('No')

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
typedef pair<pll, pll> P;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS = 1e-9;
const bool debug = 0;
//---------------------------------//

struct LazySegTree {
	vector<ll> node, lazy;
	int n;
	
	LazySegTree(int _n) {
		n = 1;
		while (n < _n) n *= 2;
		
		node.resize(2 * n - 1, 0);
		lazy.resize(2 * n - 1, 0);
	}
	
	void eval(int k, int l, int r) {
		if (lazy[k] == 0) return;
		node[k] += lazy[k];
		
		if (r - l > 1) {
			lazy[k * 2 + 1] += lazy[k] / 2;
			lazy[k * 2 + 2] += lazy[k] / 2;
		}
		
		lazy[k] = 0;
	}
	
	void add(int a, int b, ll x, int k = 0, int l = 0, int r = -1) {
		if (r < 0) r = n;
		eval(k, l, r);
		
		if (b <= l || r <= a) return;
		if (a <= l && r <= b) {
			lazy[k] += (r - l) * x;
			eval(k, l, r);
		}
		else {
			add(a, b, x, k * 2 + 1, l, (l + r) / 2);
			add(a, b, x, k * 2 + 2, (l + r) / 2, r);
			node[k] = node[k * 2 + 1] + node[k * 2 + 2];
		}
	}
	
	ll query(int a, int b, int k = 0, int l = 0, int r = -1) {
		if (r < 0) r = n;
		eval(k, l, r);
		
		if (b <= l || r <= a) return 0;
		if (a <= l && r <= b) return node[k];
		ll vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
		ll vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
		return vl + vr;
	}
};

int main() {
	int n, q;
	cin >> n >> q;
	
	LazySegTree st(n);
	
	while (q--) {
		int a, b, c, d;
		cin >> a >> b >> c;
		if (a == 0) {
			cin >> d;
			st.add(b - 1, c, d);
		}
		else {
			cout << st.query(b - 1, c) << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 7080
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;

int main(void){
    int a,b;
    cin >> a >> b;
    if(a == 1){
        if(b == 2) cout << 3 << endl;
        else cout << 2 << endl;
    }else if(a == 2){
        if(b == 3) cout << 1 << endl;
        else cout << 3 << endl;
    }else{
        if(b == 2) cout << 1 << endl;
        else cout << 2 << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        long mod = 1000000007;
        int[] c = new int[26];
        Arrays.fill(c, 1);
        for(int i = 0; i < n; i++){
            char x = s.charAt(i);
            c[x - 'a']++;
        }
        long ans = 1;
        for(int i = 0; i < 26; i++){
            ans *= c[i];
            ans %= mod;
        }
        ans--;
        System.out.println(ans);
    }
}


Measured memory_bytes: 24648
def main():
  import bisect
  s = input()
  t = input()
  al = [[] for _ in range(26)]
  for i in range(len(s)):
    al[ord(s[i])-97].append(i)
  #print(al)
  ans = 0
  std = -1
  for i in range(len(t)):
    x = al[ord(t[i])-97]
    if not x:
      print(-1)
      exit()
    y = bisect.bisect_left(x,std+1)
    if y == len(x):
      ans += len(s) - std + x[0]
      std = x[0]
    else:
      ans += al[ord(t[i])-97][y] - std 
      std = al[ord(t[i])-97][y]
  print(ans)
main()



Measured memory_bytes: 7668
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
using namespace std;
typedef long long ll;
long long mod = 1000000007;
long long power(long long m,long long n){
    long long res = 1;
    if(n > 0){
        res = power(m,n / 2);
        if(n % 2 == 0){
            res = (res * res) % mod;
        }
        else{
            res = (((res * res) % mod) * m) % mod;
        }
    }
    return res;
}
//modはグローバル変数にしておく
int main(){
  ll n,k;
  cin >> n >> k;
  vector<ll> count(k + 1);
  ll res = 0;
  for(int i = k;i >= 1;i--){
    int kazu = 0;
    kazu = k / i;
    count[i] = power((ll)kazu,n);
    for(int j = 2;j <= kazu;j++){
      count[i] -= count[j * i];
      if(count[i] < 0)count[i] += mod;
    }
    res += count[i] * i;
    res %= mod;
    //cout << kazu << " " << count[i] << endl;
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3980
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<unordered_set>
#include<unordered_map>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod;

int main(){
  ll a[3];
  for(int i=0;i<3;i++)cin>>a[i];
  sort(a,a+3);
  cout<<a[0]+a[1]<<endl;
  return 0;
}


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

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    for (int i = 0; i < n; ++i) {
        cin >> h[i];
    }
    sort(h.begin(), h.end());
    int ans = 1001001001;
    for (int j = 0; j < n - k + 1; ++j) {
        ans = min(ans, h[j + k - 1] - h[j]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h> 
using namespace std;
int main()
{
	int a,b,c,d,e;
	cin>>a>>b>>c>>d>>e;
	if (a==0)
		cout<<1;
	else if (b==0)
		cout<<2;
	else if (c==0)
		cout<<3;
	else if (d==0)
		cout<<4;
	else
		cout<<5;
	return 0;
}


Measured memory_bytes: 3632
#include "bits/stdc++.h"
using namespace std;
#define INF 1e9
#define rep(i, n) for(int i=0;i<n;i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;  
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VII;   // VII a(n,vector<int>(m)) n * m 
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
template <class T, class U>  // chmax(max, a);
bool chmax(T &a, U b){
    if (a < b){ a = b;return 1;}
    return 0;
}
template <class T, class U> //chmin(min,a)
bool chmin(T &a, U b){
    if (a > b){ a = b; return 1;}
    return 0;
}
template<typename T>   // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}

// g++ -std=c++11 prac.cpp 
int main(){
    ll y,z,n,p,m=0,k,h,w,sum=0,sum_a=0,sum_b=0,ans=0,Max=-1e9,count=0,Min=1e9+1;
    string s,t,u,v;
    bool ok=true;
    cin >> n;
    VL a(n);
    rep(i,n){
        cin >> a[i];
        chmax(Max,a[i]);
    }
    double x = Max/2;
    rep(i,n){
        if(a[i] != Max && chmin(Min,abs(a[i]-x))){
            k = a[i];
        }
    }
    cout << Max << " " << k << endl;
    return 0;
}

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


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

//-------------------------------------------------
//コピペするとこ



//-------------------------------------------------


int main()
{
  double x, y, xx, yy ;
  cin >> x >> y >> xx >> yy ;
  double d = (x-xx)*(x-xx)+(y-yy)*(y-yy) ;
  double ans = sqrt(d) ;
  cout <<SP(10)<<ans<<endl ;

  return 0 ;
}




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

// macros
#define pb emplace_back
#define mk make_pair
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define irep(itr, st) for(auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for(auto itr = (st).rbegin(); itr != (st).rend(); ++itr)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define bit(n) (1LL<<(n))
// functions
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 <typename T> istream &operator>>(istream &is, vector<T> &vec){for(auto &v: vec)is >> v; return is;}
template <typename T> ostream &operator<<(ostream &os, const vector<T>& vec){for(int i = 0; i < vec.size(); i++){ os << vec[i]; if(i + 1 != vec.size())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p){os << p.first << " " << p.second; return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << itr->first << ":" << itr->second; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const unordered_map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << itr->first << ":" << itr->second; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
//  types
using ll = long long int;
using P = pair<int, int>;
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1000000007;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
// io
struct fast_io{
  fast_io(){ios_base::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(20);}
} fast_io_;


int main(int argc, char const* argv[])
{
  int n;
  cin >> n;
  vector<int> a(n), b(n), c(n-1);
  cin >> a >> b >> c;
  rep(i, n)a[i]--;
  ll res = 0;
  rep(i, n)res += b[i];
  rep(i, n - 1){
    if(a[i+1] == a[i] + 1){
      res += c[a[i]];
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
# include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
typedef long long ll;
int n,bil;
set<int>SET;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n;;
    for(int i=1;i<=n;i++){
        cin>>bil;
        if(SET.count(bil)==1){
            cout<<"NO"<<endl;
            return 0;
        }
        SET.insert(bil);
    }
    cout<<"YES"<<endl;
}

Measured memory_bytes: 9600
#include <stdio.h>
#include <stdlib.h>
#define INT_MAX 1000000000
//Se você tivesse declarado a biblioteca limits.h não precisaria definir INT_MAX. ela é um macro dessa biblioteca.
int ordena(const void *a, const void *b){
  return (*(int *)a)-(*(int *)b);
}

int main (){    //EXERCICIO DE FORÇA BRUTA.
  int n, a[112];

  scanf("%d", &n);

  for(int i=0; i<n ; i++)
    scanf("%d", &a[i] );

  qsort(a,n,sizeof(int), ordena);

  int min = INT_MAX;
  for(int i=a[0]; i<=a[n-1]; i++){
    int soma=0;
    for(int j=0; j<n; j++){
      soma+= (a[j]-i)*(a[j]-i);
  //    printf("%d ", soma);
    }
    if(min>soma)
      min=soma;
  }
  printf("%d\n", min);

  return 0;
}


Measured memory_bytes: 128
// Created by Tanuj Jain
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int MAXN = 3002;

double dp[MAXN][MAXN];
double prob[MAXN];
//bool vis[MAXN][MAXN];
/*
double recursive(int N, int heads)
{
	//base case
	if(N<heads)
		return 0.0;
	if(N==0)
		return (heads==0);

	if(vis[N][heads])
		return dp[N][heads];
	else
	{
		//mark the node as visited
		vis[N][heads]=true;
		//find the left and right child values and save it in dp table
		//if i toss the nthe coin i can get a head and a tail
		//if i get a head then i need the ansewer for n-1 and heads-1 
		//if i get a tailt thena i need the answer for n-1 and heads
		return dp[N][heads]=(prob[N]*(recursive(N-1,heads-1))+ (1.0-prob[N])*(recursive(N-1,heads)));
	}
}
*/
void bottomup(int &N)
{
	//double dp1[MAXN][MAXN]={};
	dp[0][0]=1.0;
	//fill the first colum
	//for(int i=1;i<=N;i++)
	//	dp[i][0]=1.0-prob[i];
	
	for(int coin=1;coin<=N;coin++)
	{
		for(int heads=0;heads<=coin;heads++)
		{
			if(heads==0)
				dp[coin][heads]=dp[coin-1][heads]*(1.0-prob[coin]);
			else
				dp[coin][heads]=((prob[coin]*dp[coin-1][heads-1])+(1.0-prob[coin])*(dp[coin-1][heads]));
		}
	}
	//for(int i=0;i<=N;i++)
	//{
	//	for(int j=0;j<=N;j++)
	//		cout<<dp[i][j]<<" ";
	//	cout<<endl;
	//}
	double ans = 0.0; 
  
    // When the number of heads is greater than (n+1)/2 
    // it means that heads are greater than tails as 
    // no of tails + no of heads is equal to n for 
    // any permuation of heads and tails 
    for (int i = (N + 1) / 2; i <= N; i += 1) 
        ans += dp[N][i]; 
  
    cout<<fixed<<setprecision(9)<<ans; 
}
int main()
{
	ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

	//#ifndef ONLINE_JUDGE
	//freopen("inputf.in","r",stdin);
	//freopen("outputf.in","w",stdout);
	//#endif

	int N;
	cin>>N;
	for(int i=1;i<=N;i++)
		cin>>prob[i];
	//double ans=0;
	//for(int heads=0;heads<=N;heads++)
	//{
	//	int tails=N-heads;
	//	if(heads>tails)
	//	{
	//		ans+=recursive(N,heads);
	//	}
	//}
	//cout<<fixed<<setprecision(9)<<ans;
	bottomup(N);
	
}

Measured memory_bytes: 68992
import copy
N = int(input())
old_h_list = [list(map(int, input().split()))]
ans = 0
while True:
    new_h_list = []
    tmp = []
    for h in old_h_list:
        for i, hi in enumerate(h):
            if hi == 0:
                if tmp == []:
                    continue
                new_h_list.append(tmp)
                tmp = []
                continue
            elif i == len(h)-1:
                tmp.append(hi)
                new_h_list.append(tmp)
                tmp = []
                continue
            tmp.append(hi)
    for i, h in enumerate(new_h_list):
        new_h_list[i] = [max(0, hi-1) for hi in h]
        ans += 1
    if sum([hi for h in new_h_list for hi in h]) == 0:
        break
    old_h_list = copy.copy(new_h_list)
print(ans)


Measured memory_bytes: 3444
N = int(input())
As = list(map(lambda x: int(x), input().split(" ")))
flag = True

for a in As:
    if a % 2 != 0:
        continue
    if a % 3 != 0 and a % 5 != 0:
        flag = False
        break

if flag:
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define gc getchar_unlocked()
#define pc(x) putchar_unlocked(x)
template<typename T> void scan(T &x){x = 0;bool _=0;T c=gc;_=c==45;c=_?gc:c;while(c<48||c>57)c=gc;for(;c<48||c>57;c=gc);for(;c>47&&c<58;c=gc)x=(x<<3)+(x<<1)+(c&15);x=_?-x:x;}
template<typename T> void printn(T n){bool _=0;_=n<0;n=_?-n:n;char snum[65];int i=0;do{snum[i++]=n%10+48;n/= 10;}while(n);--i;if (_)pc(45);while(i>=0)pc(snum[i--]);}
template<typename First, typename ... Ints> void scan(First &arg, Ints&... rest){scan(arg);scan(rest...);}
template<typename T> void print(T n){printn(n);pc(10);}
template<typename First, typename ... Ints> void print(First arg, Ints... rest){printn(arg);pc(32);print(rest...);}

using namespace std;


int main(){
    
    int n; string s;
    cin >> n;
    cin >> s;
    
    for(char &c: s){
        c -= 'A';
        c += n;
        c %= 26;
        c += 'A';
    }
    
    cout << s;
    
    return 0;
}

Measured memory_bytes: 256
i = list(map(int, input().split()))
a = i[0]
b = i[1]
c = i[2]
k = i[3]
if k<=a:
    print(k)
elif a < k<=a+b:
    print(a)
elif a+b < k<=a+b+c:
    d = k - (a+b)
    print(a-d)
else:
    print(a-c)

Measured memory_bytes: 9132
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
# list(map(int, list(input()))) # スペースがない数字リストを読み込み
import math
import fractions
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
import collections
from collections import Counter
from collections import deque
import pprint

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    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


# a^n
def power(a, n, mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod


# n*(n-1)*...*(l+1)*l
def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n - 1
    while (tmp >= l):
        a = a * tmp % mod
        tmp -= 1
    return a


inf = 10 ** 18
mod = 10 ** 9 + 7

n = ir()
a = lr()
dp = [0 for i in range(32)]
for num in a:
    for j in range(32):
        if ((num >> j) & 1):
            dp[j]+=1
ans = []
for num in a:
    judge = []
    for j in range(32):
        if ((num >> j) & 1):
            judge.append((dp[j]+1)%2)
        else:
            judge.append((dp[j]) % 2)
    tmp = 0
    for i,num in enumerate(judge):
        if num == 1:
            tmp+=power(2,i,mod)
    ans.append(tmp)
print(*ans,sep=' ')

Measured memory_bytes: 111356
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long ll;

ll divceil(ll x, ll y) {
  return (x + y - 1) / y;
}

int main() {
  ll n;
  cin >> n;
  vector<pair<ll,ll>> v(n);
  REP(i,0,n) {
    cin >> v[i].first >> v[i].second;
  }
  ll t = v[0].first;
  ll a = v[0].second;
  REP(i,1,n) {
    ll k = max(divceil(t, v[i].first), divceil(a, v[i].second));
    t = v[i].first * k;
    a = v[i].second * k;
  }
  cout << t + a << endl;
  return 0;
}


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

int main(){
    int a,b,c;
    const int CO=100;
    vector<int> vb;

    cin>>a>>b>>c;
    for (int i=CO+1;i>=1;i--){
        if (a %i==0 && b % i==0){
        vb.push_back(i);
        }
    }
    cout<<vb[c-1]<<endl;
    
    return 0;
}


Measured memory_bytes: 256
while 1:
    w=int(input())
    if w==-1:break
    elif w<=10:
        tm=1150
    elif w<=20:
        tm=1150+125*(w-10)
    elif w<=30:
        tm=2400+140*(w-20)
    else:
        tm=3800+160*(w-30)
    print(4280-tm)


Measured memory_bytes: 5580
S = input()
T = input()
s = len(S)
t = len(T)
l = []
ans = []

if s < t:
    print('UNRESTORABLE')
    exit()

for i in range(s - t + 1):
    for j in range(t):
        if T[j] == S[i + j] or S[i + j] == '?':
            if j == t - 1:
                l.append(i)
            continue
        else:
            break

if l:
    for i in l:
        if i != 0 and i != s - 1:
            ans.append((S[:i] + T + S[i + t:]).replace('?', 'a'))
        elif i == 0:
            ans.append((T + S[t:]).replace('?', 'a'))
        else:
            ans.append((S[:i] + T).replace('?', 'a'))
    ans.sort()
    print(ans[0])
else:
    print('UNRESTORABLE')

Measured memory_bytes: 3064
n = int(input())
a = list(map(int,input().split()))
a = list(map(lambda x: (str(bin(x))[2:]).zfill(65), a))
mod = 10**9 + 7
ans = 0
for i in range(65):
    cnt = 0
    for j in a:
        if j[-1*(i+1)] == "1": cnt += 1
    ans += cnt * (n-cnt) * pow(2, i, mod) % mod
    ans %= mod
print(ans)


Measured memory_bytes: 148288
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc.Split(bufio.ScanWords)
	n, a, b := nextInt(), nextInt(), nextInt()
	ans := 0
	for i := 1; i <= n; i++ {
		s := digitsSum(i)
		if a <= s && s <= b {
			ans += i
		}
	}
	puts(ans)
	wt.Flush()
}

func digitsSum(n int) int {
	ret := 0
	for n > 0 {
		ret += n % 10
		n /= 10
	}
	return ret
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func nextMega() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


Measured memory_bytes: 640
#include <stdio.h>

int topnum[1010]={0}, s[1000][200000];

void push(int t, int x){
  topnum[t]++;
  s[t][topnum[t]] = x;
}

int top(int t){
  return s[t][topnum[t]];
}

void pop(int t){
  topnum[t]--;
}

int main(void){
  int n, q, opera, t, x, i;

  scanf("%d %d", &n, &q);

  for (i = 0; i < q; i++) {
    scanf("%d", &opera);
    if (opera == 0) {
      scanf("%d %d", &t, &x);
      push(t, x);
    }
    else if (opera == 1) {
      scanf("%d", &t);
      if (topnum[t] > 0){
        printf("%d\n", top(t));
      }
    }
    else {
      scanf("%d", &t);
      if (topnum[t] > 0) {
        pop(t);
      }
    }
  }

  return 0;
}



Measured memory_bytes: 6020
rows, columns = map(int, input().split(' '))

if rows == 1 and columns == 1:
    print(1)
    exit()

if rows == 1:
    print(columns - 2)
    exit()

if columns == 1:
    print(rows - 2)
    exit()

print(rows * columns - 2 * rows - 2 * columns + 4)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef vector <ll> vll;
typedef pair <ll, ll> pll;
#define pb push_back
#define mp make_pair
#define MAX 1000000
#define mod 1000000007
#define all(_) _.begin(), _.end()
#define F first
#define S second

int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);
    ll n, i;
    string s;
    cin >> s;
    n = s.length();
    for(i = 0; i < n - 1; i++)
    {
        if(s[i] == s[i + 1])
        {
            cout << i + 1 << " " << i + 2 << endl;
            return 0;
        }
        if(i < n - 2)
        {
            if(s[i] == s[i + 2])
            {
                cout << i + 1 << " " << i + 3 << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1\n";
    return 0;
}

Measured memory_bytes: 512
#include <climits>
#include <cstring>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <string>
#include <set>
#include <unordered_set>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <fstream>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define f first
#define s second

#define MM INT_MAX/5
#define MIM INT_MIN/2

int di[] = { 1,-1,0,0 };
int dj[] = { 0,0,1,-1 };

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define v vector
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define beg(x) x.begin()
#define en(x) x.end()
#define all(x) beg(x), en(x)
#define resz resize

int dp[(int)1e5 + 10];
int stone[(int)1e5 + 10];

int main()
{
	memset(dp, 63, sizeof(dp));
	int N, K;
	cin >> N >> K;
	F0R(i, N) {
		cin >> stone[i];
	}
	dp[0] = 0;
	FOR(i, 0, N) {
		for(int j = 1; j <= K; j++)
			if(i+j < N)
				dp[i + j] = min(dp[i + j], abs(stone[i] - stone[i + j]) + dp[i]);
	}
	cout << dp[N - 1];
}


Measured memory_bytes: 1024
class Point:
    def __init__(self, x, y):
        self.x = x
        self.y = y

class Vector(Point):
    pass

def point_to_vector(p1, p2):
    x = p1.x - p2.x
    y = p1.y - p2.y
    return Vector(x, y)

def dot(v1, v2):
    return v1.x * v2.x + v1.y * v2.y

def cross(v1, v2):
    return v1.x * v2.y - v1.y * v2.x

def is_orth(v1, v2):
    if dot(v1, v2) == 0:
        return True
    else:
        return False

def is_pal(v1, v2):
    if cross(v1, v2) == 0:
        return True
    else:
        return False

q = int(input())
for i in range(q):
    temp = list(map(int, input().split()))
    points = []
    for j in range(0, 8, 2):
        points.append(Point(temp[j], temp[j+1]))
    v1 = point_to_vector(points[0], points[1])
    v2 = point_to_vector(points[2], points[3])
    if is_pal(v1, v2):
        ans = 2
    elif is_orth(v1, v2):
        ans = 1
    else:
        ans = 0
    print(ans)


Measured memory_bytes: 5628
#include <iostream>
using namespace std;
int main() {
    int n;
    cin >> n;
    int c[500], s[500], f[500];
    for(int i=0; i<n-1; i++) cin >> c[i] >> s[i] >> f[i];

    for(int i=0; i<n; i++) {
        int time=0;
        for(int j=i; j<n-1; j++) {
            if(time<s[j]) time = s[j];
            else if(time%f[j]!=0) time = time + f[j] - time%f[j];
            time += c[j];
        }
        cout << time << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    string op;
    while (1)
    {
        cin >> a >> op >> b;
        if(op == "?")
            break;
        
        if(op == "+")
            cout << a + b << endl;
        if(op == "-")
            cout << a - b << endl;
        if(op == "*")
            cout << a * b << endl;
        if(op == "/")
            cout << a / b << endl;
        
    }
    
  
    return 0;
}


Measured memory_bytes: 3160
package main

import (
	"os"
	"fmt"
	"bufio"
	"strconv"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		i, _ := strconv.Atoi(scanner.Text())
		fmt.Println(i*i*i)
	}
}


Measured memory_bytes: 1084
#include<bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define ll long long
#define maxn 1000005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define F first
#define S second
#define all(x) x.begin(), x.end()
const int mod = 998244353;
int pa[100005][18];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int>v(n);
    for (auto &i : v) {
        cin >> i;
    }
    int  k;
    cin >> k;
    for (int i = 0 ; i < n ; i++) {
        int l = i, r = n;
        while (r - l > 1) {
            int mid = (l + r) >> 1;
            if (v[mid] - v[i] <= k) {
                l = mid;
            }
            else {
                r = mid;
            }
        }
        pa[i][0] = l;
    }
    for (int i = 1 ; i < 18 ; i++) {
        for (int j = 0 ; j < n ; j++) {
            pa[j][i] = pa[pa[j][i - 1]][i - 1];
        }
    }
    int t;
    cin >> t;
    while (t--) {
        int x , y;
        cin >> x >> y;
        x--, y--;
        if (x > y) {
            swap(x, y);
        }
        int l = 0, r = n;
        while (r - l > 1) {
            int mid = (l + r) >> 1;
            int tx = x;
            for (int i = 0 ; i < 18 ; i++) {
                if (mid & (1<<i)) {
                    tx = pa[tx][i];
                }
            }
            if (tx >= y) {
                r = mid;
            }
            else {
                l = mid;
            }
        }
        cout << r << '\n';
    }
}


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] NM = Console.ReadLine().Split(' ');
            int N = Convert.ToInt32(NM[0]);
            int M = Convert.ToInt32(NM[1]);
            if (N <= M)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 27288
from collections import deque
import sys
input = sys.stdin.readline

N, M = map(int, input().split())

G = [[] for _ in range(N + 1)]

for _ in range(M):
    l, r, d = map(int, input().split())
    G[l].append((r, -d))
    G[r].append((l, d))


MIN = -10 ** 18

lst = [MIN] * (N + 1)

que = deque()
que_append = que.append
que_popleft = que.popleft

for i in range(1, N + 1):
    if lst[i] == MIN:
        que_append(i)
        lst[i] = 0

    while que:
        tmp = que_popleft()
        for next_, d in G[tmp]:
            if lst[next_] == MIN:
                lst[next_] = lst[tmp] + d
                que_append(next_)
                continue
            
            if lst[next_] == lst[tmp] + d:
                continue
            else:
                print ('No')
                exit()

print ('Yes')


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

int main() {
  long long A, B, K;
  cin >> A >> B >> K;

  if (A < K) {
    B = max(0LL, B - (K - A));
    A = 0;
  }
  else A -= K;

  cout << A << " " << B << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30

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

int main(void) {
	int num, m, i, sum = 0, ok = true, k;
	cin >> num >> m;
	vector<int> d(num);
	rep(i, num) {
		cin >> d[i];
		sum += d[i];
	}
	sort(d.begin(), d.end(), greater<int>());
	k = sum / (4 * m);
	if (sum % (4 * m) == 0)
		k--;
	if (d[m - 1] <= k)
		ok = false;
	if (ok)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb(in,tmp) in.push_back(tmp)
#define all(in) in.begin(),n.end()
#define PI acos(-1)
using namespace std;
int main(){

  int a[30]={0};
  rep(i,28){
    int tmp;
    cin>>tmp;
    a[--tmp]++;
  }
  rep(i,30)if(!a[i])cout<<i+1<<endl;


}

Measured memory_bytes: 1160
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        System.out.println(a*b + " " +(
 a*2+b*2));
        sc.close();
    } 
    
}


Measured memory_bytes: 26396
// 参考: ei0124様
#include <bits/stdc++.h>
using namespace std;

int main () {

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

    int l[N];
    for (int i = 0; i < N; i++) {
        cin >> l[i];
    }

    const int K = 4;

    int ans = INT_MAX;
    for (int i = 0; i < pow(K, N); i++) {
        int cost = 0;
        vector<int> a(3, 0);
        vector<int> count(3, 0);
        for (int j = 0; j < N; j++) {
            int tmp = i;

            for (int k = 0; k < j; k++) {
                tmp /= K;
            }
            tmp %= K;

            if (tmp == 1) {
                a[0] += l[j];
                count[0]++;
            }
            else if (tmp == 2) {
                a[1] += l[j];
                count[1]++;
            }
            else if (tmp == 3) {
                a[2] += l[j];
                count[2]++;
            }
        }

        cost += abs(A - a[0]);
        cost += abs(B - a[1]);
        cost += abs(C - a[2]);

        if (count[0] == 0 || count[1] == 0 || count[2] == 0) {
            continue;
        }

        for (int j = 0; j < 3; j++) {
            cost += 10 * (count[j] - 1);
        }

        ans = min(ans, cost);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
#include <iostream>
int main() {
    int a, b, c;
    std::cin >> a >> b >> c;

    if (a == b) {
        std::cout << c << std::endl;
    } else if (a == c) {
        std::cout << b << std::endl;
    } else {
        std::cout << a << std::endl;
    }
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a,b,i;
	scanf("%d%d",&a,&b);
	if(a<b){
		for(i=0;i<b;i++){
			printf("%d",a);
		}
		printf("\n");
	}
	else{
		for(i=0;i<a;i++){
			printf("%d",b);
		}
		printf("\n");
	}
	return 0;
}

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

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

	if(N.at(0) == '7' || N.at(1) == '7' || N.at(2) == '7')
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 3628
import math

while True :
    n = int(input())
    
    if n == 0 :
        break
    else :
        S = [int(s) for s in input().split()]
        a2 = 0
        
        m = sum(S) / n
        
        for i in range(n) :
            a2 += (S[i] - m) ** 2
            
        a = math.sqrt(a2 / n)

    print(f"{a:.5f}")


Measured memory_bytes: 5720
#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 EPS (1e-8)
#define equals(a,b) (fabs((a)-(b)) < EPS)

using namespace std;
class Point{
public:
  double x,y;

  Point(double x = 0,double y = 0): x(x),y(y){}

  Point operator + (Point p){return Point(x+p.x,y+p.y);}
  Point operator - (Point p){return Point(x-p.x,y-p.y);}
  Point operator * (double a){return Point(a*x,a*y);}
  Point operator / (double a){return Point(x/a,y/a);}
  Point operator * (Point a){ return Point(x * a.x - y * a.y, x * a.y + y * a.x); }

  bool operator < (const Point& p) const{ return !equals(x,p.x)?x<p.x:(!equals(y,p.y)&&y<p.y); }

  bool operator == (const Point& p)const{ return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS; }

};

struct Segment{
  Point p1,p2;
  Segment(Point p1 = Point(),Point p2 = Point()):p1(p1),p2(p2){}
  bool operator <  (const Segment& s) const { return ( p2 == s.p2 ) ? p1 < s.p1 : p2 < s.p2; }
  bool operator == (const Segment& s) const { return ( s.p1 == p1 && s.p2 == p2 ) || ( s.p1 == p2 && s.p2 == p1 ); }

};

typedef Point Vector;

double dot(Point a,Point b){ return a.x*b.x + a.y*b.y; }

double cross(Point a,Point b){ return a.x*b.y - a.y*b.x; }

double norm(Point a){ return a.x*a.x+a.y*a.y; }

double abs(Point a){ return sqrt(norm(a)); }

#define MAX_N 18
int n;
Point ps[MAX_N];
int pairs[MAX_N];

int calcScore() {
  int score = 0;
  rep(i,n) {
    Segment s1 = Segment(ps[i],ps[pairs[i]]);
    REP(j,i+1,n) {
      if( j == pairs[i] ) continue;
      Segment s2 = Segment(ps[j],ps[pairs[j]]);
      if( equals(cross(s1.p1-s1.p2,s2.p1-s2.p2),0) ) {
	++score;
      }
    }
  }
  return score/4;
}

int maxi;
void dfs(int used) {
  if( used == ((1<<n)-1) ) {
    maxi = max(maxi,calcScore());
    return;
  }
  int tmp = ~used;
  tmp = tmp & -tmp;
  int x = ( ( tmp == 0 ) ? 0 : log2(tmp) );
  REP(i,x+1,n) {
    if( ( (used>>i) & 1 ) ) continue;
    pairs[x] = i;
    pairs[i] = x;
    dfs(used|(1<<x)|(1<<i));
    pairs[i] = pairs[x] = -1;
  }
}

void compute() {
  maxi = 0;
  memset(pairs,-1,sizeof pairs);
  dfs(0);
  cout << maxi << endl;
}

int main() {
  if(0){
  Segment s1 = Segment(Point(0,0),Point(1,0));
  Segment s2 = Segment(Point(12,33),Point(10,10));
  cout << (double)cross(s1.p1-s1.p2,s2.p1-s2.p2) << endl;
  }
  cin >> n;
  rep(i,n) cin >> ps[i].x >> ps[i].y;
  compute();
  return 0;
}



Measured memory_bytes: 3288
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;
const int dx[] = {0, -1, 0, 1};
const int dy[] = {1, 0, -1, 0};
const ll mod = 1e9 + 7;
const ll INF = 1e9;
const ll LINF = 1LL << 60;

struct edge {
  int to, id;  //先の頂点番号と辺番号
};

vector<vector<edge>> g;
vector<int> ans;

void dfs(int s, int c = -1, int p = -1) {
  int col = 1;
  rep(i, g[s].size()) {
    int u = g[s][i].to, v = g[s][i].id;
    if (u == p) continue;
    if (col == c) col++;
    ans[v] = col;
    col++;
    dfs(u, ans[v], s);
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //////////////////////////////////////
  int n;
  cin >> n;
  g.resize(n);
  ans.resize(n - 1);
  rep(i, n - 1) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    g[a].push_back(edge{b, i});
    g[b].push_back(edge{a, i});
  }
  dfs(0);
  int mx = 0;
  rep(i, n) mx = max(mx, (int)g[i].size());
  cout << mx << endl;
  rep(i, n - 1) cout << ans[i] << endl;
  return 0;
}


Measured memory_bytes: 8320
#pragma GCC optimize("Ofast")  
#pragma GCC target("avx,avx2,fma") 
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD=1e9+7;
template <class Q>
void clearQueue(Q & q) {
    q=Q();
}
void solve(){
	int n;cin>>n;int cnt=0;
	for(int a=1;a<=n;a++){
		if(n%a==0) cnt+=n/a-1;
		else
		cnt+=n/a;
	}
	cout<<cnt;
}
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL); 
//#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
//#endif
	int T=1;
	// cin>>T;
	while(T--){
		solve();
	}
}

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

int main ( ) {
    char c;
    cin >> c;

    if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
        cout << "vowel" << endl;
    } else {
        cout << "consonant" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
const double PI  = 3.1415926535897932384626433832795028841971;
const int    INF = 100000000;
const double EPS = 1e-10;
const int    MOD = 1000000007;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
int l[200];

int main(){
	cin >> n;
	rep(i,n*2) cin >> l[i];
	sort(l,l+n*2);
	int ans = 0;
	for(int i = 1; i < 2*n; i += 2){
		ans += l[i-1];
	}
	cout << ans << endl;
}

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

using namespace std;

int main() {
    int a = 0;
    int b  = 0;
    cin >> a;
    if (a % 10 == 7){
        b = 1;
    }
    a = a / 10;
    if (a % 10 == 7){
        b = 1;
    }
    a = a / 10;
    if (a == 7){
        b = 1;
    }
    if (b == 1){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
}



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

#define Pb push_back
#define Mp make_pair
#define ff first
#define ss second
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN
#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

#define db1(x) cout<<#x<<" : "<<x<<endl;
#define db2(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<endl;
#define db3(x,y,z) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\t"<<#z<<" : "<<z<<endl;

typedef long long int ll;
typedef long double ld;

const int  N = 1e5+5;
const int inf = INT_MAX;
const int MOD = 1e9+7;


void solve()
{
   string s;
   cin >> s;
   cout << s[0] << s[1] << s[2];
}

int32_t main()
{
   IOS;
   //freopen("input.txt", "rt", stdin);
   //freopen("output.txt", "wt", stdout);
   int t=1;
   //cin >> t;
   for(int i=1;i<=t;i++)
   {
      //cout<<"Case #"<<i<<": ";
      solve();
   }
   return 0;
}
/*==============================================================================================================================================================*/


Measured memory_bytes: 3644
#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>

using namespace std;

int main()
{
  ios::sync_with_stdio(false);cin.tie(0);
  vector<string> v{"dream", "erase", "dreamer", "eraser"};
  string s;
  cin >> s;
  reverse(s.begin(), s.end());
  for(int i = 0; i < 4; i++)
  {
    reverse(v[i].begin(), v[i].end());
  }
  int length;
  int f = 0;
  string auxString;
  while(1)
  {
    length = s.length();
    if (s.substr(0, 5) == v[0])
    {
      s = s.substr(5, length - 5);
    }
    else if (s.substr(0, 5) == v[1])
    {
      s = s.substr(5, length - 5);
    }
    else if (s.substr(0, 7) == v[2])
    {
      s = s.substr(7, length - 7);
    }
    else if (s.substr(0, 6) == v[3])
    {
      s = s.substr(6, length - 6);
    }
    else
      break;
  }

  if (length == 0)
  {
    cout << "YES" ;
  }
  else
  {
    cout << "NO" ;
  }
  return 0;
}


Measured memory_bytes: 512
#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<string>
#include<cstdlib>
#include<cctype>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr ll INF = 1LL << 40;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
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 lis(int n, vector<int>& A){
  vector<int> L(A.size()+1,0);
  L[0] = A[0];
  int length=1;
  for(int i=1; i<n; i++){
    if(L[length-1]>A[i]){
      L[length++] = A[i];
    }else{
      *lower_bound(L.begin(),L.begin()+length,A[i]) = A[i];
    }
  }
  return length;
}

int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  for(int i=0; i<N; i++){
    cin >> a[i];
  }
  cout << lis(N,a) << endl;

  return 0;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <assert.h>
#include <sstream>
#include <string>
//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater <>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
using namespace std;
using ll = long long;
typedef std::pair<int,int> P;
#include <boost/multiprecision/cpp_int.hpp>

using bint = boost::multiprecision::cpp_int;
 



int main(){
    int n; cin >> n;
    vector<int> a(n); rep(i,n) cin >> a[i];
    int ans = 0;
    rep(i,n){
        while(a[i]%2==0){
            ans++;
            a[i]/=2;
        }
    }
    cout << ans;
}


Measured memory_bytes: 256