akhauriyash/Code-Regression huggingface dataset:
/*ex4_3
ryo_1129*/
#include<stdio.h>
//プロトタイプ宣言
int tall(int n);

int main(void){
    //変数宣言
    int a,b,talla,ans,difference;
    //入力
    scanf("%d %d",&a,&b);
    //木の差
    difference = b-a;
    //aの高さを出す。
    talla = tall(difference-1);
    //積雪量はaの高さ-a
    ans = talla-a;
    //出力
    printf("%d\n",ans);

    return 0;
}
//n番目の木の高さを出す関数、等差数列の和
int tall(int n){
    int hight;
    hight = n*(n+1)/2;
    return hight;
}

Measured memory_bytes: 128
#include"bits/stdc++.h"
using namespace std;

void Main() {
  int N;
  cin >> N;
  long long a[N];
  long long max_v = 0, min_v = 1e9;
  int max_idx = 0, min_idx = 0;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    if (a[i] > max_v) {
      max_v = a[i];
      max_idx = i;
    }
    if (a[i] < min_v) {
      min_v = a[i];
      min_idx = i;
    }
  }
  cout << N + N - 1 << endl;
  if (abs(max_v) >= abs(min_v)) {
    for (int i = 1; i <= N; i++) {
      cout << max_idx + 1 << " " << i << endl;
    }
    for (int i = 1; i < N; i++) {
      cout << i << " " << i + 1 << endl;
    }
  } else {
    for (int i = 1; i <= N; i++) {
      cout << min_idx + 1 << " " << i << endl;
    }
    for (int i = N; i > 1; i--) {
      cout << i << " " << i - 1 << endl;
    }
  }
}

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



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int dp[100001];

int dfs(vector<int> v[],int idx)
{
  if(dp[idx]!=-1) return dp[idx];
  int max_=0;
  
  for(auto a:v[idx])
  {
    max_=max(max_,1+dfs(v,a));
  }
  return dp[idx]=max_;
  
}

int main()
{
    int n,m,a,b; cin>>n>>m;
    vector<int> v[n+1];
  //memset(visited,false,sizeof(visited));
  memset(dp,-1,sizeof(dp));
  while(m--)
  {
    cin>>a>>b; v[a].push_back(b);
  }
  int max_=0;
  
  for(int i=1;i<=n;i++)
  {
    if(dp[i]==-1) dfs(v,i);
  }
  for(int i=1;i<=n;i++) {max_=max(max_,dp[i]);}
  cout<<max_;
}

Measured memory_bytes: 8192
#include<bits/stdc++.h>
#define M_PI       3.14159265358979323846
#define Speed_UP  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define 	pb	push_back 
#define 	ff	first 
#define 	ss	second 
#define sz(x) (int)x.size()
#warning Remeber to change t
using namespace std;
typedef long long ll;
inline void setIO(string name="") {
	#ifndef ONLINE_JUDGE 
	freopen((name+".in").c_str(), "r", stdin); 
	freopen((name+".out").c_str(), "w", stdout);
	#endif
	}

int main(){
	Speed_UP
	ll t;
	t=1;
	while(t--){
		ll n;
		cin>>n;
		ll arr[n];
		for(int i=0;i<n;i++)
			cin>>arr[i];
		
		sort(arr,arr+n);
		ll ans=0;
		ans+=arr[n-1];
		ll i=1;
		ll j=n-2;
		ll cur=n-2;
		while(i<=j){
			if(i==j)
				ans+=arr[cur];
			else{
				ans+=2*arr[cur];
			}
			i++;j--;
			cur--;
			//cout<<ans<<"\n";
		}
		cout<<ans;
		
		
		
	}





}


Measured memory_bytes: 5176
(A, B), = [list(map(int, s.split())) for s in open(0)]

if B == 1:
    print(0)
elif A >= B:
    print(1)
else:
    cnt = 1
    while True:
        if B <= A + (A - 1)*(cnt - 1):
            break
        cnt += 1
    print(cnt)

Measured memory_bytes: 3064
// AOJ 2012: Space Coconut Grab
// 2017.10.1

#include <stdio.h>

int z3[102];
int y2[1002];

int bsch(int *a, int r, int x)
{
	int m, l = 1;
    while (l < r) {
        m = (l + r) >> 1;
		if (a[m] == x) return m;
        if (a[m] < x) l = m + 1; else r = m;
    }
	return l-1;
}

int main()
{
	int e, m, y, z, t, ans;

	for (z = 1; z <= 100; z++) z3[z] = z*z*z;
	for (y = 1; y <= 1000; y++) y2[y] = y*y;

	while (scanf("%d", &e) && e > 0) {
		for (ans = 0x7fffffff, z = bsch(z3, 101, e); z >= 0; z--) {
			t = e - z3[z];
			if (t < 3) { ans = z + t; break; }
			y = bsch(y2, 1001, t);
			m = z + y + (t - y2[y]);
			if (m < ans) ans = m;
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1748
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
Int gcd(Int a, Int b) {
    Int M = max(a, b);
    Int m = min(a, b);
    while (true) {
        Int r = M % m;
        if (r == 0) break;
        M = m;
        m = r;
    }
    return m;
}

Int lcm(Int a, Int b) {
    return a / gcd(a, b) * b;
}

int main() {
    Int a, b;
    cin >> a >> b;
    cout << lcm(a, b) << endl;
}


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

using namespace std;

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

ll x,cur=100;

int main(){
  int ans=0;
  cin >> x;
  while(cur<x){
    cur+=cur/100;
    ++ans;
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 3636
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.TreeMap;

public class Main {
    public static void main(String[] args) throws Exception {
        
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(br.readLine());
		}
		br.close();
		
		// <数列, 色数>
		TreeMap<Integer, Integer> map = new TreeMap<>();
		for(int i = 0; i < n; i++){
		    
		    if ( map.containsKey(a[i]) ){
		        map.put(a[i], map.get(a[i]) + 1);
		    } else {
		        map.put(a[i], 1);
		    }
		    
		    Integer l = map.lowerKey(a[i]);
		    if ( l == null ) continue;
		    int v = map.get(l);
		    if( v == 1 ){
		        map.remove(l);
		    } else {
		        map.put(l, v - 1);
		    }
		}
		
		int ans = 0;
		for(Integer k : map.keySet() ){
		    ans += map.get(k);
		}
		
		System.out.println(ans);
        
    }
}


Measured memory_bytes: 47168
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;
const int MOD=1000000007;

int n,f[N],g[N];
LL a,b,s[N];

int main()
{
    scanf("%d%lld%lld",&n,&a,&b);
    if (a>b) swap(a,b);
    for (int i=1;i<=n;i++) scanf("%lld",&s[i]);
    sort(s+1,s+n+1);
    for (int i=3;i<=n;i++) if (s[i]-s[i-2]<a) {puts("0");return 0;}
    f[0]=g[0]=1;int p=0,lim=0;
    for (int i=1;i<=n;i++)
    {
        while (p<i&&s[i]-s[p+1]>=b) p++;
        if (lim<=p) f[i]=(g[p]+MOD-(lim?g[lim-1]:0))%MOD;
        g[i]=(g[i-1]+f[i])%MOD;
        if (i>1&&s[i]-s[i-1]<a) lim=i-1;
    }
    int ans=0;
    for (int i=n;i>=0;i--)
    {
        (ans+=f[i])%=MOD;
        if (i<n&&s[i+1]-s[i]<a) break;
    }
    printf("%d",ans);
    return 0;
}

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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define int ll

const ll MOD = 1000000007;
const ll INF_LL = (ll)1000000007 * 1000000007;
const int INF_INT = (int)1000000007;
const double PI = 3.14159265358979323846;

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define irep(itr, st) for (auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for (auto itr = (st).rbegin(); itr != (st).rend(); ++itr)

#define m0(x) memset((x), 0, sizeof((x)))
#define m1(x) memset((x), -1, sizeof((x)))

// xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define RALL(x) (x).rbegin(), (x).rend()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())     // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))  //最大値を求める
#define MIN(x) *min_element(ALL(x))  //最小値を求める
#define all(x) (x).begin(), (x).end()

//略記
#define pb emplace_back  // vectorヘの挿入
#define mp make_pair     // pairのコンストラクタ
#define F first          // pairの一つ目の要素
#define S second         // pairの二つ目の要素

#define BITCOUNT __builtin_popcount
#define BITCOUNT_LL(x) __builtin_popcountll(x)

#define perm(c)             \
  sort(all(c));             \
  for (bool c##p = 1; c##p; \
       c##p = next_permutation(all(c)))  //順列 123 132 213 231 312 321

#define BIT(n) (1LL << (n))

#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ": " << (A) << std::endl;
#else
#define PRINT(A)
#endif

//入力高速化
struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

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

signed main() {
  int A, B, N; cin >> A >> B >> N;
  int ans = 0;
  if(N >= B-1){
    ans = A-A/B -1;
  }
  else{
    ans = A*N/B;
  }
  if(B == 1) ans = 0;
  cout << ans << endl;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
ll mod=1e9+7,i,j;
ll n,x,y;
ll a[300005];
int main(){
    cin>>x>>y;
    if(x!=1&&y!=1) cout<<1;
    else if(x!=2&&y!=2) cout<<2;
    else cout<<3;
    return 0;
}



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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y
#define ASSERT(expr...) assert((expr))

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using ll = long long;
constexpr i64 INF = 1010000000000000017LL;
constexpr i64 MOD = 1000000007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) xmax = x; return true;
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) xmin = x; return true;
    return false;
}
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr); ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH) cout << unitbuf;
    }
} PROCON_INIT;
ll mod_pow(ll x, ll n) {
    if (n == 0) return 1;
    if (n % 2 == 0) return mod_pow(x * x % MOD, n / 2) % MOD;
    else return x * mod_pow(x, (n - 1)) % MOD;
}
ll mod_pow_r(ll x, ll n) {
    if (x == 0) return 0;
    if (n == 0) return 1;
    ll ret = 1;
    while (n) if (n & 1) ret = ret * x % MOD; x = x * x % MOD; n /= 2;
    return ret;
}
ll factorial(ll n) {
    ll ret = 1;
    REP(i, n) ret *= (i + 1); ret %= MOD;
    return ret;
}
ll combination(ll n, ll r) {
    if (n < 0 || n < r || r < 0) return 0;
    ll fn = factorial(n);
    ll fr = factorial(r);
    ll fn_r = factorial(n-r);
    ll d = (mod_pow(fr, MOD - 2) * mod_pow(fn_r, MOD - 2)) % MOD;
    ll u = fn % MOD;
    return u * d % MOD;
}

void solve() {
    int n; cin >> n;
    vector<int> a(n-1); FOR(i, 0, n-1) cin >> a[i];

    vector<int> ret(n);
    FOR(i, 0, n-1){
        int& tmp = ret[a[i]-1];
        tmp++;
    }

    FOR(i, 0, n) cout << ret[i] << endl;
}

signed main() {
    solve();
    return 0;
}

Measured memory_bytes: 4756
n, k, s = map(int, input().split())

if k == 0:
    if s == 10**9:
        A = [1 for i in range(n)]
    else:
        A = [s+1 for i in range(n)]
else:
    A = [s for i in range(k)]
    if s == 10**9:
        A += [1 for i in range(n-k)]
    else:
        A += [s+1 for i in range(n-k)]

print(*A)


Measured memory_bytes: 9504
import java.io.*;
import java.util.*;

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/2;
    public static final int inf = Integer.MAX_VALUE/2;
    //abc43 b
    static void solve(InputReader in, PrintWriter out){
        char[] s = in.ns().toCharArray();
        char[] ans = new char[s.length];
        int now = 0;
        for (int i = 0; i < s.length; i++) {
            if(s[i]=='0'){
                ans[now] = '0';
                now++;
            }else if(s[i]=='1'){
                ans[now] = '1';
                now++;
            }else{
                if(now>0)now--;
            }
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < now; i++) {
            sb.append(ans[i]);
        }
        out.println(sb.toString());
    }

    public static void main(String[] args){
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public double nd(){
            return Double.parseDouble(ns());
        }
        public char nc(){
            return ns().toCharArray()[0];
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 23252
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
const ll INF = (ll)1e18 + 1;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n; cin >> n;
    
    if(n%2==0) cout << n << ln;
    else cout << n*2 << ln;
    return 0;
}

Measured memory_bytes: 256
from math import sqrt
from scipy.misc import comb

def cal_factors(num):
    factors = {}
    maxmod = int(sqrt(num)) + 1
    for mod in range(2, maxmod):
        i = 0
        while True:
            d, q = divmod(num, mod)
            if q == 0:
                num = d
                i += 1
                factors[mod] = i
            else:
                break

    if num > 1:
        factors[num] = 1

    return factors


n, m = [int(v) for v in input().split()]

mod = 1000000000 + 7
factors = cal_factors(m)
ans = 1
for v in factors.values():
    ans *= comb(v + n - 1, v, exact=True) % mod
    ans %= mod

print(ans)

Measured memory_bytes: 14168
S = input()
T = input()

s = len(S)
t = len(T)
m = 10 ** 4

for i in range(s - t + 1):
    c = 0
    for j in range(t):
        if S[i + j] != T[j]:
            c += 1
    if c < m:
        m = c
print(m)

Measured memory_bytes: 67232
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

int main(){
  ll N;
  cin >> N;
  ll p;
  ll leng = 0;
  ll flag = 0;
  ll ans = 0;
  rep(i, N){
    cin >> p;

    if(p == i + 1){
      if(flag == 0) flag = 1;
      leng += 1;
    } else if(flag == 1){
	flag = 0;
	ans += leng / 2 + leng % 2;
	leng = 0;
    }
  }

  if(flag == 1) ans += leng / 2 + leng % 2;

  cout << ans << endl;
  
  return 0;
}


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

int R, S, P;

int score(char c) {
  if (c == 'r') return P;
  if (c == 's') return R;
  if (c == 'p') return S;
  return 0;
}

int main() {
  int N, K;
  cin >> N >> K;
  cin >> R >> S >> P;
  string T;
  cin >> T;
  
  char hand[min(K, N)][N/K + 2];
  
  for (int i = 0; i < min(K, N); i++) {
    for (int j = 0; j < N/K + 2; j++) {
      hand[i][j] = '#';
    }
  }
  
  for (int i = 0; i < min(K, N); i++) {
    for (int j = i; j < N; j = j + K) {
      hand[i][(j - i) / K] = T.at(j);
    }
  }
  
   
  char h[min(K, N)][N/K + 1];
  int d[min(K, N)][N/K + 1];
  
  for (int i = 0; i < min(K, N); i++) {
    for (int j = 0; j < N/K + 1; j++) {
      h[i][j] = '#';
    }
  }
  
  
  for (int i = 0; i < min(K, N); i++) {
    for (int j = 0; j < N/K + 1; j++) {
      d[i][j] = 0;
    }
  }
  
  
  for (int i = 0; i < min(K, N); i++) {
    int p = 0;
    int q = 0;
    int j = 1;
    while (hand[i][j - 1] != '#') {
      if (hand[i][j - 1] != hand[i][j]) {
        h[i][p] = hand[i][j - 1];
        d[i][p] = j - q;
        p++;
        q = j;
      }
      j++;
    }
  }
  
      
  int ans[min(K, N)];
  int answer = 0;
    
  for (int i = 0; i < min(K, N); i++) {
    ans[i] = 0;
    for (int j = 0; j < N/K + 1; j++) {
      ans[i] += (d[i][j] + 1)/2 * score(h[i][j]);
    }
    answer += ans[i];
  }
    
  cout << answer << endl;
}

Measured memory_bytes: 1920
/* author:hellojim */
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
#define forn(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define fore(i,b,a)for(int i=(b),_a=(a);i>=_a;i--)
#define rep(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define vi vector<int>
#define vpii vector<pii>
#define m_p make_pair
#define re return
#define pb push_back
#define si set<int>
#define ld long double
#define X first
#define Y second
#define st string
#define ull unsigned long long
#define mod 1000000007
#define INF 1000000007
#define x1 XZVJDFADSPFOE
#define y1 GASDIJSLDAEJF
#define x2 DFDAJKVOHKWIW
#define y2 PSFSAODSXVNMQ
#define LLINF 0x3f3f3f3f3f3f3f3fLL
using namespace std;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
ll quickpower(ll n,ll k){
	ll ans=1;
	while(k){
		if(k%2){
			ans*=n;
			ans%=mod;
		}
		n*=n;
		n%=mod;
		k/=2;
	}
	return ans;
}
string int_to_string(int n)
{
	string s="";
	while(n)
	{
		int now=n%10;
		s+=now+'0';
		n/=10;
	}
	reverse(s.begin(),s.end());
	return s;
}
int string_to_int(string s)
{
	int n=0;
	rep(i,s.size())
	{
		n*=10;
		n+=s[i]-'0';
	}
	return n;
}
int n;
ll ans;
int main()
{
	ios::sync_with_stdio(0);
	//think twice,code once
	cin>>n;
	ans=0;
	forn(i,1,n-1)
	{
		ans+=((n-1)/i);
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int n = s.length();
		int ans = 0;
		for(int i = 0 ; i < n - 1 ; i++) {
			if(s.charAt(i) != s.charAt(i + 1)) ans++;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 24016
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/irange.hpp>
#include "bits/stdc++.h"

namespace adaptor = boost::adaptors;

const int64_t nmax = 25;
const int64_t nil = -1;

struct Node {
    int64_t parent, left, right;
};

Node T[nmax];
int64_t n, D[nmax], H[nmax];

void setDepth(int64_t u, int64_t d) {
    if (u == nil) return;
    D[u] = d;
    setDepth(T[u].left, d + 1);
    setDepth(T[u].right, d + 1);
}

int64_t setHeight(int64_t u) {
    int64_t h1 = 0, h2 = 0;
    if (T[u].left != nil) h1 = setHeight(T[u].left) + 1;
    if (T[u].right != nil) h2 = setHeight(T[u].right) + 1;
    H[u] = h1 > h2 ? h1 : h2;
    return H[u];
}

int64_t getSibling(int64_t u) {
    if (T[u].parent == nil) return nil;
    if (T[T[u].parent].left != nil && T[T[u].parent].left != u) return T[T[u].parent].left;
    if (T[T[u].parent].right != nil && T[T[u].parent].right != u) return T[T[u].parent].right;
    return nil;
}

void print(int64_t u) {
    std::cout << "node " << u << ": ";
    std::cout << "parent = " << T[u].parent << ", ";
    std::cout << "sibling = " << getSibling(u) << ", ";
    int64_t deg = 0;
    if (T[u].left != nil) deg++;
    if (T[u].right != nil) deg++;
    std::cout << "degree = " << deg << ", ";
    std::cout << "depth = " << D[u] << ", ";
    std::cout << "height = " << H[u] << ", ";
    if (T[u].parent == nil) {
        std::cout << "root" << std::endl;
    } else if (T[u].left == nil && T[u].right == nil) {
        std::cout << "leaf" << std::endl;
    } else {
        std::cout << "internal node" << std::endl;
    }
}

void solve() {
    std::cin >> n;
    for (int64_t i = 0; i < n; i++) {
        T[i].parent = T[i].left = T[i].right = nil;
    }
    for (int64_t i = 0; i < n; i++) {
        int64_t value, left, right;
        std::cin >> value >> left >> right;
        T[value].left = left;
        T[value].right = right;
        if (left != nil) T[left].parent = value;
        if (right != nil) T[right].parent = value;
    }

    int64_t root = 0;
    for (int64_t i = 0; i < n; i++) {
        if (T[i].parent == nil) root = i;
    }

    setDepth(root, 0);
    setHeight(root);

    for (int64_t i = 0; i < n; i++) {
        print(i);
    }

    return;
}

int main() {
    std::cin.tie(0);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    solve();
}



Measured memory_bytes: 3168
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ll long long
#define M 1000000007
#define sz(a) (ll)a.size()
#define pll pair<ll,ll>
#define rep(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define sep(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define mll map<ll,ll>
#define vl vector<ll>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(),a.end()
#define F first
#define S second
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll n,a[100005],b[100005];
pll g[100005];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    rep(i,0,n)
    {
        cin>>a[i]>>b[i];
        g[i]={a[i]+b[i],a[i]};
    }
    sort(g,g+n);
    ll p=0,ans=0;
    sep(i,n-1,0)
    {
        if(p==0)
            ans+=g[i].S;
        else
            ans-=(g[i].F-g[i].S);
        p=1-p;
    }
    cout<<ans;
}


Measured memory_bytes: 3328
#include<stdio.h>
int main(void){
    int n, m;
    while(1){
        int max=0;
        scanf("%d%d",&n, &m);
        if(n==0 && m==0) break;
        int a[n];
        for(int i=0; i<n; i++) scanf("%d",&a[i]);
        for(int i=0; i<n; i++){
            for(int j=i+1; j<n; j++){
                if(a[i]+a[j] <= m && max < a[i]+a[j])
                    max=a[i]+a[j];
            }
        }
        if(max==0) printf("NONE\n");
        else printf("%d\n",max);
    }
    return 0;
}



Measured memory_bytes: 2032
#include<bits/stdc++.h>
using namespace std;
int main(){
    string a;cin>>a;
    int co = 0;
    for(int i = 0; i < 4; i++){
        if(a[i] == '2'){
            co += 1;
        }
    }
    cout<<co<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
 
using namespace std;
 
typedef pair<bool,int>P;
const int MAX = 3000001;
int N,Q,maxi,mini;
P data[MAX];
 
void make(){
  int now = 0;
  for(int i = 0; i <= maxi; i++){
    data[i].second = now;
    if(data[i].first) now = i;
  }
}
 
void input(){
  cin >> N >> Q;
   
  for(int i = 0; i < N; i++){
    int n;
    scanf("%d",&n);
    data[n].first = true;
    maxi = max(maxi,n);
    mini = min(mini,n);
  }
}
 
int getans(int q){
  if(q == 1) return 0;
  int start = mini;
  while(start%q){
    start -= start%q;
    start += q;
  }
 
  int ans = 0;
 
  for(int i = start; i <= maxi; i+=q){
    if(ans == q-1) return ans;
    ans = max(ans,data[i].second%q);
  }
  return max(ans,maxi%q);
}
 
void solve(){
 
  for(int i = 0; i < Q; i++){
    int q;
    scanf("%d",&q);
    printf("%d\n",getans(q));
  }
}
 
int main(){
 
  maxi = 0;
  mini = MAX;
 
  input();
  make();
  solve();
 
  return 0;
}

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

using namespace std;
#define ll long long

#define pii pair<int,int>
#define pll pair<ll,ll>
#define _ <<'\n'
#define __ << ' '
#define all(x) (x).begin(), (x).end()
#define gcd __gcd
int IT_MAX = 1 << 17;
int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1e-10;
#define szz(x) (int)(x).size()
#define IOS ios_base::sync_with_stdio(false); cout.tie(0);cin.tie(0);
#define flush fflush(stdout)

ll mod(ll a, ll m) { return (a + (abs(a) / m) * m + m) % m; }

//****************************don't use int!!!!!!!****************************//
//***************************code starts here!!!!!****************************//

int main() {
    IOS

    string st;
    cin >> st;
    vector<ll> a(st.size() + 1, 0);

    for (int i = 0; i < st.size(); ++i) {
        if (st[i] == '<') {
            a[i + 1] = a[i] + 1;
        }
    }

    for (int i = st.size() - 1; i >= 0; --i) {
        if (st[i] == '>') {
            a[i] = max(a[i + 1] + 1, a[i]);
        }
    }

    ll ans = 0;
    for (auto i : a) {
        ans += i;
    }
    cout << ans;

    return 0;
}

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

int main(){
	string s_1, s_2, s_3;
	cin >> s_1 >> s_2 >> s_3;
	cout << (char)((int)s_1[0] - 32) << (char)((int)s_2[0] - 32) << (char)((int)s_3[0] - 32) << "\n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vr vector
#define pb push_back
#define mod 1000000007
#define all(v) v.begin(),v.end()

ll pow(ll x,ll n,ll p,ll res)
{
    if(n==0)
        return res%p;
    if(n&1)
    {
        res=((res%p)*(x%p))%p;
        n--;
    }
    x=((x%p)*(x%p))%p;
    n>>=1;
    return pow(x,n,p,res);
}





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

//ll t;
//cin>>t;
//while(t--)
{

    ll n,snk,d,i,k,j,h[2001]={0},cnt=0;
    cin>>n>>k;

    for(i=0;i<k;i++)
    {
        cin>>d;
        for(j=1;j<=d;j++)
        {
            cin>>snk;
            h[snk]=1;
        }
    }
     for(i=1;i<=n;i++)
     {
         if(h[i]==0)
            cnt++;
     }
     cout<<cnt;
    cout<<endl;

}
    return 0;
}





Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
long long int arr[200009]={0};
int main()
{
    long long int n,m,i,j,k;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>arr[i];
        arr[i]-=i;
    }
    sort(arr+1,arr+n+1);
    long long int b=0;
    if(n%2==1)
    {
        b = arr[(n+1)/2];
    }
    else
    {
        b = arr[n/2];
        b += arr[n/2+1];
        b/=2ll;
    }
    //cout<<b<<endl;
    long long int sum =0;
    for(i=1;i<=n;i++)
    {
        sum+=abs(arr[i]-b);
    }
    cout<<sum<<endl;
    return 0;
}



Measured memory_bytes: 1792
import sys, math
def input():
    return sys.stdin.readline()[:-1]
from itertools import permutations, combinations
from collections import defaultdict

sys.setrecursionlimit(10**7)
N, A, B = map(int, input().split())


if (B-A)%2==0:
    print((B-A)//2)
    exit()

if A-1<N-B:
    d1 = A-1
    d2 = B-1
    print((d1+d2+1)//2)
else:
    d1 = N-A
    d2 = N-B
    print((d1+d2+1)//2)


Measured memory_bytes: 3444
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <utility>

#include <cassert>
#include <cmath>
#include <cstdio>

using namespace std;

#define fi first
#define se second
#define mkp make_pair
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define FOR(i,a,b) for(ll i=(a); i < (b); i++)
#define RFOR(i,a,b) for(ll i=(b)-1; i >= (a); i--)
#define rep(i,n) FOR(i,0,(n))
#define rrep(i,n) RFOR(i,0,(n))

int main() {
	ll N;
	cin >> N;
	ll res = N-1;
	for(ll i = 1; i*i <= N; i++) {
		if(N % i == 0) {
			res = min((ll)res, i + (N/i) - 2);
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
typedef long long ll;
using namespace std;
int v[10001], w[10001];
int cache[3001][3001];
pair<int, int> p[3001][3001];
int calc(string &s, int S, string &t, int T) {
	if(S==0 || T==0) {
		return 0;
	}
	
	if(cache[S][T]!=-1) {
		return cache[S][T];
	}
	
	int mx = 0;
	if(s[S-1]==t[T-1]) {
		mx = calc(s, S-1, t, T-1) + 1;
	}
	
	int one = calc(s, S-1, t, T);
	int two = calc(s, S, t, T-1);
	
	/*if(two >= mx && two>=one) {
		p[S][T] = make_pair(S, T-1);
	}
	if(one >= mx && one>=two) {
		p[S][T] = make_pair(S-1, T);
	}
	if(mx >= one && mx>=two) {
		p[S][T] = make_pair(S-1, T-1);
	}*/
	return cache[S][T] = max(mx, max(one,two));
}

string print(string s, string t, int l, int r) {
	if(l==0 || r==0) {
		return "";
	}
	
	if(s[l-1]==t[r-1]) {
		return print(s,t,l-1, r-1) + s[l-1];
	}
	
	int one = p[l][r].first;
	int two = p[l][r].second;
	return print(s,t, one, two);
}
int main() {
	string s,t;
	cin>>s>>t;
	for (int i=0; i<=3000; i++) {
		for (int j=0; j<=3000; j++) {
			cache[i][j] = -1;
		}
	}
	int ans = calc(s, s.size(), t, t.size());
	//cout << print(s,t, s.size(), t.size());
	//cout << endl;
	int l = s.size();
	int r = t.size();
	string w = "";
	while(l>0 && r>0) {
		if(s[l-1]==t[r-1]) {
			w=s[l-1]+w;
			l--;
			r--;
		} else {
			if(cache[l-1][r] > cache[l][r-1]) {
				l--;
			} else {
				r--;
			}
		}
	}
	cout << w;
	return 0;
}

Measured memory_bytes: 36736
#include <iostream>
#define H_LENGTH 100000
int main(void)
{
    int N;
    int H[H_LENGTH];
    int count = 0;
    int max_count = 0;
 
    std::cin >> N;
    for(int i = 0; i < N; i++){
        std::cin >> H[i];
    }
 
    for(int i = 0; i < (N-1); i++){
        if(H[i] < H[i+1]){
            if(count >= max_count)
                max_count = count;
            count = 0;
        } else {
            count++;
        }
    }
    if(count >= max_count)
        max_count = count;

    std::cout << max_count;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <map>
#include <algorithm>
#include <stdio.h>
#include <set>
#include <cmath>
#include <functional>

typedef long long ll;
using namespace std;


int main(){
    string s;
    cin >> s;
    int cnt = 0;
    int ans = 0;
    for(int i = 0; i < 3; i++){
        if(s[i] == 'R'){
            cnt++;
        } else {
            ans = max(cnt, ans);
            cnt = 0;
        }
    }
    ans = max(cnt, ans);
    cout << ans << endl;
}

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

using namespace std;

int main() {
    
    //forItachi
	long long int n,w;
	
	long long int i,j;
	cin>>n>>w;
	vector<long long int> we(n,0);
	vector<long long int> v(n,0);
	for(i=0;i<n;i++){
	    cin>>we[i]>>v[i];
	}
	vector<vector<long long int> > dp( n , vector<long long int> (w+1, 0));
	
	for(i=1;i<=w;i++){
	    for(j=0;j<n;j++){
	        if(j==0){
	            if(i-we[j]>=0){
	                dp[j][i] = v[j];
	            }
	            
	        }
	        else{
	            if(i-we[j]>=0){
	                dp[j][i] = max<long long int >(dp[j-1][i],v[j]+dp[j-1][i-we[j]]);
	            }
	            else{
	                dp[j][i] = dp[j-1][i];
	            }
	        }
	    }
	}
    cout<<dp[n-1][w]<<endl;
}


Measured memory_bytes: 79360
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = 0
for i in range(n):
    val = a[i]-1
    ans += b[val]
    if a[i] == a[i-1]+1 and i > 0:
        ans += c[val-1]
        
print(ans)

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1; 
   // cin >> t;
    for(int T = 0; T < t ; T++){
        ll n;
        cin >> n;
        ll a[n];
        for(int i = 0 ; i < n ; i++){
            cin >> a[i];
        }
        sort(a, a + n);
        ll mod = 1e9 + 7, twop = 1, ans = 0;
        ll bits = log2(a[n - 1]) + 1;
        ll p[61];
        p[0] = 1;
        for(ll i = 1; i < 61; i++){
            p[i] = p[i - 1]*2;
            p[i] %= mod;
        }
        for(ll i = 0; i < bits; i++){
            ll ones = 0;
            for(ll j = 0; j < n; j++){
                if((1LL << i)&a[j]){
                    ones++;
                }
            }
            //cout << ones <<"df" << endl;
            ans += ((((ones%mod)*((n - ones)%mod))%mod)*(p[i]));
            ans %= mod;
           // cout << ans << endl;
        }
        cout << (ans%mod) << endl;
    }
    return 0;
}


Measured memory_bytes: 6112
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;



int main(){
    ll a,b,x; cin >> a >> b >> x;
    if(a % x == 0) cout << (b/x - a/x + 1) << endl;
    else cout << (b/x - a/x) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include<vector>
#include <algorithm>
#include <queue>
#include<string>
#include <map>
#include <cmath>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <utility>
typedef long long ll;
typedef long double ld;


#define REP(i,s,n)for(ll i=s;i<(n);++i)
#define rep(i,n) REP(i,0,n)
using namespace std;
ll S[1000] = { 0 };
ll N,M,Q;


int main() {
	cin >> N;
	vector<ll>A(N);
	rep(i, N)cin >> A[i];
	cin >> M;
	vector<ll>B(M);
	rep(i, M)cin >> B[i];

		if (includes(A.begin(),A.end(),B.begin(),B.end())) {
			cout << 1 << endl;
		}
		else {
			cout << 0 << endl;
		}

	return 0;
}





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

using namespace std;

const int maxn = 1e5 + 20, maxx = 102;

int a[maxx], n, m;
vector<int> fard;

int main()
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	for(int i = 0; i < m; i++) 
	{
		cin >> a[i];
		if (a[i] % 2) fard.push_back(i);
	}
	sort(fard.begin(), fard.end());
	if (m == 1 && n == 1) return cout << 1 << endl << 1 << endl << 1 << endl, 0;
	if (m == 1) return cout << a[0] << endl << 2 << endl << a[0] - 1 << " " << 1 << endl, 0;
	if (fard.size() > 2) return cout << "Impossible" << endl, 0;
	if (fard.size())
		swap(a[m-1], a[fard[0]]);
	if (fard.size() > 1)
		swap(a[0], a[fard[1]]);
	if (fard.size() == 2 && n == 2) return cout << a[0] << " " << a[1] << endl << 1 << endl << 2 << endl, 0;
//	if (a[0] == 1 && a[m-1] == 1) while (true) cout << 0 / 0 << endl;
	if (a[0] == 1) swap(a[0], a[m-1]);
	for(int i = 0; i < m; i++)
		cout << a[i] << " ";
	cout << endl << (a[0] == 1 ? m - 1 : m) << endl;
	for(int i = 0; i < m; i++) 
	{
		if (!i)
		{
			if (a[i] != 1) cout << a[i] - 1 << " ";
		}
		else if (i == m-1) cout << a[i] + 1 << " ";
		else	cout << a[i] << " ";
	}
	cout << endl;
//	for(int i = 0; i < m; i++) cout << a[i] << " ";
//	cout << endl << 1 << endl << n << endl;
//	cout << "Impossible" << endl;
	return 0;
}

Measured memory_bytes: 256
/**
  * @brief atcoder
  * @author yao
  */
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#include <climits>
#define ft first
#define sd second
#ifdef DBG
#   define dbg_pri(x...) fprintf(stderr,x)
#else
#   define dbg_pri(x...) 0
#   define NDEBUG
#endif //DBG
#include <cassert>

typedef unsigned int uint;
typedef long long int lli;
typedef unsigned long long int ulli;

#define N 262144
#define M 1048576
#define P 0xa53f309b5c65e11dull

char buf[N+M];
char *ss[N];
int nss[N];
ulli lu[M*26];
int nlu;
ulli hashs[N];
int cnt[128];

int main()
{
    int n;
    scanf("%d", &n);
    char *p = buf;
    for(int i=0;i<n;++i)
    {
        scanf("%s", p), nss[i] = strlen(p);
        ss[i] = p, p += nss[i] + 1;
    }
    for(int i=0;i<n;++i)
        dbg_pri("poi 3: %s\n", ss[i]);
    for(int i=0;i<n;++i)
    {
        for(int j=0;j<nss[i];++j)
            ++cnt[ss[i][j]];
        ulli x = 0;
        int tn = nlu;
        for(int j=nss[i]-1;j>=0;--j)
        {
            x = x * P;
            for(int k='a';k<='z';++k)if(cnt[k])
            {
                lu[tn++] = x ^ k;
                dbg_pri("poi 1: %c %s %016llx\n", (char)k, ss[i]+j+1, x^k);
            }
            x^=ss[i][j];
            --cnt[ss[i][j]];
        }
        hashs[i] = x;
        dbg_pri("poi 2: %s %016llx\n", ss[i], x);
        std::sort(lu+nlu, lu+tn);
        nlu = std::unique(lu+nlu,lu+tn)-lu;
    }
    std::sort(lu,lu+nlu);
    lli ans = 0;
    for(int i=0;i<n;++i)
        ans += std::upper_bound(lu,lu+nlu,hashs[i]) - std::lower_bound(lu,lu+nlu,hashs[i]);
    ans -= n;
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 202376
import java.util.*;
import java.math.*;

public class Main {

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

    for (int i = 0; i < n; i++) {
      s[i] = sc.next();
    }

    int m = sc.nextInt();
    String[] t = new String[m];

    for (int i = 0; i < m; i++) {
      t[i] = sc.next();
    }

    int ans = 0;

    for (int i = 0; i < n; i++) {

      int count = 0;

      for (int j = 0; j < n; j++) {
        if (s[i].equals(s[j])) {
          count++;
        }
      }

      for (int j = 0; j < m; j++) {
        if (s[i].equals(t[j])) {
          count--;
        }
      }

      ans = Math.max(ans,count);

    }

    System.out.println(ans);

  }

}


Measured memory_bytes: 22868
#include<bits/stdc++.h>
#define int long long
using namespace std;
int32_t main()
{
    int n;
    cin>>n;
    for(int i=1;i<20;++i)
    {
        if(1000*i==n)
        {
            cout<<0;break;
        }
        else if(1000*i>n)
        {
            cout<<1000*i-n;break;
        }
    }
}

Measured memory_bytes: 3596
#include <iostream>
#include <string>

int main(){
  int n;
  std::string s;
  std::cin >> n >> s;
  std::string ans = "Yes";
  int h = n/2;
  if (n == h * 2){
    std::string a = s.substr(0,h);
    std::string b = s.substr(h,h);
    if (a != b)
      ans = "No";
  }
  else
    ans = "No";
  std::cout << ans << std::endl;
  return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define dbg(x) cout<<#x" = "<<(x)<<ln

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

string s;
int c;

int main() {
	cin >> s;
	rep(i,6) c += s[i] - '0';
	cout << c << ln;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

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

using ll = long long;
using P = std::pair<ll, ll>;

ll N;
std::map<ll, ll> cnt;
std::vector<ll> vs;

int main()
{
  std::cin >> N;

  rep( i, N )
  {
    ll A;
    std::cin >> A;

    ++cnt[A];
  }

  itr( it, cnt ) if( it->second >= 2 )
  {
    vs.emplace_back( it->first );

    if( it->second >= 4 )
      vs.emplace_back( it->first );
  }

  std::sort( rall(vs) );

  ll ans = 1;

  if( vs.size() < 2 )
    ans = 0;

  else
    ans = vs[0]*vs[1];

  std::cout << ans << std::endl;

  return 0;
}

Measured memory_bytes: 6528
input() # N
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
satisfaction = sum(b)
for dish, next_dish in zip(a, a[1:]):
    if next_dish == dish+1:
        satisfaction += c[dish-1] # because 0-indexed
print(satisfaction)

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

#define int long long

const int N = 1e2 + 10;
int n, k, mx, ar[N];

int32_t main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> k;
	for (int i = 1; i <= n; i++)
		cin >> ar[i];
	
	for (int l = 0; l <= n; l++)
		for (int r = n + 1; r > l; r--) {
			if (l + n + 1 - r > k)
				continue;
			
			vector <int> vec;
			for (int i = 1; i <= l; i++)
				vec.push_back(ar[i]);
			for (int i = r; i <= n; i++)
				vec.push_back(ar[i]);
			if (!vec.size())
				continue;
			
			int rem = k - (l + n + 1 - r), ans = 0;
			sort(vec.begin(), vec.end());
			
			int indx = 0;
			while (indx < vec.size() && rem && vec[indx] < 0)
				indx++, rem--;
			
			for (int i = indx; i < vec.size(); i++)
				ans += vec[i];
			mx = max(mx, ans);
		}
	cout << mx;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int n;
  scanf("%d", &n);
  int i, j;
  int ans=0;
  int count;
  for(i=1; i<n+1; i++){
    if(i%2==0){
      continue;
    }else{
      count=0;
      for(j=1; j<n+1; j++){
        if(i%(2*j+1)==0){
          count++;
        }
      }
    }
    if(count==7){
      ans++;
    }
  }
  
  printf("%d\n", ans);
    
  return 0;
}

Measured memory_bytes: 1712
#include <iostream>
#include <string>
#include <set>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <map>
#include <cstring>
#include <cmath>
using namespace std;
#define MAXA 1001
#define MAXB 1001
#define MAXH 1000000001
#define MAXW 405
#define INF 5000
#define MAXN 41
#define MAXM 1001
#define MAXP 1000001
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;

int N, Ma, Mb;
int dp[MAXW][MAXW], a[MAXN], b[MAXN], c[MAXN];


int main(){
    cin >> N >> Ma >> Mb;
    for(int i = 0;i < N;i++){
        cin >> a[i] >> b[i] >> c[i];
    }

    for(int i = 0;i < MAXW;i++){
        fill(dp[i], dp[i] + MAXW, INF);
    }


    dp[0][0] = 0;
    for(int i = 0;i < N;i++){
        for(int j = MAXW - 1;j >= 0;j--){
            for(int k = MAXW - 1;k >= 0;k--){
                if(j - a[i] >= 0 && k - b[i] >= 0)dp[j][k] = min(dp[j][k], dp[j - a[i]][k - b[i]] + c[i]);
            }
        }
    }


    int ans = INF;
    for(int i = 1;i * Ma < MAXW && i * Mb < MAXW;i++){
        ans = min(dp[i * Ma][i * Mb], ans);
    }

    if(ans == INF) printf("-1\n");
    else printf("%d\n", ans);

    return 0;
}

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

int main() {
	int a, b, h;
	cin >> a >> b >> h;
	cout << (a + b) * h / 2;
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり

今更言わなくても知ってると思うけど、台形の面積は(上底+下底)*高さ/2ね
分からないなら同じ台形を2個用意して、片方を180度回転させて左右どちらかにくっつけてどうぞ
それでも分からないなら平行四辺形の面積の公式を思い出してね
*/

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bool cmp(int x,int y){
    return x>y;
}
int n,k,a[52];
int main(){
    
    cin>>n>>k;
    for(int i=1;i<=n;i++)cin>>a[i];
    sort(a+1,a+1+n,cmp);
    int ans=0;
    for(int i=1;i<=k;i++){
        ans+=a[i];
    }
    int i=k;
    while(a[i]==a[i+1]){
        i++;
        ans+=a[i];
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define ITR(i,x) for(auto i=(x).begin();i!=(x).end();++i)
using namespace std;

typedef pair<int, int> P;
typedef long long ll;
const int mod = 1000000007;

bool square(ll a){ll n=(ll)sqrt(a);return a==n*n;}
int digitsum(ll N,int a);//a進数におけるNの各桁の和、計算量はloga(N)
ll mpow(ll x, ll n);
ll inv_mod(ll a){return mpow(a,mod-2);}
int gcd(int x,int y){return y ? gcd(y,x%y) : x;};//xとyの最大公約数
int lcm(int x,int y){return x*y/gcd(x,y);}//xとyの最小公倍数

int main(){
    int N;
    cin>>N;
    ll L[87];
    L[0]=2;
    L[1]=1;
    REP(i,N-1) L[i+2]=L[i+1]+L[i];
    cout<<L[N]<<endl;
}

int digitsum(ll N,int a){
    if(N==0) return 0;
    int ret=0;
    ret+=digitsum(N/a,a)+N%a;
    return ret;
}
ll mpow(ll x, ll n){ //x^n(mod division) ←普通にpow(x,n)では溢れてしまうため，随時mod計算 2分累乗法だから早い
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % mod;
        x = x*x % mod;
        n = n >> 1;
    }
    return ans;
}
/*
class Factorial{//階乗とその逆元を求めて計算に利用するクラス
private:
    vector<ll> fac;
public:
    
    Factorial(ll N){
        fac.push_back(1);
        for(int i=0;i<N;i++) fac.push_back(fac[i]*(i+1)%mod);
    }

    ll fact(ll a){return fac[a];}
    ll ifact(ll a){return inv_mod(fac[a]);}

    ll cmb(ll a,ll b){
        if(a==0&&b==0) return 1;
        if(a<b||a<0) return 0;
        ll tmp =ifact(a-b)*ifact(b)%mod;
        return tmp*fac[a]%mod;
    }
};
*/

/*
class UnionFind{//UnionFind木
 private:
    vector<int> Parent;
 public:
    UnionFind(int N){
        for(int i=0;i<N;i++) Parent.push_back(-1);
    }

    int root(int A){
        if(Parent[A]<0) return A;
        return Parent[A]=root(Parent[A]);
    }

    int size(int A){
        return -Parent[root(A)];
    }

    bool connect(int A,int B){
        A=root(A);
        B=root(B);
        if(A==B) return false;
        if(size(A)<size(B)) swap(A,B);
        Parent[A]-=Parent[B];
        Parent[B]=A;
    }
};
*/

Measured memory_bytes: 256