akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>

using namespace std;
typedef long long ll;
#define pl pair<ll,ll>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define dbg(x) cout << #x"="<< (x) << endl
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a) 
#define in(x) cin >> x;
#define all(x) (x).begin(), (x).end()
#define INF 2147483600
#define fi first
#define se second

int main(){
	ll x,i;
	cin>>x;
	for(i=1;i<100000000;i++)
	if(i*(i+1)>=2*x)break;
	cout<<i<<endl;

    return 0;
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.math;


void main() {
    int n, q;
    scan(n, q);

    auto sd = SqrtDecomp(n);

    foreach (_ ; 0 .. q) {
        auto line = readln.split.to!(int[]);
        if (line[0] == 0) {
            sd.add(line[1] - 1, line[2], line[3]);
        }
        else {
            writeln(sd.get(line[1] - 1));
        }
    }
}

struct SqrtDecomp {
    private {
        enum rt = 512;
        int N, K;
        int[] bucket;
        int[] data;
    }

    this(int n) {
        N = n;
        K = (N + rt - 1) / rt;
        bucket = new int[](K);
        data = new int[](K * rt);
    }

    void add(int l, int r, int x) {
        foreach (k ; 0 .. K) {
            int bl = k * rt, br = (k + 1) * rt;
            if (r <= bl || br <= l) continue;
            if (l <= bl && br <= r) {
                bucket[k] += x;
            }
            else {
                foreach (i ; max(l, bl) .. min(r, br)) {
                    data[i] += x;
                }
            }
        }
    }

    int get(int idx) {
        int k = idx / rt;
        foreach (i ; k * rt .. (k + 1) * rt) {
            data[i] += bucket[k];
        }
        bucket[k] = 0;
        return data[idx];
    }
}



void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}



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

int main()
{
  int n, m;
  cin >> n >> m;
  vector<int64_t> x(m), y(m - 1);
  for (auto i = 0; i < m; i++) {
    cin >> x[i];
  }
  sort(begin(x), end(x));
  for (auto i = 1; i < m; i++) {
    y[i - 1] = x[i] - x[i - 1];
  }
  sort(begin(y), end(y), greater<>());
  int64_t sum{0};
  for (auto i = n - 1; i < m - 1; i++) {
    sum += y[i];
  }
  cout << sum << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <math.h>
#include <vector>

using namespace std;

string replace_with_str(string str, string str_from, string str_to) {
    string::size_type pos = 0;
    while (pos = str.find(str_from, pos), pos != string::npos) {
        str.replace(pos, str_from.length(), str_to);
        pos += str_to.length();
    }
    return str;
}

int main(int argc, char const *argv[]){
    int H, W;
    cin >> H >> W;
    char ans[100][100];
    int ans_i = 0;

    for(int i=0; i<H; i++){
        string line;
        cin >> line;
        cout << line <<endl;
        cout << line << endl;
    }

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            //個数
            long N = long.Parse(Console.ReadLine());
            List<string> list = new List<string>(); 
            HashSet<string> check = new HashSet<string>();
            String result = "Yes";
            //語尾
            String wordEnd = "";
            for(int i = 0; i < N; i++)
            {
                //単語取得
                string W = Console.ReadLine();
                //Hashsetに入れ込む
                check.Add(W);
                if (check.Count != i + 1)
                {
                    //ループ回数と入れ込んだ個数が違ったら
                    result = "No";
                    break;
                }
                if (wordEnd == "")
                {
                    //語尾取得
                    wordEnd = W.Substring(W.Length - 1, 1);
                }
                else
                {
                    //しりとりの確認
                    if (W.Substring(0, 1) == wordEnd)
                    {
                        //頭と語尾が同じ時
                        wordEnd = W.Substring(W.Length - 1, 1);
                    }
                    else
                    {
                        //違うとき
                        result = "No";
                        break;
                    }
                }
            }

            Console.WriteLine(result);
        }
    }
}
// 文字列の入力
//string s = Console.ReadLine();

// 整数の入力
//long n = long.Parse(Console.ReadLine());

// 文字列配列の入力
//string[] inputStrArray = Console.ReadLine().Split(' ');

// 整数配列の入力
//long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();


Measured memory_bytes: 27884
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#pragma warning( disable:4996 )
using namespace std;
typedef long long LL;
#define SWAP(a,b) (a += b,b = a - b,a -= b)
#define MIN(a, b) ((a) < (b) ? (a) : (b))

int dat[100000];

LL mini = 1e12;
map<LL, LL> m;
vector<LL> list;
LL n, cnt = 0;

LL mypow(LL n, LL m) {
	while (m >= 1) {
		n *= n;
		m--;
	}
	return n;
}

void rec(LL now, vector<LL>::iterator it) {
	if (it != list.end()) {
		for (int i = 0; i < m.count((*it)); i++) {
			vector<LL>::iterator it2 = it;
			LL newn = now * mypow((*it2), i);
			rec(newn, it2);
		}
	}
	else {
		if (mini > now + n / now - 2) {
			mini = now + n / now - 2;
		}
	}
	
}

int main(void) {
	/*int a, b;
	scanf("%d %d", &a, &b);
	if (1 <= a && a <= 9 && 1 <= b && b <= 9) {
		printf("%d\n", a * b);
	}
	else {
		printf("-1\n");
	}

	int n;
	scanf("%d", &n);
	for (int i = 9; i >= 1; i--) {
		
		if (n % i == 0) {
			if (n / i <= 9) {
				printf("Yes\n");
				return 0;
			}
			else {
				printf("No\n");
				return 0;
			}
		}
	}
	printf("No\n");*/

	
	
	scanf("%lld", &n);
	/*
	for (int i = 2; i <= sqrt(n)+1; i++) {
		if (n % i == 0) {
			dat[cnt] = i;
			n = n / i;
			i = 1;
			cnt++;
		}
	}
	
	for (int i = 0; i < cnt; i++) {
		if (m.count(dat[i])==0) {
			m.insert(make_pair(dat[i], 1));
			list.push_back(dat[i]);
		}
		else {
			m.at(dat[i])++;
		}
	}
	LL all = 1;
	/*for (vector<LL>::iterator it = list.begin(); it != list.end(); it++) {
		all *= m.count((*it)) + 1;
	}*/
	//rec(1, list.begin());
	//printf("%lld\n", mini);
	for (LL i = 1; i <= sqrt(n) + 1; i++) {
		if (n % i == 0 && mini > n / i + i - 2) {
			mini = n / i + i - 2;
		}
	}

	printf("%lld\n", mini);
	return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
k=[list(map(int,input().split())) for i in range(m)]
p=list(map(int,input().split()))

cnt=0
for i in range(2**n):
  l=[0 for j in range(n)]
  for j in range(n):
    if (i>>j)&1:
      l[j]=1

  t_cnt=0
  for j in range(m):
    on_l=0
    for x in k[j][1:]:
      x-=1
      if l[x]==1:
        on_l+=1
    if on_l%2==p[j]:
      t_cnt+=1

  if t_cnt==m:
    cnt+=1

print(cnt)

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

#define loop(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < n; ++i)
#define dump(a) cerr << #a << " = " << (a) << "(L:" << __LINE__ << ")" << endl

long long ans;
long long N,M,Q;
vector<long long> a, b, c, d;

long long score(vector<long long>& A) {
    long long sc = 0;
    rep (i, Q) {
        if (A[b[i]-1] - A[a[i]-1] == c[i]) sc += d[i];
    }
    return sc;
}

void dfs(vector<long long>& A) {
    if (A.size() == N) {
        ans = max(ans, score(A));
        return;
    }
    for (int x = A.back(); x <= M; ++x) {
        A.push_back(x);
        dfs(A);
        A.pop_back();
    }
}

void solve() {
    ans = 0;
    vector<long long>A(1,1);
    dfs(A);
    cout << ans << endl;
}

int main() {
    scanf("%lld", &N);
    scanf("%lld", &M);
    scanf("%lld", &Q);
    a = std::vector<long long>(Q);
    b = std::vector<long long>(Q);
    c = std::vector<long long>(Q);
    d = std::vector<long long>(Q);
    for (int i = 0; i < Q; i++) {
        scanf("%lld", &a[i]);
        scanf("%lld", &b[i]);
        scanf("%lld", &c[i]);
        scanf("%lld", &d[i]);
    }
    solve();
    return 0;
}


Measured memory_bytes: 3672
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#define file(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)

const int N(310), Mod(1e9 + 7);
int n, m, ans, f[N][N][N];
std::vector<std::pair<int, int> > qry[N];
void Inc(int &x, int y) { x = (x + y) % Mod; }

int main()
{
	scanf("%d%d", &n, &m), f[1][0][0] = 1;
	for (int i = 1, l, r, x; i <= m; i++)
		scanf("%d%d%d", &l, &r, &x), qry[r].emplace_back(l, x);
	for (int i = 1; i <= n; i++)
	{
		for (int j = 0, l, x; j < (int) qry[i].size(); j++)
		{
			l = qry[i][j].first, x = qry[i][j].second;
			for (int k = 0; k < i; k++)
				for (int p = 0; p <= std::max(0, k - 1); p++)
				{
					if (x == 1) { if (l <= k) f[i][k][p] = 0; }
					else if (x == 2) { if (k < l || l <= p) f[i][k][p] = 0; }
					else if (p < l) f[i][k][p] = 0;
				}
		}
		if (i == n) break;
		for (int j = 0; j < i; j++)
			for (int k = 0; k <= std::max(0, j - 1); k++) if (f[i][j][k])
			{
				Inc(f[i + 1][j][k], f[i][j][k]);
				Inc(f[i + 1][i][k], f[i][j][k]);
				Inc(f[i + 1][i][j], f[i][j][k]);
			}
	}
	for (int j = 0; j < n; j++)
		for (int k = 0; k <= std::max(0, j - 1); k++) Inc(ans, f[n][j][k]);
	printf("%lld\n", 3ll * ans % Mod);
	return 0;
}


Measured memory_bytes: 112896
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[200010];
struct edge{int to,cost;};
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
bool prime(int a){
	if(a==1)return false;
	for(int i=2;i*i<=a;i++){
		if(a%i==0)return false;
	}
	return true;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){//線分の交差判定
	double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
	double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
	double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
	double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
	return tc*td<0&&ta*tb<0;
}
void init_fact(int n){
	kaijo[0]=1;
	for(int i=1;i<=n;i++){
		kaijo[i]=kaijo[i-1]*i;
		kaijo[i]%=MOD;
	}
}
int modpow(int a,int b){
	if(b==0)return 1;
	if(b%2)return modpow(a,b-1)*a%MOD;
	int memo=modpow(a,b/2);
	return memo*memo%MOD;
}
int comb(int a,int b){
	if(b>a)return 0;
	if(a==b)return 1;
	return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int g(int x){
	x=modpow(x,MOD-2);
	return x;
}
int n,k,a[2010],x[2010],y[2010],ans;
signed main(){
	cin>>n>>k;
	rep(i,n)cin>>a[i];
	rep(i,n){
		rep(j,n){
			if(a[j]<a[i])x[i]++;
		}
	}
	rep(i,n){
		for(int j=i+1;j<n;j++){
			if(a[j]<a[i])y[i]++;
		}
	}
	rep(i,n){
		ans+=(k*y[i])%MOD;
		ans%=MOD;
		ans+=(k*(k-1)/2%MOD)*x[i]%MOD;
		ans%=MOD;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll ;
const int N=100010;
int h[N];
bool flag[N];

int main(){
    int n,m;cin >> n >> m;
    for(int i=1;i<=n;i++)cin >> h[i];
    while(m--){
        int a,b ;cin >> a >> b;
        if(h[a]==h[b])flag[a]=flag[b]=1;
        flag[h[a]>h[b]?b:a]=1;
    }
    int ans=0;
    for(int i=1;i<=n;i++)if(!flag[i])ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4132
#include<bits/stdc++.h>
#define endl '\n'
#define ll long long int
#define loop(i,a,b)           for(ll i=a;i<=b;++i)
#define pb                    push_back
#define F                     first
#define S                     second
#define mp                    make_pair
#define clr(x)                x.clear()
#define MOD                   1000000007
#define itoc(c)               ((char)(((int)'0')+c))
#define vl                    vector<ll>
#define SZ(x)                 (x).size()
#define all(p)                p.begin(),p.end()
#define mid(s,e)              (s+(e-s)/2)
#define sv()                  ll t,n; scanf("%lld",&t);n=t; while(t--)
#define tcase()               ll t,n; cin>>t;n=t; while(t--)
#define iscn(num)             scanf("%d",&num);
using namespace std;
const ll INF = 2e18 + 99;
typedef pair<ll,ll> Pair;
typedef vector<ll> vll;
bool file=0,rt=1;
clock_t tStart ;
void FAST_IO();
////////////////////////
void max_self(ll &a, ll b){
    a=max(a,b);
}
int main()
{

    FAST_IO();
    ////////////////////////
    ll n,w; scanf("%lld %lld",&n,&w);
    vll dp(w+1);
    for(int i=0;i<n ; i++){
        ll weight, value;   scanf("%lld%lld",&weight,&value);
        for(ll now_weight=w-weight; now_weight>=0 ; now_weight--){
            max_self(dp[now_weight+weight],dp[now_weight]+value);
        }
    }
    ll ans=0;
    for(int i=0; i<=w; i++)
        max_self(ans,dp[i]);
    printf("%lld\n",ans );

    ////////////////////////
    if(rt && file){
     printf("\nTime taken: %.6fs", (double)(clock() - tStart)/CLOCKS_PER_SEC);
    }
    return 0;
   }

void FAST_IO()
{
    // ios_base::sync_with_stdio(0);
    //cin.tie(NULL);
    //cout.tie(NULL);
    //cout.setf(ios::fixed);
    //cout.precision(2);
    if(rt && file){ tStart = clock(); }
    if(file){
    #ifndef _offline
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    }
}


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

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main(){
    ll n;
    cin >> n;
    vector<ll> v(n);
    map<ll, ll> mp;
    ll ans = 0;
    rep(i,n){
        cin >> v[i];
        mp[v[i]]++;
    }

    auto begin = mp.begin(), end = mp.end();
    for(auto itr = begin; itr!=end; itr++){
        ans += (itr->second)*(itr->second-1)/2;
    }

    ll tmp;
    rep(i,n){
        tmp = ans;
        tmp -= (mp[v[i]])*(mp[v[i]]-1)/2;
        tmp += (mp[v[i]]-2)*(mp[v[i]]-1)/2;
        cout << tmp << endl;
    }

    return 0;
}  


Measured memory_bytes: 12160
#include<stdio.h>
 
int main(void)
{
 int i,j;
  int a,b,k,c,d;
  
  scanf("%d",&k);
  scanf("%d",&a);
  scanf("%d",&b);
  
  c=a/k;
  d=b/k;
  
  if(c<d){
    printf("OK\n");
  }else if(a%k==0){
    printf("OK\n");
  }else{
    printf("NG\n");
  }
  
  return 0;
}

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

int main() {
	int d;
	cin >> d;
	const int n = 26;
	vector<int> c(n);
	vector<vector<int>> s(d, vector<int>(n));
	rep(i, n) cin >> c[i];
	rep(i, d) rep(j, n) cin >> s[i][j];
	vector<int> t(d), last(n);
	
	rep(i, d) cout << i%26+1 << endl;
	
	return 0;
}

Measured memory_bytes: 3680
// atcoder/abc122/D/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  while (cin >> n) {
    const int A = 0;
    const int C = 1;
    const int G = 2;
    const int T = 3;
    map<int, char> m;
    m[A] = 'A';
    m[C] = 'C';
    m[G] = 'G';
    m[T] = 'T';

    const lli mod = 1e9 + 7;

    const int N = 100 + 5;
    const int M = 4;
    lli dp[N][M][M][M];
    fill(&dp[0][0][0][0], &dp[N - 1][M - 1][M - 1][M - 1] + 1, 0);
    dp[0][T][T][T] = 1;
    for (int i = 0; i < n; ++i) {
      for (int a = 0; a < M; ++a) {
        for (int b = 0; b < M; ++b) {
          for (int c = 0; c < M; ++c) {
            for (int d = 0; d < M; ++d) {
              string s = string("") + m[a] + m[b] + m[c] + m[d];
              string t = string("")        + m[b] + m[c] + m[d];
              if (t == "AGC") continue;
              if (t == "ACG") continue;
              if (t == "GAC") continue;
              bool f = true;
              for (int i = 0; i < s.size(); ++i) {
                string u;
                for (int j = 0; j < s.size(); ++j) {
                  if (i != j) u += s[j];
                }
                f = f && (u != "AGC");
              }
              if (f) (dp[i + 1][b][c][d] += dp[i][a][b][c]) %= mod;
            }
          }
        }
      }
    }
    lli sum = 0;
    for (int i = 0; i < M; ++i) {
      for (int j = 0; j < M; ++j) {
        for (int k = 0; k < M; ++k) {
          (sum += dp[n][i][j][k]) %= mod;
        }
      }
    }
    cout << sum << endl;
  }

  return 0;
}


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

int main() {
  int n,ans;
  cin >> n;
  vector<int> a (n);
  vector<int> b (n);
  vector<int> c (n-1);
  for (int i=0; i<n; i++){
    cin >> a.at(i);
  }
  for (int i=0; i<n; i++){
    cin >> b.at(i);
  }
  for (int i=0; i<n-1; i++){
    cin >> c.at(i);
  }
  for (int i=0; i<n-1; i++){
    if (a.at(i)+1 == a.at(i+1)){
      ans += c.at(a.at(i)-1);
    }
  }
  for (int i=0; i<n; i++){
    ans += b.at(i);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair <int, int> pii;
typedef vector<int> vi;

#define mp make_pair
#define pb push_back

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)
 
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
 
const int MOD = 1000000007;
double PI = 4*atan(1);

int a[100];

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	int N,z = 0; cin >> N;
	F0R(i,N) {
	    int x; cin >> x;
	    z = max(z,x);
	    a[x]++;
	}
	if (a[z] == 1) {
	    cout << "Impossible";
	    return 0;
	}
	F0R(i,z+1) {
	    int z1 = max(i,z-i);
	    if (a[z1] == 0) {
	        cout << "Impossible";
	        return 0;
	    }
	    a[z1] --;
	}
	FOR(i,1,(z+1)/2+1) if (a[i] > 0) {
	    cout << "Impossible";
	    return 0;
	}
	cout << "Possible";
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

int main() {
  int n, m, x;
  cin >> n >> m >> x;
  vector<bool> b(n);
  REP(i, m) {
    int a;
    cin >> a;
    b[a] = true;
  }

  int ans = 0;
  int tmp = 0;
  REP(i, x) {
    if (b[i])
      ans++;
  }

  FOR(i, x, n) {
    if (b[i])
      tmp++;
  }
  cout << min(ans, tmp) << endl;
}


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

using namespace std;

int A[1000000], n;

int binarySearch(int key){
    int left = 0;
    int right = n;
    int mid;

    while(left < right){
        mid = (left + right) / 2;
        if(key == A[mid]) return 1;
        if(key > A[mid]) left = mid + 1;
        else if(key < A[mid]) right = mid;        
    }
    return 0;
}

int main(){
    int i, q, k, sum = 0;

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

    cin >> q;
    for (i = 0; i < q; i++)
    {
        cin >> k;
        if(binarySearch(k)) sum++;
    }
    
    cout << sum << endl;

    return 0;
}



Measured memory_bytes: 3440
#include <stdio.h>

#define MAX 10005
#define NIL -1

typedef struct node{
  int p,l,r;
}Node;

Node T[MAX];
int N;

void prep(int);
void inp(int);
void postp(int);

int main(){
  int i,id,l,r,root;

  scanf("%d",&N);

  for(i=0;i<N;i++){
    T[i].p = NIL;
  }

  for(i=0;i<N;i++){
    scanf("%d %d %d",&id,&l,&r);
    T[id].l = l;
    T[id].r = r;
    if(l != NIL)T[l].p = id;
    if(r != NIL)T[r].p = id;
  }

  for(i=0;i<N;i++) if(T[i].p == NIL) root = i;

  printf("Preorder\n");
  prep(root);
  printf("\nInorder\n");
  inp(root);
  printf("\nPostorder\n");
  postp(root);
  printf("\n");

  return 0;
}

void prep(int n){
  if(n == NIL) return;

  printf(" %d",n);
  prep(T[n].l);
  prep(T[n].r);
}

void inp(int n){
  if(n == NIL)return;

  inp(T[n].l);
  printf(" %d",n);
  inp(T[n].r);
}

void postp(int n){
  if(n == NIL) return;

  postp(T[n].l);
  postp(T[n].r);
  printf(" %d",n);
}



Measured memory_bytes: 2104
using System;
class Program {
    static void Main(string[] args){
        string[] input = Console.ReadLine().Split(' ');
        int n = int.Parse(input[0]); //カードの数
        int m = int.Parse(input[1]); //ゲートの数
        int min = 0, max = n;
        for(int i = 0; i < m; i++){
            string[] input2 = Console.ReadLine().Split(' ');
            min = Math.Max(min, int.Parse(input2[0]));
            max = Math.Min(max, int.Parse(input2[1]));
        }
        int res = Math.Max(0, max - min + 1);
        Console.WriteLine(res);
    }
}

Measured memory_bytes: 17216
#include <stdio.h>
#include <math.h>

int main(){
        int N;
        scanf("%d",&N);
        int A[N];
        for(int i=0;i<N;i++){
                scanf("%d", &A[i]);
        }
        int j=0,count=0;
        for(j=2;j<pow(2,34);j=j*2){
                for(int i=0;i<N;i++){
                        if(A[i]%j!=0){
                                goto fin;
                        }
                }
                count++;
        }
fin:  printf("%d",count);
        return 0;
}


Measured memory_bytes: 128
fun main(args: Array<String>) {
  val (n, k) = readLine()!!.split(" ").map { it.toInt() }
  val hList = readLine()!!.split(" ").map { it.toInt() }

  var dp = mutableMapOf<Int, Int>()
  dp[0] = 0

  for (i in 0 until hList.size) {
    val dl = dp[i]!!
    val hl = hList[i]
    for (j in 1..k) {
      val hr = hList.getOrNull(i + j) ?: break
      val dr = dl + Math.abs(hl - hr)
      dp[i + j] = dp[i + j]?.let { Math.min(it, dr) } ?: dr
    }
  }

  println(dp[n - 1])
}



Measured memory_bytes: 125728
/* Click on the checkbox for Add Custom Input and then write the input there before running the program */
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
	    Scanner input = new Scanner(System.in);
	    int[] a = new int[]{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	    int n = input.nextInt()-1;
	    System.out.println(a[n]);
	}
}

Measured memory_bytes: 23636
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <queue>
#include <cctype>
#include <climits>
#include <stack>
#include <map>
#include <cstring>
 
using namespace std;

int main(){

	string s;
	cin>>s;

	for(int i=0;i<s.size()-1;i++){
		if(s[i]=='A' && s[i+1]=='C'){
			cout<<"Yes"<<endl;
			return 0;
		}
	}

	cout<<"No"<<endl;

	return 0;
}


Measured memory_bytes: 256
def divisors(N):
    res = []
    i = 1
    for i in range(1, int(N ** 0.5)):
        if N % i == 0:
            res += [i, N // i]
    if N % i == 0:
        res.append(i)
    res.sort()
    return res

N, M = map(int, input().split())
print(max(d for d in divisors(M) if d * N <= M))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main ()
{
   int n,ans=0,x,y;
   cin>>n;
   while(n--)
   {
        cin>>x>>y;
        ans+=(y-x)+1;   
   }
   cout<<ans;
   
   
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> V;

int main() {
  int a, b;
  cin >> a >> b;
  dump((a+b)%24);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main() {
  int n, l, m;
  string s, t;
  char u, p;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> s;
    cin >> t;
    l = s.size();
    m = t.size();
    for (int i = l-1; i >= 0; --i) {
      p = s[i];
      if (p == 'P') {
	for (int j = 0; j < m; ++j) {
	  if (t[j] == '0') t[j] = '9';
	  else if ('0' < t[j] && t[j] <= '9') {
	    t[j] = t[j] - 1;
	  }
	}
      } else if (p == 'M') {
	for (int j = 0; j < m; ++j) {
	  if (t[j] == '9') t[j] = '0';
	  else if ('0' <= t[j] && t[j] < '9') {
	    t[j] = t[j] + 1;
	  }
	}
      } else if (p == 'C') {
	u = t[0];
	for (int j = 0; j < m-1; ++j) t[j] = t[j+1];
	t[m-1] = u;
      } else if (p == 'A') {
	for (int j = 0; j < m/2; ++j) {
	  u = t[m-1-j];
	  t[m-1-j] = t[j];
	  t[j] = u;
	}
      } else if (p == 'E') {
	for (int j = 0; j < m/2; ++j) {
	  u = t[m/2+m%2+j];
	  t[m/2+m%2+j] = t[j];
	  t[j] = u;
	}
      } else if (p == 'J') {
	u = t[m-1];
	for (int j = m-1; j > 0; --j) t[j] = t[j-1];
	t[0] = u;
      }
      //      cout << p << " " << t << endl;
    }
    cout << t << endl;
  }
  return 0;
}

Measured memory_bytes: 3060
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int D = sc.nextInt();
    System.out.println(Math.max(A*B, C*D));
  }
}

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

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n,x;
	cin>>n>>x;
	if(n==2){
		if(x==2){
			cout<<"Yes"<<endl;
			cout<<1<<endl<<2<<endl<<3<<endl;
		}
		else 
			cout<<"No"<<endl;
	}
	else{
		if(x==1||x==2*n-1)
			cout<<"No"<<endl;
		else{
			cout<<"Yes"<<endl;
			vector<int> v(2*n);
			int y=x+n;
			if(y>2*n-1)	y-=2*n-1;
			for(int i=1;i<=2*n-1;i++){
				v[i]=y;
				y=y%(2*n-1)+1;
			}
			for(int i=1;i<=2*n-1;i++)
				cout<<v[i]<<'\n';
		}
	}
}



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

#define pb push_back
#define ff first
#define ss second

const long long MAXN = 1e5 + 10, inf = 1e18 + 21, LG = 20;

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int a, b;
    cin >> a >> b;
    int mn = min(a, b);
    int mx = max(a, b);    
    
    int ans = mx;
    mx--;
    ans += max(mx, mn);
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <algorithm>
#include <numeric>
#include <functional>
#include <utility>
#include <bitset>
#include <cstdio>

using namespace std;
using namespace std::placeholders;

// namespace { struct NoSync { NoSync() { cin.tie(0); ios::sync_with_stdio(false); } } nosync; }

using ll = long long;
#define float double

constexpr ll INF = 999999999;
constexpr ll MOD = 1e9 + 7;

#define y0 Y0
#define y1 Y1
#define j0 J0
#define j1 J1
#define prev PREV
#define next NEXT

#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i##_len = (n), i = (i##_len) - 1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define permutations(v) sort(all(v));for(bool v##p = true; v##p; v##p=next_permutation(all(v)))
#define UNIQUE(v) (v).erase(unique(all(v)), (v).end())
#define REMOVE(v) (v).erase(remove(all(v)), (v).end())
#define ROTATE(v, n) rotate((v).begin(), (v).begin() + (n), (v).end())
#define TO_SUMS(v) partial_sum(all(v), (v).begin())
#define SUMS(srcv, dstv) partial_sum(all(srcv), (dstv).begin())
#define nth_bit(n) (1LL<<(n))

template <typename T> T high()  { return numeric_limits<T>::max(); }
template <typename T> T high(T) { return numeric_limits<T>::max(); }
template <typename T> T low()   { return numeric_limits<T>::lowest(); }
template <typename T> T low(T)  { return numeric_limits<T>::lowest(); }

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

// f には functional のオブジェクトが便利 (lambda 式も   [](int a){ return a / 2 }   みたいな)
template<class C, class F> inline C mapped(const C& c, F f){// mapっていうSTLがあるから...
    // ex: mapped(v, bind(plus<ll>(), _1, 2))   [v の各要素について x + 2]
    C r; r.reserve(c.size()); transform(all(c), back_inserter(r), f); return r;
}
template<class C, class F> inline C filtered(const C& c, F f){
    // ex: filtered(v, bind(equal_to<ll>(), bind(modulus<ll>(), _1, 2), 0)   [x mod 2 == 0 な x を取ってくる]
    C r; copy_if(all(c), back_inserter(r), f); return r;
}
template<class C, class I, class F> inline typename C::value_type foldl(const C& c, I i, F f){
    // ex: foldl(v, 1, multiplies<int>())   [v の総乗]
    return accumulate(all(c), static_cast<typename C::value_type>(i), f);
}


int main(){
    ll x;
    cin >> x;
    cout << x * x * x << endl;

    return 0;
}



Measured memory_bytes: 3080
# include <stdio.h>

int main (void)
{
    int N , A , B;
    scanf("%d", &N);
    if (N == 1) {
        printf("Hello World");
    } else if (N == 2) {
        scanf("%d%d", &A, &B);
        printf("%d", A + B);
    }
    return 0;
}

Measured memory_bytes: 128
S = input()

flag = 0

kisu = ['R', 'U', 'D']
gusu = ['L', 'U', 'D']
for c in S[0::2]:
    if not c in kisu:
        flag = 1
for c in S[1::2]:
    if not c in gusu:
        flag = 1

if flag:
    print('No')
else:
    print('Yes')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pii pair<int, int>
#define fr(n) for (int i = 0; i < n; i++)
#define fr1(n) for (int i = 1; i <= n; i++)
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    int n, b[102] = {};
    vector<int> z;
    cin >> n;
    fr1(n) cin >> b[i];
    for (int i = n; i; i--) {
        for (int j = i; j; j--) if (b[j] == j) {
            z.push_back(j);
            for (int k = j; k < i; k++) b[k] = b[k + 1];
            break;
        }
    }
    if (z.size() < n) {cout << -1; return 0;}
    reverse(z.begin(), z.end());
    for (int i : z) cout << i << '\n';
}


Measured memory_bytes: 256
#include<stdio.h>
#define min(a,b) a<b?a:b
int main()
{
    int n,a,i,c=0;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%d",&a);
        if(a!=i)
            c++;
    }
    if(c>2)
        printf("NO\n");
    else
        printf("YES\n");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <string>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<n;++i)
#define mrep(i,n) for(ll i=n;i>=0;--i)
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define pl pair<ll,ll>
#define inf 1001001001001000
#define mod 1000000007
#define pi 3.1415926535
using namespace std;

int main(void){
    string a,b,c;
    cin>>a>>b>>c;
    ll aind = 0;
    ll bind = 0;
    ll cind = 0;
    char turn = 'a';
    while(true){
        if(turn == 'a'){
            if(aind == a.size()){
                cout<<"A"<<endl;
                break;
            }
            turn = a[aind];
            aind++;
        }
        else if(turn == 'b'){
            if(bind == b.size()){
                cout<<"B"<<endl;
                break;
            }
            turn = b[bind];
            bind++;
        }
        else{
            if(cind == c.size()){
                cout<<"C"<<endl;
                break;
            }
            turn = c[cind];
            cind++;
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) x.begin(),x.end()
#define dmp(x) cerr<<#x<<":"<<x<<endl
#define FOR(i,a,b) for(int i=(int)a,c=(int)b;i<c;++i)
#define rep(i,b) FOR(i,0,b)
#define ROF(i,a,b) for(int i=b-1,c=(int)a;i>=c;--i)
#define per(i,b) ROF(i,0,b)
typedef pair<int,int> P;
typedef pair<int,P> PP; 
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
const int MOD = 1e9+7;

signed main(){
  int n,a,b;
  cin>>n>>a>>b;
  int ans=0;
  rep(i,n){
    int t;
    cin>>t;
    if(t<a||b<=t)ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 384
#include <iostream>

int main() {
  int a[101];
  int n;

  auto read = [](auto & a){std::cin >> a;};
  auto write = [](auto a){std::cout << a << " ";};

  std::cin >> n;

  for (int i=0; i<n; i++)
    read(a[i]);


  for (int i=n-1; i>0; --i)
    write(a[i]);

  std::cout << a[0] << std::endl;
}



Measured memory_bytes: 3092
import java.util.*;

class Main{

    void solve(){
        Scanner sc = new Scanner(System.in);

        int max = 1150;
        boolean[] boo = new boolean[max];
        for(int i=2; i<max; i++) boo[i] = true;
        for(int i=2; i<Math.sqrt(max); i++){
            for(int j=i*i; j<max; j+=i) boo[j] = false;
        }

        int[][] dp = new int[max][16];
        dp[0][0] = 1;
        for(int i=1; i<max; i++){
            if(!boo[i]) continue;
            for(int j=max-1-i; j>=0; j--){
                for(int k=15; k>=1; k--){
                    dp[j+i][k] += dp[j][k-1];
                }
            }
        }

        while(true){
            int n = sc.nextInt(), k = sc.nextInt();
            if(n==0 && k==0) break;

            System.out.println(dp[n][k]);
        }
    }

    public static void main(String[] args){
        new Main().solve();
    }
}

Measured memory_bytes: 21224
H, W = map(int, input().split())
areas = [[] for _ in range(4)]

h1 = round(H/3)
areas[0].append(h1*W)
areas[1].append(h1*W)
H -= h1
h2 = round(H/2)
w2 = round(W/2)
areas[0].append(h2*W)
areas[0].append((H-h2)*W)
areas[1].append(H*w2)
areas[1].append(H*(W-w2))

H += h1

w1 = round(W/3)
areas[2].append(H*w1)
areas[3].append(H*w1)
W -= w1
h2 = round(H/2)
w2 = round(W/2)
areas[2].append(h2*W)
areas[2].append((H-h2)*W)
areas[3].append(H*w2)
areas[3].append(H*(W-w2))

ans = H*W
for area in areas:
    area.sort()
    ans = min(ans, area[2] - area[0])
print(ans)


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
int n, k, extra;
int sol[100010][4];

int main() {
    cin >> n >> sol[1][1] >> sol[1][2] >> sol[1][3];

    for (int i = 2; i <= n; i++)
        for (int j = 1; j <= 3; j++) {
            cin >> extra;
            for (int h = 1; h <= 3; h++)
                if (j != h)
                    sol[i][j] = max(sol[i][j], sol[i - 1][h] + extra);
        }

    cout << max(max(sol[n][1], sol[n][2]), sol[n][3]);
    return 0;
}





Measured memory_bytes: 1792
S = input()

ans = 'WA'
if S[0] == 'A' and S[2:-1].count('C') == 1 and S[1] != 'C' and S[-1] != 'C':
    S2 = S.replace('A', 'a')
    S3 = S2.replace('C', 'c')
    if S3 == S.lower():
        ans = 'AC'
    
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef vector< long long > vi;
typedef long long ll;
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define endl "\n"
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define fr(n) for(ll i=0;i<n;i++)
#define tr(a) for(auto it=a.begin();it!=a.end();it++)
#define N 1000000007
#define PI 3.1415926535897932384
#define F first
#define S second
#define elasped_time    1.0 * clock() / CLOCKS_PER_SEC
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mp make_pair

void tree(ll t[],ll s, ll e, ll a[], ll node){
    if(s==e){
        t[node]=a[s];
    }
    else{
        ll mid=(s+e)/2;
        tree(t,s,mid,a,2*node);
        tree(t,mid+1,e,a,2*node+1);
        t[node]=t[2*node]+t[2*node+1];
    }
    return;
    
}

int query(ll t[],ll s, ll e,ll l, ll r,ll node){
    
    if(l>e || r<s) return 0;
    if(l<=s and e<=r) return t[node];
    
        ll mid=(s+e)/2;
        return query(t,s,mid,l,r,2*node)+
        query(t,mid+1,e,l,r,2*node+1);

}

void update(ll tree[],int node, int start, int end, int idx, int val,ll A[])
{
    if(start == end)
    {
        A[idx] += val;
        tree[node] += val;
    }
    else
    {
        int mid = (start + end) / 2;
        if(start <= idx and idx <= mid) update(tree,2*node, start, mid, idx, val,A);
        else update(tree,2*node+1, mid+1, end, idx, val,A);
        tree[node] = tree[2*node] + tree[2*node+1];
    }
}


void solve(){ 
ll l,r,n,ans=0;
cin>>l>>r>>n;
rep(i,l,r+1){
    if(i%n==0) ans++;
}
cout<<ans;

}
int main()
{   FAST;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output1.txt", "w", stdout); 
#endif
   
    ll test;
    test=1;
   
    //cin>>test;
    while(test--)
    {
        solve();
    }
     cerr<<endl<<"maut : "<<elasped_time<<endl;
    return 0;
}
 
    



Measured memory_bytes: 3800
/*jai_ganeshdeva*/

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pu push  //  adds the value to the last of the queue 
#define lld long long int
#define ins insert /// used in set to insert the values 
#define adv advance  /// used to increment the iterator
#define mp make_pair
#define fi first
#define se second
#define all(c) c.begin(),c.end()
#define PI 3.1415926
#define INF (lld)1e18
#define vl  vector<long long int >
#define vpll vector< pair<lld ,lld> >
#define vvl vector<vector<lld> > 
#define pll pair <lld,lld>
#define modA(cccc,bbbb ,p) (((cccc+bbbb)%p+p)%p)
#define modS(cccc,bbbb ,p) (((cccc-bbbb)%p+p)%p)
#define modM(cccc,bbbb ,p) ((((cccc%p)*(bbbb%p))%p+p)%p)

long long int modp(lld a,lld p,lld n)
{
    lld d[100];
    lld i,j,k,l;
    if(n==0) return 1;
    for(i=0;n>=1;i++)
    {
        d[i]=n%2;
        n/=2;
    }
    l=i;
    long long int e=1;
    if(d[0]==1) e*=(a%p);
    for(i=1;i<l;i++)
    {
        a*=a;
        a=a%p;
        if(d[i]==1) 
        {
            e*=a;
            e=e%p;
        }
    }
    return e%p;
}
lld modInverse(lld n, lld p) 
{ 
    return modp(n, p, p-2); 
}

// lld fac[2000005]; 

// void getfac(lld p)
// {
//     fac[0] = 1; 
//     for (lld i=1 ; i<=2000005; i++) 
//         fac[i] = fac[i-1]*i%p; 
// }    

// long long int nCrmodp(lld n, lld r,lld p) 
// { 
//    // Base case 
//    if (r==0) 
//       return 1; 
     
//     return (fac[n]* modInverse(fac[r], p) % p * 
//             modInverse(fac[n-r], p) % p) % p; 
// }



// lld maxSumSub(vector<lld>& v , lld l)
// {
//     lld x = 0;
//     lld y =0 ;
//     for(i=0;i<l;i++)
//     {
//         y += v[i];
//         if(x<y)
//         {
//             x=y;

//         }
//         if(y<0)
//             y=0;
//     }
//     return x;
// }


lld p1=1e9 + 7,p2=998244353;
lld l,r,mid,ans;
lld n,i,j,k,g,m;
lld x,y,n1,n2,h,z,c;
lld aa=1;

// bool sorter(lld a, lld b)
// {
//     vector<lld> v2;
//     vector<lld> w;
//     // cout<<"A == " <<a<<"  B== "<<b;
//     while(a>=1)
//     {
//         v2.pb(a%10);
//         a/=10;
//     }
//     while(b>=1)
//     {
//         w.pb(b%10);
//         b/=10;
//     }   
       
//     reverse(all(v2));
//     reverse(all(w));
//     lld l1 = v2.size();
//     lld l2 = w.size();
//     lld  l = (l1*l2)/__gcd(l1,l2);
//     // cout<<l1<< " "<<l2<< " "<<l<< " ";
//     for(int i=0;i<l;i++)
//     {
//         if(v2[i%l1]!=w[i%l2])
//         {
//             // cout<< "   "<< (v2[i%l1] > w[i%l2])<<"\n";
//             return v2[i%l1] > w[i%l2];
//         }
//     }
//     // printf("false\n");
//     return false;
// }


void solve()
{
    ans = 0;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        x  = (n/i);
        y = x *(x+1);
        y /=2;
        y*= i;
        ans+=y;
    }
    cout<<ans;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t=1;
    
   // cin>>t;
    //cout<<t;
    // getfac(p1);
    //check the value by which modulo is to be taken
    lld ans=0;
    for(int i=0;i<t;i++)
    {
   //     cout<<"Case #"<<i+1<<": ";
                  solve();
        cout<<"\n";
    }
    return 0;
}


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

#define llint long long int

using namespace std;

int N;

void calc(string ans, int i, int max){
    if(i == N){
        cout << ans << endl;
    }else{
        for(int j = 0; j <= ans[i - 1] - 'a' + 1 || j <= max; j ++){
            calc(ans + (char) (j + 'a'), i + 1, j == max ? max + 1 : max);
        }
    }
}
int main(){
    cin >> N;

    calc("a", 1, 1);
}

Measured memory_bytes: 1536
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    string s,t,u;
    cin >> s >> t >> u;
    string ans = "ans";
    ans.at(0) = s.at(0);
    ans.at(1) = t.at(1);
    ans.at(2) = u.at(2);

    cout << ans << endl;


 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;

#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////


int main(){fastio
    ll n,k;cin>>n>>k;
    ll v[n];rep(i,0,n-1)cin>>v[i];
    ll ans=0;
    if(n<=k){
        ll sum=0;rep(i,0,n-1)sum+=v[i];
        Max(ans,sum);
    }
    rep(l,0,n-1){
        rep(r,l,n-1){
            ll now=l+(n-r-1);
            if(now>k)continue;
            priority_queue<ll,vector<ll>,greater<ll>>u;
            rep(i,0,l-1)u.push(v[i]);
            rep(i,r+1,n-1)u.push(v[i]);
            while(!u.empty()){
                ll t=u.top();
                if(t>=0)break;
                if(now>=k)break;
                u.pop();
                now++;
            }
            ll sum=0;
            while(!u.empty()){
                ll t=u.top();u.pop();sum+=t;
            }
            Max(ans,sum);
        }
    }
    
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
#include <unordered_map>
#include <cstdio>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define int long long
#define P pair<int,int>
#define all(vec) vec.begin(),vec.end()

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int a, b, h, m;

signed main() {
	cin >> a >> b >> h >> m;
	long double x = h * 30 + 0.5*m;
	long double y = (long double)6 * m;
	long double s = max(x, y) - min(x, y);
	s = min(s, 360 - s);
	if (s == 0)cout << abs(a - b) << endl;
	else if (s == 180)cout << a + b << endl;
	else {
		printf("%.15Lf", sqrt(a*a + b * b - 2 * a*b*cos(pie*s / 180)));
		cout << endl;
	}
}

Measured memory_bytes: 4104
#include<bits/stdc++.h>
using namespace std;
inline int digit(char a,char b,char c)
{
	int x=a-'0',y=b-'0',z=c-'0';
	int n=x*100+y*10+z;
	return n;
}
int main()
{
	string s;
	cin>>s;
	int ans=643;
	for(int i=0;i<=s.size()-3;i++)
	{
		int num=abs(digit(s[i],s[i+1],s[i+2])-753);
		ans=min(ans,num);
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef unsigned long long int ull;
typedef long long lint;

int main(void){
    string S;
    cin >> S;
    int L=S.length();
    int rem=(S[0]==S[L-1])?L-3:L-2;
    if(rem%2!=0) cout << "First" << endl;
    else cout << "Second" << endl;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a/gcd(a, b) * b;
}

int main()
{
    cout << fixed << setprecision(15);
    ll H, W, K;
    cin >> H >> W >> K;

    vector<vector<char>> C(H, vector<char>(W));

    REP(i, H){
        REP(j, W){
            cin >> C[i][j];
        }
    }

    ll ans = 0;
    for (int bit = 0; bit < (1<<H); ++bit) {
        for (int bit2 = 0; bit2 < (1<<W); ++bit2) {
            ll temp = 0;
            for (int i = 0; i < H; ++i) {
                for (int j = 0; j < W; ++j) {
                    if ((bit & (1<<i)) || (bit2 & (1<<j))){
                        continue;
                    }
                    if(C[i][j] == '#') temp++;
                }
            }
            if(temp == K) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628