akhauriyash/Code-Regression huggingface dataset:
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

H, W = mi()
S = [input() for _ in range(H)]

dij = [[0, 1], [1, 0], [0, -1], [-1, 0]]
for i in range(H):
    for j in range(W):
        if S[i][j] == '#':
            for dj, di in dij:
                if -1 < i + di < H and -1 < j + dj < W:
                    if S[i + di][j + dj] == '#':
                        break
            else:
                print('No')
                exit()
print('Yes')

Measured memory_bytes: 3064
#include <iostream>

int ans,n,m,p[100005];
int rt(int i) { return (p[i]==i?i:p[i]=rt(p[i])); }

int main() {
  scanf("%d %d",&n,&m);
  ans=n-1;
  for (int i=0;i<n;i++) p[i]=i;
  for (int i=0;i<m;i++) {
	int u,v;
    scanf("%d %d",&u,&v);
	int a=rt(u),b=rt(v);
    if (a!=b) p[a]=b,ans--;
  }
  printf("%d",ans);
}

Measured memory_bytes: 4148
#include <iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include <queue>
#include<algorithm>
typedef long long int ll;
using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,a) for (int i=1;i<=(a);i++)
const ll MOD = (1000000000+7);
    int ans=0,id;
    int N,M;
    ll A,B,C,W;
    string O,E;
    ll sum=0;
int main(){
    ios_base::sync_with_stdio(false);
    cin>>W>>A>>B;
    if(A<=B&&B<=A+W||A<=B+W&&B+W<=A+W){
        cout<<"0";
        return 0;
    }else{
        if(A>B+W){
            ans=A-(B+W);

        }
        if(A+W<B){
            ans=B-(A+W);
        }
    }
cout<<ans;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        char[] arr = sc.next().toCharArray();
        int[][] lengths = new int[n * 2][n * 2];
        int max = 0;
        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n; j++) {
                if (arr[i] == arr[j]) {
                    lengths[i][j] = 1;
                    max = 1;
                }
            }
        }
        for (int i = 1; i < n / 2; i *= 2) {
            for (int j = 0; j < n - 1; j++) {
                for (int k = j + i + 1; k < n; k++) {
                    if (lengths[j][k] != i) {
                        continue;
                    }
                    lengths[j][k] = Math.min(lengths[j][k] + lengths[j + i][k + i], k - j);
                    max = Math.max(max, lengths[j][k]);
                }
            }
        }
        System.out.println(max);
    }
}

Measured memory_bytes: 583012
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
#include <map>
#include <tuple>
using namespace std;

int main() {
	int T, A, B; cin >> A >> B >> T;
	int C = T / A;
	cout << C * B << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std ;
#define endl '\n' 

struct HASH{
  size_t operator()(const pair<int,int>&x)const{
    return hash<long long>()(((long long)x.first)^(((long long)x.second)<<32));
  }
};
unordered_map<pair<int,int>,int,HASH>mp;
#ifdef _DEBUG
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

int cnt ; 
void bubbleSort(int n , int ara[]) 
{
	for(int i = 0 ; i < n ; i++){
		for(int j = 0 ; j < n-i-1 ; j++){
			if(ara[j] > ara[j+1]){
				swap(ara[j] , ara[j+1]) ;
				cnt++ ;
			}
		}
	}
} 

int main(){
	int n , ara[105] ;
	scanf("%d" ,&n) ;
	for(int i = 0 ; i < n ; i++){
		scanf("%d" ,&ara[i]) ;
	}
	
	bubbleSort(n , ara) ;
	
	for(int i = 0 ; i < n ; i++){
		if(i > 0) printf(" ") ;
		printf("%d" ,ara[i]) ;
	}
	printf("\n%d\n" ,cnt) ;
	
	return 0 ;
}



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

using namespace std;

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

   struct Data{
      string s;
      int p;
      int num;

      bool operator<(const Data& right) const{
         return s == right.s ? p > right.p : s < right.s;
      }
   };

   vector<Data> data(n); 

   for(int i=0;i<n;i++){
      cin >> data[i].s;
      cin >> data[i].p;
      data[i].num = i+1;
   }

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

   for(int i=0;i<n;i++){
      cout << data[i].num << endl;
   }

   return 0;
}


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

#define ll long long
#define mtv(kit) cout<<#kit<<" - "<<kit<<"\n";
#define ff first
#define ss second
#define pb push_back
#define rep(i,a,b) for(i=a;i<b;i++)
#define pii pair<ll , ll>
#define all(x) x.begin(),x.end()
#define nl "\n"
#define ump unordered_map

void doit(){	
	ll n, i;
	cin >> n;
	vector< pii > v(n);
	rep(i,0,n){
		cin >> v[i].ff >> v[i].ss;
	}
	sort(all(v),[&](pii p1, pii p2){
			return( (p1.ss != p2.ss and p1.ss < p2.ss) or
				   	(p1.ss == p2.ss and p1.ff < p2.ff) );
	});
	ll cur = 0;
	rep(i,0,n){
		cur += v[i].ff;
		if(v[i].ss < cur){
			cout << "No" << nl;
			return;
		}
	}
	cout << "Yes" << nl;
}

int main() {
#ifndef ONLINE_JUDGE
//    freopen("input1.txt","r",stdin);
//    freopen("output1.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t = 1;
	// cin >> t;
    for(ll i = 1; i <= t; i++){
        doit();
    }
}


Measured memory_bytes: 6304
from sys import stdin
from copy import deepcopy
input = stdin.readline

N = int(input())
A = [int(input()) for _ in range(N)]

B = deepcopy(A)
S = deepcopy(A)


def p(N):
    for i in range(len(N)):
        if i == len(N) - 1:
            print(N[i])
        else:
            print(N[i], end=" ")


cnt = 0


def insertionsort(n, g):
    global cnt
    for i in range(g, N):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j + g] = A[j]
            j = j - g
            cnt += 1
        A[j + g] = v


def shellsort(n):
    h = 1
    G = []

    while h <= n:
        G.append(h)
        h = 3 * h + 1

    G.reverse()
    m = len(G)

    print(m)
    p(G)

    for i in range(0, m):
        insertionsort(n, G[i])


shellsort(N)

print(cnt)

for a in A:
    print(a)



Measured memory_bytes: 62256
#include<bits/stdc++.h>
//补题
using namespace std;
const int N=1e5+5;
int pa[N],cnt[N],fr[N];
 int n,m,k;
int search(int x){
    //if(pa[x]!=pa[pa[x]]) pa[x]=search(pa[x]);//这一句速度竟然能差 50倍？？
    return pa[x]==x?pa[x]:pa[x]=search(pa[x]);
    
}
inline void uion(int x,int y){//不止那一句，还有这里，如果写在函数里里面的话，就错了
    int a=search(x);
    int b=search(y);
    if(a!=b){
        pa[a]=b;
        cnt[b]+=cnt[a];   
     }
}
int main()
{   
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    while(cin>>n>>m>>k)
    { 
        for(int i=1;i<=n;i++){
            pa[i]=i; cnt[i]=1; fr[i]=0;
        }
        int x,y;
        while(m--) {
            cin>>x>>y;
            fr[x]++;fr[y]++;
            uion(x,y);
        }
        for(int i=1;i<=n;i++){
            cnt[i]=cnt[search(i)];
        }
        while(k--)
        {
            cin>>x>>y;
            int a=search(x);
            int b=search(y);
            if(a==b){
                cnt[x]--; cnt[y]--;
            }
        }
        for(int i=1;i<=n;i++)
            cout<<cnt[i]-fr[i]-1<<' ';
        cout<<endl;
    
    }

    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const int INF = numeric_limits<int>::max() / 2;

struct UF {
	vector<int> data;
	UF(int size) : data(size, -1) { }
	bool unite(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool find(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

struct edge {
	int src, dst, weight;
	edge(int src, int dst, int weight) :
		src(src), dst(dst), weight(weight) { }
};
bool operator < (const edge &e, const edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}

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

	int n, m;
	while (true) {
		cin >> n >> m;
		if (n == 0) break;
		vector<P> g[100];
		vector<edge> edges;
		for (int i = 0; i < m; i++) {
			int a, b, w; cin >> a >> b >> w;
			a--; b--;
			edge e(a, b, w);
			edges.push_back(e);
			g[a].push_back(P(b, w));
			g[b].push_back(P(a, w));
		}
		int res = INF;
		for (int i = 0; i < m; i++) {
			UF uf(n);
			edge e = edges[i];
			int a = e.src, b = e.dst;
			int ma = e.weight, mi = e.weight;
			priority_queue<P,vector<P>,greater<P>> q;
			uf.unite(a, b);
			for (int j = 0; j < (int)g[a].size(); j++){
				if (g[a][j].second >= mi) q.push(P(g[a][j].second, g[a][j].first));
			}
			for (int j = 0; j <(int) g[b].size();j++){
				if(g[b][j].second >= mi) q.push(P(g[b][j].second, g[b][j].first));
			}
			while (!q.empty()) {
				P p = q.top();q.pop();
				if (p.first < mi) continue;
				if (uf.find(a, p.second)) continue;
				ma = max(ma, p.first);
				uf.unite(a, p.second);
				for (int j = 0; j <(int) g[p.second].size(); j++) {
					if (g[p.second][j].second >= mi && !uf.find(a,g[p.second][j].first)) q.push(P(g[p.second][j].second, g[p.second][j].first));
				}
			}
			if (uf.size(a) < n) continue;
			else res = min(res,ma - mi);
		}
		if (res == INF) cout << -1 << endl;
		else cout << res << endl;
	}
}

Measured memory_bytes: 3260
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
//////////////
int H, W, A, B;
vector<LL> kai(200001);
vector<LL> kai_inv(200001);

LL powMod(LL num, LL n, LL mod = (LL)MOD) {//(num**n)%mod
	num %= mod;//
	if (n == 0) {
		return (LL)1;
	}
	LL mul = num;
	LL ans = (LL)1;
	while (n) {
		if (n & 1) {
			ans = (ans * mul) % mod;
		}
		mul = (mul * mul) % mod;
		n >>= 1;
	}
	return ans;
}
LL mod_inverse(LL num, LL mod = MOD) {
	return powMod(num, MOD - 2, MOD);
}

LL nCk(LL N, LL k, LL mod = MOD) {
	LL ans = 1;
	if (k == 0 || k == N) {
		return 1;
	}
	ans = (kai[N] * kai_inv[N - k]) % mod;
	ans = (ans * kai_inv[k]) % mod;
	return ans;
}
void solve() {
	
	cin >> H >> W >> A >> B;
	kai[0] = 1; //kai_inv[0] = mod_inverse(1);
	kai[1] = 1; kai_inv[1] = mod_inverse(1);

	for (int i = 2; i <= 200000; ++i) {
		kai[i] = (kai[i - 1] * i) % MOD;
		kai_inv[i] = mod_inverse(kai[i]);
	}

	LL ans = nCk(H + W - 2, W - 1);
	
	for (int b = 1; b <= B; ++b) {
		LL base = nCk(H-A-1+b-1,b-1);
		LL neg = nCk(A-1+W-b,A-1);
		LL res = (base * neg) % MOD;

		ans = (ans - res + MOD) % MOD;
	}

	cout << ans << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


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

using namespace std;

int f(int n) {
    int sum = 0;
    while (n > 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}

int main() {
    int N, A, B;
    cin >> N >> A >> B;

    int ans = 0;
    for (int i = 1; i <= N; ++i) {
        if (f(i) >= A && f(i) <= B) ans += i;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using V = vector<ll>;
#define _GLIBCXX_DEBUG
#define rep(i, a) for(int i = 0; i < a; i++)
#define ALL(v) v.begin(), v.end()

int main(){
    int t,x; cin>>t>>x;
    cout<<(double)t/x<<endl;
}

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

int main()
{
  long A, B, M;
  cin >> A >> B >> M;
  vector<int> a(A), b(B);
  int a_min = 100000001, b_min = 100000001;
  for (int i = 0; i < A; i++)
  {
    cin >> a[i];
    a_min = min(a[i], a_min);
  }
  for (int i = 0; i < B; i++)
  {
    cin >> b[i];
    b_min = min(b[i], b_min);
  }
  int min_value = a_min + b_min;
  for (int i = 0; i < M; i++)
  {
    int x, y, c;
    cin >> x >> y >> c;
    min_value = min(min_value, a[x-1] + b[y-1] - c);
  }
  cout << min_value << endl;
}

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

int main(){
    string a, b, c;
    cin >> a >> b >> c;
    if(a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0]) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

int main(){
  int n,T,x=1001;
  cin >> n >> T;
  vector<int> c(n),t(n);
  for(int i=0;i<n;i++)cin >> c.at(i) >> t.at(i);
  for(int i=0;i<n;i++){
    if(t.at(i)<=T && x>c.at(i))x=c.at(i);
  }
  if(x==1001)cout << "TLE" << endl;
  else cout << x << endl;
}


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

int Gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b == 0) return a;
	Gcd(b, a % b);
}

int main()
{
	int ans;
	int ary[10];
	int n;

	cin >> n;
	for (int i = 0; i < n; i++)
	{ 
		cin >> ary[i];
	}
	ans = ary[0];
	for (int i = 1; i < n; i++)
	{
		ans = ans * ary[i] / Gcd(ans, ary[i]);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n'
#define ll int64_t
#define ull uint64_t
using namespace std;

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

Measured memory_bytes: 3800
S = input()
 
MOD = 10**9+7
 
dp = [[0]*13 for _ in range(len(S) + 1)]
 
 
dp[0][0] = 1
 
for index in range(len(S)):
    if S[index] == '?':
        for pre_index in range(13):
            for i in range(10):
                next_i = (i +  pre_index * 10 ) % 13
                dp[index+1][next_i] += dp[index][pre_index] 
                dp[index+1][next_i] %= MOD

    else:
        for pre_index in range(13):
            i = int(S[index])
            next_i = (i +  pre_index  * 10) % 13
            dp[index+1][next_i] += dp[index][pre_index] 
            dp[index+1][next_i] %= MOD
 
 
 
print(dp[len(S)][5])


Measured memory_bytes: 61788
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
main(){
int W,H,x,y,r;
cin >> W >> H >> x >>y>>r;
if(x>=r&&y>=r&&x<=(W-r)&&y<=(H-r)){cout<<"Yes"<<endl;}
else cout<<"No"<<endl;
}

Measured memory_bytes: 3076
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class AL {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int a, b, c;
	    in >> a >> b >> c;
	    if(b-a == c-b) out << "YES" << endl;
	    else out << "NO" << endl;
	}
};


int main() {
	AL solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cmath>

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

int main()
{
    int n, t;
    double a;
    int H[n];

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

    double tmp[n];
    double min = 1e10;
    int index;

    REP(i, n){
        tmp[i] = t - H[i]*0.006;
        if (min > abs(a - tmp[i])){
            min = abs(a - tmp[i]);
            index = i + 1;
        }
    }
    cout << index << endl;   
}

Measured memory_bytes: 256
from math import ceil
N, K = map(int, input().split())
A = list(map(int, input().split()))
F = list(map(int, input().split()))
if K >= sum(A):
  print(0)
  exit()
A.sort(reverse=True)
F.sort()
lot = []
for k in range(N):
  lot.append((A[k]*F[k], k))
lot.sort(key =  lambda x:x[0],reverse=True)
high = lot[0][0]
#print('A:', A)
#print('F:', F)
#rint(lot)
def binary_search(high):
  low = 0
  mid = (low + high) //2
  while low < high:
    final = False
    mid = (low + high) //2
    #print(low, high, mid)
    if low == high-1:
      final = True
    #print(low, high, mid)
    res = K
    flag = True
    for k in range(N):
      if res < 0:
        break
      else:
        if lot[k][0] <= mid:
          break
        else:
          res -= ceil((lot[k][0]-mid)/F[lot[k][1]])
          continue
    if res < 0:
      flag = False
    #print(flag)
    if flag:
      high = mid
    else:
      if final:
        mid += 1
      low = mid
    #print(low, high, mid)
  #return None
  return mid

print(binary_search(high))

Measured memory_bytes: 119904
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	xx := make([]int, 5)
	for i := 0; i < 5; i++ {
		xx[i] = getNextInt(scanner)
	}
	for i := 0; i < 5; i++ {
		if xx[i] == 0 {
			fmt.Fprintln(writer, i+1)
			return
		}
	}
}


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

using namespace std;

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

struct Union_Find {
    //各要素が属する集合の代表(根)を管理する
    //もし、要素xが根であればdata[x]は負の値を取り、-data[x]はxが属する集合の大きさに等しい
    vector<int> data;
    
    Union_Find(int size) : data(size, -1) {}
    bool Union(int x, int y) {
        x = Find(x);
        y = Find(y);
        bool is_union = (x != y);
        if (is_union) {
            if (data[x] > data[y]) swap(x, y);
            data[x] += data[y];
            data[y] = x;
        }
        return is_union;
    }
    int Find(int x) {
        if (data[x] < 0) { //要素xが根である
            return x;
        } else {
            data[x] = Find(data[x]); //data[x]がxの属する集合の根でない場合、根になるよう更新される
            return data[x];
        }
    }
    bool same(int x, int y) {
        return Find(x) == Find(y);
    }
    int size(int x) {
        return -data[Find(x)];
    }
};


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<P> x(n), y(n);
	for (int i = 0; i < n; i++) {
		cin >> x[i].first >> y[i].first;
		x[i].second = i;
		y[i].second = i;
	}
	sort(x.begin(), x.end());
	sort(y.begin(), y.end());

	vector<T> e;
	for (int i = 0; i + 1 < n; i++) {
		e.emplace_back(x[i + 1].first - x[i].first, x[i + 1].second, x[i].second);
		e.emplace_back(y[i + 1].first - y[i].first, y[i + 1].second, y[i].second);
	}

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

	ll ans = 0;
	Union_Find uf(n);
	for (T& t : e) {
		int c, u, v;
		tie(c, u, v) = t;
		if (uf.same(u, v)) continue;
		uf.Union(u, v);
		ans += c;
		if (uf.size(0) == n) break;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6388
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <deque>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

const int MAX = 100001;
const int MOD = 1000000007;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;

int ceil(int x, int y) { return (x % y == 0) ? x / y : x / y + 1; }

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }

int lcm(int x, int y) { return x / gcd(x, y) * y; }

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

  int n, m;
  cin >> n >> m;

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

  return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define cs const
#define pb push_back
#define fi first
#define se second
using namespace std;
int Mod;
int add(int a, int b){ return a + b >= Mod ? a + b - Mod : a + b; }
int dec(int a, int b){ return a - b < 0 ? a - b + Mod : a - b; }
int mul(int a, int b){ return 1ll * a * b % Mod; }
void Add(int &a, int b){ a = add(a,b); }
void Dec(int &a, int b){ a = dec(a,b); }
void Mul(int &a, int b){ a = mul(a,b); }
cs int N = 505;
typedef pair<int, int> pi;
int n; pi a[N];
int dp[N][N];
int main(){
	#ifdef FSYolanda
	freopen("1.in","r",stdin);
	#endif
	scanf("%d%d",&n,&Mod);
	for(int i=0; i<n; i++)
	a[i] = pi(sqrt(n*n-1-i*i) + 1, sqrt(4*n*n-i*i) + 1);
	for(int i=n; i<n+n; i++)
	a[i] = pi(sqrt(4*n*n-i*i) + 1,0);
	sort(a, a+n+n); int ans = 0;
	for(int k = 0; k <= n; k++){
		memset(dp, 0, sizeof(dp));
		dp[0][0] = 1; 
		for(int i=0,c=0,z=0; i<n+n; i++){
			int p = min(n+n, a[i].fi);
			int q = min(n+n, a[i].se);
			for(int j=0,coe; j<=k; j++)
			if(coe = dp[i][j]){
			if(!q) Add(dp[i+1][j],mul(coe,p-c-j));
			else{
				Add(dp[i+1][j+1],mul(coe,p-c-j));
				Add(dp[i+1][j],mul(coe,q-n-k-z+j));
			} 
			} if(q) ++z; else ++c;
		} if(k & 1) Dec(ans, dp[n+n][k]);
		else Add(ans, dp[n+n][k]);
	} cout << ans; return 0;
}

Measured memory_bytes: 4724
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <stack>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long int ll;

string intToString(int num){
	string str;
	while( num != 0){
		int digit = num % 10;
		num /= 10;
		str.push_back( digit);
	}
	return str;
}

bool isPalindromic(string str){
	int n = str.size();
	for(int i = 0; i < n/2; i++){
		if( str[i] != str[n-i-1]) return false;
	}
	return true;
}

int main(){
	int A,B;
	cin>>A>>B;
	int ans = 0;
	for(int i = A; i <= B; i++){
		if( isPalindromic(intToString(i)) == true){
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3160
a, b, c = map(int, input().split())

if (a==b and b==c):
    print("1")

elif (a==b and b!=c):
    print("2")

elif (a!=b and b==c ):
    print("2")

elif (a==c and b!=c):
    print("2")

elif (a!=c and b==c):
    print("2")

else: print("3")


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

int main() {
    int n; cin >> n;
    vector<long long> a(n);
    for (int i=0; i<n; ++i) cin >> a[i];
    long long m = a[0];
    long long M = a[0];
    long long now = 1000;
    for (int i=1; i<n; ++i) {
        if (a[i] < a[i-1]) {
            long long num = now / m;
            now += num * (M - m);
            m = a[i];
            M = a[i];
        }
        else {
            m = min(m, a[i]);
            M = max(M, a[i]);
            if (i == n-1) {
                long long num = now / m;
                now += num * (M - m);
            }
        }
    }
    cout << now << endl;
}

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

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

  bool isNine = true;
  for (int i = 1; i < n.size(); i ++) {
    if (n.at(i) != '9') {
      isNine = false;
      break;
    }
  }

  int ans;
  if (isNine) {
    ans = int(n.at(0) - '0') + 9 * (n.size() - 1);
  } else {
    ans = int(n.at(0) - '0') + 9 * (n.size() - 1) - 1;
  }

  cout << ans << endl;
}


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

if a < k:
    b = a + b - k
    if b < 0:
        b = 0
    a = str(0)
    b = str(b)
    print(a, b)
else:
    a = str(a - k)
    b = str(b)
    print(a, b)

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

#define lxl long long
#define ull unsigned long long

const int MAXN=1<<22;

int n,k;
int mx=1000000000,mxl=0;
int data[MAXN][21],mem[MAXN*2];
char s[MAXN];

inline int read(void)
{
	int ans=0,f=1;
	char a=getchar();
	while(!isdigit(a))
	{
		if(a=='-')
			f=-f;
		a=getchar();
	}
	while(isdigit(a))
	{
		ans=ans*10+(a-'0');
		a=getchar();
	}
	return ans*f;
}

void update(int sta,int nums,int len)
{
    mem[sta|(1<<len)]+=nums;
    if(mem[sta|(1<<len)]>=k)
    {
    	if(mxl<len)
		{
			mxl=len;
			mx=sta;
		}
        else if(mxl==len)
			mx=min(mx,sta);
	}
}

int main(void)
{
	n=read();k=read();
	for(int i=0;i<=n;++i)
	{
		scanf("%s",s);
		for(int j=0;j<(1<<i);++j)
		{
			int temp=j;
			temp|=1<<i;
			data[temp][0]+=(s[j]=='1');
		}
	}
	for(int i=0;i<=n;++i)
	{
		for(int j=0;j<(1<<(n+1));++j)
		{
			if(!data[j][i])
				continue;
			ull s=j&((1<<i)-1),t=j>>i;
			int l=(32-__builtin_clz(t))-1;
			if(i)
				update(s,data[j][i],i);
			if(!l)
				continue;
			t^=(1<<l);
			int first1=(32-(t?__builtin_clz(t):32));
			unsigned int num=t<<(32-l);
			int first0=l?(l-((~num)?__builtin_clz(~num):l)):0;
			int newt,news;
			if(first1>0)
			{
				newt=t&((1<<first1)-1);
				newt|=(1<<first1-1);
                news=(s<<1)|1;
                data[(newt<<(i+1))|news][i+1]+=data[j][i];
			}
			if(first0>0)
			{
				newt=t&((1<<first0)-1);
				newt|=(1<<first0-1);
				news=(s<<1);
				data[(newt<<(i+1))|news][i+1]+=data[j][i];
			}
		}
	}
	if(mx==1000000000)
	{
		puts("");
		return 0;
	}
	for(int i=mxl;i>=1;i--)
        printf("%d",(mx&(1<<i-1))?1:0);
	return 0;
}

Measured memory_bytes: 185728
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>

#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;
typedef long long ll;
const long double PI = (acos(-1));
#define rep(i,n) REP(i,0,n)
#define REP(i,x,n) for(int i=x;i<n;++i)

///////////////////////////////////////////////////
// -------------------- I/O -------------------- //
///////////////////////////////////////////////////
// https://stackoverflow.com/questions/610245/where-and-why-do-i-have-to-put-the-template-and-typename-keywords
template<typename T> void outputVec(const std::vector<T>& vec, const int precision = 0) {
	if (precision > 0) std::cout << std::fixed << std::setprecision(precision);
	for (auto it = vec.begin(); it != vec.end() - 1; ++it) { std::cout << *it << " "; }
	std::cout << *(vec.end() - 1) << "\n";
}
template<typename T> void outputVal(const T& res, const int precision = 0) {
	if (precision > 0) std::cout << std::fixed << std::setprecision(precision);
	std::cout << res << "\n";
}
template<typename T> T inputVal() { T a; std::cin >> a; return a; }
template<typename T> std::vector<T> inputVec(T N) {
	std::vector<T> vec(N);
	for (auto it = vec.begin(); it != vec.end(); ++it) { std::cin >> *it; }
	return vec;
}
template<typename T> void inputVec(std::vector<T>& vec) {
	for (auto it = vec.begin(); it != vec.end(); ++it) { std::cin >> *it; }
}

///////////////////////////////////////////////////
// ------------------- utils ------------------- //
///////////////////////////////////////////////////
// change min/max
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; }

///////////////////////////////////////////////////
// ------------------- main -------------------- //
///////////////////////////////////////////////////
void Main() {

	int N = inputVal<int>();

	int res = ((N % 2) == 0) ? (N / 2) - 1 : N / 2;
	
	outputVal(res);
}

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

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<string>
#include<queue>
#include<vector>
#include<algorithm>
#include<tuple>
#include<numeric>
#include<map>
#include<cmath>
#include<utility>
#define ll long long
#define mod 1000000000+7
#define rep(i,n) for(int i=0;i<(int) (n);i++)
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;}
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  vector<int>h(n);
  rep(i,n)cin>>h[i];
  int cnt=0;
  rep(i,n){
    int a;
    a=h[i];
    if(a>=k)cnt++;
  }

  cout<<cnt;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<pair<int, int>, int> PP;
// const ll INF = 1LL << 60;
const ll MOD = 1000000007;
const int INF = 1000000000;

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

vector<vector<int>> G;
void dfs(int v, vector<int> &d) {
    for (auto nv : G[v]) {
        if (d[nv] != INF) {
            continue;
        }
        d[nv] = d[v] + 1;
        dfs(nv, d);
    }
    return;
}

int main(void) {
    int N, u, v;
    cin >> N >> u >> v;
    u--;
    v--;
    vector<int> du(N, INF), dv(N, INF);
    G.resize(N);
    for (int i = 0; i < N - 1; i++) {
        int s, t;
        cin >> s >> t;
        s--;
        t--;
        G[s].push_back(t);
        G[t].push_back(s);
    }
    du[u] = dv[v] = 0;
    dfs(u, du);
    dfs(v, dv);
    int maxd = -1;
    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (du[i] < dv[i]) {
            maxd = max(maxd, dv[i]);
            ans = maxd - 1;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 10368
#include <stdio.h>
#define MOD 1000000007

int main(void)
{
  int i, n;
  long long ans=1;
  scanf("%d", &n);

  for(i = 1; i <= n; i++)
    ans = ans * i % MOD;
  
  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;


const int MAX_N = 100010;

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int h, w; cin >> h >> w;
	vector<string>field(h); rep(i, h)cin >> field[i];
	vector<VE>l(h, VE(w)), r(h, VE(w)), d(h, VE(w)), u(h, VE(w));
	rep(i, h)rep(j, w) {
		if (field[i][j] == '#')l[i][j] = 0;
		else if (j == 0)l[i][j] = 1;
		else l[i][j] = l[i][j - 1] + 1;
	}
	rep(i, h) {
		repr(j, w - 1) {
			if (field[i][j] == '#')r[i][j] = 0;
			else if (j == w - 1)r[i][j] = 1;
			else r[i][j] = r[i][j + 1] + 1;
		}
	}
	rep(j, w) {
		rep(i, h) {
			if (field[i][j] == '#')u[i][j] = 0;
			else if (i == 0)u[i][j] = 1;
			else u[i][j] = u[i - 1][j] + 1;
		}
	}
	rep(j, w) {
		for (int i = h - 1; i >= 0; i--) {
			if (field[i][j] == '#')d[i][j] = 0;
			else if (i == h - 1)d[i][j] = 1;
			else d[i][j] = d[i + 1][j] + 1;
		}
	}
	int ans = 0;
	rep(i, h)rep(j, w) {
		if (field[i][j] == '.') {
			chmax(ans, l[i][j] + r[i][j] + d[i][j] + u[i][j] - 3);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 129920
/* ファイル名：ITP1_9_C.c	*/
/* 内容：太郎と花子がカードゲームをする。二人はそれぞれn枚のカードを持っており、nターンの勝負を行う。			*/
/*		 各ターンではそれぞれ１枚ずつカードを出す。																*/
/*		 カードにはアルファベットからなる動物の名前が書かれており、辞書順で大きいものがそのターンの勝者となる。	*/
/*		 勝者には３ポイント、引き分けの場合にはそれぞれ１ポイントが加算される。									*/
/*		 このプログラムは、太郎と花子の手持ちのカードの情報を読み込み、ゲーム終了後のそれぞれの得点を出力する。	*/

/* include	*/
#include <stdio.h>
#include <string.h>
/* 外部変数宣言	*/

/* プロトタイプ宣言	*/

/* 関数名:main	*/
/* 処理内容:太郎と花子の手持ちのカードの情報を読み込み、ゲーム終了後のそれぞれの得点を出力する。	*/
int main( void )
{
	/* 内部変数定義	*/
	/* 入力	*/
	int n;					/* ターン数		*/
	char taro_card[101];	/* 太郎のカード	*/
	char hanako_card[101];	/* 花子のカード	*/
	
	/* 処理・出力	*/
	int i;				/* ループ用変数	*/
	int taro_point;		/* 太郎の得点	*/
	int hanako_point;	/* 花子の得点	*/
	
	/* 両者の得点の初期化	*/
	taro_point = 0;
	hanako_point = 0;
	
	scanf("%d",&n);		/* ターン数の取得	*/
	
	/* ターン数だけループ	*/
	for(i = 0; i < n; i++){
		scanf("%s",taro_card);		/* 太郎のカードの取得	*/
		scanf("%s",hanako_card);	/* 花子のカードの取得	*/
		
		/* 太郎が勝った場合	*/
		if(strcmp(taro_card, hanako_card) > 0){
			taro_point += 3;	/* 太郎に3ポイント	*/
		}
		/* 花子が勝った場合	*/
		else if(strcmp(taro_card, hanako_card) < 0){
			hanako_point += 3;	/* 花子に3ポイント	*/
		}
		/* 引き分けの場合	*/
		else if(strcmp(taro_card, hanako_card) == 0){
			taro_point += 1;	/* 太郎に1ポイント	*/
			hanako_point += 1;	/* 花子に1ポイント	*/
		}
		else{
			/* 処理なし	*/
		}
	}
	
	/* 結果の出力	*/
	printf("%d %d\n", taro_point, hanako_point);
	
	return 0;
}



Measured memory_bytes: 2044
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = a; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int mod = 1e9 + 7;
const int inf = 2e18;

signed main() {
    int H, W;
    cin >> H >> W;
    vector<vector<char>> a(H + 1, vector<char>(W + 1));
    for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) {
        cin >> a[i][j];
    }
    vector<vector<int>> dp(H + 1, vector<int>(W + 1, 0));
    dp[0][0] = 1;
    for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) {
        if (a[i + 1][j] != '#') {
            dp[i + 1][j] += dp[i][j];
            dp[i + 1][j] %= mod;
        }
        if (a[i][j + 1] != '#') {
            dp[i][j + 1] += dp[i][j];
            dp[i][j + 1] %= mod;
        }
    }
    cout << dp[H - 1][W - 1] << endl;
}



Measured memory_bytes: 9088
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    lis1=[]
    lis2=[]

    for i in range(4):
        if i<2:
            lis1.append(INT())
        else:
            lis2.append(INT())

    print(min(lis1) + min(lis2))

if  __name__=='__main__':
    main()

Measured memory_bytes: 5144
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
#define wzh(x) cerr<<#x<<'='<<x<<endl;
int n;
int main() {
  ios::sync_with_stdio(false);
  cin>>n;
  int ans=0;
  for(int i=1;i<=n;i++){
    for(int j=i;j<n;j+=i){
      ans++;
    }
  }
  cout<<ans<<'\n';
  return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
string to_string(const string& s) {
	return '"' + s + '"';
}
string to_string(const bool b) {
	return (b ? "true" : "false");
}
string to_string(const char* s) {
	return to_string((string)s);
}
string to_string(const char c) {
	string s = "'";
	s += c;
	s += "'";
	return s;
}
template<class T, class U>
string to_string(const pair<T, U>& p) {
	string s = "(";
	s += to_string(p.first);
	s += ", ";
	s += to_string(p.second);
	s += ")";
	return s;
}
template<class T>
string to_string(const T& a) {
	bool first = true;
	string s = "{";
	for (const auto& x : a) {
		if(!first){
			s += ", ";
		}
		first = false;
		s += to_string(x);
	}
	s += "}";
	return s;
}
void debug_out() {cerr << '\n';}
template<class Head, class... Tail>
void debug_out(Head head, Tail... tail) {
	cerr << ' ' << to_string(head);
	debug_out(tail...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
using ll = long long;
using ld = long double;
const int mod = 998244353;
const int inf = 2e9;
const ll inf64 = 7e18l;
int mult(int x, int y) {
	return 1ll * x * y % mod;
}
int add(int x, int y) {
	x += y;
	if (x >= mod) {
		x -= mod;
	}
	return x;
}
int bin_pow(int x, int y) {
	if (y == 0) {
		return 1;
	}
	if (y % 2 == 0) {
		return bin_pow(mult(x, x), y / 2);
	}
	return mult(x, bin_pow(x, y - 1));
}
int inv(int x) {
	return bin_pow(x, mod - 2);
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(20);
	int n, m, k;
	cin >> n >> m >> k;
	int answer = 0;
	vector<int> fact(n + 1), inv_fact(n + 1);
	fact[0] = inv_fact[0] = 1;
	for (int i = 1; i <= n; ++i) {
		fact[i] = mult(fact[i - 1], i);
		inv_fact[i] = inv(fact[i]);
	}
	auto C = [&](int x, int y) {
		return mult(mult(fact[x], inv_fact[y]), inv_fact[x - y]);
	};
	for (int one = 0; one <= k; ++one) {
		int cnt = mult(m, bin_pow(m - 1, n - one - 1));
		cnt = mult(cnt, C(n - 1, one));
		answer = add(answer, cnt);
	}
	cout << answer << '\n';
 	return 0;
}


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

using namespace std;

#define PI 3.14159265358979323846264338327950L

int main(void) {

	long long X, K, D;
    long long last=0,last2=0;

	cin >> X >> K >> D;

	long long count = 0;

    X=llabs(X);


    if(X/D >= K ){
        X=X-K*D;
        cout<<X<<endl;
        return 0;
    }

    long long rest = K-X/D;
    X=X-D*(X/D);
    if(rest % 2 == 1){
        X=X-D;
    }
  


	cout << llabs(X) << endl;


	return 0;
}



Measured memory_bytes: 3628
X,Y = map(int,input().split())


mod = 10 ** 9 + 7
MAX = 10**6 + 1
fac = [0] * MAX
finv = [0] * MAX
inv = [0] * MAX

def cominit():
    fac[0] = 1
    fac[1] = 1
    finv[0] = 1
    finv[1] = 1
    inv[1] = 1
    for i in range(2,MAX):
        fac[i] = fac[i-1] * i % mod
        inv[i] = mod - inv[mod%i] * (mod//i) % mod
        finv[i] = finv[i-1] * inv[i] % mod

if (2*Y-X)%3 == 0 and (2*X-Y)%3 == 0:
    n1 = (2*Y-X)//3
    n2 = (2*X-Y)//3
    if n1 < 0 or n2 < 0:
        print(0)
    else:
        cominit()
        ans = fac[(n1+n2)]*finv[n1]*finv[n2]
        ans %= mod
        print(ans)
        
else:
    print(0)

Measured memory_bytes: 121768
n, k = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)

s = a.inject(&:+)
divs = []
i = 1
while i * i <= s
  if s % i == 0
    divs << i
    divs << s / i if s / i != i
  end
  i += 1
end
ans = []
# p divs
divs.each do |d|
  r = a.map { |x| x % d }.sort
  if r.all? { |x| x == 0 }
    ans << d
  end
  sum = 0
  negs = [0].concat(r.map { |x| sum += x })
  sum = 0
  1.upto(n - 1) do |j|
    negop = negs[j] - negs[0]
    posop = ((n - j) * d - (negs[n] - negs[j]))
    if (negop == posop && negop <= k)
      ans << d
      break
    end
  end
end
p ans.max


Measured memory_bytes: 11256
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main(){
	int n,a,b;
	cin >> n >> a >> b;
	if(n <= a) cout << 1 << endl;
	else if(a == b) cout << -1 << endl;
	else{
		int ans = (n - b - 1) / (a - b);
		if(ans < 0) cout << -1 << endl;
		else cout << ans * 2 + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
input = gets
input_f = input.split.map(&:to_i)

a = input_f[0]
b = input_f[1]
c = input_f[-1]
if a + b + 1 > c
  puts(b+c).to_s
elsif c < a
  puts(b+c).to_s
else
  puts(b*2 + a + 1)
end


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pull = pair<ull, ll>;
using pis = pair<int, string>;
#define all(x) (x).begin(), (x).end()
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 998244353ll

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  //cout << fixed << setprecision(15)
  ll n, x, m;
  cin >> n >> x >> m;
  vector<ll> a;
  vector<bool> isuse(m);
  a.emplace_back(x);
  ll last = x, nx;
  isuse[x] == 0;
  while(1) {
    nx = (last * last) % m;
    if (isuse[nx]) break;
    isuse[nx] = true;
    a.emplace_back(nx);
    last = nx;
  }

  ll ans = 0, now = x, cnt = 0;
  while(nx != now) {
    cnt++;
    if (cnt > n) break;
    ans += now;
    now = (now * now) % m;
  }
  n -= cnt;
  ll loop = 0;
  ll len = 0;
  for (ll as: a) {//loop += as;
    if (as == nx) len++;
    if (len == 0) continue;
    loop += as;
    len++;
    if (as == nx) len--;
  }
  ans += loop * (n / len);

  n %= len;
  now = nx;
  for (int i = 0; i < n; i++) {
    ans += now;
    now = (now * now) % m;
  }
  cout << ans << endl;
}


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

int main() {
  int n;
  int a[210];
  cin >> n;
  for(int i = 0; i < n; i++) cin >> a[i];
  int cnt = 0;
  while(true) {
    bool odd_flag = false;
    for(int i = 0; i < n; i++) {
      if(a[i] % 2 == 1) {
        odd_flag = true;
        break;
      }
      a[i] /= 2;
    }
    if(odd_flag) break;
    cnt++;
  }
  cout << cnt << endl;
  return 0;
}

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

int main(){
    int b1, b2, b3;
    cin >> b1 >> b2 >> b3;
    if(b1 && !b2 && !b3) cout << "Close" << endl;
    if(!b1 && b2 && !b3) cout << "Close" << endl;
    if(b1 && b2 && !b3) cout << "Open" << endl;
    if(!b1 && !b2 && b3) cout << "Open" << endl;
    if(!b1 && !b2 && !b3) cout << "Close" << endl;
    return 0;
}

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

int main() {
  for(int N, M; cin >> N >> M && (N|M); ) {
    vector<int> L(N);
    for(int i = 0; i < N; ++i) {
      cin >> L[i];
    }
    vector<int> ans;
    for(int b = 0; b < (1<<M); ++b) {
      if(__builtin_popcount(b) != L[0]) continue;
      try {
        vector<int> v;
        for(int j = 0; j < M; ++j) v.push_back(b >> j & 1);
        int p = b;
        for(int i = 1; i < N; ++i) {
          int now = L[i-1] - (p & 1);
          int k = 0;
          if(now == L[i] || now + 1 == L[i]) {
            k = L[i] - now;
          } else {
            throw 0;
          }
          v.push_back(k);
          p = (p | (k << M)) >> 1;
        }
        ans = v;
        break;
      } catch(...) {}
    }
    if(ans.size()) {
      for(int i = 0; i < ans.size(); ++i)
        cout << ans[i];
      cout << endl;
    } else {
      cout << "Goofy" << endl;
    }
  }
  return 0;
}

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

using namespace std;

typedef long long ll;

int main(){
 ll N; cin >> N;
  vector<ll> A(N); bool flag = true;
  for(int i = 0; i < N; i++){ cin >> A[i];
                             if( A[i] % 2 ){ flag = false;}}
  
  if( flag){ cout <<"second" << endl;}
  else{ cout << "first" << endl;}
return 0;}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

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

const int INF = 1e9;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

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

int a, b;

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

  cin >> a >> b;
  int all = (a * b) - (a + b - 1);

  cout << all << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

int getGcd(int x, int y){
	int r;
	while( (r=x%y) != 0 ){
		x=y;
		y=r;
	}
	return y;
}

int main() {
	long long a,b, gcd, lcm;
	while(cin>>a>>b){
		if(a==0 || b==0){ break; }
		gcd = getGcd(a,b);
		lcm = (a*b) / gcd;
		cout<<gcd<<" "<<lcm<<endl;
	}
	return 0;
}

Measured memory_bytes: 1156