akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define MOD (int)1e9+(int)7
#define INF 2147483647
typedef long long ll;
//dark power
//#define int ll
//define Error、大抵は、セミコロン忘れとか、Defineは関係ない
/*
vector<int> d(100000);
vector<int> b(100000);
class UnionFind{
	public:
	UnionFind(signed n){rep(i,n){d[i]=i;b[i]=0;}}
	signed find(signed x){
		if(d[x]==x){
			return x;
		}else{
			return d[x]=find(d[x]);
		}
	}
	UnionFind(signed n){rep(i,n){d[i]=i;b[i]=0;}}
	void unite(signed x,signed y){
		x=find(x);
		y=find(y);
		if(x==y)return;
		if(b[x]<b[y]){
			d[x]=y;
		}else{
			d[y]=x;
			if(b[x]==b[y])b[x]++;
		}
	}
	bool same(signed x,signed y){return (find(x)==find(y));}
};
*/
signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	int k;
	cin>>n;
	cin>>k;
	vector<int> v(n);
	rep(i,n)cin>>v[i];
	sort(all(v));
	int mi=INF;
	int now=0;
	k--;
	rep(i,n-k){
		now=v[i+k]-v[i];
		if(mi>now)mi=now;
	}
	cout<<mi<<endl;

	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define p_b push_back
#define pll pair < ll , ll >

using namespace std;

const ll M = 1000000007;

ll mult( ll a, ll b)
{
    return (a*b)%M;
}

ll bin_pow( ll a, ll n)
{
    if(n==0)
    {
        return 1;
    }
    if(n%2==0)
    {
        ll b = bin_pow(a,n/2)%M;
        return mult(b,b);
    }
    else
    {
        return (bin_pow(a,n-1)*a)%M;
    }
}

ll solve( ll a, ll n)
{
    ll p = 1, q = 1;
    for( int i = 1; i <= a; i++)
    {
        p = mult(p,i);
    }
    for( int i = 0; i < a; i++)
    {
        q = mult(q,n-i);
    }
    return mult(q,bin_pow(p,M-2));
}


int main()
{
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n,a,b;
    cin >> n >> a >> b;
    ll ans = bin_pow(2,n)-1;
    ans = ans - solve(a,n)-solve(b,n);
    ans%=M;
    if(ans<0)
    {
        ans+=M;
    }
    cout << ans;
}


Measured memory_bytes: 256
s = input(); n = len(s)
dp = [ [0,1<<32] for i in range(n+1) ]
for i in range(n):
  d = ord(s[i])-ord('0')
  dp[i+1][0] = min(dp[i][0], dp[i][1])+d
  dp[i+1][1] = min(dp[i][0], dp[i][1]-2)+11-d
print(min(dp[n][0],dp[n][1]))

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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    ll N, A, B; cin >> N >> A >> B;
    ll ans = N/(A+B)*A;
    N -= (A+B)*(N/(A+B));
    //if N <= A -> N else -> A
    cout << ans + min(A, N) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int n,x,ways;
int main(void){
    while(true){
        cin>>n>>x;
        if(n==0&&x==0){break;}
        ways=0;
        for(int i=1;i<=n;i++){
            for(int j=i+1;j<=n;j++){
                if(x-i-j>j&&x-i-j<=n){
                    ways++;
                }
            }
        }
        cout<<ways<<endl;
    }
    return 0;
    

    
}


Measured memory_bytes: 3092
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <algorithm>
using namespace std;

const int MOD = 1000000007;


int main()
{
	int a,b;
	cin >> a >> b;
	cout << max(a+b, max(a-b, a*b)) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdint>
#include <iostream>
#include <vector>
#include <set>

using namespace std;

int main() {
  int64_t N, K;
  cin >> N >> K;
  
  int64_t mx_log = 0;
  vector<int64_t> logs(N);
  for (int64_t n = 0; n < N; ++n) {
    cin >> logs[n];
    mx_log = max(mx_log, logs[n]);
  }
  int64_t left = 0;
  int64_t right = mx_log;
  while (right - left > 1) {
    int64_t half = (left + right) / 2;
    int64_t k = K;
    for (int64_t n = 0; n < N; ++n) {
      if (half < logs[n]) {
        k -= (logs[n] -1) / half;
      }
    }
    if (k < 0) {
      left = half;
    } else {
      right = half;
    }
  }
  cout << right << endl;

  return 0;
}


Measured memory_bytes: 4768
#include<stdio.h>

int main()
{
  int n;
  scanf("%d",&n);
  
  if(n % 10 == 2 || n%10 == 4 || n%10 == 5 || n%10 == 7 || n%10 == 9){
    printf("hon");
    }else if(n%10 == 0 || n%10 == 1 || n%10 == 6 || n%10 == 8){
    printf("pon");
  }else{
    printf("bon");
  }
  return 0;
};


Measured memory_bytes: 2104
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define Return(expr) { Cout(expr); return 0; }
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(ll, x);
    ll p = 100;
    For(y, 10000){
        p += p / 100;
        if(p >= x) Return(y+1);
    }
}





Measured memory_bytes: 3636
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <iostream>

using namespace std;

//ifstream cin ("test.in");
//ofstream cout ("test.out");

const int MaxN = 100005;

string str1, str2;
int pSum[2][MaxN];
int pSum2[2][MaxN];

int main() {
  cin >> str1 >> str2;
  if (str1[0] == 'B') {
    pSum[0][1] = 1;
    pSum2[0][1] = 2;
  }
  else {
    pSum[0][1] = 2;
    pSum2[0][1] = 1;
  }

  for (int i = 1; i < str1.size(); ++i) {
    if (str1[i] == 'A') {
      pSum[0][i + 1] = pSum[0][i] + 2;
      pSum2[0][i + 1] = pSum2[0][i] + 1;
    }
    else {
      pSum[0][i + 1] = pSum[0][i] + 1; 
      pSum2[0][i + 1] = pSum2[0][i] + 2; 
    }
  }

  if (str2[0] == 'B') {
    pSum[1][1] = 1;
    pSum2[1][1] = 2;
  }
  else {
    pSum[1][1] = 2;
    pSum2[1][1] = 1;
  }
  for (int i = 1; i < str2.size(); ++i) {
    if (str2[i] == 'A') {
      pSum[1][i + 1] = pSum[1][i] + 2;
      pSum2[1][i + 1] = pSum2[1][i] + 1;
    }
    else {
      pSum[1][i + 1] = pSum[1][i] + 1; 
      pSum2[1][i + 1] = pSum2[1][i] + 2; 
    }
  }

  int q;
  cin >> q;
  for (int i = 1; i <= q; ++i) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (((pSum[0][b] - pSum[0][a - 1]) % 3 == (pSum[1][d] - pSum[1][c - 1]) % 3) and ((pSum2[0][b] - pSum2[0][a - 1]) % 3 == (pSum2[1][d] - pSum2[1][c - 1]) % 3)) {
      cout << "YES\n";
    }
    else {
      cout << "NO\n";
    }
  }
  return 0;
}

Measured memory_bytes: 2432
#include<stdio.h>

#define MAX_H 100
#define MAX_W 100
char field[MAX_H][MAX_W+1];
int count, H, W;

void dfs(int x, int y)
{
    if (field[x][y] == '#') {
        field[x][y] = '.';
        if (0 <= x-1 && x-1 < H && field[x-1][y] == '#') dfs(x-1, y);
        if (0 <= x+1 && x+1 < H && field[x+1][y] == '#') dfs(x+1, y);
        if (0 <= y-1 && y-1 < W && field[x][y-1] == '#') dfs(x, y-1);
        if (0 <= y+1 && y+1 < W && field[x][y+1] == '#') dfs(x, y+1);
    } 
    if (field[x][y] == '*') {
        field[x][y] = '.';
        if (0 <= x-1 && x-1 < H && field[x-1][y] == '*') dfs(x-1, y);
        if (0 <= x+1 && x+1 < H && field[x+1][y] == '*') dfs(x+1, y);
        if (0 <= y-1 && y-1 < W && field[x][y-1] == '*') dfs(x, y-1);
        if (0 <= y+1 && y+1 < W && field[x][y+1] == '*') dfs(x, y+1);
    } 
    if (field[x][y] == '@') {
        field[x][y] = '.';
        if (0 <= x-1 && x-1 < H && field[x-1][y] == '@') dfs(x-1, y);
        if (0 <= x+1 && x+1 < H && field[x+1][y] == '@') dfs(x+1, y);
        if (0 <= y-1 && y-1 < W && field[x][y-1] == '@') dfs(x, y-1);
        if (0 <= y+1 && y+1 < W && field[x][y+1] == '@') dfs(x, y+1);
    }
    return ;
}

int main(void)
{
    int i, j;
    while (scanf("%d%d", &H, &W) != EOF) {
        if (!H && !W) break;
        for (i = 0; i < H; i++) {
            scanf("%s", field[i]);
        }
        count = 0;
        for (i = 0; i < H; i++) {
            for (j = 0; j < W; j++) {
                if (field[i][j] != '.') {
                    dfs(i, j);
                    count++;
                }
            }
        }
        printf("%d\n", count);
    }
    return 0;
}

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

#pragma GCC optimize "O3"
#define rep(i,a,n) for(int i=a; i<n; i++)
typedef long long ll;
typedef pair<int,int> P;
const ll MOD = (int)1e9+7;
const ll INF = MOD*MOD;
const ll powll = 1LL<<1;


int main() {
    int t;
    cin >> t;
    rep(i,0,t){
        string s1,s2;
        cin >> s1 >> s2;
        int n1 = s1.size();
        int n2 = s2.size();
        int dp[n1+1][n2+1];
        rep(j,0,n1+1){
            rep(k,0,n2+1){
                dp[j][k] = 0;
            }
        }
        rep(j,0,n1){
            rep(k,0,n2){
                if(s1[j] == s2[k]){
                    dp[j+1][k+1] = max(dp[j+1][k], dp[j][k] + 1);
                }else{
                    dp[j+1][k+1] = max(dp[j+1][k], dp[j][k+1]);
                }
            }
        }
        // rep(j,0,n1+1){
        //     rep(k,0,n2+1){
        //         cout << dp[j][k] << " ";
        //     }
        //     cout << "\n";
        // }
        cout << dp[n1][n2] << "\n";
    }
}


Measured memory_bytes: 7072
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
using namespace std;
int main(){
  vector< int > A(10),B(10);
  for(int i = 0 ; i < 10 ; i++ ) cin >> A[i];
  for(int i = 0 ; i < 10 ; i++ ) cin >> B[i];
  sort(A.rbegin(),A.rend());
  sort(B.rbegin(),B.rend());
  cout << accumulate(A.begin(),A.begin()+3,0) << " "
       << accumulate(B.begin(),B.begin()+3,0) << endl;
}

Measured memory_bytes: 1200
N = int(input())
A = list(map(int, input().split()))


def comb2(n):
    return n * (n - 1) // 2


counts = [0] * (N + 1)
for a in A:
    counts[a] += 1
total = sum(map(comb2, filter(lambda n: n > 1, counts)))

for a in A:
    print(total - (counts[a] - 1))


Measured memory_bytes: 26012
using System;

namespace AtCoderBC113A_DiscountFare
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');

            int Ans = int.Parse(s[0]) + int.Parse(s[1]) / 2;

            Console.WriteLine(Ans.ToString());
        }
    }
}


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

#define ff first
#define ss second
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define w(x) int t; cin >> t; while(t--)
#define rep(i, a, b) for(int i = a; i <= b; i++)
#define repd(i, b, a) for(int i = b; i >= a; i--)
#define mk(arr,n,type) type* arr = new type[n];
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define um unordered_map
#define us unordered_set
#define pqm priority_queue<int>
#define pqmi priority_queue<int, vi, greater<int>>
#define lb(v, val) lower_bound(v.begin(), v.end(), val) - v.begin();
#define ub(v, val) upper_bound(v.begin(), v.end(), val) - v.begin();
#define setbits(x) __builtin_popcountll(x)
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define out(flag) flag ? cout << "NO" << endl : cout << "YES" << endl;
#define MAX 100001
#define mod 998244353
#define inf 1e18
#define PI 3.1415926535

void IO() {
	fast;
}

int main() {

	IO();

	ll n, w;
	cin >> n >> w;
	vector<ll> wt(n), val(n);
	for (ll i = 0; i < n; i++) {
		cin >> wt[i] >> val[i];
	}
	vector<vector<ll>> dp(n + 1, vector<ll>(w + 1));
	ll maxi = INT_MIN;
	for (ll i = 1; i <= n; i++) {
		for (ll j = 1; j <= w; j++) {
			dp[i][j] = dp[i - 1][j];
			if (wt[i - 1] <= j) {
				dp[i][j] = max(dp[i][j], val[i - 1] + dp[i - 1][j - wt[i - 1]]);
			}
		}
	}
	for (ll i = 0; i <= w; i++) {
		maxi = max(maxi, dp[n][i]);
	}
	cout << maxi << endl;

	return 0;
}


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

#define ll              long long
#define all(a)          a.begin(), a.end()
#define mod             1000000007
#define nl              printf("\n", )

using namespace std;

int main (){
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    
    int n;
    scanf("%d", &n);
    if(n) printf("0\n" );
    else printf("1\n" );


    return 0;
}


Measured memory_bytes: 3760
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;

long long cnt;
int l;
int A[1000000];
int n;
vector<int> G;

//間隔ｇを指定した挿入ソート
void insertionSort(int A[], int n, int g)
{
	for(int i=g;i<n;i++)
	{
		int v=A[i];
		int j=i-g;
		while(j>=0&&A[j]>v)
		{
			A[j+g]=A[j];
			j-=g;
			cnt++;
		}
		A[j+g]=v;
	}
}

void shellSort(int A[], int n)
{
	//数列G={1, 4, 13, 40, 121, 364, 1093, ...}
	for(int h=1; ; )
	{
		if( h > n )break;
		G.push_back(h);
		h=3*h + 1;
	}
	for(int i=G.size()-1;i>=0;i--)
	{
		insertionSort(A, n, G[i]);
	}
}

int main()
{
	cin>>n;
	for(int i=0;i<n;i++)scanf("%d", &A[i]);
	cnt = 0;

	shellSort(A,n);

	cout<<G.size()<<endl;
	for(int i=G.size()-1;i>=0;i--)
	{
		printf("%d",G[i]);
		if(i)printf(" ");
	}
	printf("\n");
	printf("%d\n",cnt);
	for(int i=0;i<n;i++)printf("%d\n",A[i]);
	return 0;
}




Measured memory_bytes: 7100
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <cmath>
const int MOD = 1e9 + 7;
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};
using namespace std;
typedef long long ll;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int A[100010] = {};
	int cnt = 0;
	long a;
	for(int i = 0; i < n; i++)
	{
		cin >> a;
		if(a > 100000)
			cnt++;
		else
			A[a]++;
	}
	long sum = 0;
	for(int i = 1; i < 100001; i++)
	{
		if(A[i] == i)
			continue;
		if(A[i] > i)
			sum += A[i] - i;
		else
			sum += A[i];
	}
	cout << sum + cnt << endl;
	return 0;
}



Measured memory_bytes: 640
#pragma GCC optimize("O3", "unroll-loops")
//#pragma GCC target("avx2")
#pragma optimize("fast-math")

#include <bits/stdc++.h>
#include <stdio.h>

using namespace std;
#define endl '\n'
#define ull unsigned long long
#define si short int
#define ll long long
#define ld long double
#define pb push_back
#define pii pair<int, int>
#define pdd pair<double, double>
#define pil pair<int, ll>
#define pli pair<ll, int>
#define pll pair<ll, ll>
#define piii pair<pair<int, int>, int>
#define all(vec) (vec).begin(), (vec).end()
#define rall(vec) (vec).rbegin(), (vec).rend()
#define piiii pair<pair<int, int>, pair<int, int>>

void solve() {
    int n;
    cin>>n;
    vector<pli> arr(n);
    for(int i=0;i<n;i++){
        cin>>arr[i].first;
        arr[i].second=i;
    }
    //will see who is coming on prefix thats why if value equals latest is more
    static ll dp[2001][2001];
    sort(rall(arr));
    /*for(int i=0;i<n;i++) cout<<arr[i].first<<" ";
    cout<<endl;*/
    //dp[m][k] if we are looking on first m values and k from them is going to first
    //dp[0][0]=1;
    for(int m=1;m<=n;m++){
        for(int k=0;k<=m;k++){
            dp[m][k]=max((k<=m-1)?dp[m-1][k]+arr[m-1].first*abs(arr[m-1].second-(n-m+k)):0,
                    ((k-1>=0)?dp[m-1][k-1]+arr[m-1].first*abs(arr[m-1].second-k+1) : 0));
        }
    }
    ll mx=-1;
    for(int k=0;k<=n;k++){
        mx=max(dp[n][k], mx);
    }
    cout<<mx<<endl;
}

void testcases(int n) {
    n = 1 - n;
    if (!n) cin >> n;
    for (int i = 0; i < n; i++) {
        solve();
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    //freopen("C:\\Users\\Maximus\\CLionProjects\\Codeforces\\BestTeam\\output.txt", "r", stdin);
    //f=fopen("C:\\Users\\Maximus\\CLionProjects\\Codeforces\\BestTeam\\output.txt", "w");
    //freopen("C:\\Users\\Maximus\\CLionProjects\\Codeforces\\BestTeam\\output.txt", "w", stdout);

    unsigned int beg_time = clock();
    testcases(0);
    // 0 - no t, 1 - with t

    unsigned int end_time = clock();
    //cout << endl << endl << end_time - beg_time;
    return 0;
}

Measured memory_bytes: 26336
n, a, b, c = map(int, input().split())
d = {'A':a, 'B':b, 'C':c}
ans = []
def move(inc, dec):
    d[inc]+=1
    d[dec]-=1
    ans.append(inc)
q = []
for i in range(n):
    q.append(input())
for i in range(n):
    x = q[i][0]
    y = q[i][1]
    if d[x] == 0 and d[y] == 0:
        print("No")
        exit()
    if d[x] == 1 and d[y] == 1:
        if i == n-1:
            move(x, y)
            continue
        if x in q[i+1]:
            move(x, y)
        else:
            move(y, x)
    else:
        if d[x] >= d[y]:
            move(y, x)
        else:
            move(x, y)
print("Yes")
print(*ans, sep = '\n')

Measured memory_bytes: 18496
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int unsigned long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"
#define pi 3.1415926535897932384626433832795028841971693993751058
#define maxn 100005

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define pq priority_queue
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
#define ceil(a,b) (a+b-1)/b
 
using namespace std;

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

#define MAX 10000002
int prime[MAX]; 
  
// Map to store count of primes 
unordered_map<int, int> prime_count; 
  
// Function to store smallest prime factor  
// in prime[] 
void sieve() 
{ 
    memset(prime, 0, sizeof(prime)); 
    prime[0] = prime[1] = 1; 
    for (int i = 2; i * i < MAX; i++) { 
        if (prime[i] == 0) { 
            for (int j = i * 2; j < MAX; j += i) { 
                if (prime[j] == 0) 
                    prime[j] = i; 
            } 
        } 
    } 
    for (int i = 2; i < MAX; i++) { 
  
        // If the number is prime then 
        // it's the smallest prime factor  
        // is the number itself 
        if (prime[i] == 0) 
            prime[i] = i; 
    } 
} 
  
// Function to return the count of the divisors for 
// the product of all the numbers from the array 
int numberOfDivisorsOfProduct(const int* arr,  
                                            int n) 
{ 
  
    for (int i = 0; i < n; i++) { 
        int temp = arr[i]; 
        while (temp != 1) { 
  
            // Increase the count of prime 
            // encountered 
            prime_count[prime[temp]]++; 
            temp = temp / prime[temp]; 
        } 
    } 
  
    int ans = 1; 
  
    // Multiplying the count of primes  
    // encountered 
    unordered_map<int, int>::iterator it; 
    for (it = prime_count.begin(); 
         it != prime_count.end(); it++) { 
        ans = ans * (it->second + 1); 
    } 
  
    return ans; 
} 
//START OF CODE ->->->->->->->

void solve()
{
    int n;
    cin>>n;
    int ans = 0;
    int arr[] = {0};
    sieve();
    // out1(numberOfDivisorsOfProduct(arr,1));
    // cout<<getFactorization(2)<<endl;
    rep(i,1,n+1){
        arr[0] = i;
        // out1(arr[0]);
        ans += (i*numberOfDivisorsOfProduct(arr,1));
        prime_count.clear();
    }
    cout<<ans<<endl;
}

//END OF CODE ->->->->->->->->

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 81768
#include <algorithm>
#include <iostream>
#include <vector>
#define repeat(i, n) for (int i = 0; (i) < (n); ++(i))
#define repeat_from(i, m, n) for (int i = (m); (i) < (n); ++(i))
using namespace std;
template <class T>
void setmax(T &a, T const &b) {
    if (a < b) a = b;
}

template <class T>
void setmin(T &a, T const &b) {
    if (a > b) a = b;
}

template <typename T, typename X>
auto vectors(T a, X x) { return vector<T>(x, a); }

template <typename T, typename X, typename Y, typename... Zs>
auto vectors(T a, X x, Y y, Zs... zs) {
    auto cont = vectors(a, y, zs...);
    return vector<decltype(cont)>(x, cont);
}

// 閉路検出が必要。ダブリングっていう方法は思い出せない、、
const long long INF = 1e17;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> P(N), C(N);
    repeat(i, N) {
        cin >> P[i];
        --P[i];
    }
    repeat(i, N) cin >> C[i];

    vector<int> Loop(N, -1);
    vector<long long> Score(N);
    repeat(i, N) {
        if (Loop[i] != -1) continue;
        int cur = i;
        long long score = 0;
        int loop = 0;
        while (true) {
            cur = P[cur], ++loop;
            score += C[cur];
            if (cur == i) break;
        }

        while (true) {
            Loop[cur] = loop, Score[cur] = score;
            cur = P[cur];
            if (cur == i) break;
        }
    }
    /*
    auto Table = vectors(make_pair(0, 0LL), 30, N);
    repeat(i, 30) {
        if (i == 0) {
            repeat(j, N) {
                Table[i][j].first = P[i];
                Table[i][j].second = C[P[i]];
            }
            continue;
        }

        int prev_to = Table[i - 1][j].first;
        Table[i][j].first = Table[i - 1][prev_to].first;
        Table[i][j].second = Table[i - 1][j].second + Table[i - 1][prev_to].second;
    }
    */
    long long ans = -INF;
    K--;
    repeat(i, N) {
        long long res = C[i];
        if (Score[i] <= 0) {
            long long score = C[i];
            int cur = i;
            int K1 = K;
            while (K1 > 0) {
                cur = P[cur];
                K1--;
                score += C[cur];
                setmax(res, score);
                if (cur == i) break;
            }
        } else {
            long long score = Score[i] * (K / Loop[i]) + C[i];
            long long K1 = K % Loop[i];
            setmax(res, score);
            int cur = i;
            while (K1 > 0) {
                cur = P[cur];
                K1--;
                score += C[cur];
                setmax(res, score);
            }
        }
        setmax(ans, res);
    }
    cout << ans << endl;
    return 0;
}

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

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

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

  int x = 0;
  for (int i = 0; i < n; ++i) {
    if (i % 2 == 0)
      x += a[i];
    else
      x -= a[i];
  }

  vector<int> ans(n);
  ans[0] = x;
  for (int i = 1; i < n; ++i) {
    ans[i] = 2 * a[i - 1] - ans[i - 1];
  }

  for (int i = 0; i < n; ++i) {
    printf("%d%c", ans[i], i == n - 1 ? '\n' : ' ');
  }
}

Measured memory_bytes: 2048
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define all(vec) vec.begin(),vec.end()
#define ggr getchar(); getchar();return 0;
#define ll long long
#define P pair<int,int>
#define S second
#define F first
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;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int kai(int x) {
	if (x == 1)return 1;
	return kai(x - 1)*x%mod;
}

int mod_pow(int x, int y, int moder) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%moder;
		x = x * x%moder;
		y >>= 1;
	}
	return res;
}

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

int n, m, a[114514], b[114514], c[114514];
vector<pair<int, int>> ta;
int ans;

signed main() {
	cin >> n >> m;
	rep(i, n)cin >> a[i];
	sort(a, a + n);
	rep(i, m) {
		cin >> b[i] >> c[i];
		ta.push_back({ c[i],b[i] });
	}
	sort(all(ta));
	reverse(all(ta));
	int k = 0;
	rep(i, m) {
		for (int j = k; j < k + ta[i].second; j++) {
			if (j >= n) break;
			if (a[j] < ta[i].first)a[j] = ta[i].first;
			else break;
		}
		k += ta[i].second;
	}
	rep(i, n)ans += a[i];
	cout << ans << endl;
}

Measured memory_bytes: 5236
#include <iostream>
#include <string>
#include <vector>


using namespace std;

int main(){
    
    int A, B, C;
    
    cin >> A >> B >> C;
    
    
    if (C-A+B > 0) {
        cout << C-A+B << endl;
    }else{
        cout << 0 << endl;
    }
    
    
    
    
    return 0;
    
}


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

using namespace std;

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

signed main () {
  cin.tie(0);
  cout << setprecision(10);

  const int MAX = 1000000000000000000;

  //19:36:30
  int a, b, c, k; cin >> a >> b >> c >> k;

  int ta = a, tb = b, tc = c;

  if(k % 2 == 0) {
    cout << a - b << endl;
  } else {
    cout << b - a << endl;
  }
}


Measured memory_bytes: 256
import math
A,B,H,M=list(map(int,input().split()))
jisin=30*H+(1/2)*M
hunsin=6*M
kakudo=abs(jisin-hunsin)
x=(A**2+B**2-2*A*B*math.cos(math.radians(kakudo)))**(1/2)
print(x)

Measured memory_bytes: 9500
#pragma GCC optimize "-O3"
#pragma GCC target ("avx")
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v),greater<int>())
signed gcd(int a, int b){return b?gcd(b,a%b):a;}
signed lcm(int a, int b){return a*b/gcd(a,b);}

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n;
    cin >> n;
    vi a(n);
    rep(i,n)cin >> a[i];
    int ans=a[0];
    for(int i=1;i<n;++i)
    {
        ans=gcd(ans,a[i]);
    }

    cout << ans << endl;
}


Measured memory_bytes: 1024
x, y = map(int, input().split())
res = 99999999999999
# そのまま
c = y - x
if c >= 0:
    res = min(res, c)

# 最初に1かい押す
c = y - (-x)
if c >= 0:
    res = min(res, c + 1)

# 最後に1かい押す
c = (-y) - (x)
if c >= 0:
    res = min(res, c + 1)

# 2回押す
c = (-y) - (-x)
if c >= 0:
    res = min(res, c + 2)

print(res)

Measured memory_bytes: 38588
#include<stdio.h>

int main() {
   double w, h, x, y;
   scanf("%lf%lf%lf%lf", &w, &h, &x, &y);

   printf("%lf %d\n", w*h/2., w/2 == x && h/2 == y ? 1 : 0);
   return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;
class Main
{
  public static void main(String args[])
  {
    Scanner sc=new Scanner(System.in);
    int a,b;
    a=sc.nextInt();
    b=sc.nextInt();
    if(a>(2*b))
    {
      System.out.println(((a-(2*b))));
    }
    else
      System.out.println("0");
  }
}

Measured memory_bytes: 21972
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)

int main(){
  int N;
  cin >> N;
  while(N >= 0){
    if(N % 4 == 0){
      cout << "Yes" << endl;
      return 0;
    }
    N -= 7;
  }
  cout << "No" << endl;
}

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

int main() {
  int n;
  cin >> n;
  vector<string> S(n);

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

  vector< map<char, int> > m(n, map<char, int>());

  for(int i = 0; i < n; i++) {
    for(char c: S[i]) {
      m[i][c] += 1;
    }
  }

  // cout << m << endl;

  for(char c = 'a'; c <= 'z'; c++) {
    int c_possible = 10000;
    for(int i = 0; i < n; i++) {
      c_possible = min(m[i][c], c_possible);
    }
    for(int i = 0; i < c_possible; i++) {
      cout << c;
    }
  }

  cout << endl;

}


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

int main()
{

	int n;
	cin >> n;

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

	int count=0;
	int left=0;
	int right=n-1;
	while (left<right)
	{
		// find W from left
		int pos;
		for (pos=left;pos<right;++pos)
		{
			if (c[pos]=='W')
			{
				break;
			}
		}
		if (pos==right)
		{
			cout << count << endl;
			return 0;
		}
		left=pos;
		
		// find R from right
		for (pos=right;pos>left;--pos)
		{
			if (c[pos]=='R')
			{
				break;
			}
		}
		if (pos==left)
		{
			cout << count << endl;
			return 0;
		}
		right=pos;

		++count;
		++left;
		--right;
	}
	cout << count << endl;
}







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

int main(void)
{
	
	int N, H, W;

	cin >> N >> H >> W;

	vector<int> A(N);
	vector<int> B(N);

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

	int count = 0;

	for (int i = 0; i < N; i++)
	{
		if (A[i] >= H && B[i] >= W)
		{
			count++;
		}
	}
	cout << count;

	return 0;
}


Measured memory_bytes: 256
object Main extends App {
  val in = new java.util.Scanner(System.in)
  val n = in.nextInt
  val as = Array.fill(n)(in.nextInt)
  val last = as.foldLeft(0){case (cur, act) => if (cur + 1 == act) act else cur}
  println(if (last == 0) -1 else n - last)
}

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

using namespace std;

#define REP(i, N) for (int i = 0; i < (int)N; i++)
#define LOOP(i, N) for (int i = 1; i <= (int)N; i++)
#define RREP(i, N) for (int i =(int)N-1; i >= 0; i--)
#define RLOOP(i, N) for (int i =(int)N; i > 0; i--)
#define FOR(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

typedef long long ll;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;
//cout<<"Yes"<<endl;
//cout<<"No"<<endl;
int main(){
  string s;
  cin>>s;
  REP(i,s.size()){
    if(s[i]=='?'){
      s[i]='D';
    }

  }
  cout<<s<<endl;
}


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

#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
 
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
 
const ll MAX = 1e6 + 3;
const ll inf = 1e18;
const ll mod = 1e9 + 7;


vii c;

ll bp(ll a,ll e){
    if(e == 0) return 1;
    if(e&1) return (a*bp(a,e-1))%mod;
    ll x = bp(a,e>>1);
    return (x*x)%mod;
}

ll inv(ll a){
    return bp(a,mod-2);
}

ll mul(ll a,ll b){
    return (a*b)%mod;
}
int main(){
    fastio;
    ll n,x,y;
    string s;
    cin >> x >> y;
    ll a = x -(x+y)/3, b = y - (x+y) /3;
    if( (x+y)%3 != 0 || a<0 || b <0) cout << "0\n";
    else{
        ll ans = 1;
        f(i,1,a+1) ans = mul(ans,mul(a+b+1-i,inv(i)));
        cout << ans << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;

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

    int N, K;
    cin >> N >> K;
    vector<pii> td(N);
    for (int i = 0; i < N; ++i) {
        cin >> td[i].first >> td[i].second;
        td[i].first--;
    }

    auto cmp = [&](pii a, pii b) { return a.second == b.second ? a.first < b.first : a.second > b.second; };
    sort(td.begin(), td.end(), cmp);

    priority_queue<int, vector<int>, greater<int>> que1;
    priority_queue<int> que2;
    vector<bool> isused(N);
    int cnt = 0;
    ll pt = 0;
    for (int i = 0; i < K; ++i) {
        if (isused[td[i].first])
            que1.push(td[i].second);
        else {
            isused[td[i].first] = true;
            cnt++;
        }
        pt += td[i].second;
    }
    for (int i = K; i < N; ++i) {
        if (!isused[td[i].first]) {
            isused[td[i].first] = true;
            que2.push(td[i].second);
        }
    }

    ll ans = pt + (ll)cnt * cnt;
    while (!que1.empty() && !que2.empty()) {
        pt -= que1.top();
        pt += que2.top();
        que1.pop();
        que2.pop();
        cnt++;
        ans = max(ans, pt + (ll)cnt * cnt);
    }

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


Measured memory_bytes: 1416
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include<stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
const int inf = 1000000007;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % inf;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), inf - 2, inf) % inf * mod_pow(kai(y), inf - 2, inf) % inf;
}
pair<string, string>p[110];
pair<string, int>o[110];
signed main() {
	int n;
	cin >> n;
	rep(i, n) {
		cin >> p[i].first >> p[i].second;
		if (p[i].second == "0") {
			p[i].second = "99-";
			o[i].first = p[i].first + p[i].second;
		}
		else if (stoi(p[i].second) < 100&&stoi(p[i].second)>90) {
			p[i].second = to_string(100 - stoi(p[i].second));
			o[i].first = p[i].first + "0" + p[i].second;
		}
		else {
			p[i].second = to_string(100 - stoi(p[i].second));
			o[i].first = p[i].first + p[i].second;
		}
		o[i].second = i;
	}
	sort(o, o + n);
	rep(i, n) {
		cout << o[i].second + 1 << endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
   
   int main()
   {
    int n;
    bool f = false;
  
    std::cin >> n;
  
    for (int x = 1; x <= 9; ++x){
      for (int y = 1; y <= 9; ++y){
        if ( n == x*y){
            f = true;
          }
  
      }
    }
  
    if (f == true){
     std::cout << "Yes" << std::endl;
    }else{
    std::cout << "No" << std::endl;
  }
   }

Measured memory_bytes: 256
n,k = map(int,input().split())
V = list(map(int,input().split()))
ans = 0
for i in range(n+1):
    for j in range(n+1-i):
        removed = V[:i] + V[n-j:]
        if len(removed) > k:break
        removed.sort()
        get = sum(removed)
        for l in range(min(k-len(removed),len(removed))):
            if removed[l] >= 0:break
            get -= removed[l]
        ans = max(ans,get)
print(ans)


Measured memory_bytes: 3064
while True:
    H,W = (int(x) for x in input().split())

    if H == 0 and W == 0:
        break
    
    print("#" * W)
    for i in range(1, H - 1):
        print("#", end="")
        print("." * (W - 2), end="")
        print("#")
    print("#" * W)
    print("")


Measured memory_bytes: 5644
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int n, m, a[20];
int f[20][1 << 17];
int fac[1 << 17], ifac[1 << 17];
int ans;

int fpow(int x, int y) {
	int ans = 1;
	while (y) {
		if (y & 1) ans = 1ll * ans * x % mod;
		y >>= 1; x = 1ll * x * x % mod;
	}
	return ans;
}

void init() {
	fac[0] = ifac[0] = 1;
	for (int i = 1; i <= 1 << 16; ++i) {
		fac[i] = 1ll * fac[i - 1] * i % mod;
		ifac[i] = fpow(fac[i], mod - 2);
	}
}

int comb(int x, int y) {
	if (y < 0 || y > x) return 0;
	return 1ll * fac[x] * ifac[y] % mod * ifac[x - y] % mod;
}

int main() {
	init();
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= m; ++i)
		scanf("%d", &a[i]);
	f[m + 1][0] = 1;
	for (int i = m; i >= 1; --i)
		for (int j = 0; j < 1 << n; ++j)
			if (f[i + 1][j]) {
				(f[i][j] += f[i + 1][j]) %= mod;
				int cnt = (1 << n) - a[i];
				for (int k = 0; k < n; ++k)
					if (j >> k & 1) cnt -= 1 << k;
				for (int k = 0; k < n; ++k)
					if (!(j >> k & 1))
						(f[i][j | (1 << k)] += mod - 1ll * f[i + 1][j] * comb(cnt, (1 << k) - 1) % mod * fac[1 << k] % mod) %= mod;
			}
	for (int i = 0; i < 1 << n; ++i) {
		int cnt = (1 << n) - 1;
		for (int j = 0; j < n; ++j)
			if (i >> j & 1) cnt -= 1 << j;
		(ans += 1ll * f[1][i] * fac[cnt] % mod) %= mod;
	}
	printf("%lld", (1ll << n) * ans % mod);
}


Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n; scanf("%d", &n);
	int N = 1 << n;
	static std::string s; cin >> s; std::vector<int> p(N);
	for(int i = 0; i < N; i++) scanf("%d", &p[i]);
	
	struct node {
		int id;

		node(int id = -1): id(id) {}
		node operator+(node r) const {
			if(id == -1) return r;
			if(r.id == -1) return (*this);
			
			if(id < r.id) return (s[r.id - id - 1] == '0' ? (*this) : r);
			return (s[id - r.id - 1] == '0' ? r : (*this));
		};
	};

	auto dp = make_v<node>(n + 1, 2 * N);
	for(int i = 0; i < N; i++) dp[0][i] = dp[0][i + N] = node(p[i]);
	for(int i = 0; i < n; i++) {
		for(int j = 0; j + (1 << i) < 2 * N; j++) {
			dp[i + 1][j] = dp[i][j] + dp[i][j + (1 << i)];
		}
	}

	for(int i = 0; i < N; i++) printf("%d\n", dp[n][i].id);
	return 0;
}



Measured memory_bytes: 45456
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
# define mod 1000000007
# define INF (1 << 29)
# define MAX_N 1000010
/* ACはうれCすぎてうれD */

int main(void){ 
    string s;
    cin >> s;
    if(s[0] == 'S' && s[1] == 'U') cout << 7;
    else if (s[0] == 'M') cout << 6;
    else if (s[0] == 'T' && s[1] == 'U') cout << 5;
    else if (s[0] == 'W') cout << 4;
    else if (s[0] == 'T' && s[1] == 'H') cout << 3;
    else if (s[0] == 'F') cout << 2;
    else if (s[0] == 'S' && s[1] =='A') cout << 1;
    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vii> vvii;

#define fastIO ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define forw(i,l,r) for(int i=(l);i<(r);i++)
#define forb(i,r,l) for(int i=(r);i>(l);i--)
#define log2i(x) 32 - __builtin_clz((x)) - 1
#define log2ll(x) 64 - __builtin_clzll((x)) - 1
#define Pi acos(-1.0)
#define sz(x) (int)x.size()
#define pw(x,y) trunc(exp(log((x))*(y)))
#define mt make_tuple
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

ll a,b,x,y;

int main() {
#ifndef ONLINE_JUDGE
    //freopen("test.inp","r",stdin);
    //freopen("test.out","w",stdout);
#endif
    fastIO;
    cin >> a >> b;
    x=max(a*25/2+((a*25)&1),b*10);
    y=min((a+1)*25/2-(1-((a+1)*25)&1),(b+1)*10-1);
    if(x<=y) cout << x;
    else cout << -1;
    return 0;
}


Measured memory_bytes: 256
/***********************************************
#
#      Filename: a.cpp
#
#        Author: Comsyl - ylsong15@fudan.edu.cn
#   Description: ---
#        Create: 2017-05-27 20:02:58
***********************************************/
#include <iostream>
using namespace std;
int N, A, B;

long long solve() {
    if (A == B) return 1L;
    if (A > B) return 0L;
    if (N == 1) {
        return 0;
    } else {
        long long min_v = (N - 1) * 1LL * A + B * 1LL;
        long long max_v = (N - 1) * 1LL * B + A * 1LL;
        return max_v - min_v + 1;
    }
}

int main()
{
    cin >> N >> A >> B;
    long long ans = solve();
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n, m = map(int, raw_input().strip().split())

if max(n, m) == 1:  # One point
    print 1
elif min(n, m) == 1:  # A line
    print max(n, m) - 2
    # End nodes have 1 neighbor each
    # Non-end nodes have 2 neighbors
else:
    print (n - 2) * (m - 2)  # Internal points have 8 neighbors
    # All corner points have 3 neighbors
    # All non-corner border nodes have 5 neighbors


Measured memory_bytes: 2568
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int H, W;
vector<vector<int>> map;
vector<string> process;

int getj(int i) {
	return ((i / W) % 2 == 0)? i % W : W - 1 - i % W;
}

int main() {

	cin >> H >> W;

	for (int i = 0; i < H; i++) {
		map.push_back(vector<int>());
		for (int j = 0; j < W; j++) {
			int tmp;
			cin >> tmp;
			map[i].push_back(tmp);
		}
	}

	int coin = 0, count = 0;
	for (int i = 0; i < H*W - 1; i++) {
		if (coin == 1) {
			if (map[i / W][getj(i)] % 2 == 0) {
				//コイン横流し
				string str;
				str = to_string(i / W + 1) + " " + to_string(getj(i) + 1) + " " + to_string((i + 1) / W + 1) + " " + to_string(getj(i + 1) + 1);
				process.push_back(str);
				count++;
			}
			else {
				//コイン停留
				coin = 0;
			}

		}
		else {
			if (map[i / W][getj(i)] % 2 == 1) {
				//コイン発生
				string str;
				str = to_string(i / W + 1) + " " + to_string(getj(i) + 1) + " " + to_string((i + 1) / W + 1) + " " + to_string(getj(i + 1) + 1);
				process.push_back(str);
				count++;
				coin = 1;
			}
		}
	}

	cout << count << endl;

	for (int i = 0; i < process.size(); i++) {
		cout << process[i] << endl;
	}
	return 0;
}

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

long long N, M, Q;
std::vector<long long> a, b, c, d;
long long ans = 0;

void dfs(vector<int> A) {
    if (A.size() == N + 1) {
        long long tmpans = 0;
        for (long long j = 0; j < Q; j++) {
            if (A[b[j]] - A[a[j]] == c[j]) {
                tmpans += d[j];
            }
        }
        ans = max(ans, tmpans);
        return;
    }

    A.push_back(A.back());
    while (A.back() <= M) {
        dfs(A);
        A.back()++;
    }
}

int main() {
    scanf("%lld", &N);
    scanf("%lld", &M);
    scanf("%lld", &Q);
    a = b = c = d = 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]);
    }
    dfs(vector<int>(1, 1));
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
#define ALL(A) (A).begin(),(A).end()
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)

const ll mod = 1e9+7;
const ll INF = -1*((1LL<<63)+1);
const int inf = -1*((1<<31)+1);

using namespace std;

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N ;
	vector<ll> a(N);
	rep(i,N)cin >> a[i];
	//実験するとマイナスとマイナスは+にできて マイナスとプラスは片方だけプラスにできるので
	sort(ALL(a));
	ll ans = 0;
	rep(i,N){
		if(a[i]<=0 && a[i+1]<=0 && i+1<N){
			ans += abs(a[i]) + abs(a[i+1]);
			i++;
		}else if(a[i]<=0 && a[i+1] >=0 && i+1<N){
			ans += max(abs(a[i]),abs(a[i+1]));
			ans -= min(abs(a[i]),abs(a[i+1]));
			i++;
		}else ans += a[i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <numeric>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9000000000000000000;
const double PI = acos(-1);

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

Measured memory_bytes: 768
#include <iostream>
#include <queue>
#include <vector>

#define VISITED 1

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> D(n, 0);
  vector<vector<int> > graph(n);
  vector<int> dist(n, -1);
  queue<int> q;
  for(int i = 0; i < n; i++) {
    int u, k, v_i;
    cin >> u >> k;
    for(int j = 0; j < k; j++) {
      cin >> v_i;
      graph[u-1].push_back(v_i-1);
    }
  }
  q.push(0);
  D[0] = VISITED;
  dist[0] = 0;
  while(!q.empty()) {
    int id = q.front();
    q.pop();
    for(int i = 0; i < graph[id].size(); i++) {
      if(D[graph[id][i]] != VISITED) {
	dist[graph[id][i]] = dist[id] + 1;
	q.push(graph[id][i]);
	D[graph[id][i]] = VISITED;
      }
    }
  }

  for(int i = 0; i < n; i++) cout << i+1 << " " << dist[i] << endl;
  return 0;
}

    
  

Measured memory_bytes: 3116
import java.util.Scanner;

public class Main{
 public static void main(String[] args) {
   Scanner kbd =new Scanner(System.in);
   long x=kbd.nextLong();
   long a=100;
   int y=0;

   while(x>a){
   a=(long)Math.floor(a*1.01);
   y=y+1;
}
System.out.println(y);
 }
}


Measured memory_bytes: 35792