akhauriyash/Code-Regression huggingface dataset:
/*
ID: rchalam1
LANG: C++14
TASK:
*/
// For train.usaco.org, fill the template above.

// Competitive Coding Template

// GCC OPTIMIAZTION FLAGS
#ifdef ONLINE_JUDGE
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#endif

#include <bits/stdc++.h>

/*
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
*/
// All Includes for Competitive Coding Template

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

using vi = std::vector<int>;
using vll = std::vector<long long>;
using vull = std::vector<unsigned long long>;

#define FOR(i, a, b) for (auto i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (auto i = (a); i >= (b); --i)
#define R0F(i, a) ROF(i, a, 0)
#define ITR(a, x) for (auto& a: x)

#define FSRT(set) sort((set).begin(),(set).end())
#define RSRT(set) sort((set).rbegin(),(set).rend())
#define CSRT(set, function) sort((set).begin(),(set).end(), (function))
#define TRS(set) sort((set).begin(),(set).end(), greater<>())
#define REV(set) reverse((set).begin(),(set).end());

#define ALL(set) (set).begin(), (set).end()

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second

// For stdio, call setIO() or setIO("").
void setIO(std::ifstream &readFile, std::ofstream &writeFile, const std::string &name = "", bool stdIO = false)
{
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(nullptr);
	std::cout.tie(nullptr);
	if(!name.empty() && !stdIO)
	{
		readFile.open(name + ".in");
		if(readFile.fail()) return;
		writeFile.open(name + ".out");
		std::cin.rdbuf(readFile.rdbuf());
		std::cout.rdbuf(writeFile.rdbuf());
	}
}

// To time program, create object Timer  to start timing, and call Timer.elapsed().
#include <chrono>

class Timer
{
	std::chrono::time_point<std::chrono::high_resolution_clock> m_beg;
public:
	Timer() : m_beg(std::chrono::high_resolution_clock::now())
	{}

	void reset()
	{ m_beg = std::chrono::high_resolution_clock::now(); }

	[[nodiscard]] long double elapsed() const
	{
		return std::chrono::duration_cast<std::chrono::duration<long double, std::ratio<1> >>(
				std::chrono::high_resolution_clock::now() - m_beg).count();
	}
};

// Defines datatype
using dt = int;
// Defines MAXN value
constexpr dt MAXN = 1e5 + 1;
// Defines Modulus
constexpr dt MOD = 1e9 + 7;
// Defines Floating Point Correction
constexpr long double EPS = 1e-9;

//*****
//START CODE BELOW
//*****

int main(int argc, char *argv[])
{
	static std::ifstream readFile;
	static std::ofstream writeFile;
	setIO(readFile, writeFile);
	vector<int> prices(5);
	for(auto &price : prices) cin >> price;
	sort(prices.begin(), prices.end(), [](const int &i, const int &j)
	{ return (i % 10 == 0 ? 10 : i % 10) > (j % 10 == 0 ? 10 : j % 10); });
	int currentTime = 0;
	for(auto &price : prices)
	{
		if(currentTime % 10) currentTime += 10 - (currentTime % 10);
		currentTime += price;
	}
	cout << currentTime;
}

Measured memory_bytes: 3652
n = int(input())

a = list(map(int,input().split()))

dic = {}

for i in a:
    if i in dic:
        dic[i] = dic[i] + 1
    else:
        dic[i] = 1

s = 0
for i in dic.keys():
    s += (dic[i] * (dic[i] - 1)) // 2

for i in a:
    answer = s - (((dic[i] - 1) * (dic[i] - (dic[i]-2))) // 2)
    print(answer)

Measured memory_bytes: 32196
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7/*998244353*/;
const ll INF = 1LL << 60;
ll mod_pow(ll, ll, ll); ll mod_fact(ll, ll); ll mod_inv(ll, ll); ll gcd(ll, ll); ll lcm(ll, ll);
//
int main(){
    string s;
    cin >> s;
    int a, z;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == 'A') {a = i; break;}
    }
    for(int i = s.size() - 1; i >= 0; i--){
        if(s[i] == 'Z') {z = i; break;}
    }
    cout << z - a + 1;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll mod=1e9+7;
int dy[]={1,-1,0,0};
int dx[]={0,0,1,-1};

int main(){
    int n,m,d;
    cin>>n>>m>>d;
    double tonari;
    if(d==0){
        tonari=1.0/n;
    }else{
        tonari=2.0*(n-d)/n/n;
    }
    double ans=tonari*(m-1);
    printf("%.10f\n",ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e18)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))


int main(){
	int N,ans=0,b;
	cin >> N;
	vector<int> A(N+1),C(N+1);
	FOR(i,1,N+1){
		cin >> A[i];
	}
	FOR(i,0,N){
		cin >> b;
		ans += b;
	}
	FOR(i,1,N){
		cin >> C[i];
	}
	FOR(i,2,N+1){
		if(A[i]==(A[i-1]+1)){
			ans += C[A[i-1]];
		}
	}
	cout << ans << endl;
}


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

int mx=0;
int tab[5][110];
bool vis[5][110];
int n;

void dfs(int x,int y,int now)
{
	if (x>2) return;
	if (y>n) return;
	vis[x][y]=1;
	now+=tab[x][y];
//	cout<<x<<" "<<y<<" "<<now<<"\n";
	if (x==2 && y==n)
	{
//		cout<<now<<" now\n";
		mx=max(now,mx);
		return;
	}
	dfs(x,y+1,now);
	dfs(x+1,y,now);
}

int main()
{
//	freopen("input.txt","r",stdin);
	cin>>n;
	for (int i=1;i<=2;i++)
	 for (int j=1;j<=n;j++)
	  cin>>tab[i][j];
	dfs(1,1,0);
	cout<<mx<<"\n";
}

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

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
#define int long long
#define f(i,a,b) for(int i=(a);i<(b);i++)
#define MOD 1000000007
using pii=std::pair<int,int>;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); <-- PUT IN main()/solve()!

using namespace std;

int n,k,q,a,freq[100005];
class CAttackSurvival {
public:
	void solve(std::istream& in, std::ostream& out) {
		in >> n >> k >> q;
		f(i,0,q)
		{
			in >> a;
			a--;
			freq[a]++;
		}
		int cnt=0;
		f(i,0,n)
		{
			if(k-q+freq[i]>0)
				out << "Yes\n";
			else
				out << "No\n";
		}

	}
};


int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	CAttackSurvival solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

void MAIN() {
    int n, a, b;
    scanf("%d%d%d", &n, &a, &b);
    int ans = 0;
    for(int i = 0; i < n; ++ i) {
        int val;
        scanf("%d", &val);
        ans += val < a || val >= b;
    }
    printf("%d\n", ans);
}

int main() {
    MAIN();
    return 0;
}


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

for num in range(k):
    if a + num <= b:
        ans_set.add(a + num)

for num in range(k):
    num = k - num - 1
    if b - num >= a:
        ans_set.add(b - num)
for num in sorted(ans_set):
    print(num)


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

int main(void)
{
    string s;
    cin >> s;

    if (s == "SAT") {
        cout << 1 << endl;
    } else if (s == "SUN") {
        cout << 7 << endl;

    } else if (s == "MON") {
        cout << 6 << endl;
    } else if (s == "TUE") {
        cout << 5 << endl;
    } else if (s == "WED") {
        cout << 4 << endl;
    } else if (s == "THU") {
        cout << 3 << endl;
    } else if (s == "FRI") {
        cout << 2 << endl;
    }
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 500005
using namespace std;
int n,a[N],b[N];
inline bool check(int x){
	for (int i=1;i<2*n;i++) b[i]=(a[i]>=x);
	if (b[n]==b[n+1]||b[n-1]==b[n]) return b[n];
	for (int i=n,j=n;i>=1&&j<2*n;i--,j++){
		if (b[i]==b[i+1]) return b[i];
		if (b[j]==b[j-1]) return b[j];
	}
	return b[n]^(n&1)^1;
}
int main(){
	scanf("%d",&n);
	for (int i=1;i<2*n;i++) scanf("%d",&a[i]);
	int l=1;int r=2*n;
	while (l+1<r){
		int mid=(l+r)>>1;
		if (check(mid)) l=mid;
		else r=mid;
	}
	if (check(r)) printf("%d\n",r);else printf("%d\n",l);
	return 0;
}

Measured memory_bytes: 1920
#![allow(unused_imports)]
use std::cmp;
use std::collections::*;

pub struct Scanner {
    line: Vec<String>,
    idx: usize,
}

#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner {
        return Scanner {
            line: vec![],
            idx: 0,
        };
    }
    fn next<T: std::str::FromStr>(&mut self) -> T {
        if self.idx == self.line.len() {
            let mut buffer = String::new();
            std::io::stdin().read_line(&mut buffer).ok();
            let a: Vec<&str> = buffer.trim().split(' ').collect();
            self.line = a.iter().map(|&s| String::from(s)).collect();
            self.idx = 0;
        }
        let ret: T = self.line[self.idx].parse::<T>().ok().expect("Parse error.");
        self.idx += 1;
        ret
    }
    fn next_string(&mut self) -> Vec<char> {
        let s: String = self.next();
        return s.chars().collect::<Vec<char>>();
    }
    fn next_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        let mut v: Vec<T> = Vec::with_capacity(n);
        for _i in 0..n {
            v.push(self.next());
        }
        v
    }
}

fn main() {
    let mut scan = Scanner::new();
    let x: i64 = scan.next();

    for a in 0..1000 {
        let a: i64 = a;
        let mut r = a * a * a * a * a - x;
        if r < 0 {
            r = -r;
        }
        let mut lb: i64 = 0;
        let mut ub: i64 = 1000;
        while ub - lb > 1 {
            let m = (lb + ub) / 2;
            if m * m * m * m * m <= r {
                lb = m;
            } else {
                ub = m;
            }
        }
        if lb * lb * lb * lb * lb == r {
            let b = lb;
            if a * a * a * a * a - b * b * b * b * b == x {
                println!("{} {}", a, b);
                break;
            }
            if a * a * a * a * a + b * b * b * b * b == x {
                println!("{} {}", a, -b);
                break;
            }
        }
    }
}


Measured memory_bytes: 2040
def main():
    target_number = int(input())
    answer = ""
    if target_number == 0:
        answer = "0"
    else:
        while abs(target_number) > 0:
            if target_number % 2:
                answer = "1" + answer
                target_number = (target_number - 1) // -2
            else:
                answer = "0" + answer
                target_number = target_number // -2
    print(answer)


if __name__ == '__main__':
    main()

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

#define LEN 10

int main() {

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

    sort(hills, hills + LEN);

    cout << hills[9] << endl;
    cout << hills[8] << endl;
    cout << hills[7] << endl;

    return 0;
}

Measured memory_bytes: 1180
package main

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

func main() {
	var reader = bufio.NewReader(os.Stdin)
	var s string
	if _, err := fmt.Fscan(reader, &s); err != nil {
		panic(err)
	}
	m := make(map[rune]bool)
	for _, c := range s {
		if m[c] {
			fmt.Println("no")
			return
		}
		m[c] = true
	}
	fmt.Println("yes")
}


Measured memory_bytes: 1848
#include <bits/stdc++.h>
using namespace std;
//useful 
#define rep(i,n) for(int i = 0; i < (n); i++)
int long long gcd(int long long a, int long long b){
    return b?gcd(b,a%b):a;
} //最大公約数
int long long lcm(int long long a, int long long b){
    return a/gcd(a,b)*b;
} //最小公倍数
int long long GetDigit(int long long num){
    int long long digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
} //桁数
int long long GetDigitN(int long long num, int long long N){
    int long long digit=0;
    while(num!=0){
        num /= N;
        digit++;
    }
    return digit;
} //十進数でnumの際のN進数における桁数
int long long GetDigitSum(int long long n){
    if(n < 10){
       return n;
    }
    return GetDigitSum(n/10) + n%10;
} //十進数の桁和
unsigned int long long unsignedGetDigitSum(unsigned int long long n){
    if(n < 10){
       return n;
    }
    return unsignedGetDigitSum(n/10) + n%10;
} //十進数の桁和unsigned
int long long divisorcount(int long long n){
	int long long ans = 1;
	vector<int> x(n + 1);
	int long long num = n; // 素因数分解する変数num 
	for (int long long i = 2; i <= n; i++) {
		while (num%i == 0) { // 素数で割り切れなくなるまで割っていく
			x.at(i)++; //割った個数を配列に足す
			num /= i;
		}
	}
	for (int i = 2; i <= n; i++){
		ans *= x.at(i) + 1; //それぞれを+1して掛けていく
	}
    return ans;
} //約数カウント


int main(){
    int N;
    cin >> N;
    for(int i = 0; i < N; i++){
        cout << "ACL";
    }
    return 0;
}

Measured memory_bytes: 3596
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int n, m;
	vector<int> a;
	cin >> n >> m;
	while((n*n)+(m*m)!=0){
	 int bi = ((n + 1)*(n + 2)) / 2;
	vector<int> p(n);
	for (int i = 0; i < n; i++) {
		cin >> p[i];
	}
	vector<int> g(bi);
	int ch = n + 1;
	for (int i = 0; i < n; i++) {
		g[i] = p[i];
	}
	g[n] = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= i; j++) {
			g[ch] = p[i] + p[j];
			ch++;
		}
	}
	sort(g.begin(), g.end());
	int ans = 0;
	int qans;
	for (int i = 0; i < bi; i++) {
		int lo = 0;
		int up = bi - 1;
		int tan = m - g[i];
		if (g[up] <= tan) {
			qans = g[up];
		}
		else if (tan < g[lo]) {
			qans = -2 * 1000 * 1000 * 1000 - 1;
		}
		else {
			while (up - lo > 1) {
				int mi = (up + lo) / 2;
				if (tan < g[mi]) {
					up = mi;
				}
				else {
					lo = mi;
				}
			}
			qans = g[lo];
		}
		ans = max(ans, g[i] + qans);
	}
	cout << ans << endl;   
	cin >> n>>m;
	}
}



Measured memory_bytes: 5028
import sys
def input():
    return sys.stdin.readline()[:-1]
import time
h,w=map(int,input().split())
a=[list(map(int,input().split())) for i in range(h)]
i=0
j=0
ni=0
nj=1
pro=0
if len(a[0])==1:
    ni=1
    nj=0
tmp=0
cnt=0
li=[]
while(ni<h):
    # print(str(i+1)+" "+str(j+1))
    if (a[i][j]+tmp)%2==1:
        li.append(" ".join(map(str, [i+1,j+1,ni+1,nj+1])))
        cnt+=1
        tmp=1
    else:
        tmp=0
    i,j=ni,nj
    if (nj+1==w and pro==0) or (nj+1==1 and pro==1):
        ni+=1
        pro^=1
    else:
        if pro==0:
            nj+=1
        else:
            nj-=1
    # print(tmp)
    # time.sleep(1)
print(cnt)
for i in li:
    print(i)

Measured memory_bytes: 66648
#include <stdio.h>
#include <math.h>
int main(void){
	int i,j,m,n,h[1000],k;
	while(scanf("%d %d",&n,&m)!=EOF){
		if(n==0 && m==0)break;
		for(i=0;i<n;i++){h[i]=1;}
		i=0;j=1;k=n;
		while(1){
			if(j==m){h[i]=0;j=0;n--;}
			i=(i+1)%k;
			if(h[i]==1){
				j++;
				if(n==1)break;
			}
		}
		printf("%d\n",i+1);
	}
	return 0;
}

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

// 基本テンプレート
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// 型
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// 定数
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion

#define int long long

signed main()
{
    int n;
    cin >> n;
    int ans[26];
    fill(ans, ans+26, 1e9);
    while(n--) {
        int a[26]{};
        string s;
        cin >> s;
        for(auto&& c:s) a[c-'a']++;
        for(int i=0; i<26; ++i) ans[i] = min(ans[i],a[i]);
    }
    for(int i=0; i<26; ++i) cout << string(ans[i], char('a'+i));
    cout << endl;

    return 0;
}



Measured memory_bytes: 256
n=int(input())
dic={}
sl=[]
for i in range(n):
  s,t=map(str,input().split())
  dic[s]=int(t)
  sl.append(s)
x=input()

ans=0
flag=False
for s in sl:
  if flag:
    ans+=dic[s]
  if s==x:
    flag=True
print(ans)

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

int dp[310][310][310];

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

  string S;
  cin >> S;
  int K;
  cin >> K;
  int N = SZ(S);

  REP(i,N) dp[i][i+1][0] = 1;
  for(int len=2;len<=N;++len){
	for(int l=0,r=len;r<=N;++l,++r){
	  REP(k,K+1){
		if(S[l] == S[r-1])
		  maxi(dp[l][r][k], dp[l+1][r-1][k] + 2);
		maxi(dp[l][r][k], max(dp[l+1][r][k], dp[l][r-1][k]));
		maxi(dp[l][r][k+1], dp[l+1][r-1][k] + 2);
	  }
	}
  }

  int ans = 0;
  REP(i,K+1) maxi(ans, dp[0][N][i]);
  cout << ans << endl;

  return 0;
}


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

const int km = 1e5;
int k, c = 0;
vector<long long> lun { 1, 2, 3, 4, 5, 6, 7, 8, 9 };

int main() {
	while (lun.size() < km) {
		long long n = lun[c];
		int t = n % 10;
		if (t > 0)
			lun.push_back(n * 10 + t - 1);
		lun.push_back(n * 10 + t);
		if (t < 9)
			lun.push_back(n * 10 + t + 1);
		c++;
	}

	cin >> k;
	cout << lun[k - 1] << endl;
}



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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int n, a, b;
LL v[50];
LL c[51][51];

void init() {
    forn(i, 51) c[0][i] = 0;
    c[0][0] = 1;
    for (int i = 1; i < 51; ++i) {
        c[i][0] = 1;
        for (int j = 1; j < 51; ++j) {
            c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
        }
    }
}

int main() {
    init();
    cin >> n >> a >> b;
    forn(i, n) cin >> v[i];
    sort(v, v + n, greater<LL>());
    double res = 0;
    forn(i, a) res += v[i];
    res /= a;
    printf("%.18f\n", res);
    int cnt = 0;
    for (int i = a; i < n; ++i) {
        if (v[i] == v[a - 1]) {
            ++cnt;
        }
    }
    int eq = 0;
    forn(i, a) if (v[i] == v[a - 1]) {
        ++eq;
    }
    int bad = a - eq;

    LL ans = 0;
    for (int i = a; i <= (bad == 0 ? b : a); ++i) {
        ans += c[eq + cnt][i - bad];
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

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

	vector<int> v( n );
	for(auto& x : v) {
		cin >> x;
	}

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

	stack<int> s;
	for(auto i = 0U; i < v.size() - 1; ++i) {
		if(v[i] == v[i + 1]) {
			s.push(v[i]);
			int cnt{ 0 };
			for(; v[i + cnt] == v[i + cnt + 1] && i + cnt < v.size() - 1; ++cnt);
			if(cnt >= 4) {
				s.push(v[i]);
			}
			i += cnt;
		}
	}

	long long result{ 0 };
	if(s.size() >= 2) {
		result = s.top();
		s.pop();
		result *= s.top();
	}
	
	cout << result << endl;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
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;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll N,A;
    cin >>N>>A;
    
    cout << N*N-A << endl;


    return 0;
    

}

Measured memory_bytes: 3620
<?php
$A=[];
for($i=97;$i<123;$i++) $A[$i]=0;

while(1){
	$S=trim(fgets(STDIN));
	if(!$S){break;}

	foreach(str_split($S) as $c){
		$n=ord($c);
		if(64<$n && $n<91) ++$A[$n+32];
		elseif(96<$n && $n<123) ++$A[$n];
	}
}

for($i=97;$i<123;$i++) echo chr($i),' : ',$A[$i],PHP_EOL;

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  vector<int> b = a;
  sort(b.begin(), b.end(), greater<int>());
  for (int i = 0; i < n; i++) {
    if (a[i] == b[0]) {
      cout << b[1] << endl;
    } else {
      cout << b[0] << endl;
    }
  }
}

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

using namespace std;

typedef long long int ll;

ll wt[105] , Val[105];

int main()
{   
    int N ;
    ll W;
    cin >> N >> W;

    ll sum =0;
    for(int i=1; i<=N; i++)
    {
        cin >> wt[i] >> Val[i];
        sum += Val[i];
    } 

    ll dp[sum+1];

        for(int j=0; j<=N;j++)
    {
    for(ll i =0; i<=sum; i++)        {
            if(i==0) dp[i] = 0;
            else
            {
                dp[i] = 1000000000000LL;
                
            }
        }
    }
    
        for(int j=1; j<=N; j++)
        {
            for(ll s=sum; s>=0 ; s--)
            {
            if(s >=Val[j])
                dp[s] = min(dp[s], dp[s-Val[j]]+wt[j]);
            // cout<< dp[s][j]<< endl;
        }
        
    }
    // ll result;
    for(ll s=sum; s>0; s--){
        if(dp[s] <=W){
            cout << s <<endl;
            break;
        }
    }
    // cout << INT64_MAX;
    return 0;
}

Measured memory_bytes: 1024
def main():
    S = input()
    for num, i in enumerate(S, 1):
        if num % 2 == 0:
            if i != "L" and i != "U" and i != "D":
                print("No")
                exit(0)

        else:
            if i != "R" and i != "U" and i != "D":
                print("No")
                exit(0)

    print("Yes")


if __name__ == "__main__":
    main()


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

using namespace std;

#define fio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define double long double
#define endl '\n'

signed main() {
    fio;
    int n; cin >> n;
    map<int , int> freq;
    int sum = 0;
    for(int i = 0; i < n; i++) {
        int in; cin >> in;
        freq[in]++;
        sum += in;
    }
    
    int q; cin >> q;
    while(q--) {
        int b , c; cin >> b >> c;
        sum -= b * freq[b];
        sum += c * freq[b];
        freq[c] += freq[b];
        freq.erase(b);
        cout << sum << endl;
    }
    

    return 0;
}




Measured memory_bytes: 7576
#include <iostream>
#include <vector>


using namespace std;


int H, W, K;

long long solve() {
  
    --K;
    int dp[110][10]={0};
  
    dp[0][0] = 1;
  
    for (int i = 0; i < H; ++i) {
      
        for (int j = 0; j < W; ++j) {
           
            for (int bit = 0; bit < 1<<(W-1); ++bit) {
                bool ok = true;
              
                for (int k = 0; k < W-2; ++k) {
                    if ((bit & (1<<k)) && (bit & (1<<(k+1)))) ok = false;
                }
                if (!ok) continue;
                int nj = j;
                if (bit & (1<<j)) nj = j+1;
                else if (j > 0 && (bit & (1<<(j-1)))) nj = j-1;
                dp[i+1][nj] += dp[i][j];
              
                dp[i+1][nj] %= 1000000007;
            }   
        }
    }
  
     return dp[H][K]%1000000007;
}

int main() {
  cin >> H >> W >> K;
  
   cout << solve() << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int p=0;//A to B
    int q=0;// B to C
    int r=0;//c to a
    cin>>p>>q>>r;
    int p1=p+q,p2=p+r,p3=q+r,p4=r+p,p5=q+p;
    if(p1<=p2&&p1<=p3&&p1<=p4&&p1<=p5)
    {
        cout<<p1;
    }
    else if(p2<=p1&&p2<=p3&&p2<=p4&&p2<=p5)
    {
        cout<<p2;
    }
    else if(p3<=p1&&p3<=p2&&p3<=p4&&p3<=p5)
    {
        cout<<p3;
    }
    else if(p4<=p1&&p4<=p2&&p4<=p3&&p4<=p5)
    {
        cout<<p4;
    }
    else if(p5<=p1&&p5<=p3&&p5<=p4&&p5<=p2)
    {
        cout<<p5;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String S = sc.next();
        char []s = new char[S.length()];
        for(int i=0; i<S.length(); i++) {
        	s[i] = S.charAt(i);
        }

        char []alphabet = new char[26];
        char c = 'A';
        for (int i = 0; i < 26; i++){
            alphabet[i] = c++;
        }

        for(int i=0; i<S.length(); i++) {
        	for(int j=0; j<26; j++) {
        		if(s[i] == alphabet[j]) {
        			if(j+N<26) {
        				s[i] = alphabet[j+N];
        				break;
        			}else {
        				s[i] = alphabet[j+N-26];
        				break;
        			}
        		}
        	}

        }

        for(int i=0; i<S.length(); i++) {
        	System.out.print(s[i]);
        }



    }
}






Measured memory_bytes: 26324
#line 2 "header.hpp"

//%snippet.set('header')%
//%snippet.fold()%
#ifndef HEADER_H
#define HEADER_H

// template version 2.0
using namespace std;
#include <bits/stdc++.h>

// varibable settings
const long long INF = 1e18;
template <class T> constexpr T inf = numeric_limits<T>::max() / 2.1;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define _rrep(i, n) rrepi(i, 0, n)
#define rrepi(i, a, b) for (ll i = (ll)((b)-1); i >= (ll)(a); --i)
#define r_rep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(i, a) for (auto &&i : a)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(...) make_tuple(__VA_ARGS__)
#define ub upper_bound
#define lb lower_bound
#define lpos(A, x) (lower_bound(all(A), x) - A.begin())
#define upos(A, x) (upper_bound(all(A), x) - A.begin())
template <class T> inline void chmax(T &a, const T &b) { if ((a) < (b)) (a) = (b); }
template <class T> inline void chmin(T &a, const T &b) { if ((a) > (b)) (a) = (b); }
template <typename X, typename T> auto make_table(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto make_table(X x, Y y, Z z, Zs... zs) { auto cont = make_table(y, z, zs...); return vector<decltype(cont)>(x, cont); }

#define cdiv(a, b) (((a) + (b)-1) / (b))
#define is_in(x, a, b) ((a) <= (x) && (x) < (b))
#define uni(x) sort(all(x)); x.erase(unique(all(x)), x.end())
#define slice(l, r) substr(l, r - l)

typedef long long ll;
typedef long double ld;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;

template <typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;
void check_input() { assert(cin.eof() == 0); int tmp; cin >> tmp; assert(cin.eof() == 1); }

#if defined(PCM) || defined(LOCAL)
#else
#define dump(...) ;
#define dump_1d(...) ;
#define dump_2d(...) ;
#define cerrendl ;
#endif

#endif /* HEADER_H */
//%snippet.end()%
#line 2 "solve.cpp"
template<class T=ll> using vec = vector<T>;
struct Fast { Fast() { std::cin.tie(0); ios::sync_with_stdio(false); } } fast;


int solve() {
    ll x;cin>>x;
    cout << (x >= 30 ? "Yes" : "No") << endl;
    return 0; 
}


int main(){/*{{{*/
    solve();
    check_input();
    return 0;
}/*}}}*/


Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <algorithm>
#include <iterator>
#include <functional>
#include <vector>
#include <math.h>
#include <typeinfo>
#include <numeric>
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <queue>

using namespace std;


int main()
{
	string S, T;

	cin >> S >> T;

	int cnt = 0;
	for (int i = 0; i < 3; i++)
	{
		if (S[i] == T[i])
		{
			cnt++;
		}
	}

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 256
n=gets.to_i
arr=Array.new()
n.times do
  com,num=gets.split
  case com
  when "insert"
    arr.unshift(num.to_i) 
  when "delete"
    index=arr.find_index{ |i| i==num.to_i}
    arr.delete_at(index) unless index.nil?
  when "deleteFirst"
    arr.shift
  when "deleteLast"
    arr.pop
  end
end
puts arr.join(' ')

Measured memory_bytes: 23204
#include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
// #include <ext/rope>
// using namespace __gnu_cxx;
typedef long long int ll;
typedef long double ld;
#define FAST                 \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mxe(v) *max_element(v.begin(), v.end())
#define mne(v) *min_element(v.begin(), v.end())
#define ve vector
#define lb lower_bound
#define ub upper_bound
#define bb break
#define cc continue
#define rem 998244353
#define PI 3.141592653589793238462643383279502
ll power(ll x, ll y, ll p)
{
    ll res = 1; // Initialize result
    x = x % p;  // Update x if it is more than or
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1; // y = y/2
        x = (x * x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p)
{
    return power(n, p - 2, p);
}
struct point
{
    ll x, y;
};
int main()
{
    FAST
    // freopen("input1.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    /*ll tests;
    cin>>tests;
    rep (gg,0,tests)
    {}*/
    ll n,k;
    cin>>n>>k;
    ve <pair<ll,ll>> seg(k);
    for (int i=0;i<k;i++)
    {
        cin>>seg[i].first>>seg[i].second;
    }
    vector <int> dp2(n+2,0);
    ll val=1;
    rep (i,1,n)
    {
        val+=dp2[i];
        val%=rem;
        // cout<<"val.. "<<val<<"\n";
        // cout<<"i.. "<<i<<"\n";
        for (auto x: seg)
        {
            ll lhs=x.first,rhs=x.second;
            lhs+=i;
            rhs+=i;
            rhs++;
            lhs=min(lhs,n+1);
            rhs=min(rhs,n+1);
            // cout<<"lhs.. "<<lhs<<" rhs"<<rhs<<"\n";
            dp2[lhs]+=val;
            dp2[lhs]%=rem;
            dp2[rhs]-=val;
            if (dp2[rhs]<0)
            {
                dp2[rhs]+=rem;
            }
            dp2[rhs]%=rem;
        }
        if (i==1)
        {
            val=0;
        }
        // rep (j,1,n+2)
        // {
        //     cout<<dp2[j]<<" ";
        // }
        // cout<<"\n";
    }
    ll ans=0;
    rep (i,2,n+1)
    {
        ans+=dp2[i];
        if (ans<0)
        {
            ans+=rem;
        }
        ans%=rem;
    }
    cout<<ans<<"\n";
}


Measured memory_bytes: 3992
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

constexpr ll infl = 10000000000000007LL;
constexpr int inf = 1000000007;

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    cout << ((b - a) % 2 == 0 ? "Alice" : "Borys") << endl;
    return 0;
}

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

int main(){
ll H, W;
cin >> H >> W;
ll sum = 0;
if(H != 1 && W != 1){
  if (W%2 == 0)
  {
    sum = (H/2+(H+1)/2)*W/2;
  }
  else
  {
    sum = (H/2+(H+1)/2)*(W-1)/2+(H+1)/2;
  }
  cout << sum << endl;
}
else
{
  cout << 1 << endl;
}

}

Measured memory_bytes: 256
#include <stdio.h>
 
int main()
{
    char s[11];
    scanf("%s",&s);
    for(int i=0;i<s[i]!='\0';i++){
        if(s[i]=='B'){
            int j=i;
            int k=1;
            while(s[j]=='B'){
                j++;
                s[i-k]='B';
                k++;
            }
        }
    }
    for(int l=0;l<s[l]!='\0';l++){
        if(s[l]!='B'){
            printf("%c",s[l]);
        }
    }
    return 0;
}

Measured memory_bytes: 1644
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {
            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }


        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var n = Read();
            var s = Console.ReadLine();
            long max = 0;
            for (int i = 0; i < s.Length; i++)
            {
                long count = 0;
                for (int j = 'a'; j <='z'; j++)
                {
                    bool a = false;
                    bool b = false;
                    for (int k = 0; k < s.Length; k++)
                    {
                        if (k <= i && s[k] == (char)j)
                            a = true;
                        else if (k > i && s[k] == (char)j)
                            b = true;
                    }
                    if (a && b)
                        count++;
                }
                if (max < count)
                    max = count;
            }



            Console.WriteLine(max);
           
            Console.Out.Flush();
        }
    }
}

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

int main(){

  int a,b,c,d=0;
  cin>>a>>b>>c>>d;
	

  while(1){

    c-=b;
    if(c<=0){cout<<"Yes"<<endl;return 0;}
    a-=d;
    if(a<=0){cout<<"No"<<endl; return 0;}
    
  }

}


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

using namespace std;
typedef long long ll;
int A[1<<18];
int N;
vector<int> v;

int calc(vector<int> u){
    if(u.size() == 1) return u[0];
    vector<int> buf;
    for(int i = 0; i < u.size(); i+= 2){
        buf.push_back(max(u[i], u[i+1])-min(u[i], u[i+1]));
    }
    return calc(buf);
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    cin >> N;
    for(int i = 0; i <(1<<N); i++){
        cin >> A[i];
        v.push_back(A[i]);
    }
    cout << calc(v) << endl;
}

Measured memory_bytes: 8444
N = int(input())
B = list(map(int, input().split()))

A = [0] * N

A[0] = B[0]
A[N-1] = B[N-2]
if N > 2:    
    for i in range(1, N-1):
        A[i] = min(B[i], B[i-1])

ans = 0
for i in range(N):
    ans += A[i]

print(ans)

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

template <typename T>
void print_vector(vector<T>& vec) {
    cout << "print_vector -> ";
    for(int i=0; i<vec.size(); i++) {
        if(i == vec.size()-1) {
            cout << vec[i] << endl;
        }
        else {
            cout << vec[i] << " ";
        }
    }
    return;
}

typedef struct {
    int c;
    vector<int> A;
} Data;

int N, M, X;

void bnf(vector<int> conv, vector<Data> data, unsigned long long *ans) {

    if(conv.size() > N) return;

    unsigned long long temp_ans = 0;
    vector<int> sum(M, 0);
    for(int i=0; i<conv.size(); i++) {
        for(int j=0; j<M; j++) {
            sum[j] += data[conv[i]].A[j];
        }
        temp_ans += data[conv[i]].c;
    }

    bool p = true;
    for(int i=0; i<M; i++) {
        if(sum[i] < X) {
            p = false;
        }
    }

    if(p && temp_ans < *ans) {
        *ans = temp_ans;
    }

}

int main() {

    cin >> N >> M >> X;

    vector<Data> data(N);

    for(int i=0; i<N; i++) {
        cin >> data[i].c;
        for(int j=0; j<M; j++) {
            int temp;
            cin >> temp;
            data[i].A.push_back(temp);
        }
    }
    
    unsigned long long ans = 10E+12;
    int bit = 0;
    for(int i=0; i<N; i++) {
        bit |= (1 << i);
    }
    for(int i=0; i<=bit; i++) {
        vector<int> conv;
        for(int j=0; j<N; j++) {
            if((i >> j) & 0x01 == 0x01) {
                conv.push_back(j);
            } 
        }
        bnf(conv, data, &ans);
    }

    if(ans == 10E+12) cout << -1 << endl;
    else cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3632
<?php
$n = (int)trim(fgets(STDIN));
$s = trim(fgets(STDIN));
$k = (int)trim(fgets(STDIN));

$k = $s[$k-1];

for ($i=0; $i < $n; $i++) { 
	if ($s[$i] === $k) {
		echo $s[$i];
	}else{
		echo '*';
	}
}

Measured memory_bytes: 4728
#include <bits/stdc++.h>
	#include <cstdio>
	#include <cstring>
	#include <cmath>
	#include <cstring>
	#include <chrono>
	#include <complex>
	#define endl "\n"	
	typedef long long LL;
	#define ld long double
	#define ll long long int
	#define vi vector<int>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<int,int>
	#define pll pair<long long, long long>
	#define mod 1000000007
	#define mod2 998244353
	#define INFINITE 1000000000000000001;
	#define all(c) c.begin(),c.end()
	#define sz(v) ((ll)(v).size())
	#define mp(x,y) make_pair(x,y)
	#define mem(a,val) memset(a,val,sizeof(a))
	#define eb emplace_back
	#define pb push_back
	#define f first
	#define s second
	#define dbg(a) cout<<#a<<" --> "<<(a)<<"\n";
	#define forn(i,n) for (ll i=0; i<(n); ++i)
	#define fornd(i,n) for (ll i=(n)-1; i>=0; --i)	
	#define forab(i,a,b) for (ll i=(a); i<=(b); ++i)
	#define read(a) ll a; cin >> a;
	#define reads(s) string s; cin >> s;
	#define readb(a, b) ll a, b; cin >> a >> b;
	#define readc(a, b, c) ll a, b, c; cin >> a >> b >> c;
	#define readarr(a, n) int a[(n) + 1] = {}; forab(i, 0, (n-1)) {cin >> a[i];}
	#define readmat(a, n, m) int a[n + 1][m + 1] = {}; forab(i, 1, n) {forab(j, 1, m) cin >> a[i][j];}
	#define readv(A,n) vll A(n,0); forn(i,n) cin>>A[i]; 
	#define print(a) cout << a << endl;
	#define printarr(a, n) forab (i, 1, n) cout << a[i] << " "; cout << endl;
	#define printv(v) for (int i: v) cout << i << " "; cout << endl;
	#define printmat(a, n, m) forab(i, 1, n) {forab (j, 1, m) cout << a[i][j] << " "; cout << endl;}
	#define precision(a) cout<<fixed<<setprecision(a);
	#define INF (1e18+5)
	#define inf (1e9+5)
	int dx[4] = { 0, 0, 1, -1 };
	int dy[4] = { 1, -1, 0, 0 };
	// 8-directions
	//int dx[]={1,1,1,0,0,-1,-1,-1};
	//int dy[]={-1,0,1,-1,1,-1,0,1};
	#define fast_io ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
	using namespace std;
	int begtime = clock();
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	mt19937_64 rngb(chrono::steady_clock::now().time_since_epoch().count()); // can give negative values too
	bool isPowerOfTwo(int x) {
    return x && (!(x & (x - 1)));
	}
	int takemod(int x) {
    return (x % mod + mod) % mod;
	}
 
	ll fpow(ll base, ll power, ll MOD) {
    ll result = 1;
    base = base % MOD;
    while (power) {
        if (power & 1)
            result = (result * base) % MOD;
        base = (base * base) % MOD;
        power = power >> 1;
    }
    return result;
	}
 
	ll modinv(ll x,ll MOD) {return fpow(x, MOD - 2, MOD);}
	void solve()
	{
		ll n;
		cin>>n;
		ll ans=0;
		forab(i,1,n)
		{
			ll res=n/i;
			if(n%i==0)res--;
			ans+=res;
		}			
		cout<<ans<<endl;	
	}
	int main()
	{	
		#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		#endif
		fast_io;
		int T=1;
	//	cin>>T;
		// cin.ignore(); must be there when using getline(cin, s)
		while(T--)
		{
			solve();
		}
		#ifndef ONLINE_JUDGE
    		cerr << "Time elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
    		#endif
		return 0;
	}

	
	
	
	

Measured memory_bytes: 3648
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}


fn f(d1: &Vec<i32>, d2:&Vec<i32>) -> bool{

    for i in 0..d1.len() {
        
    }


    return true;
}

use std::iter::Iterator;
use std::cmp;


fn main() {
    input! {
         s:chars
    }

    let mut s = s;

    s.sort();
 
    let ans = s.len() == 4 && s[0] == s[1] && s[2] == s[3] && s[0] != s[2];
 
    println!("{}", if ans {"Yes"} else {"No"});

}


Measured memory_bytes: 4352
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 1<<31-1
#define LNF 9223372036854775807
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
//#define MOD 998244353
#define NUM 100005

void swap(int* a,int* b){int tmp=*a;*a=*b;*b=tmp;}
int dup(int a,int d){if(a%d==0)return a/d;else return a/d+1;}
int mod(int a,int m){if(a<0)return a%m+m;else return a%m;}
int GCD(int a,int b){int c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
int LCM(int a,int b){return a*b/GCD(a,b);}
LL POW(LL a,LL n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return ans;}
int icmp(const void* a,const void* b){return *(int*)a-*(int*)b;}
int lcmp(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return 1;if(*(LL*)a<*(LL*)b)return -1;return 0;}
int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
int scmp(const void* a,const void* b){return strcmp(*(char**)a,*(char**)b);}
LL fac[NUM],finv[NUM],inv[NUM];
void comi(){int i;fac[0]=fac[1]=1;finv[0]=finv[1]=1;inv[1]=1;FOR(i,2,NUM){fac[i]=fac[i-1]*i%MOD;inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;finv[i]=finv[i-1]*inv[i]%MOD;}}
int com(int n,int k){if(n<k||n<0||k<0)return 0;return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;}

LL calc(LL a){
  if(a<0)return -a;
  return a;
}

int main(){
  LL M,i,ans=0,a=0;
  scanf("%lld",&M);
  LL d[M],c[M];
  FOR(i,0,M)scanf("%lld%lld",&d[i],&c[i]);
  FOR(i,0,M)ans+=c[i],a+=d[i]*c[i];
  if(a%9==0)a=a/9-1;
  else a/=9;


  printf("%lld\n",ans+a-1);
	return 0;
}


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

#define sc second
#define fr first
#define mk make_pair
#define pb push_back
#define int long long

using namespace std;

const int N = (1e6 + 5);
const int inf = (1e9 + 7);

main () {
    int a,b;
    cin >> a >> b;
    
    cout << (a * b) / __gcd(a,b) << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <string>
#include <math.h>

using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)
static const ll maxLL = (ll)1 << 62;

///////////////////////////
////Prime Creator//////////
///////////////////////////
//bool Prime[100001] = {};
//void createPrime() {
//	ll n = 100001;
//	rep(i, 0, n) Prime[i] = true;
//	Prime[0] = false;
//	Prime[1] = false;
//	rep(i, 2, n) {
//		if (Prime[i]) {
//			rep(j, 2, n) {
//				if (j*i >= n)break;
//				Prime[j*i] = false;
//			}
//		}
//	}
//}
///////////////////////////
///////////////////////////

ll a[100001] = {};
int main() {
	ll n; cin >> n;
	ll maxV = 0;
	rep(i, 0, n) {
		cin >> a[i];
		maxV = max(maxV, a[i]);
	}
	ll minD = (ll)1 << 55;
	ll minV = (ll)1 << 55;

	rep(i, 0, n) {
		if (a[i] != maxV) {
			ll v = abs(a[i] - maxV / 2);
			if (minD > v) {
				minD = v;
				minV = a[i];
			}
		}
	}
	cout << maxV << " " << minV << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <math.h>
#include <string.h>
using namespace std;
 
int main(){
	long long int N=0,n,maxi=-1,ans=0;
	cin>>N;
	n=sqrt(N);
	for(long long int i=1;i<=n;i++)
	{
		if(N%i==0)maxi =N/i;
	}
	n=1;
	for(long long int i=1;maxi>=n;i++)
	{
		n*=10;
		ans =i;
	}
	cout<<ans;
	return 0;
	}

Measured memory_bytes: 256