akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <list>
#include <algorithm>

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

    std::list<int> list;
    for (int i = 0; i < n; i ++) {
        char str[11];
        scanf("%s", str);
        std::string command = str;
        if (command == "insert") {
            int key;
            scanf("%d", &key);
            list.push_front(key);
        } else if (command == "delete") {
            int key;
            scanf("%d", &key);
            auto it = std::find(list.begin(), list.end(), key);
            if (it != list.end()) {
                list.erase(it);
            }
        } else if (command == "deleteFirst") {
            list.pop_front();
        } else if (command == "deleteLast") {
            list.pop_back();
        }
    }

    for (auto it = list.begin(); it != list.end(); it ++) {
        if (it != list.begin()) std::cout << " ";
        std::cout << *it;
    }
    std::cout << std::endl;
}



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

int gcd(int a,int b){
    if(a%b==0){
        return b;
    }else{
        return gcd(b,a%b);
    }
}

int main(){
    int k,ans=0;
    cin >> k;

    for(int i=1;i<=k;i++){
        for(int j=1;j<=k;j++){
            for(int l=1;l<=k;l++){
                ans+=gcd(gcd(i,j),l);
            }
        }
    }
    cout << ans <<endl;
    return 0;
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;
int main() {
	string S;
	cin >> S;
	int R = 0;
	int L = 0;
	vector<pair<int, int>>VP;
	for (int n = 0; n < S.size() ; ++n) {
		if ('L' == S[n]) {
			L++;
		}
		else {
			if (0 != n) {
				if ('L' == S[n - 1]) {
					VP.push_back(make_pair(R,L));
					R = 0;
					L = 0;
				}
			}
			R++;
		}
	}
	VP.push_back(make_pair(R, L));
	vector<int>A(S.size());
	int now = 0; 
	for (int n = 0;n<VP.size();++n) {
		for (int m = 0; m < VP[n].first;++m) {
			if (m == VP[n].first-1) {
				A[now] += VP[n].first/2 + VP[n].first % 2;
				A[now] += VP[n].second / 2;
			}
			now++;
		}
		for (int m = 0; m < VP[n].second;++m) {
			if (m == 0) {
				A[now] += VP[n].first / 2;
				A[now] += VP[n].second / 2 + VP[n].second % 2;
			}
			now++;
		}
	}
	for (int n = 0;n< A.size(); ++n) {
		if (0 != n) {
			cout << " ";
		}
		cout << A[n];
	}
	return 0;
}

Measured memory_bytes: 4192
import java.util.*;
class Main{
	static Scanner input = new Scanner(System.in);
	public static void main(String[] args){
		int n = input.nextInt();
		long A[] = new long[n+1];
		long B[] = new long[n+1];
		for(int i= 0 ;i < n+1 ; i++)
			A[i] = input.nextInt();
		for(int i = 0 ;i < n; i++)
			B[i] = input.nextInt();
		long ans = 0 ,left = 0;
		for(int i = 0 ;i < n+1 ; i++){
			if(A[i] > left + B[i]){
				ans += left + B[i];
				left = 0;
			}
			else if(A[i] < left){
				ans += A[i];
				left = B[i];
			}
			else{
				ans += A[i];
				left = B[i] - A[i] + left;
			}
		}
		System.out.println(ans);
	}		
}

Measured memory_bytes: 64928
#include "bits/stdc++.h"
using namespace std;
int main() {
	double Dice, Point;
	cin >> Dice >> Point;
	double ans = 0;
	for (double i = 1; i <= Dice; i++) {
		double Coin = 0;
		double tmp = i;
		while (tmp < Point) {
			Coin++;
			tmp *= 2;
		}
		ans += (1 / Dice) * pow(0.5, Coin);
	}
	printf("%.14lf", ans);
}

Measured memory_bytes: 256
import sys
from functools import lru_cache
sys.setrecursionlimit(10**9)
 
def mul(x, y, mod):
  x %= mod
  y %= mod
  return x * y % mod
 
def div(x, y, mod):
  x %= mod
  y %= mod
  return x * mod_pow(y, mod - 2, mod) % mod
 
@lru_cache(maxsize=None)
def mod_pow(a, p, mod):
  if p == 0:
    return 1
  if p % 2 == 0:
    root = mod_pow(a, p / 2, mod)
    return root * root % mod
  else:
    return a * mod_pow(a, p - 1, mod) % mod
 
def dnm(n, mod, factorials):
  denominators = [0] * (n + 1)
  denominators[n] = div(1, factorials, mod)
  for i in reversed(range(n)):
    denominators[i] = mul(denominators[i+1], i+1, mod)
  return denominators
 
def nmr(n, mod):
  factorials = [0] * (n + 1)
  factorials[0] = 1
  for i in range(n):
    factorials[i + 1] = (i + 1) * factorials[i] % mod
  return factorials
 
def cmb(a, b, mod, factorials, factorial_divs):
    if len(factorials) == 0:
        raise
    af = factorials[a]
    bf = factorial_divs[b]
    abf = factorial_divs[a - b]
    return mul(mul(af, bf, mod), abf, mod)
 
MOD=10**9+7
H,W,A,B=map(int,input().split())
ans = 0
 
n = nmr(H+W-2, MOD)
d = dnm(H+W-2, MOD, n[H+W-2])
 
for i in range(H-A):
  x = cmb(B-1+i, B-1, MOD, n, d)
  y = cmb(H+W-3-(B-1+i), W-B-1, MOD, n, d)
  ans += x * y % MOD
  ans %= MOD
 
print(ans)

Measured memory_bytes: 25460
import sys
card = [ list(map(int,input().split())) for a in range(3) ]
N = int(input())
point = [ int(input()) for a in range(N) ]

# cut holes
for I in point:
    for J in card:
        if I in J:
            J.index(I)
            J[J.index(I)] = "H"
# vertical check
for K in range(3):
    check = set([ x[K] for x in card ])
    if len(check) == 1 and list(check)[0] == "H":
        print('Yes')
        sys.exit()
# horizon check
for L in card:
    check = set(L)
    if len(check) == 1 and list(check)[0] == "H":
        print('Yes')
        sys.exit()
# diagonal check
LtoR = set([ card[M][M] for M in range(3)])
RtoL = set([ card[M][-M-1] for M in range(3)])
if len(LtoR) == 1 and list(LtoR)[0] == "H" or  len(RtoL) == 1 and list(RtoL)[0] == "H":    
    print('Yes')
    sys.exit()
print('No')

Measured memory_bytes: 9264
#include <iostream>
#include <map>

using namespace std;

int a, b, c;

inline int next(int x)
{
    return (a * x + b) % c;
}

int main()
{
    int n, x;

    while (cin >> n >> a >> b >> c >> x, n || a || b || c || x) {
        int reel[100];
        int y, ans;
        bool flag = false;

        for (int i = 0; i < n; i++) 
            cin >> reel[i];

        y = ans = 0;
        for (int i = 0; i <= 10001; i++) {
            if (y == n) {
                flag = true;
                ans = i - 1;
                break;
            }

            if (reel[y] == x) 
                y++;
            x = next(x);
        }

        if (flag)
            cout << ans << endl;
        else
            cout << -1 << endl;
    }

    return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>

int main()
{ int a[10000],x,i,b;i=0;
	while(1){
	scanf("%d",&x);
	a[i]=x;
	b=b+1;
	if(x==0){break;};
	i++;
	printf("Case %d: %d\n",i,x);
	};
	
	return 0;
}


Measured memory_bytes: 2028
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>
#include <set>
#include <sstream>
#include <iomanip>
#include <limits>
using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll>> PP;

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define fr first
#define sc second



int main() {
	ll n, x, a[4010], ans = INF2, d[4010];
	cin >> n >> x;
	for (int i = 0;i < n;i++)cin >> a[i], a[i + n] = a[i], d[i] = INF2;
	for (int i = 0;i < n;i++) {
		ll sum = 0;
		for (int j = 0;j < n;j++) {
			d[j] = min(d[j], a[j + n - i]);
			sum += d[j];
	    }
		ans = min(ans, sum + i * x);
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
    int h,w; cin >> h >> w;
    vector<string> b(h); rep(i,h) cin >> b[i];
    vector<bool> hf(h), wf(w);
    rep(i,h)rep(j,w) if (b[i][j] == '#') {
        hf[i] = true;
        wf[j] = true;
    }
    rep(i,h) {
        rep(j,w) if (hf[i] && wf[j]) {
            cout << b[i][j];
        }
        cout << endl;
    }
}

Measured memory_bytes: 3624
require 'pp'
n = gets.to_i
a = gets.split.map(&:to_i)
b = gets.split.map(&:to_i)
# p a # monster
# p b # soldier
sum1 = a.inject(&:+)
n.times do |i|
  if a[i] >= b[i]
    a[i] -= b[i]
    b[i] = 0
  else
    b[i] -= a[i]
    a[i] = 0
    if a[i+1] >= b[i]
      a[i+1] -= b[i]
      b[i] = 0
    else
      b[i] -= a[i+1] # 多分この計算はいらない
      a[i+1] = 0
    end
  end

end
# p a # monster
# p b # soldier
sum2 = a.inject(&:+)
p sum1 - sum2


Measured memory_bytes: 15748
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
char a[400][400];
int f[400][400],n,ans;
void ck(int x,int y)
{
	bool flag=0;
	int xx=x-1,yy=y-1;
	for(int i=1;i<=n;++i)
	{
		if(flag) break;
		for(int j=i+1;j<=n;++j)
		{
			int x1=xx+i;
			int y1=j+yy;
			int x2=xx+j;
			int y2=yy+i;
			if(x1>n) x1-=n;
			if(y2>n) y2-=n;
			if(y1>n) y1-=n;
			if(x2>n) x2-=n;
			if(a[x1][y1]!=a[x2][y2])
			{
				flag=1;
				break;
			}	
		}
	}
	if(!flag) f[x][y]=1;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
	scanf("%s",a[i]+1);
	for(int i=1;i<=n;++i)
	ck(1,i),ck(i,1);
	for(int i=2;i<=n;++i)
	for(int j=2;j<=n;++j)
	f[i][j]=f[i-1][j-1];
	for(int i=0;i<n;++i)
	for(int j=0;j<n;++j)
	ans+=f[i+1][j+1];
	cout<<ans;
	return 0;
 } 

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <b; i++)
typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pi;
#define trace(x) cout<<#x<<"="<<x<<"\n";
#define sz(x) (int)(x.size())
#define mod 1000000007

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define deb(x) cerr << #x << " = " << x << endl;



int32_t main(){
    ios::sync_with_stdio(false);
    int n, k;
    cin>>n>>k;
    string s;
    cin>>s;
    int ini=0;
    for(int i=1;i<s.size();i++){
        if(s[i]==s[i-1]){
            ini++;
        }
    }
    sort(s.begin(),s.end());
    int maxi=0;
    for(int i=1;i<s.size();i++){
        if(s[i]==s[i-1]){
            maxi++;
        }
    }
    maxi=n-1;
    int ans=min(ini+2*k,maxi);
    cout<<ans<<"\n";



    return 0;
}

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

int main(void)
{
    ios::sync_with_stdio(false);
    int n, x, t, temp;
    cin>>n>>x>>t;
    temp = n/x;
    if(temp*x!=n)
        temp++;
    cout<<temp*t<<'\n';
    return 0;
}


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
ll S, W;

ll i, j, k;
int main(){
    scanf("%lld%lld", &S, &W);
    if(S<=W){
        printf("unsafe\n");
    }
    else{
        printf("safe\n");
    }

    return 0;
}

Measured memory_bytes: 3688
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n-1); i >= 0; i--)
#define all(v) (v).begin(),(v).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a/gcd(a,b)*b; }
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

int n;
vector<vector<int>> to;

int bfs(int sv) {
    queue<int> q;
    vector<int> dist(n, INF);
    q.push(sv);
    dist[sv] = 0;
    int res = 0;
    while (q.size()) {
        int v = q.front(); q.pop();
        res = max(res, dist[v]+1);
        for (int u: to[v]) {
            if (dist[u] != INF) continue;
            dist[u] = dist[v] + 1;
            q.push(u);
        }
    }
    rep(i,n) {      // 2部グラフ判定
        for (int j : to[i]) {
            if (abs(dist[i]-dist[j]) != 1) return -1;
        }
    }
    return res;
}

int main() {
    cin >> n;
    to = vector<vector<int>>(n);
    rep(i,n) {
        string s;
        cin >> s;
        rep(j,n) {
            if(s[j]=='1') to[i].push_back(j);
        }
    }
    int ans = -1;
    rep(i,n) ans = max(ans, bfs(i));
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
typedef long long int ll;
typedef unsigned long long int sll;
typedef long double ld;
#define A 1000000007
#define D 100000000000000ll
#define B 998244353ll
#define C 1000000000000000000ll
#define M 4000
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define oset tree<pair<ll,ll>, null_type,less_equal<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> 
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define br break
#define PI acos(-1)
#define subt cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n" 

bool ch(ll x, ll y)
{
    ll z=(1<<y);
    x=x/z;
    return (x&1);
}

int main() 
{
    FAST;
    ll n,m,k;
    cin>>n>>m>>k;
    string s[n];
    for(int i=0;i<n;i++)
        cin>>s[i];
    ll ans=0;
    for(int i=0;i<(1<<n);i++)
    {
        for(int j=0;j<(1<<m);j++)
        {
            ll co=0;
            for(int x=0;x<n;x++)
                for(int y=0;y<m;y++)
                    if(s[x][y]=='#' && !ch(i,x) && !ch(j,y))
                        co++;
            if(co==k)
                ans++;
        }
    }
    cout<<ans;
    subt;
    return 0;
}

Measured memory_bytes: 3828
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iomanip>

using namespace std;

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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T>
void print_container(T &container, string delim=" ") {
    bool first = true;
    for(auto &t: container){
        if(!first){
            cout << delim;
        }
        first = false;
        cout << t;
    }
    cout << endl;
}

vector<pll> factor(ll a){
    vector<pll> ans;
    ll b = a;
    for(ll x=2;x*x<=b;x++){
        if(a%x > 0)
            continue;
        int cnt = 0;
        while(a % x == 0){
            cnt++;
            a /= x;
        }
        ans.push_back(make_pair(x, cnt));
    }
    if(a > 1)
        ans.push_back(make_pair(a, 1));
    return ans;
}

ll gcd(ll a, ll b){
    if(b == 0)
        return a;

    return gcd(b, a%b);
}


int main() {
    ll a, b;
    cin >> a >> b;

    ll g = gcd(a, b);
    auto fg = factor(g);

    cout << fg.size() + 1 << endl;
    return 0;
}

Measured memory_bytes: 256
n, k =map(int, input().split())
p = list(map(int, input().split()))
c = list(map(int, input().split()))
roop = []
seen = [0 for  _ in range(n)]
count = 0
for i in range(n):
    if seen[i]>0:
        continue
    else:
        count+=1
        seen[i] = count
        roop.append([c[i]])
        t = i
        while i!=p[t]-1:
            seen[p[t]-1]=count
            roop[-1].append(c[p[t]-1])
            t = p[t]-1
#print(seen)
#print(roop)
ans = max(c)

for i in roop:
    #print(ans)
    
    s = sum(i)
    ii = i+i
    #print(ii)
    if len(i)>=k:
        for j in range(1, k+1):
            temp = sum(ii[:j])
            for l in range(len(i)):
                if l!=0:
                    temp+=ii[l+j-1]
                    temp-=ii[l-1]
                    #temp = sum(ii[l:l+j])
                #print(i, j, l, temp)
                ans  = max(ans, temp)
    else:
        for j in range(1, len(i)+1):
            temp=  sum(ii[:j])
            for l in range(len(i)):
                if l != 0:
                    temp+=ii[l+j-1]
                    temp-=ii[l-1]
                #print(temp)
                if s>0:
                    temp1 = temp+s*((k-j)//len(i))
                else:
                    temp1 = temp
                
                #print(i, j, l, temp)
                ans  = max(ans, temp)
                ans  = max(ans, temp1)
            
print(ans)

        


Measured memory_bytes: 74816
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#include<cmath>
#include<map>
using namespace std;
typedef long long LL;
const int N = 1e5+10;
inline LL read()
{
	register LL x = 0 , f = 0; register char c = getchar();
	while(c < '0' || c > '9') f |= c == '-' , c = getchar();
	while(c >= '0' && c <= '9') x = (x << 3) + (x << 1) + c - '0' , c = getchar();
	return f ? -x : x;
}
int n;
LL d[N];
int eu[N] , ev[N] , siz[N];
vector<int> G[N];
map<LL , int> mp;
struct node
{
	LL d;
	int id;
}p[N];

inline bool cmp(const node &A , const node &B) { return A.d > B.d; }

void dfs1(int x , int dep , int rot)
{
	siz[x] = 1; d[rot] += dep;
	for(int i = 0 ; i < G[x].size() ; ++i) dfs1(G[x][i] , dep + 1 , rot) , siz[x] += siz[G[x][i]];
	return ;
}

void dfs2(int x)
{
	for(int i = 0 ; i < G[x].size() ; ++i)
	{
		d[G[x][i]] = d[x] + n - 2 * siz[G[x][i]];
		dfs2(G[x][i]);
	}
	return ;
}

int main()
{
	n = read();
	for(int i = 1 ; i <= n ; ++i) p[i].d = read() , p[i].id = i , mp[p[i].d] = i;
	LL sum = 0;
	for(int i = 1 ; i <= n ; ++i) sum += p[i].d;
	if(sum & 1) { puts("-1"); return 0; }
	sort(p + 1 , p + 1 + n , cmp);
	for(int i = 1 ; i <= n ; ++i) siz[i] = 1;
	for(int i = 1 ; i <  n ; ++i)
	{
		LL fa_d = p[i].d - n + 2 * siz[p[i].id];
		if(!mp.count(fa_d)) { puts("-1"); return 0; }
		ev[i] = p[i].id; eu[i] = mp[fa_d]; siz[eu[i]] += siz[ev[i]];
	}
	for(int i = 1 ; i <  n ; ++i) G[eu[i]].push_back(ev[i]);
	dfs1(p[n].id , 0 , p[n].id); dfs2(p[n].id);
	for(int i = 1 ; i <= n ; ++i) if(d[p[i].id] != p[i].d) { puts("-1"); return 0; }
	for(int i = 1 ; i <  n ; ++i) cout << eu[i] << ' ' << ev[i] << '\n';
	return 0;
}

Measured memory_bytes: 19712
package main

import "fmt"

func main() {
	var c500, c100, c50, X int
	fmt.Scan(&c500, &c100, &c50, &X)
	ans := 0

	for i := 0; i <= c500; i++ {
		for j := 0; j <= c100; j++ {
			for k := 0; k <= c50; k++ {
				if i*500+j*100+k*50 == X {
					ans++
				}
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
const int M = 10000001;
ll a[M];
/*int main() {
    int N;
    cin >> N;
    fill(a, a + M, 1);
    for (ll i = 2; i < M; i++) {
        for (ll j = 1; i * j < M; j++) {
            a[i * j]++;
        }
    }
    ll ans = 0;
        for(long long i=1;i<=N;i++){
        ans += i * a[i];
    }
    cout << ans << "\n";
    return 0;
}*/
int main(void){
    long long int N;
    cin >> N;

    long long int ans = 0;
    long long temp_N = N;
    for(long long int i=1;i<=N;i++){
        long long int g = temp_N*(temp_N+1)/2;
        ans += i * g;
        temp_N = N/(i+1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
N = int(input())
a = list(map(int, input().split()))
dp = [[0] * (N) for _ in range(N)]
ans = int(0)
#for i in range(N):
#    dp[i][i] = a[i]

for l in range(1,N):
    for i in range(N-l):
        j = i + l
        dpcandi = [0] * (j-i)
        Sdp = int(0)
        for k in range(i,j+1):
            Sdp += a[k]
        for k in range(0,j-i):
            dpcandi[k] = dp[i][i+k] + dp[i+k+1][j]
#            print(i,j,dpcandi)

        dp[i][j] = min(dpcandi) + Sdp

ans = dp[0][N-1]

print(ans)

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

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

subs = []
s = 0
for i in range(n):
    s += w[i]
    subs.append(s)

ans = 1000
for i in range(n-1):
    a = abs(subs[-1] - 2*subs[i])
    ans = min(ans, a)

print(ans)


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

void dfs(int h, int w, int(*A)[50], int W, int H) {
  A[h][w] = 0;
  for (int i = -1; i <= 1; ++i) {
    for (int j = -1; j <= 1; ++j) {
      int hp = h + i;
      int wp = w + j;
      if (0 <= hp && hp < H && 0 <= wp && wp < W && A[hp][wp] == 1) {
        dfs(hp, wp, A, W, H);
      }
    }
  }
}

int main() {
  int A[50][50];
  int W, H, ans;

  while (true) {
    cin >> W >> H;
    if (W == 0 && H == 0) break;

    for (int i = 0; i < H; ++i) {
      for (int j = 0; j < W; ++j) {
        cin >> A[i][j];
      }
    }

    ans = 0;
    for (int i = 0; i < H; ++i) {
      for (int j = 0; j < W; ++j) {
        if (A[i][j] == 1) {
          dfs(i, j, A, W, H);
          ++ans;
        }
      }
    }
    cout << ans << endl;
  }  

  return 0;
}



Measured memory_bytes: 3212
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

char r[] = "apple",m[]="peach";
bool f = 0;
string s, t, ans = "";

int main(){
	getline(cin, s);
	stringstream ss;
	ss << s;
	while (ss >> t){
		if (t.find("apple") != -1){
			int pos = t.find("apple");
			for (int i = pos; i <  pos+ 5; i++){
				t[i] = m[i - pos];
			}
		}
		else if (t.find("peach") != -1){
			int pos = t.find("peach");
			for (int i = pos; i < pos + 5; i++){
				t[i] = r[i - pos];
			}
		}
		if (f == 0){
			ans += t;
		}
		else{
			ans += " " + t;
		}
		f = 1;
	}
	cout << ans << endl;
}

Measured memory_bytes: 1212
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<iostream>
#include<algorithm>//next_permutation
#include<complex>
#include<math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define rep2(i, j, n) for (int i = j; i < (int)(n); i++)

int main() {
	int n;
	cin >> n;
	vector<string> sss(n);
	rep(i, n) {
		cin >> sss.at(i);
	}
	sort(sss.begin(), sss.end());
	string s = "";
	int count = 0;
	rep(i, n) {
		if (s == sss.at(i)) {
		}
		else {
			count++;
		}
		s = sss.at(i);
	}
	cout << count << endl;
}


Measured memory_bytes: 9544
tenbou, road = map(int, input().split())
height = list(map(int, input().split()))
route = [[] for _ in range(tenbou)]
for i in range(road):
    _from, _to = map(int, input().split())
    route[_from-1].append(_to-1)
    route[_to-1].append(_from-1)
ans = 0
for i in range(tenbou):
    m = height[i]
    # judge = True
    for j in route[i]:
        if(m <= height[j]):
            break
    else:
        ans += 1
print(ans)


Measured memory_bytes: 29568
#include<bits/stdc++.h>
#define endl "\n"
#define pb push_back
#define ll long long
#define d1(x)  cerr << #x << "--> " << x << endl
#define d2(x,y)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<endl
#define d3(x,y,z)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<" | " << #z << "--> "<< z<< endl
#define d4(x,y,z,w)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<" | " << #z << "--> "<< z << " | "<< #w << "--> " << w <<endl
#define vpll vector<pair<ll,ll>>
#define F first
#define S second
#define T ll tt; cin>>tt; while(tt--)
using namespace std;
ll mode=1e9+7;
const long long maxn=30;
const long long inf=99999999999;
ll __lcm(ll a, ll b){ return (a*b)/__gcd(a,b); }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll getRand(ll l, ll r){ uniform_int_distribution<ll> uid(l, r); return uid(rng); }

void solve(){
	
	ll n;
	cin>>n;
	ll x=n%10;
	if (x==2 || x==4 || x==5 || x==7 || x==9){
		cout<<"hon"<<endl;
	}
	else if (x==3){
		cout<<"bon"<<endl;
	}
	else{
		cout<<"pon"<<endl;
	}
	
	
	return;
}

 
int main(){ 
    
    #ifndef ONLINE_JUDGE
	//	freopen("input.txt", "r", stdin);
    #endif
    srand(time(0)); 
    
    ios::sync_with_stdio(0);
    cin.tie(0);
 	
	//T{ solve(); }
	solve();
	
	
	return 0;
	
}

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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }


int main() {
    int n,m; cin >> n >> m;
    if(n == m) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}



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

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


Measured memory_bytes: 4844
// Problem : D - Redistribution
// Contest : AtCoder - AtCoder Beginner Contest 178
// URL : https://atcoder.jp/contests/abc178/tasks/abc178_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// $%U%$
// Mere bas ka nahi hai
// still i'm trying
// apna time aayega
//
//        .--------------.  
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |  
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'                          		  
//
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll power(ll x,ll y,ll m){if(y==0)return 1;ll p=power(x,y/2,m)%m;p=(p*p)%m;return (y%2==0)?p:(x*p)%m;}
ll nCr(ll n,ll r,ll m){if(r>n)return 0;ll a=1,b=1,i;for(i=0;i<r;i++){a=(a*n)%m;--n;}while(r){b=(b*r)%m;--r;}return (a*power(b,m-2,m))%m;}
#define Test int t;cin>>t;while(t--)
#define endl '\n'
const ll mod=(ll)1e9+7;
void solve()
{
	ll n;
	cin >> n;
	vector<ll> dp(n+1);
	dp[0]=1;
	for(int i=0;i<=n;++i)
	{
		for(int j=3;j<=n;++j)
		{
			if(j+i<=n)
			dp[j+i]=(dp[j+i]+dp[i])%mod;
		}
	}
	cout << dp[n] << endl;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//Test
	solve();
	return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll ans[100001];
int h[100001];
ll cost(int n)
{
    if(ans[n]!=-1)
        return ans[n];
    
    //ll ans;
    if(n==2)
    {
        //cout<<n<<endl;
        return ans[2]=abs(h[2]-h[1]);
    }
    
    if(n==3)
    {
        //cout<<n<<endl;
        return ans[3]=min( (cost(2) + abs(h[3]-h[2])), (ll)abs(h[3]-h[1]));
    }
    //cout<<n<<endl;
    return ans[n]= min((cost(n-1) + abs(h[n]-h[n-1])), (cost(n-2) + abs(h[n]-h[n-2])));
}

int main()
{
    memset(ans,-1,sizeof(ans));
    int n;
    cin>>n;
    //cout<<n;
   // int h[n+1];
    h[0]=0;
    for(int i=1;i<=n;i++)
        cin>>h[i];
    cout<<cost(n);
}

Measured memory_bytes: 2944
import java.util.Scanner;

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

        if (r < 1200) {
            System.out.println("ABC");
        } else {
            if (r < 2800) {
                System.out.println("ARC");
            } else {
                System.out.println("AGC");
            }

        }

    }

}




Measured memory_bytes: 22868
//TINY_OUNCE911666
// You are not prepared!

#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

int n, m, idx;
ll ans;

int32_t main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	cin >> n >> m;
	priority_queue <ll> pq;
	
	for (int i = 0; i < n; ++i) {
		ll x; cin >> x;
		pq.push(x);
	}
	
	idx = 2;
	while (m--) {
		ll x = pq.top();
		x /= 2;
		pq.pop();
		pq.push(x);
	}
	
	while ((int) pq.size()) {
		ans += pq.top();
		pq.pop();
	}
	
	cout << ans;
}


Measured memory_bytes: 1400
#-*-coding:utf-8-*-

def main():
    a, b, c, d = map(int, input().split())

    if min(b, d) - max(a, c) >= 0:
        print(min(b, d) - max(a, c))
    else:
        print(0)

if __name__ == '__main__':
    main()

Measured memory_bytes: 2940
#include<cstdio>
#include<algorithm>
#define fo(i,a,b) for(i=a;i<=b;i++)
#define fd(i,a,b) for(i=a;i>=b;i--)
using namespace std;
typedef long long ll;
ll two[70],a,b,ans,x,y,u,v;
int i,j,k,l,t,n,m,d;
int main(){
	scanf("%lld%lld",&a,&b);
	swap(a,b);
	two[0]=1;
	fo(i,1,62)  two[i]=(ll)two[i-1]*2;
	fd(i,62,0){
		if ((a&two[i])!=(b&two[i])) break;
		if ((a&two[i])>0){
			a^=two[i];
			b^=two[i];
		}
	}
	if (a==b){
		printf("1\n");
		return 0;
	}
	d=i;
	fd(k,i-1,-1)
		if (k==-1||(a&two[k])>0) break;
	x=b;y=two[d]+two[k+1]-1;
	u=two[d]+b;v=two[d+1]-1;
	ans=y-x+1;
	if (u>y) ans+=v-u+1;
	else if (u<=y&&v>y) ans+=v-y;
	printf("%lld\n",ans);
}

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

int solve(string s, int p[4]){
    stack<char> op, num;
    for(auto c : s){
        if(c=='[')continue;
        if(c=='+' || c=='*' || c=='^'){
            op.push(c);
        }
        else if(c==']'){
            int a, b;
            a = num.top(); num.pop();
            b = num.top(); num.pop();
            if(op.top()=='+'){
                a |= b;
            }
            if(op.top()=='*'){
                a &= b;
            }
            if(op.top()=='^'){
                a ^= b;
            }
            num.push(a);
            op.pop();
        }
        else{
            num.push(p[c-'a']);
        }
    }
    return num.top();
}

int main() {
    string s, p;
    while(cin >> s){
        if(s==".")break;
        cin >> p;
        int a[4], h, cnt = 0;
        for(int i=0;i<4;i++){
            a[i] = p[i]-'0';
        }
        h = solve(s, a);
        for(int i=0;i<10000;i++){
            int t = i;
            for(int j=0;j<4;j++){
                a[j] = t%10;
                t /= 10;
            }
            if(solve(s, a)==h)cnt++;
        }
        cout << h << " " << cnt << endl;
    }
    return 0;
}



Measured memory_bytes: 3220
n = int(input())
b=list(map(int, input().split())) 

sum =b[0]

if len(b) >= 2:
    for i in range(1,len(b)):
        if b[i-1]<b[i]:
            sum+=b[i-1]
        else:
            sum+=b[i]
        
sum+=b[-1]
        
print(sum)

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;

int f(int n) {
  if (n % 2 == 0) {
    return n / 2;
  }
  return 3 * n + 1;
}

int main() {
  int s;
  std::cin >> s;
  std::vector<int> a;

  a.push_back(s);
  int i = 1;
  bool ok = false;
  while (!ok) {
    int current = f(a[i - 1]);
    a.push_back(current);
    for (int j = 0; j < i; j++) {
      if (a[j] == current) {
        ok = true;
      }
    }
    i++;
  }
  std::cout << i << std::endl;
  return 0;
}


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

int main(){
  int n;
  cin >> n;
  int a[n];
  rep(i,n)cin >> a[i];

  sort(a,a+n);
  long long ans=0;
  rep(i,n-1){
    if(i%2==0)ans+=a[n-1-i/2];
    else ans+=a[n-2-i/2];
  }
  
  cout << ans << endl;
}

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

using namespace std;

int a, b, f[100005];

int main() {

    int n, m;

    cin >> n >> m;

    for(int i = 1; i <= m; ++i){
        cin >> a >> b;
        f[a]++;
        f[b]++;
    }

    for(int i = 1; i <= n; ++i){
        if(f[i] % 2 != 0) {cout << "NO"; return 0;}
    }

    cout << "YES";

    return 0;

}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Numerics;
using System.Text;

namespace AtCoder.ABC
{
	class QuestionC
	{
		public static void Main(string[] args)
		{
            var scanner = new Scanner();

            var n = scanner.nextInt();
            var a = scanner.ArrayInt(n);

            var sum = 0L;
            var previous = 0;

            for(int i = 0; i < n; i++) {
                var height = a[i];

                var dif = previous - height;
                if(dif > 0) {
                    sum += dif;
                    height += dif;
				}

                previous = height;
			}

            Console.WriteLine(sum);
        }

        class Scanner
        {
            string[] s;
            int i;

            char[] cs = new char[] { ' ' };

            public Scanner()
            {
                s = new string[0];
                i = 0;
            }

            public string next()
            {
                if (i < s.Length) return s[i++];
                string st = Console.ReadLine();
                while (st == "") st = Console.ReadLine();
                s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
                if (s.Length == 0) return next();
                i = 0;
                return s[i++];
            }

            public int nextInt()
            {
                return int.Parse(next());
            }
            public int[] ArrayInt(int N, int add = 0)
            {
                int[] Array = new int[N];
                for (int i = 0; i < N; i++) {
                    Array[i] = nextInt() + add;
                }
                return Array;
            }

            public long nextLong()
            {
                return long.Parse(next());
            }

            public long[] ArrayLong(int N, long add = 0)
            {
                long[] Array = new long[N];
                for (int i = 0; i < N; i++) {
                    Array[i] = nextLong() + add;
                }
                return Array;
            }

            public double nextDouble()
            {
                return double.Parse(next());
            }


            public double[] ArrayDouble(int N, double add = 0)
            {
                double[] Array = new double[N];
                for (int i = 0; i < N; i++) {
                    Array[i] = nextDouble() + add;
                }
                return Array;
            }
        }
    }
}


Measured memory_bytes: 45868
package main
 
import (
    "bufio"
    "fmt"
    "os"
    "strconv"
)

func main(){
    
    a := nextInt()
    b := nextInt()
    h := nextInt()
    
	fmt.Println((a+b)*h/2)
}
 
/* templates */


func Max(a []int) int {
    r := a[0]
    for i := 0; i < len(a); i++ {
        if r < a[i] {
            r = a[i]
        }
    }
    return r
}
 
func Min(a []int) int {
    r := a[0]
    for i := 0; i < len(a); i++ {
        if r > a[i] {
            r = a[i]
        }
    }
    return r
}
 
func Sum(a []int) (r int) {
    for i := range a {
        r += a[i]
    }
    return r
}
 
func Abs(a float64) float64 {
    if a < 0 {
        return -a
    }
    return a
}
 
type Pair struct {
    a, b int
}
 
type Pairs []Pair
 
func (p Pairs) Len() int {
    return len(p)
}
 
func (p Pairs) Swap(i, j int) {
    p[i], p[j] = p[j], p[i]
}
 
func (p Pairs) Less(i, j int) bool {
    return p[i].b < p[j].b
}
 
var nextReader func() string
 
func init() {
    nextReader = NewScanner()
}
 
func NewScanner() func() string {
    r := bufio.NewScanner(os.Stdin)
    r.Buffer(make([]byte, 1024), int(1e+11))
    r.Split(bufio.ScanWords)
    return func() string {
        r.Scan()
        return r.Text()
    }
}

func nextString() string {
    return nextReader()
}
 
func nextInt64() int64 {
    v, _ := strconv.ParseInt(nextReader(), 10, 64)
    return v
}
 
func nextInt() int {
    v, _ := strconv.Atoi(nextReader())
    return v
}
 
func nextInts(n int) []int {
    r := make([]int, n)
    for i := 0; i < n; i++ {
        r[i] = nextInt()
    }
    return r
}

func nextStrings(n int) []string {
    r := make([]string, n)
    for i := 0; i < n; i++ {
        r[i] = nextString()
    }
    return r
}

func nextFloat64() float64 {
    f, _ := strconv.ParseFloat(nextReader(), 64)
    return f
}


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

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

    int n;
    cin >> n;
    vector<int> s(n);
    REP(i, n) cin >> s[i];

    sort(s.begin(), s.end());
    int sum = accumulate(s.begin(), s.end(), 0);

    vector<int> div(n);
    int cnt = 0;
    REP(i, n) {
        div[i] = s[i] % 10;
        if (div[i] == 0) cnt++;
    }

    int sumDiv = accumulate(div.begin(), div.end(), 0);

    int ans = 0;
    if (sumDiv % 10) ans = sum;
    else {
        if (cnt == n) ans = 0;
        else {
            REP(i, n) {
                if (div[i] != 0) {
                    ans = sum - s[i];
                    break ;
                }
            }
        }
    }

    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)
        self.size = [1] * (n+1)
        self.con = [0] * (m+1)#convenience

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y, j):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            self.con[j] = self.con[j+1] + self.size[x] * self.size[y]
        else:
            self.con[j] = self.con[j+1]
        #print([x,y])
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
            self.size[y] = self.size[x] + self.size[y]
            self.size[x] = 0
        else:
            self.par[y] = x
            if x != y:
                self.size[x] = self.size[x] + self.size[y]
                self.size[y] = 0
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)

n, m = map(int, input().split())

uf = UnionFind(n)

x = [0] * (m+1)
y = [0] * (m+1)


for i in range(1,m+1):
    x[i], y[i] = map(int, input().split())
    #print([x,y])
    
for j in range(m-1,0,-1):
    #print([x[j+1],y[j+1]])
    uf.union(x[j+1],y[j+1],j)
    
    #print(uf.size)
    #print(uf.con)

N = int(n * (n-1) / 2)

for i in range(1,m+1):
    print(N-uf.con[i])
        

Measured memory_bytes: 20652
#include<bits/stdc++.h>
using namespace std ;
int main()
{
    int n,l,c=0,d=0,i;
    string s;
    cin>>s;
    l= s.size();
    for(i=0;i<l;i++)
    {
        if (s[i]=='A')
                c++;
        else
            d++;
    }
    if(c>0 && d>0)
        cout<<"Yes";
    else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <string.h>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
using namespace std;
int main()
{
	int n,k,l[55],i,s=0;
	cin>>n>>k;
	for(i=0;i<n;i++)
		cin>>l[i];
	sort(l,l+n);
	for(i=n-1;i>=n-k;i--)
		s+=l[i];
	cout<<s<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0, max_i = (n); i < max_i; i++)
#define REPI(i, a, b) for (int i = (a), max_i = (b); i < max_i; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define fi first
#define se second
#define int long long
using namespace std;
using ll = long long;
using II = pair<int, int>; using VII = vector<II>; using VVII = vector<VII>;
using VI = vector<int>; using VVI = vector<VI>; using VVVI = vector<VVI>;
template <class T = int> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template <class T = int> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
template <class T> ostream& operator<<(ostream &s, const vector<T>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : " "); return s; }
template <class T> ostream& operator<<(ostream &s, const vector<vector<T>>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : "\n"); return s; }
template <class T, class S> ostream& operator<<(ostream &s, const pair<T, S>& p) { s << "{" << p.first << ", " << p.second << "}"; return s; }
template <class T, class S> ostream& operator<<(ostream &s, const map<T, S> m) { for (pair<T, S> p: m) s << p << endl; return s; }
#ifdef _MY_DEBUG
  #define dump(...) cerr << "/* " << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << endl, dump_func(__VA_ARGS__), cerr << "*/\n\n";
#else
  #define dump(...)
#endif
void dump_func() { cerr << endl; }
template <class Head, class... Tail> void dump_func(Head&& h, Tail&&... t) { cerr << h << (sizeof...(Tail) == 0 ? "" : ", "), dump_func(forward<Tail>(t)...); }
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); } } fast;
constexpr int MOD = 1e9 + 7;

int count(int a, int b) {
  if (a <= b && b < 4 * a) return 0;
  else if (a < b) {
    return -1 + count(4 * a, b);
  } else {
    return 1 + count(a, 4 * b);
  }
}
signed main() {
  int N; cin >> N;
  VI A(N);
  REP (i, N) cin >> A[i];
  VVI dp(2, VI(N));
  REP (k, 2) {
    map<int, int> mp;
    for (int i = N - 2; i >= 0; i--) {
      dp[k][i] = dp[k][i + 1];
      int dif = count(A[i], A[i + 1]);
      int pt = i;
      dump(i, dif);
      if (dif == 0) {
        continue;
      } else if (dif < 0) {
        mp[i] = -dif;
      } else {
        for (auto it = mp.begin(); it != mp.end(); ) {
          dp[k][i] += dif * (it->fi - pt);
          pt = it->fi;
          if (it->se <= dif) {
            dif -= it->se;
            mp.erase(it++);
          } else {
            it->se -= dif;
            dif = 0;
            break;
          }
        }
        dp[k][i] += dif * (N - 1 - pt);
      }
      dump(i, mp);
    }
    reverse(ALL(A));
  }
  dump(dp);
  int ans = 1e18;
  REP (i, N) {
    ans = min(ans, i + 2 * (dp[0][i] + (i == 0 ? 0 : dp[1][N - i])));
  }
  cout << ans << endl;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define rep(i, a) for(int i = 0; i < a; i++)
#define all(v) v.begin(), v.end()
#define dcout cout << fixed << setprecision(15)
#define arep(i, a) for(auto i : a)
#define F first
#define S second
#define VE vector<int>
#define pb(x) push_back(x)
#define MOD 1000000007
#define INF 10000000000
#define int long long
#define KETA(n) floor(log10(n) + 1)
using namespace std;
signed main() {
    string s;
    cin >> s;
    int ans = 700;
    if(s[0] == 'o') ans += 100;
    if(s[1] == 'o') ans += 100;
    if(s[2] == 'o') ans += 100;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define maxn 100001
#define rep(i,n) for(int i=0; i<int(n); ++i)
#define pb push_back
#define mp make_pair

int n, m, x;
deque<int> a[301];
int ban[301];
vector<int> b;
void solve(){
	cin >> n >> m;
	rep(i, n){
		rep(j, m){
			cin >> x;
			a[i].pb(x);
		}
	}
	int ans = n;
	while (1){
		bool do_break = 0;
		b.clear();
		rep(i, n){
			while (!a[i].empty() && ban[a[i].front()]) a[i].pop_front();
			if (a[i].empty()){
				do_break = 1;
				break;
			}
			b.pb(a[i].front());
		}
		if (do_break) break;
		sort(b.begin(), b.end());
		int most_b = b[0];
		int cnt = 0;
		int most_cnt = 0;
		rep(i, n){
			if (i == 0 || b[i] == b[i - 1]) cnt++; else cnt = 1;
			if (cnt > most_cnt){
				most_b = b[i];
				most_cnt = cnt;
			}
		}
		ban[most_b] = 1;
		//cout << most_b << ' ' << most_cnt << endl;
		ans = min(ans, most_cnt);
	}
	cout << ans;
}

int main(int argc, char const *argv[])
{
    ios_base::sync_with_stdio(0);
    solve();
}

Measured memory_bytes: 768
#include "bits/stdc++.h"
#define ALL(x) x.begin(), x.end()
#define LEN(x) (int)x.size()
#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;

signed main()
{
  string s; cin >> s;
  sort(ALL(s));

  bool f = true;
  for (int i = 1; i < LEN(s); ++i) {
    if (s[i] == s[i-1]) f=false;
  }

  puts(f ? "yes" : "no");

  return 0;
}



Measured memory_bytes: 256
/*
author : w2sc
  date : 2019/12/22
  time : 20:05:23
*/
#include <bits/stdc++.h>
#define ull unsigned long long
#define ll long long
using namespace std;
const int INF=0x3f3f3f3f;
const double EPS=1e-10,PI=acos(-1.);
int main()
{
    ll A,B;
    cin>>A>>B;
    cout<<(A*B/__gcd(A,B));
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
long long MIN(long long a,long long b){return a<b?a:b;}
long long MAX(long long a,long long b){return a<b?b:a;}
long long f(long long a,long long b,long long c){return MAX(MAX(a,b),c)-MIN(MIN(a,b),c);}
long long g(long long w,long long h){
	if(w%3==0)return 0;
	long long a,b;
	a=w/3;
	b=h/2;
	return MIN(MIN(f(a*h,(w-a)*b,(w-a)*(h-b)),f((a+1)*h,(w-a-1)*b,(w-a-1)*(h-b))),w);
}
int main(){
	long long w,h;
	scanf("%lld %lld",&w,&h);
	printf("%lld\n",MIN(g(w,h),g(h,w)));
	return 0;
}

Measured memory_bytes: 128