akhauriyash/Code-Regression huggingface dataset:
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}

const ll INF = 1LL<<60;
ll n;
ll a[575],b[575];

//区間[l,r)の最小の総和
ll dp[575][575];
bool visited[575][575];

//区間[l,r)の総和
ll get(ll l, ll r){
  ll res = b[r];
  if(l) res -= b[l-1];
  return res;
}

ll dfs(ll l, ll r){
  if(l == r) return 0;
  if(visited[l][r]) return dp[l][r];

  visited[l][r] = true;
  ll res = INF;
  //分裂させて和を足す
  FOR(i, l, r) {
    res = min(res, dfs(l, i)+dfs(i+1, r)+get(l, r));
    //res %= MOD;
  }
  return dp[l][r] = res;
}

int
main(void){  

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

  int l=0, r=n;
  REP(i, n) REP(j, n) dp[i][j] = INF;
  
  b[0] = a[0];
  FOR(i,1,n) b[i] = b[i-1]+a[i];

  cout << dfs(0, n-1) << endl;
  
  return 0;
}


Measured memory_bytes: 2304
//#pragma GCC optimize(2)
//ÄÏ¾©ÊÐµÚÈýÇøOIÎ¯ÌáÐÑÄú£º
//´úÂëÇ§ÍòÌõ£¬-O2µÚÒ»Ìõ¡£
//-O2²»¹æ·¶£¬³¬Ê±Á½ÐÐÀá¡£
// Happy TLE and WA every day!
// by: zxb
#include<bits/stdc++.h>
#define mp              make_pair
#define rep(i,n)        for(int i = 0; i < n; i++)
#define foreach(i,c)    for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define BINF            0x7fffffff
#define INF             0x3f3f3f3f
#define LINF            4557430888798830399
#define pb              push_back
#define F               first
#define S               second
#define Time            clock()/CLOCKS_PER_SEC
#define read            ZXBs_fast_input
#define write           ZXBs_fast_output
//#define usingFiles
using namespace std;

typedef unsigned int ui;
typedef pair<int, int> pii;
typedef long long ll;

inline bool read(int& x){
	x = 0;
	int c;
	int sign = 1;
	while( (c = getchar()) < '0' || c > '9' ) if(c == '-') sign = -1;
	x = c ^ '0';
	while( (c = getchar()) >= '0' && c <= '9' ) x = (x<<3) + (x<<1) + (c ^ '0');
	x *= sign;
	return 1;
}

inline bool write(int x){
	if(x >= 10) write(x / 10);
	putchar(x % 10 + '0');
	return 1;
}

const int rp = 666666;
const bool debug = 1;
const bool I_good_vegetable_a = 1;

int n;
bool F[111][15];
int P[111][15];
bool chs[15];

signed main(){
	ios::sync_with_stdio(false);
	#ifdef usingFiles
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	cin >> n;
	rep(i, n){
		rep(j, 10) cin >> F[i][j];
	}
	rep(i, n){
		rep(j, 11) cin >> P[i][j];
	}
	ll mx = -LINF;
	for(int i = 1; i < 1024; i++){
		rep(j, 10){
			chs[j] = (i>>j) & 1;
		}
		ll sum = 0;
		rep(j, n){
			int cnt = 0;
			rep(k, 10){
				cnt += (F[j][k] && chs[k]);
			}
			sum += P[j][cnt];
		}
		mx = max(mx, sum);
	}
	cout << mx << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

//AtCoder Beginner Contest 118
//B	Foods Loved by Everyone
public class Main {

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

		List<List<Integer>> inList = new ArrayList<>();
		for (int i = 0; i < N; i++) {
			int K = sc.nextInt();
			List<Integer> inListK = new ArrayList<>();
			for (int j = 0; j < K; j++) {
				inListK.add(sc.nextInt());
			}
			inList.add(inListK);
		}
		sc.close();

		int[] Ms = new int[M];
		for (int i = 0; i < Ms.length; i++) {
			Ms[i] = 0;
		}

		for (List<Integer> list : inList) {
			for (Integer i : list) {
				Ms[i.intValue()-1]++;
			}
		}

		int kind = 0;
		for (int i = 0; i < Ms.length; i++) {
			if (Ms[i] == N) {
				kind++;
			}
		}

		System.out.println(kind);
	}
}


Measured memory_bytes: 24404
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define P pair<ll, ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
constexpr ll mod = 1000000007;
constexpr ll INF = (1ll << 60);
constexpr double pi = 3.14159265358979323846;
template <typename T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}

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

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());

    cout << B[0] + A[N - 1] << "\n";

    return 0;
}

Measured memory_bytes: 4844
using System;
using System.Linq;

namespace B___Five_Dishes
{
    class Program
    {
        static void Main(string[] args)
        {
            var dishes = new int[5];
            dishes[0] = int.Parse(Console.ReadLine());
            dishes[1] = int.Parse(Console.ReadLine());
            dishes[2] = int.Parse(Console.ReadLine());
            dishes[3] = int.Parse(Console.ReadLine());
            dishes[4] = int.Parse(Console.ReadLine());

            var provideDishes = dishes.Select(x => x % 10).Where(x => x>0);

            int lastDish;
            if(provideDishes.Any())
            {
                lastDish = provideDishes.Min()%10;
            }else
            {
                lastDish = 10;
            }

            var time = dishes.Select(s => (int)(Math.Ceiling((decimal)s/10)*10)).Sum() - 10 + lastDish;

            Console.WriteLine(time);
        }
    }
}


Measured memory_bytes: 11348
using System;

namespace ABC043A{
    public class Program{
        public static void Main(string[] args){
            var sr = new StreamReader();
            //---------------------------------
            var N = sr.Next<int>();
            Console.WriteLine(N * (N + 1) / 2);
            //---------------------------------
        }
    }

    public class StreamReader{
        private readonly char[] _c = {' '};
        private int _index = -1;
        private string[] _input = new string[0];

        public T Next<T>(){
            if(_index == _input.Length - 1){
                _index = -1;
                while(true){
                    string rl = Console.ReadLine();
                    if(rl == null){
                        if(typeof(T).IsClass) return default(T);
                        return (T)typeof(T).GetField("MinValue").GetValue(null);
                    }
                    if(rl != ""){
                        _input = rl.Split(_c, StringSplitOptions.RemoveEmptyEntries);
                        break;
                    }
                }
            }
            return (T)Convert.ChangeType(_input[++_index], typeof(T), System.Globalization.CultureInfo.InvariantCulture);
        }

        public T[] Next<T>(int x){
            var ret = new T[x];
            for(var i = 0; i < x; ++i) ret[i] = Next<T>();
            return ret;
        }

        public T[][] Next<T>(int y, int x){
            var ret = new T[y][];
            for(var i = 0; i < y; ++i) ret[i] = Next<T>(x);
            return ret;
        }
    }
}

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

using namespace std;

int main(void) {
  int n, k;
  while (cin >> n >> k, n) {
    set<int> st;
    for (int i = 0; i < k; i++) {
      int a;
      cin >> a;
      st.insert(a);
    }

    vector<int> up(n + 1, 1), dw(n + 1, 1);
    for (int i = 2; i <= n; i++) {
      if (st.find(i) == st.end()) continue;
      if (st.find(i - 1) == st.end()) continue;
      dw[i] += dw[i - 1];
    }
    for (int i = n - 1; i >= 0; i--) {
      if (st.find(i) == st.end()) continue;
      if (st.find(i + 1) == st.end()) continue;
      up[i] += up[i + 1];
    }

    int ans = 0;
    if (st.find(0) == st.end()) {
      for (int i = 1; i <= n; i++) {
        ans = max(ans, up[i] + dw[i] - 1);
      }
    } else {
      for (int i = 1; i <= n; i++) {
        if (st.find(i) != st.end()) continue;
        int sum = 1;
        if (i + 1 <= n && st.find(i + 1) != st.end()) sum += up[i + 1];
        if (i - 1 >= 1 && st.find(i - 1) != st.end()) sum += dw[i - 1];
        ans = max(ans, sum);
      }
    }

    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 7244
n = int(input())
c = [int(input()) for _ in range(n)]
MOD = 10 ** 9 + 7

dp = [0] * (n + 1)
dp[0] = 1
prev = [-1] * (10 ** 6)
for i, x in enumerate(c):
    dp[i + 1] = dp[i]
    if 0 <= prev[x] < i:
        dp[i + 1] += dp[prev[x]]
        dp[i + 1] %= MOD
    prev[x] = i + 1
print(dp[n])


Measured memory_bytes: 26776
#include <cstdio>
#include <algorithm>
#include <cstring>

using namespace std;

char sir[310];
int d[310][310][160];

int main()
{
    //freopen("file.in","r",stdin);
    //freopen("file.out","w",stdout);
    int k1;
    scanf("%s\n",sir+1);
    int n=strlen(sir+1);
    scanf("%d",&k1);
    if(k1>=n/2) {printf("%d",n);return 0;}
    for(int l=0;l<n;l++)
        for(int i=1;i<=n-l;i++)
            for(int k=0;k<=k1;k++)
            {
                int j=i+l;
                if(i==j) d[i][j][k]=1;
                else if(i==j-1)
                {
                    if(k>0 or sir[i]==sir[j]) d[i][j][k]=2;
                    else d[i][j][k]=1;
                }
                else
                {
                    d[i][j][k]=max(d[i+1][j][k],d[i][j-1][k]);
                    if(sir[i]==sir[j]) d[i][j][k]=max(d[i][j][k],d[i+1][j-1][k]+2);
                    if(k>0) d[i][j][k]=max(d[i][j][k],d[i+1][j-1][k-1]+2);
                }
            }
    printf("%d",d[1][n][k1]);
    return 0;
}


Measured memory_bytes: 59392
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);

    int N = scan.nextInt();
    int M= scan.nextInt();
    int[][] array = new int[N][2];
    for (int i = 0; i < M; i++) {
      int mondai = scan.nextInt() - 1;
      if ( " AC".equals(scan.nextLine())) {
        array[mondai][1] = 1;
      } else {
        if (array[mondai][1] != 1) {
          array[mondai][0] += 1;
        }
      }
    }
    int waResultCount = 0;
    int acResultCount = 0;
    for (int i = 0; i < N; i++) {
      if (array[i][1] == 1) {
        acResultCount += 1;
        waResultCount += array[i][0];
      }
    }
    System.out.println(acResultCount + " " + waResultCount);
  }
}


Measured memory_bytes: 163604
#include<bits/stdc++.h>
#define INF (1e10)
#define mp make_pair
#define pb push_back
#define A 0
#define B 1
#define C 2
using namespace std;
typedef long long int lo;
lo dp[10000005],arr[50000005],n,k;
lo f(lo i){
	if(i == n) return 0;
    if(i > n) return INF;
    if(dp[i] != -1) return dp[i];
    lo mini = INF;
    for(lo j = 1;j <= k;j++){
        lo s = f(i + j) + abs(arr[i] - arr[i + j]);
        if(s < mini){
            mini = s;
        }
    }
    return dp[i] = mini;
}
int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
	cin >> n >> k;
    memset(dp,-1,sizeof dp);
	for(lo i=1;i<=n;i++){
		cin >> arr[i];
	}
	cout <<f(1);
}

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

#define deb(x) cout << #x << " " << x << "\n";
#define fo(i, n) for(i=0; i<n; i++)
#define Fo(i, k, n) for(i=k; i<n; i++)
#define endl "\n"
#define ll long long
#define vi vector<int>



int main() {
#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif
	ios::sync_with_stdio(0);
	cin.tie(0);

	ll sum = 0, i, n;

	cin >> n;

	Fo(i, 1, n + 1) {
		ll j = n / i;
		sum += i * j * (j + 1) / 2;
	}

	cout << sum;

	return 0;
}

Measured memory_bytes: 3660
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
#define vv(a,b,c,d) vector<vector<a> >(b,vector<a>(c,d))
#define vvv(a,b,c,d,e) vector<vector<vector<a> > >(b,vv(a,c,d,e))
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

int H, W;

void f(vector<string> S) {
    if (W % 2)
        rep(y, H / 2)
            if (S[y][W / 2] != S[H - 1 - y][W / 2])
                return;

    rep(b, W / 2) {
        bool ok = false;
        FOR(c, b + 1, W - b) {
            if (W % 2 && c == W / 2)continue;
            ok = [&] {
                rep(a, H)
                    if (S[a][b] != S[H - 1 - a][c])
                        return false;
                return true;
            }();
            if (ok) {
                rep(a, H)
                    swap(S[a][c], S[a][W - 1 - b]);
                break;
            }
        }
        if (!ok) return;
    }
    cout << "YES" << endl;
    exit(0);
}

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

    cin >> H >> W;

    vector<string> S(H);
    rep(y, H)cin >> S[y];

    // 行のペアの作り方は最大
    // C(12, 2) * C(10, 2) * C(8, 2) * C(6, 2) * C(4, 2) / 6!
    // = 10395通り

    using P = set<pii>;
    vector<set<P> > A(1ll << H);
    A[0].insert(P());

    rep(T, (1 << H)) {
        rep(a, H)FOR(b, a + 1, H)if (!(T >> a & 1) && !(T >> b & 1)) {
            for(auto p:A[T]) {
                p.insert(mp(a, b));
                A[T | (1 << a) | (1 << b)].insert(p);
            }
        }
    }

    rep(T, 1 << H) {
        int p = 0, r = -1;
        rep(a, H) {
            if (T >> a & 1)p++;
            else r = a;
        }
        if (p % 2 != 0 || (p != H&&p != H - 1))continue;

        each(q, A[T]) {
            auto U = S;
            int row = 0;
            each(s, q) {
                U[row] = S[s.first];
                U[H - 1 - row] = S[s.second];
                row++;
            }

            if (H % 2) U[H / 2] = S[r];

            if (W % 2) {
                rep(b, W) {
                    rep(a, H)swap(U[a][b], U[a][W / 2]);
                    f(U);
                    rep(a, H)swap(U[a][b], U[a][W / 2]);
                }
            } else {
                f(U);
            }
        }
    }

    cout << "NO" << endl;
}

Measured memory_bytes: 43008
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

int n;
vector<vll> solve(vi a){
    vector<vll> dp(n + 1, vll(3, inf));
    dp[0][0] = 0;

    rep(i, n){
        rep(j, 3){
            ll cur = dp[i][j];
            if(cur == inf) continue;
            // cerr << "(i, j) = " << i << ", " << j << ": " << cur << endl;
            
            if(j == 0){
                chmin(dp[i+1][0], cur + a[i]);
            } 
            if(j == 0 or j == 1){
                chmin(dp[i+1][1], cur + a[i] % 2 + (a[i] == 0 ? 2:0));
            }
            chmin(dp[i+1][2], cur + (a[i] + 1) % 2);
        }
    }
    // cerr << endl;

    return dp;
}

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

    cin >> n;
    vi a(n); for(auto& e : a) cin >> e;

    auto dp1 = solve(a);
    reverse(_all(a));
    auto dp2 = solve(a);

    ll res = inf;
    rep(i, n+1){
        rep(j, 3) rep(k, 3){
            chmin(res, dp1[i][j] + dp2[n - i][k]);
        }
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 23792
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
int dp[1100][1100];
const int mod = 1000000007;
signed main(){
    int h,w;cin >> h >> w;
    vector<string> f(h);
    rep(i,h)cin >> f[i];
    dp[1][1] = 1;
    rep(i,h)rep(j,w){
        if(f[i][j] == '#')continue;
        dp[i+1][j+1] =(dp[i+1][j+1]+dp[i+1][j])%mod;
        dp[i+1][j+1] = (dp[i+1][j+1] + dp[i][j+1])%mod;
    }
    //rep(i,h+1){
    //    rep(j,w+1)cout << dp[i][j] << " ";
    //    cout << "\n";
    //}
    cout << dp[h][w]%mod << endl;

    return 0;
}

Measured memory_bytes: 14004
#include <stdio.h>
#include <string.h>

int main() {
	char sun[] = "Sunny";
	char clo[] = "Cloudy";
	char rai[] = "Rainy";
	char s[256];

	gets(s, 256);
	if (strcmp(sun, s) == 0) {
		printf("%s\n", clo);
	}
	else if (strcmp(clo, s) == 0) {
		printf("%s\n", rai);
	}
	else {
		printf("%s\n", sun);
	}

	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main()
{
  int i,j,n,key;
  int A[100];

  scanf("%d",&n);
  for (i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

  for (j=1;j<n;j++){
    for (i=0;i<n-1;i++){
      printf("%d ",A[i]);
    }
    printf("%d\n",A[n-1]);
    key=A[j];
    i=j-1;
    while ((i>=0) && (A[i]>key)){
      A[i+1]=A[i];
      i=i-1;
    }
    A[i+1]=key;
  }
  for (i=0;i<n-1;i++){
    printf("%d ",A[i]);
  }
  printf("%d\n",A[n-1]);
  return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
int main(){
    int y,m,d;
    char c;
    cin >> y >> c >> m >> c >>d;
     
    // cout << "y:" << y << endl;
    // cout << "m:" << m << endl;
    // cout << "d:" << d << endl;
    if(y<=2019&&m<=4){
        cout<<"Heisei"<<endl;
    }else if(y<=2018){
        cout<<"Heisei"<<endl;
    }else{
        cout<<"TBD"<<endl;
    }
}

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

// Problem 
// 1st C++ Try
// Reference1 https://img.atcoder.jp/arc090/editorial.pdf
// Reference2 https://atcoder.jp/contests/arc090/submissions/2033343

int main(void){
    int answer;
    answer = 0;
    int N;
    cin >> N;
    vector<int> A1;
    vector<int> A2;
    A1.clear();
    A2.clear();
    for(int j=0;j<N;j++){
        int candy;
        cin >> candy;
        A1.push_back(candy);
    }
    for(int j=0;j<N;j++){
        int candy;
        cin >> candy;
        A2.push_back(candy);
    }
    int nowmax;
    nowmax=0;
    for(int j=0;j<N;j++){
        int nowsum;
        nowsum = 0;
        for(int k=0;k<=j;k++){
            nowsum = nowsum + A1.at(k);
        }
        for(int k=j;k<N;k++){
            nowsum = nowsum + A2.at(k);
        }
        if(nowmax < nowsum){
            nowmax = nowsum;
        }
    }
    answer = nowmax;
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 256
import std.stdio,
       std.string,
       std.conv;

void main() {
  int N = readln.chomp.to!(int);
  int[] a = readln.chomp.split.to!(int[]);

  int[int] mp;
  for (int i = 0; i < N; i++) {
    mp[a[i]]++;
  }

  int ans;
  foreach (m; mp.byKey) {
    if (m <= mp[m]) {
      ans += mp[m] - m;
    }
    else {
      ans += mp[m];
    }
  }

  writeln(ans);
}


Measured memory_bytes: 9304
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder bd = new StringBuilder();

        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i=0; i<N; i++) {
            A[i] = sc.nextInt();
        }

        int counter = bubbleSort(A, N);
        for (int i=0; i<N-1; i++) {
            System.out.print(A[i] + " ");
        }
        System.out.println(A[N-1]);
        System.out.println(counter);
    }


    public static int bubbleSort(int[] A, int N) {
        int flag = 1;
        int count = 0;
        while (flag == 1) {
            flag = 0;
            for (int i=N-1; i>=1; i--) {
                if (A[i] < A[i-1]) {
                    int t = A[i];
                    A[i] = A[i-1];
                    A[i-1] = t;
                    flag = 1;
                    count++;
                }
            }
        }
        return count;
    }
}


Measured memory_bytes: 26300
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

void solve(void)
{
  int A, B, C, D, E, F; cin >> A >> B >> C >> D >> E >> F;
  A *= 100;
  B *= 100;

  pair<int, int> res{A, 0};
  for (int b = 0; b < 30; ++b) {
    int w2 = B * b;
    if (w2 > F) {
      break;
    }
    for (int a = 0; a < 30; ++a) {
      int w1 = A * a;
      int w = w1 + w2;
      if (w > F) {
        break;
      }
      int S = F - w;
      int M = w / 100 * E;
      for (int d = 0; d < 3000; ++d) {
        if (d * D > S) break;
        for (int c = 0; c < 3000; ++c) {
          int suger = c * C + d * D;
          if (suger > S) break;
          if (suger > M) break;
          pair<int, int> rA, rB;
          if (res.second == 0) {
            res.first = suger + w;
            res.second = suger;
            continue;
          }
          rA.first = res.first * suger;
          rA.second = res.second * suger;
          rB.first = (suger + w) * res.second;
          rB.second = suger * res.second;

          if (rA.first > rB.first) {
            res.first = suger + w;
            res.second = suger;
          }
        }
      }
    }
  }

  cout << res.first << SPACE << res.second << CRLF;
  return;
}

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

  solve();

  return 0;
}


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

using namespace std;

int N, X, Y, minx, miny, maxx, maxy; vector<int> x, y, c1, c2;

int main()
{
	scanf("%d", &N);

	for (int i = 0; i < N; i++)
	{
		scanf("%d", &X);
		scanf("%d", &Y);

		x.push_back(X + Y);
		y.push_back(X - Y);
	}

	minx = *min_element(x.begin(), x.end());
	miny = *min_element(y.begin(), y.end());
	maxx = *max_element(x.begin(), x.end());
	maxy = *max_element(y.begin(), y.end());

	for (int i = 0; i < N; i++)
	{
		c1.push_back(min(max(x[i] - minx, y[i] - miny), max(maxx - x[i], maxy - y[i])));
		c2.push_back(min(max(maxx - x[i], y[i] - miny), max(x[i] - minx, maxy - y[i])));
	}

	printf("%d\n", min(*max_element(c1.begin(), c1.end()), *max_element(c2.begin(), c2.end())));

	return 0;
}

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

using namespace std;

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

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

    vector<vector<long long>> dp(n + 1, vector<long long>(2551, 0));
    dp[0][0] = 1;
    for (int i = 0; i < n; i++) {
        vector<vector<long long>> next(n + 1, vector<long long>(2551, 0));
        for (int j = 0; j < n; j++) {
            for (int k = 0; k <= 2500; k++) {
                next[j][k] = dp[j][k];
            }
        }

        for (int j = 0; j < n; j++) {
            for (int k = 0; k <= 2500; k++) {
                next[j + 1][k + x[i]] += dp[j][k];
            }
        }

        dp = next;
    }

    long long res = 0;
    for (int i = 1; i <= n && i * a <= 2500; i++) {
        res += dp[i][i * a];
    }

    cout << res << endl;
}


Measured memory_bytes: 2352
import numpy as np

N,M,C = map(int,input().split())
B=np.array(list(map(int,input().split())))
ans=0

for i in range(N):
  A=np.array(list(map(int,input().split())))
  if sum(A*B)+C > 0:
    ans+=1
print(ans)


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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

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

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

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 1e9+7;


int main(){
	//ios_base::sync_with_stdio(false);
	int N, K, ans=0;
	set<int> D;
	
	cin >> N >> K;
	rep(i,K){
		int d;
		cin >> d;
		D.insert(d);
	}

	ans = N;
	while(true){
		int a = ans;
		bool f = true;
		while(a){
			if( D.count(a%10) ) f = false;
			a /= 10;
		}
		if(f) break;
		ans++;
	}

	cout << ans << endl;

	return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> M(N-1);
  
  for(int i = 0; i < N-1; i++){
      cin >> M.at(i);
  }
  vector<int> A(N);

  A.at(0) = M.at(0);
  A.at(N-1) = M.at(N-2);

  for(int i = 1; i < N-1; i++){
      A.at(i) = min(M.at(i-1),M.at(i));
  }
  int B = 0;

  for(int i = 0; i < N; i++){
      B = A.at(i) + B;

  }
  cout << B << endl;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    int N,M;
    cin>>N>>M;
    vii v(M,vi(2));
    rep(i,M) {
        rep(j,2) {
            cin>>v[i][j];
        }
    }
    int counter=0;
    for(int i=1; i<=N; i++) {
        rep(j,M) {
            rep(k,2) {
                if(v[j][k]==i) counter++;
            }
        }
        cout<<counter<<endl;
        counter=0;
    }
}

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

int main() {
  int N,M;
  cin>>N>>M;
  int l,r;
  cin>>l>>r;
  int min=l;
  int max=r;
  for(int i=0;i<M-1;i++){
    cin>>l>>r;
    if(l>=min)min=l;
    if(r<=max)max=r;
  }
  int ans =max-min+1;
  if(ans<0)ans=0;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
n = int(input())
stores = []
for i in range(n):
    s, p = input().split()
    p = int(p)
    stores.append({'id': i+1, 'city': s, 'point': p})
stores_sorted = sorted(stores, key=lambda x:x['point'], reverse=True)
stores_sorted = sorted(stores_sorted, key=lambda x:x['city'])
for store in stores_sorted:
    print(store['id'])

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


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

   


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

lli n;
string s, t;

int main(void){
	cin >> n >> s >> t;
	lli ans = 2*n;
	rep(i, n){
		if(s.substr(i, n-i) == t.substr(0, n-i)){
			ans = min(ans, n+i);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3644
def main():
    T1, T2 = map(int, input().split())
    A1, A2 = map(int, input().split())
    B1, B2 = map(int, input().split())
    D1 = (B1 - A1) * T1
    D2 = (B2 - A2) * T2
    if D1 + D2 == 0:
        print('infinity')
    elif (D1 >= 0 and D2 >= 0) or (D1 <= 0 and D2 <= 0):
        print(0)
    elif (D1 >= 0 and D1 + D2 >= 0) or (D1 <= 0 and D1 + D2 <= 0):
        print(0)
    else:
        diff = abs(D1 + D2)
        top = abs(D1)
        if top % diff == 0:
            n = top // diff
            ans = 1 + 2 * n - 1
        else:
            n = top // diff
            ans = 1 + 2 * n
        print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 39896
package main

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

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	return n
}

func main() {
	sc.Split(bufio.ScanWords)
	a, b := getInt(), getInt()

	if a <= 8 && b <= 8 {
		fmt.Println("Yay!")
	} else {
		fmt.Println(":(")
	}

}


Measured memory_bytes: 640
def main():
    N, M = map(int ,input().split())
    xyz = []
    for i in range(N):
        xyz.append(list(map(int, input().split())))
    
    pxpypz = []
    pxpynz = []
    pxnypz = []
    pxnynz = []
    nxpypz = []
    nxpynz = []
    nxnypz = []
    nxnynz = []
    
    for i in range(N):
        pxpypz.append(+xyz[i][0] + xyz[i][1] + xyz[i][2])
        pxpynz.append(+xyz[i][0] + xyz[i][1] - xyz[i][2])
        pxnypz.append(+xyz[i][0] - xyz[i][1] + xyz[i][2])
        pxnynz.append(+xyz[i][0] - xyz[i][1] - xyz[i][2])
        nxpypz.append(-xyz[i][0] + xyz[i][1] + xyz[i][2])
        nxpynz.append(-xyz[i][0] + xyz[i][1] - xyz[i][2])
        nxnypz.append(-xyz[i][0] - xyz[i][1] + xyz[i][2])
        nxnynz.append(-xyz[i][0] - xyz[i][1] - xyz[i][2])
      
    pxpypz.sort(reverse=True)
    pxpynz.sort(reverse=True)
    pxnypz.sort(reverse=True)
    pxnynz.sort(reverse=True)
    nxpypz.sort(reverse=True)
    nxpynz.sort(reverse=True)
    nxnypz.sort(reverse=True)
    nxnynz.sort(reverse=True)
    
    ans = max(sum(pxpypz[:M]),
              sum(pxpynz[:M]),
              sum(pxnypz[:M]),
              sum(pxnynz[:M]),
              sum(nxpypz[:M]),
              sum(nxpynz[:M]),
              sum(nxnypz[:M]),
              sum(nxnynz[:M]))
    
    print(ans)
    
    
if __name__ == "__main__":
    main()

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

typedef long long ll;

ll N;
ll X;
const ll MOD = 1e9 + 7;
vector<ll> Inv, Fact, InvFact;

ll choose(ll n, ll k) {
  return n < k ? 0 : Fact[n] * InvFact[k] % MOD * InvFact[n - k] % MOD;
}
int main() {
  cin >> N;
  vector<ll> first;
  first.resize(N, -1);
  for (ll i = 0; i < N + 1; ++i) {
    ll a;
    cin >> a;
    --a;
    if (first[a] >= 0) X = i + 1 - first[a];
    first[a] = i;
  }
  Inv.resize(N + 2);
  Fact.resize(N + 2);
  InvFact.resize(N + 2);
  Inv[1] = Fact[0] = Fact[1] = InvFact[0] = InvFact[1] = 1;
  for (ll i = 2; i <= N + 1; ++i) {
    Inv[i] = MOD - (MOD / i) * Inv[MOD % i] % MOD;
    Fact[i] = i * Fact[i - 1] % MOD;
    InvFact[i] = Inv[i] * InvFact[i - 1] % MOD;
  }
  for (ll k = 1; k <= N + 1; ++k) {
    cout << (choose(N + 1, k) + MOD - choose(N + 1 - X, k - 1)) % MOD << endl;
  }
  return 0;
}


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

const int N = 32e4;

string s[N];
int a[N], r[N];

bool cmp(int x, int y)
{
	if (s[x] == s[y])
		return a[x] > a[y];
	return s[x] < s[y];
}

int main()
{
	ios::sync_with_stdio();
	int n;
	cin>>n;
	for (int i = 0; i < n; i++)
	{
		cin>>s[i]>>a[i];
		//scanf("%s%d", &s[i], &a[i]);
		r[i] = i;
	}
	sort(r, r + n, cmp);
	for (int i = 0; i < n; i++)
	{
		cout<<r[i]+1<<'\n';
		//printf("%d\n", r[i]+1);
	}
	return 0;
}

Measured memory_bytes: 3200
#include <iostream>
#include <string>
#include <cmath>

using namespace std;

//const long double PI = 3.141592653589793238462643383279;

int main()
{
	string str;
	cin >> str;
	
	int count = 0;
	for (int i = 0; i < str.size() / 2; i++) {
		if (str[i] != str[str.size() - 1 - i]) {
			count++;
		}
	}

	cout << count;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long int
using namespace std;
int ans1=0,ans2=0;
const int N=1e5+5;
int arr[N];
int recur(int n,int k)
{
  int dp[n];
    dp[0]=0;

    for(int i=1;i<n;i++){
        if(i==1){
            dp[i]=abs(arr[0]-arr[1]);
        }

        else{
               int val=1e9;
            for(int c=i-1;c>=max(0LL,i-k);c--){

                val=min(val,dp[c]+abs(arr[i]-arr[c]));

            }

            dp[i]=val;
        }
    }
//    for(int i=0;i<n;i++){
//        cout<<dp[i]<<" ";
//    }
//    cout<<endl;
    return dp[n-1];
}
signed main()
{


    int n;
    cin>>n;

    int mat[n][3];

    for(int i=0;i<n;i++){
        int a,b,c;
        cin>>a>>b>>c;
        mat[i][0]=a;
        mat[i][1]=b;
        mat[i][2]=c;
    }

   int dp[n][3];
    dp[0][0]=mat[0][0];
    dp[0][1]=mat[0][1];
    dp[0][2]=mat[0][2];


    for(int i=1;i<n;i++){
        dp[i][0]=mat[i][0]+max(dp[i-1][1],dp[i-1][2]);
        dp[i][1]=mat[i][1]+max(dp[i-1][0],dp[i-1][2]);
        dp[i][2]=mat[i][2]+max(dp[i-1][0],dp[i-1][1]);
    }
    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));


    return 0;
}

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

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        // [1-1]:top
        // [2-1]:south
        // [3-1]:east
        // [4-1]:west
        // [5-1]:north
        // [6-1]:down
        int[] n = new int[6];
        for (int i = 0; i < 6; i++) {
            n[i] = Integer.parseInt(sc.next());
        }
        Dice dice = new Dice(n[0], n[1], n[2], n[3], n[4], n[5]);

        int q = Integer.parseInt(sc.next());
        for (int i = 0; i < q; i++) {
            int top = Integer.parseInt(sc.next());
            int south = Integer.parseInt(sc.next());
            dice.rotation(top, south);
            out.printf("%d\n", dice.getEast());
        }
        out.flush();
    }
}

class Dice {
    private int top;
    private int south;
    private int east;
    private int west;
    private int north;
    private int down;
    Dice(int in_top, int in_south, int in_east, int in_west, int in_north, int in_down) {
        top = in_top;
        south = in_south;
        east = in_east;
        west = in_west;
        north = in_north;
        down = in_down;
    }
    public void rotation(int top_val, int south_val) {
        if (top == top_val && south == south_val) {
            return;
        }
        if (south != south_val) {
            if (top == south_val) {
                this.toSouth();
            } else if (east == south_val) {
                this.toWest();
                this.toSouth();
            } else if (west == south_val) {
                this.toEast();
                this.toSouth();
            } else if (north == south_val) {
                this.toSouth();
                this.toSouth();
            } else if (down == south_val) {
                this.toNorth();
            }
            rotation(top_val, south_val);
        } else {
            if (east == top_val) {
                this.toWest();
            } else if (west == top_val) {
                this.toEast();
            } else {
                this.toWest();
                this.toWest();
            }
        }
    }
    public void toNorth() {
        int temp = top;
        top = south;
        south = down;
        down = north;
        north = temp;
    }
    public void toSouth() {
        int temp = top;
        top = north;
        north = down;
        down = south;
        south = temp;
    }
    public void toEast() {
        int temp = top;
        top = west;
        west = down;
        down = east;
        east = temp;
    }
    public void toWest() {
        int temp = top;
        top = east;
        east = down;
        down = west;
        west = temp;
    }
    public int getTop() {
        return top;
    }
    public int getEast() {
        return east;
    }
}


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

typedef long long          ll;
typedef long double        ld;
typedef unsigned long long ull;
typedef vector<ll>         vl;
typedef vector<vl>         vvl;
typedef pair<ll,ll>        pll;
typedef vector<pll>        vpll;

#define ff          first
#define ss          second
#define mp          make_pair
#define mt          make_tuple
#define pb          push_back
#define eb          emplace_back
#define fr(i,n)     for(ll i = 0; i < n; ++i)
#define frs(i,s,n)  for(ll i = s; i < n; ++i)
#define frb(i,s,e)  for(ll i = s; i <= e; ++i)
#define rfr(i,n)    for(ll i = n-1; i >= 0; i--)
#define frbr(i,e,s) for(ll i = e; i >= s; i--)
#define all(x)      (x).begin(), (x).end()
#define sz(x)       ((ll)(x).size())

#ifdef LOCAL
#include </home/udaya_bhaskar/Desktop/debugger.h>
#else
#define dbg(x...)      {}
#define dbg_arr(a,n)   {}
#define dbg_mat(m,r,c) {}
#define dbg_time()     {}
#endif

const ll MOD  = 1e9+7; // 998244353;
const ll INF  = 1e18;
const ll MAX  = 100100;


		
namespace factorizer 
{
    const ll N = 1'000'100;
    ll lp[N+1];
    vl pr;
 
    void sieve()
    {
        for (ll i = 2; i <= N; ++i) 
        {
            if (lp[i] == 0) 
            {
                lp[i] = i;
                pr.eb(i);
            }
            for (ll j = 0; j < sz(pr) && pr[j] <= lp[i] && 1LL * i * pr[j] <= N; ++j)
                lp[i * pr[j]] = pr[j];
        }
    }
 
    vpll pfact(ll x)
    { 
        vpll factors;
        while(x > 1)
        {
            ll cnt = 0;
            ll p = lp[x];
            while(x % p == 0)
            {
                x /= p;
                cnt++;
            }
            factors.eb(p, cnt);
        }
        return factors;
    }
 
    vl build_divisors(const vpll & factors) 
    {
        vl divisors = {1};
        for (auto & p : factors) 
        {
            ll size = sz(divisors);
            fr(i, size) 
            {
                ll cur = divisors[i];
                fr(j, p.ss)
                {
                    cur *= p.ff;
                    divisors.pb(cur);
                }
            }
        }
        sort(all(divisors));
        return divisors;
    }

    ll divisors(ll x)
    {
        vpll v1 = pfact(x);
        ll ans = 1;
        for(auto p: v1)
          ans *= (1 + p.ss);
        return ans;
    }
}

using namespace factorizer;


void pre()
{
  factorizer::sieve();
  // prepare_factorials();
}



void solve()
{
  ll n; cin >> n;
  ll ans = 0;
  frb(i, 1, n - 1)
   ans += divisors(i);
  cout << ans << "\n";
}




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

#ifdef LOCAL
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  // cout << fixed << setprecision(15);
  
  pre();

  ll t = 1;
  // cin >> t;
  frb(CASE, 1, t)
  {
    // cout << "Case #" << CASE << ": ";
    // dbg(CASE);
    solve();
  }

  dbg_time();
  
  return 0;
}     
     


Measured memory_bytes: 12024
#include<bits/stdc++.h>
using namespace std;
#define faster_io ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
#define bug(a)       cerr << #a << " : " << a << endl;
#define itc(n) char(n+48)
#define cti(ch) (ch-48)
template<class T>void ExEuclid(T n, T m, T &a, T &b, T &gcd){if(m==0){gcd=n;a=1;b=0;return;}ExEuclid(m,n%m,a,b,gcd);T x=a;a=b;b=x-(n/m)*a;}
template<class T>T gcd(T n, T m){if(m==0){return n;}gcd(m,n%m);}
template<class T>T lcm(T n, T m){return (n*m)/gcd(n,m);}
template<class T>string to_string(T n){ostringstream convert;convert<<n;return convert.str();}
template<class T>ll to_int(T s){ll num=0,power=0;for(int i=s.size()-1; i>=0; i--)num+=(pow(10.0,power++)*(s[i]-'0'));return num;}
template<class T>bool is_mod(T n, T m){if(n%m==0)return true;return false;}
template<class T>bool is_upper(T s){for(int i=0; i<s.size(); i++)if(s[i]>90 || s[i]<65)return false;return true;}
template<class T>bool is_lower(T s){for(int i=0; i<s.size(); i++)if(s[i]>122 || s[i]<97)return false;return true;}
template<class T>bool is_palindrome(T s){T s1=s;reverse(s1.begin(),s1.end());if(s==s1)return true;return false;}
template<class T>int digit_sum(T s){int sum=0; for(int i=0; i<s.size(); i++)sum+=cti(s[i]);return sum;}
template<class T>T mod(T n, T m){return ((n%m)+m)%m;}
template<class T>T Big_mod(T base, T power, T MOD){
    if(power==1)return base;
    if(power & 1)return ((base%MOD)*(Big_mod(base,power-1,MOD))%MOD)%MOD;
    else {T temp=(Big_mod(base,power>>1,MOD));return ((temp%MOD)*(temp%MOD))%MOD;}
}
template<class T>T doStringSum(T s1, T s2){int len1=s1.length(), len2=s2.length();
    if(len1<len2)return doStringSum(s2, s1);
    T ans="";int carry=0, i, s;
    for(i=1;i<=len1;i++){s = carry+cti(s1[len1-i]);if(i<=len2)s += cti(s2[len2-i]);
    ans = itc(s%10)+ans;carry = s/10;}if(carry!=0)ans = itc(carry)+ans;
    return ans;
}
template<class T>T dostringmultiply(T s1, T s2){int len1=s1.length(), len2=s2.length();
    if(len1<len2)return dostringmultiply(s2,s1);
    int i,j,p, carry=0;T result, net="", c;
    for(i=len2-1;i>=0;i--){carry=0;result="";c="";
    for(j=len1-1;j>=0;j--){p=cti(s1[j])*cti(s2[i]);result = itc((p+carry)%10)+result;carry=(p+carry)/10;}
    if(carry!=0){c=to_string(carry);result=c+result;}
    for(j=i;j<len2-1;j++)result+="0";net=doStringSum(net,result);}
    return net;
}
template<class T>T nCr(T n, T r)
    {if(r > n - r) r = n - r;T ans = 1;T i;
    for(i = 1; i <= r; i++){ans *= n - r + i;ans /= i;}
    return ans;
}

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    faster_io;

    int n;
    string s,ss;
    cin>>s>>ss;
    int cnt=0;
    for(int i=0; i<3; i++)if(s[i]==ss[i])cnt++;
    cout<<cnt<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize ("O3")
#pragma GCC target ("avx2") 
#pragma GCC optimization ("unroll-loops")

using namespace std;
using ll = long long;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ff first
#define ss second
#define Ceil(x, y) ((x+y-1)/y)
#define pb(x) push_back(x)
#define eb(x) emplace_back(x);
const int mod = (int) 1000000007;

void solve()
{
    int d, t, s;
    cin>>d>>t>>s;
    if(t*s < d)
        cout<<"No";
    else
        cout<<"Yes";
}
 

int main(int argc, char *argv[])
{
    clock_t clk_start = clock();
    fast;
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
 
    int cases = 1;
    // cin>>cases;
    for(int i=1; i<=cases; i++)
    {
        // cout<<"Case #"<<i<<": ";
        solve();
    }
    cerr<<"Execution Time: "<<fixed<<double(clock() - clk_start)/double(CLOCKS_PER_SEC)<<setprecision(6)<<" sec\n"; 
}

Measured memory_bytes: 3820
import fractions
import collections

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

n=list(map(int, input().split()))
a=fractions.gcd(n[0], n[1])
c = collections.Counter(prime_factorize(a))
b=list(c.keys())
d=len(b)+1
print(d)

Measured memory_bytes: 5048
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
#include <queue>
#include <map>
#include <set>
using namespace std;
using Int = int64_t;
const Int INF = 1<<30;
const Int MOD = (Int)1e9 + 7;
const Int MAX_N = (Int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

void solve()
{
    Int A, B; cin >> A >> B;
    cout << A * B << endl;
}

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

Measured memory_bytes: 3652