akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
int n,m,a,b;
vector<int> sol;
vector<int> v[3001];
bitset<1001> f;
deque<int> st;
bool found;
bool in_stack[1001],use[1001];
void makegood()
{
    f.reset();
    for(int l=0;l<sol.size();l++)
    {
        int nd=sol[l];
        f[sol[l]]=1;
    }
    for(int l=0;l<sol.size();l++)
    {
        int nod=sol[l];
        for(int j=0;j<v[nod].size();j++)
            if(f[v[nod][j]]==1&&v[nod][j]!=sol[(l+1)%sol.size()])
            {
                int n1=v[nod][j];
                int n2=nod;
                vector<int> aux;
                bool found1=0;
                bool found2=0;
                for(int t=0;t<2*sol.size();t++)
                {
                    int poz=t%sol.size();
                    int val=sol[poz];
                    if(val==n1&&!found1)
                    {
                        found1=1;
                        aux.push_back(val);
                    }
                    else if(val!=n1&&val!=n2&&found1==1&&found2==0)
                    {
                        aux.push_back(val);
                    }
                    else if(val==n2&&found1==1&&found2==0)
                    {
                        found2=1;
                        aux.push_back(val);
                        break;
                    }
                }
                sol=aux;
                /*for(auto t:aux)
                    cout<<t<<" ";
                cout<<'\n';*/
                makegood();
                break;
            }
    }
}
bool dfs(int node)
{
    use[node]=1;
    in_stack[node]=1;
    st.push_back(node);
    for(auto i:v[node])
    {
        if(!use[i])
        {
            if(dfs(i))
                return true;
        }
        else if(in_stack[i])
        {
            while(st.back()!=i)
            {
                sol.push_back(st.back());
                st.pop_back();
            }
            sol.push_back(i);
            reverse(sol.begin(),sol.end());
            makegood();
            return true;
        }
    }
    st.pop_back();
    in_stack[node]=0;
    return false;
}
int main()
{
    cin>>n>>m;
    for(int i=1;i<=m;i++)
    {
        cin>>a>>b;
        v[a].push_back(b);
    }
    for(int i=1;i<=n;i++)
    {
        memset(use,0,sizeof(use));
        memset(in_stack,0,sizeof(in_stack));
        st.clear();
        if(dfs(i))
        {
            cout<<sol.size()<<'\n';
            for(int j=0;j<sol.size();j++)
                cout<<sol[j]<<'\n';
            return 0;
        }
    }
    cout<<-1;
    return 0;
}


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

using namespace std;

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const ll mod = 1e9+7;

int main()
{

	//cin.tie(0); ios_base::sync_with_stdio(false);
	string s;
	cin >> s ;
	int n=sz(s);
	cout << s.substr(0,n-8) <<"\n";
	return 0;

}


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

int main(){
  int a,b;
  cin>>a>>b;
  if(a<=8 && b<=8) cout<<"Yay!"<<endl;
  else cout<<":("<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <set>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())

using namespace std;
typedef long long ll;

int main(int argc, const char * argv[]) {
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n, m;
    cin >> n >> m;
    
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    
//    rep(i, m)
//    {
//        auto it = max_element(a.begin(), a.end());
//        *it /= 2;
//    }
//

    
    // 割引された値段, 商品id
    vector<pair<int, int>> vp;
    vp.reserve(n*31);
    rep(i,n)
    {
        int val = a[i];
        while(val > 0)
        {
            vp.emplace_back(make_pair(val, i));
            val /= 2;
        }
//        vp.emplace_back(make_pair(val, i));
    }
    
    sort(vp.rbegin(), vp.rend());
    
    if (vp.size() <= m)
    {
        cout << 0 << endl;
        return 0;
    }
    
    rep(i, m)
    {
        a[vp[i].second] /= 2;
    }
    
    ll sum = 0;
    rep(i, n)
    {
        sum += a[i];
    }

    cout << sum << endl;
    
    return 0;
}

Measured memory_bytes: 24832
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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 Monoid> struct SegTree {
    using Func = function<Monoid(Monoid, Monoid)>;
    const Func F;
    const Monoid UNITY;
    int SIZE_R;
    vector<Monoid> dat;
    
    SegTree(int n, const Func f, const Monoid &unity): F(f), UNITY(unity) { init(n); }
    void init(int n) {
        SIZE_R = 1;
        while (SIZE_R < n) SIZE_R *= 2;
        dat.assign(SIZE_R * 2, UNITY);
    }
    
    /* set, a is 0-indexed */
    void set(int a, const Monoid &v) { dat[a + SIZE_R] = v; }
    void build() {
        for (int k = SIZE_R - 1; k > 0; --k)
            dat[k] = F(dat[k*2], dat[k*2+1]);
    }
    
    /* update a, a is 0-indexed */
    void update(int a, const Monoid &v) {
        int k = a + SIZE_R;
        dat[k] = v;
        while (k >>= 1) dat[k] = F(dat[k*2], dat[k*2+1]);
    }
    
    /* get [a, b), a and b are 0-indexed */
    Monoid get(int a, int b) {
        Monoid vleft = UNITY, vright = UNITY;
        for (int left = a + SIZE_R, right = b + SIZE_R; left < right; left >>= 1, right >>= 1) {
            if (left & 1) vleft = F(vleft, dat[left++]);
            if (right & 1) vright = F(dat[--right], vright);
        }                                                                                                              
        return F(vleft, vright);
    }
    inline Monoid operator [] (int a) { return dat[a + SIZE_R]; }
    
    /* debug */
    void print() {
        for (int i = 0; i < SIZE_R; ++i) {
            cout << (*this)[i];
            if (i != SIZE_R-1) cout << ",";
        }
        cout << endl;
    }
};

ll Solve(SegTree<pair<ll, ll>>& seg, ll l, ll r)
{
    if (r - l <= 0) return 0;
    if (r - l == 1) return seg[l].second;

    pair<ll, ll> p = seg.get(l, r);

    return (p.second * ((p.first - l + 1) * (r - p.first))) + Solve(seg, l, p.first) + Solve(seg, p.first + 1, r);
}

void _main()
{
    ll N;
    cin >> N;

    SegTree<pair<ll, ll>> seg(N, [](pair<ll, ll> a, pair<ll, ll> b)
    {
        return a.second < b.second ? a : b;
    },
    make_pair(0, 1000000000));

    rep(i, 0, N)
    {
        ll a;
        cin >> a;
        seg.set(i, make_pair(i, a));
    }

    seg.build();

    cout << Solve(seg, 0, N) << endl;
}


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

int main(){
  int t=1,i,j,h,bu,a[4],b[4];

  while(cin>>a[0]>>a[1]>>a[2]>>a[3]){

  for(i=0;i<4;i++){
      cin>>b[i];
    }
  h=0;bu=0;
  for(i=0;i<4;i++){
    for(j=0;j<4;j++){
      if(a[i]==b[j]&&i==j)h+=1;
      else if(a[i]==b[j])bu+=1;   
    }
  }
  cout<<h<<" "<<bu<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;

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

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

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

            int sum = 0;
            double m;
            for(int i=0;i<n;i++){
                sum += s[i];
            }
            m = (double)sum/n;

            double a = 0;
            for(int i=0;i<n;i++){
                a += (s[i]-m)*(s[i]-m);
            }
            a/=n;

            System.out.printf("%.8f\n", Math.sqrt(a));
        }
    }
}



Measured memory_bytes: 31784
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;


int main() {

    long long int n;
    cin >> n;

    vector< long long int > v;

    for ( long long int i = 0; i < n; i++ ) {
        long long int in;
        cin >> in;
        v.push_back( in );
    }

    sort( v.begin(), v.end() );

    long double d = v[0];

    for ( long long int i = 1; i < n; i++ ) {
        d = ( d + v[i] ) / 2;
    }

    cout << fixed << setprecision(10) << d << endl;

    return 0;

}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
const int MAX_n = 300000;
int main(){
	int prime[MAX_n];
	for( int i = 2; i < MAX_n; i++ ){
		prime[i] = 1;
	}
	for( int i = 2; i < MAX_n; i++ ){
		if( prime[i] ){
			for( int j = i * 2; j < MAX_n; j += i ){
				prime[j] = 0;
			}
		}
	}
	int n;
	while( cin >> n, n ){
		int sum = 0;
		for( int i = n + 1; i <= 2 * n; i++ ){
			if( prime[i] == 1 ){
				sum++;
			}
		}
		cout << sum << endl;
	}
}

Measured memory_bytes: 2332
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


using namespace std;

struct Edge {
    int to, id;
    Edge(int to, int id): to(to), id(id) {}
};

vector<Edge> g[55];

vector<int> es;
bool dfs(int v, int tv, int p = -1) {
    if (v == tv) {
        es = vector<int>();
        return true;
    }
    for (Edge e: g[v]) {
        if (e.to == p) continue;
        if (dfs(e.to, tv, v)) {
            es.push_back(e.id);
            return true;
        }
    }
    return false;
}


int main(){
    int n, m;
    cin >> n;
    rep(i, n-1) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        g[a].emplace_back(b, i);
        g[b].emplace_back(a, i);
    }

    cin >> m;
    vector<ll> eset(m);
    rep(i, m) {
        int a, b;
        cin >> a >>b;
        --a; --b;
        dfs(a, b);
        for (int e:es) {
            eset[i] |= 1ll<<e;
        }
    }

    ll ans = 0;
    rep(i, 1<<m) {
        ll mask = 0;
        rep(j, m) {
            if (i >> j & 1) mask |= eset[j];
        }
        int white = __builtin_popcountll(mask);
        ll now = 1ll << (n-1-white);
        if (__builtin_popcountll(i)%2 == 0) ans += now;
        else ans -=now;
    }
    cout << ans << endl;

}

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

using namespace std;

const int NMAX = 55;
double v[NMAX];
int n;

int main(){
    int i;
    cin >> n;
    for(i = 1 ; i <= n ; i++){
        cin >> v[i];
    }

    if(n == 1){
        cout << v[1];
        return 0;
    }

    sort(v + 1, v + n + 1);

    double x = (v[1] + v[2]) / 2;
    for(i = 3 ; i <= n ; i++){
        x = (x + v[i]) / 2;
    }

    cout << x;

    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;

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

int main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	
	int ans;

	ans =  min(B, D) - max(A, C);

	if (ans < 0) ans = 0;

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

Measured memory_bytes: 256
#include <string>
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
  int N, K;
  cin >> N;

  string ans;
  int num = N;
  while (num != 0) {
    int r = num % 2;
    if (r < 0) {
      r += 2;
    }
    num = (num - r) / -2;
    ans += '0' + r;
  }

  reverse(ans.begin(), ans.end());
  if (ans.size() == 0) {
    cout << 0 << endl;
  } else {
    cout << ans << endl;
  }
}

Measured memory_bytes: 256
import collections

N = int(input())
A = list(map(int, input().split()))

L = [item+i for i, item in enumerate(A)]
R = [i - item for i, item in enumerate(A)]


C1 = collections.Counter(L)
C2 = collections.Counter(R)

ans = 0
for k, v in C1.items():
    if k in C2:
        ans += v * C2[k]
print(ans)



Measured memory_bytes: 63348
#include <iostream>

int main() {
    int n, h[100];
    std::cin >> n;
    for (int i = 0; (i < n); ++i) {
        std::cin >> h[i];
    }
    int sum = 1;
    for (int i = 1; (i < n); ++i) {
        bool ok = true;
        for (int j = 0; (j <= i - 1); ++j) {
            if (h[j] > h[i]) {
                ok = false;
            }
        }
        if (ok) sum++;
    }
    std::cout << sum << std::endl;
    return 0;
}


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

int n;

int main ()
{
	cin >> n;
	int ans = 0;
	for (int i = 1; i <= n; i += 2)
	{
		int cnt = 0;
		for (int j = 1; j *j <= i; ++j)
		{
			if (i % j == 0)
				cnt += 2;
			if (cnt > 8)
				break;
			if (j * j == i)
				--cnt;
		}
		if (cnt == 8)
			++ans;
	}
	cout << ans;
}


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

int lcs(string x, string y){
    int n = x.size();
    int m = y.size();
    int dp[n+1][m+1];
    for(int i = 0;i<n+1;i++)dp[i][0] = 0;
    for(int j = 0;j<m+1;j++)dp[0][j] = 0;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(x[i]==y[j]){
                dp[i+1][j+1]=dp[i][j]+1;
            }else{
                dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1]);
            }
        }
    }
    return dp[n][m];
}

int main(){
    int n;cin>>n;
    // string s1,s2;
    for(int i=0;i<n;i++){
        string s1,s2;
        cin>>s1>>s2;
        cout<<lcs(s1,s2)<<endl;
    }
    return 0;
}



Measured memory_bytes: 7076
White, Black = map(int, input().split())

White -= 1
Black -= 1
# White = "."
# Black = "#"
W = "."
B = "#"

ans = []
for i in range(max(2 * (-(-1 * White // 50)), 2)):
    ans.append([B for i in range(100)])
for j in range(max(2 * (-(-1 * Black // 50)), 2)):
    ans.append([W for i in range(100)])

# print(ans)
tmp = -2
row = 0
while(White != 0):
    if(tmp == 98):
        row += 2
        tmp = 0
    else:
        tmp += 2

    ans[row][tmp] = W
    White -= 1

row += 3
tmp = -2
while(Black != 0):
    # print(row, tmp)
    if(tmp == 98):
        # print(row)
        row += 2
        tmp = 0
    else:
        tmp += 2

    ans[row][tmp] = B
    Black -= 1

print(len(ans), 100)
for a in ans:
    print("".join(a))

Measured memory_bytes: 3188
s = gets.chomp.split("")
rights = []
lefts = []
s.each_with_index do |char, index|
  if char == "R"
    rights.unshift(index)
  else
    lefts.push(index)
  end
end

answers = Array.new(s.size, 0)

s.each_with_index do |char, index|
  if char == "R"
    destination = lefts.bsearch { |item| item > index }
    if (destination - index).even?
      answers[destination] += 1
    else
      answers[destination - 1] += 1
    end
  else
    destination = rights.bsearch { |item| item < index }
    if (index - destination).even?
      answers[destination] += 1
    else
      answers[destination + 1] += 1
    end
  end
end

puts answers.join(" ")


Measured memory_bytes: 13564
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
const ll INF = 1e16;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

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

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

int main() {
    init();
    ll N;
    cin >> N;
    vl A(N);
    rep(i, N) cin >> A[i];

    ll ans = N;
    ll x = 0, sum = 0, ri = 0;
    rep(i,N){
        while(ri<N&&(x^A[ri])==(sum+A[ri])){
            x ^= A[ri];
            sum += A[ri];
            ri++;
        }
        ans += ri - i - 1;
        sum -= A[i], x ^= A[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
N = int(input())
A = list(map(int, input().split()))
ans = 0
m = 10 ** 9 #絶対値の最小
c = 0 #マイナスの数
for i in range(N):
  ans += abs(A[i])
  if m > abs(A[i]):
    m = abs(A[i])
  if A[i] < 0: c += 1
print(ans if c % 2 == 0 else ans - 2 * m)

Measured memory_bytes: 14332
#include <bits/stdc++.h>
//#include <ext/numeric>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define oo 0x3f3f3f3f
#define OO 0x3f3f3f3f3f3f3f3f
#define popcount(n) __builtin_popcount(n)
#define popcountll(n) __builtin_popcountll(n)

//bool flag = __builtin_add_overflow(a , b , &tmp);
//bool flag = __builtin_mul_overflow(a , b , &tmp);
//bool flag3= __builtin_sub_overflow(a , b , &tmp);

using namespace std;
//using namespace __gnu_cxx;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const double PI = acos(-1.0), EPS = 1e-12;
const long long inf = 2e12 + 12;
const int MAXN = 250005, MAXM = 102, Mod = 1000000007 , MAXLog = 20;


int main() {
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "rt", stdin);
//    freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0), cout.precision(9), cout << fixed;

    int n;
    cin >> n;
    vector<int> a(n + 1), b(n + 1);
    for (int i = 0; i <= n; ++i)
        cin >> a[i];
    for (int i = 0; i < n; ++i)
        cin >> b[i];
    long long ans = 0;
    for (int i = 0; i < n; ++i) {
        int mn = min(a[i], b[i]);
        ans += mn;
        a[i] -= mn;
        b[i] -= mn;
        if (b[i]) {
            ans += min(a[i + 1], b[i]);
            a[i + 1] -= min(a[i + 1], b[i]);
        }
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <chrono>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template<class T>
istream &operator>>(istream &is, vector<T> &v) {
  for (T &x : v)
    is >> x;
  return is;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i)
      os << ' ' << v[i];
  }
  return os;
}

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int dfrac(int x, int y) {
  if (x < 0)return (x - y + 1) / y;
  return x / y;
}

int main() {
#ifdef ELEGIA
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);


  function<ll(int, int, int)> solve = [&](int n, int m, int k) {

    vector<int> div(n + 1);
    for (int i = 1; i <= n; ++i)
      for (int j = i; j <= n; j += i)
        ++div[j];

    ll ret = 0;
    for (int i = 1; i < n; ++i) {
      for (int d = 0; d < m - 1; ++d) {
        int d1 = gcd(d, n);
        int S2 = i * d;
        // G = S - (d1 + d2 + d3)/2
        int est = d1 + div[i] + div[n - i];
        if (S2 - n * 2 + 1 > k * 2) break;
        if (S2 - est + 1 > k * 2) continue;
        int least = min(dfrac(k * 2 - S2 + est - 1, n) - 1, m - 1 - d);
        least = max(least, 0);
        //int least = 0;
        ll con = 0;
        con += least;
        for (int j = least + 1; j * n + S2 - n * 2 + 1 <= k * 2 && j + d < m; ++j) {
          int act = S2 + j * n - d1 - gcd(i, j) - gcd(n - i, j + d) + 1;
          if (act <= k * 2)
            ++con;
        }
        if (d == 0) ret += con;
        else
          ret += con * 2;
      }
    }
    return ret;
  };

  int n, m, k;
  cin >> n >> m >> k;
  cout << (solve(n, m, k) + solve(m, n, k)) * 2;

#ifdef ELEGIA
  LOG("Time: %dms\n", int ((clock()
          -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}


Measured memory_bytes: 3576
s = (input())
ans = []
for i in s:
    if i == '0':
        ans.append(0)
    elif i == '1':
        ans.append(1)
    elif i == 'B':
        if len(ans) >= 1:
            del ans[-1]
ans = list(map(str, ans))
print(''.join(ans))

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
using namespace std;

int n,a,b,dig,tmp;
long long x,y;
vector<long long> ans;
int main(int argc,char const* argv[])
{
  cin >> x >> y;
  while(x<=y)
    {
      ans.push_back(x);
      x=x*2;
    }
  cout << ans.size() << endl;
  return 0;
}


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

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

  	getline(cin, A);
  	while(n--) {
  		
    getline(cin, A);
    for(int i=0;i<(int) A.size()-6;i++) {
    	
    if(A.substr(i,7) == "Hoshino")
    A.replace(i, 7, "Hoshina");

    }
    cout <<A << "\n";
  }
  	return 0;
}


Measured memory_bytes: 3192
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] H = new int[N];
        long ans = 0;
        long max = 0;
        for (int i=0;i<N;i++) {
            H[i] = sc.nextInt();
            if (i == 0) continue;
            if (H[i] > H[i-1]) {
                ans = max > ans ? max : ans;
                max = 0;
            } else {
                max++;
            }
        }
        ans = max > ans ? max : ans;
        System.out.println(ans);
    }
}


Measured memory_bytes: 51136
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

int main() {
  int n;
  cin >> n;
  map<string, int> cnt;
  while (n--) {
    string s;
    cin >> s;
    cnt[s]++;
  }
  cout << "AC x " << cnt["AC"] << endl;
  cout << "WA x " << cnt["WA"] << endl;
  cout << "TLE x " << cnt["TLE"] << endl;
  cout << "RE x " << cnt["RE"] << endl;
  return 0;
}


Measured memory_bytes: 3252
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    N=ii()
    P=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]

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



    N_p = {x:0 for x in P}
    for i in range(1,N+1):
        for p in prime_array(i):
            N_p[p] += 1
    
    # print(N_p)

    ans = 0
    for p in P:
        if N_p[p] >= 74: ans += 1
    
    for p1 in P:
        for p2 in P:
            if p1 == p2: continue
            if N_p[p1] >= 2 and N_p[p2] >= 24: ans += 1
            if N_p[p1] >= 4 and N_p[p2] >= 14: ans += 1
    
    seen = set()
    for p1 in P:
        for p2 in P:
            if p1 == p2: continue
            for p3 in P:
                if p2 == p3 or p1 == p3 or (p1,p2,p3) in seen: continue
                if N_p[p1] >= 2 and N_p[p2] >= 4 and N_p[p3] >= 4: ans += 1

                seen.add((p1,p2,p3))
                seen.add((p1,p3,p2))

    print(ans)




if __name__ == "__main__":
    main()

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

int main(){
  ll n;
  cin >> n;
  if(n == 1){
    cout << 0 << endl;
    return 0;
  }
  ll init = n;
  map<ll,ll> mp;
  for(ll i=2;i*i<=init;i++){
    while(n%i == 0){
      //cout << n << endl;
      mp[i]++;
      n /= i;
    }
  }
  if(mp.size() == 0){
    cout << 1 << endl;
    return 0;
  }
  //for(auto p : mp) cout << p.first << " " << p.second << endl;
  ll ans = 0;
  for(auto p : mp){
    //ll a = p.first;
    ll b = p.second;
    ll cnt = 1;
    while(b-cnt >= 0){
      //cout << a << " " << b << endl;
      b -= cnt;
      cnt ++;
      ans ++;
    }
  }//for
  cout << ans + (n!=1) << endl;
}


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

using namespace std;

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

int n;
vector<int> w;
int dp[333][333];

int solve(int l, int r) {
  if (r - l <= 1) return 0;
  if (r - l == 2) {
    if (abs(w[l + 1] - w[l]) <= 1) {
      return 2;
    } else {
      return 0;
    }
  }
  if (dp[l][r] != -1) return dp[l][r];
  if (abs(w[r - 1] - w[l]) <= 1 && solve(l + 1, r - 1) == r - l - 2) {
    chmax(dp[l][r], r - l);
  }

  for (int i = l + 1; i < r; i++) {
    chmax(dp[l][r], solve(l, i) + solve(i, r));
  }
  return dp[l][r];
}

int main() {
  while (cin >> n, n) {
    w.assign(n, 0);
    for (int i = 0; i < n; i++) {
      cin >> w[i];
    }
    for (int i = 0; i <= n; i++) {
      for (int j = 0; j <= n; j++) {
        dp[i][j] = -1;
      }
    }
    cout << solve(0, n) << endl;
  }

  return 0;
}


Measured memory_bytes: 3468
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int root[100000];
int getRoot(int v){ return root[v] == -1 ? v : root[v] = getRoot(root[v]); }

int main(){
	int N, M;
	while(cin >> N >> M){
		fill(root, root+N, -1);
		vector<int> a(N);
		for(int& t : a) cin >> t;
		for(int i=0;i<M;i++){
			int x, y; cin >> x >> y;
			int p = getRoot(x);
			int q = getRoot(y);
			if(p != q) root[q] = p;
		}
		map<int, int> id;
		for(int i=0;i<N;i++){
			int p = getRoot(i);
			if(!id.count(p)){
				int size = id.size();
				id[p] = size;
			}
		}
		if(id.size() == 1){
			cout << 0 << endl;
			continue;
		}
		vector<vector<int>> v(id.size());
		for(int i=0;i<N;i++){
			v[id[getRoot(i)]].push_back(a[i]);
		}
		for(auto& vec : v) sort(vec.begin(), vec.end());
		long long res = 0;
		vector<int> all;
		for(const auto& vec : v){
			res += vec[0];
			for(int i=1;i<vec.size();i++) all.push_back(vec[i]);
		}
		if(all.size() < (int)v.size()-2){
			cout << "Impossible" << endl;
			continue;
		}
		sort(all.begin(), all.end());
		for(int i=0;i<(int)v.size()-2;i++) res += all[i];
		cout << res << endl;
	}
}


Measured memory_bytes: 11264
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N;
    cin >> N;
    string S;
    cin >> S;

    int x = 0, ans = 0;
    for(int i=0;i<N;i++){
        if(S.at(i) == 'I')
            x++;
        else
            x--;
        ans = max(x, ans);
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAXN=200010,P=998244353;
struct Ro {
	int x,d;
}rb[MAXN];
int n,mx,eg,r[MAXN],hd[MAXN],ver[2*MAXN],nx[2*MAXN],dp[MAXN],fa[MAXN],val[MAXN*4];
bool cmp (Ro a,Ro b) {return a.x<b.x;}
void modify (int p,int l,int r,int pos,int v) {
	if (l==r) {val[p]=v;return;}
	int mid=(l+r)>>1;
	if (pos<=mid) {modify(p<<1,l,mid,pos,v);}
	else {modify((p<<1)|1,mid+1,r,pos,v);}
	val[p]=max(val[p<<1],val[(p<<1)|1]);
	return; 
}
int query (int p,int l,int r,int xl,int xr) {
	if (xr<l||r<xl) {return 0;}
	if (xl<=l&&r<=xr) {return val[p];}
	int mid=(l+r)>>1;
	return max(query(p<<1,l,mid,xl,xr),query((p<<1)|1,mid+1,r,xl,xr));
}
void add_edge (int x,int y) {
	ver[++eg]=y;
	nx[eg]=hd[x];
	hd[x]=eg;
	return;
}
void dfs (int x,int fa) {
	int res=1;
	for (int i=hd[x];i;i=nx[i]) {
		if (ver[i]==fa) {continue;}
		dfs(ver[i],x);
		res=(1ll*res*dp[ver[i]])%P;
	}
	dp[x]=(res+1)%P;
	return;
}
int main () {
	scanf("%d",&n);
	for (int i=1;i<=n;i++) {
		scanf("%d%d",&rb[i].x,&rb[i].d);
	}
	sort(rb+1,rb+n+1,cmp);
	for (int i=n;i>=1;i--) {
		int l=i,rr=n;
		while (l<rr) {
			int mid=(l+rr+1)>>1;
			if (rb[i].x+rb[i].d>rb[mid].x) {l=mid;}
			else {rr=mid-1;}
		}
		r[i]=query(1,1,n,i,l);
		if (!r[i]) {r[i]=i;}
		modify(1,1,n,i,r[i]); 
	}
	int p=n+1;
	r[n+1]=n;
	for (int i=1;i<=n;i++) {
		while (r[i]>r[p]) {p=fa[p];}
		fa[i]=p;
		add_edge(i,p),add_edge(p,i);
		p=i;
	}
	dfs(n+1,0);
	printf("%d\n",(dp[n+1]-1+P)%P);
	return 0;
}

Measured memory_bytes: 23680
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
typedef vector<int> vi;
const int mod = 1000000007;





int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    int dig = n%10;
    if(dig==2 ||dig==4 ||dig==5||dig==7 ||dig==9){
        cout<<"hon"<<endl;
    }
    else if(dig==0||dig==1 ||dig==6 ||dig== 8){
        cout<<"pon"<<endl;
    }
    else
    {
        cout<<"bon"<<endl;
    }
    



  






}

Measured memory_bytes: 3652
#include <stdio.h>

int bitcount(unsigned int num) {
	num=((num&0xAAAAAAAA)>>1)+(num&0x55555555);
	num=((num&0xCCCCCCCC)>>2)+(num&0x33333333);
	num=((num&0xF0F0F0F0)>>4)+(num&0x0F0F0F0F);
	num=((num&0xFF00FF00)>>8)+(num&0x00FF00FF);
	num=((num&0xFFFF0000)>>16)+(num&0x0000FFFF);
	return (int)num;
}

int main(void) {
	int n,k,s;
	while(scanf("%d%d%d",&n,&k,&s)==3 && (n|k|s)!=0) {
		int i;
		int count=0;
		int max=1<<n;
		for(i=0;i<max;i++) {
			if(bitcount(i)==k) {
				int j,sum=0;
				for(j=0;j<n;j++) {
					if((i>>j)&1)sum+=(j+1);
				}
				if(sum==s)count++;
			}
		}
		printf("%d\n",count);
	}
	return 0;
}

Measured memory_bytes: 600
import sys
x, y = map(int, input().split(' '))
ans = 0

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

if (x+y) % 3 != 0:
  print(0)
  sys.exit()

m = (2*x - y) / 3
n = x -2*m

# print(m, n)
if m < 0 or n < 0:
  print(0)
  sys.exit()

ans = cmb(int(m+n), int(n))
print(ans % (10**9 + 7))

Measured memory_bytes: 102028
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", x);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;

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

	sort(a, a + 3);

	int ans = 0;
	while (a[0] < a[2] - 1) {
		a[0] += 2;
		ans++;
	} 
	while (a[1] < a[2] - 1) {
		a[1] += 2;
		ans++;
	}

	if (a[1] == a[0] && a[1] == a[2]) cout << ans << endl;
	else if (a[0] == a[1]) cout << ans + 1 << endl;
	else cout << ans + 2 << endl;

	return 0;
}

Measured memory_bytes: 256
from collections import Counter


H, W = map(int, input().split())
A = [input() for _ in range(H)]

char_to_cnt = Counter()
for h in range(H):
    for w in range(W):
        char_to_cnt.update(A[h][w])

if H % 2 != 0 and W % 2 != 0:
    g1 = 1
    g2 = H // 2 + W // 2
    g4 = (H // 2) * (W // 2)
else:
    g1 = 0
    if H % 2 == 0 and W % 2 == 0:
        g2 = 0
    else:
        if H % 2 == 0:
            g2 = H // 2
        else:
            g2 = W // 2
    g4 = (H * W - g1 - g2 * 2) // 4

for _ in range(g1):
    for char in char_to_cnt.keys():
        cnt = char_to_cnt[char]
        if cnt % 4 == 1 or cnt % 4 == 3:
            char_to_cnt[char] -= 1
            break

for _ in range(g2):
    for char in char_to_cnt.keys():
        cnt = char_to_cnt[char]
        if cnt % 4 == 2:
            char_to_cnt[char] -= 2
            break

for _ in range(g4):
    for char in char_to_cnt.keys():
        cnt = char_to_cnt[char]
        if cnt != 0 and cnt % 4 == 0:
            char_to_cnt[char] -= 4
            break

for _, cnt in char_to_cnt.items():
    if cnt % 4 != 0:
        print("No")
        exit()

print("Yes")


Measured memory_bytes: 3316
if __name__ == '__main__':
    n = int(input())
    n %= 10
    if n == 2 or n == 4 or n == 5 or n == 7 or n == 9:
        print("hon")
    elif n == 0 or n == 1 or n == 6 or n == 8:
        print("pon")
    elif n == 3:
        print("bon")

Measured memory_bytes: 9164
n, k = map(int, input().split())
d = list(map(int, input().split()))
ds = set(d)

ans = n
flag = True

while flag:
  stans = str(ans)
  array = list(map(int, stans))
  sa = set(array)
  
  if sa & ds == set():
    flag = False
  else:
    ans += 1
    
print(ans)

Measured memory_bytes: 3060
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repA(i, a, n) for(int i = a; i <= (n); ++i)
#define repD(i, a, n) for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a) memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
	ll n; cin >> n;
	ll a, b; cin >> a >> b;
	if((b-a)%2 == 0){
		cout << (b-a)/2;
	}else{
		if(a-1 < n-b){
			cout << (b-a-1)/2 + a;
		}else{
			cout << (n-b+1) + (b-a-1)/2;  
		}
	}
	return 0;
}



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

using namespace std;

#define INF 1000007
#define MOD 1000000007
#define maxn 100
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)

int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}

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

int mpow(int N, int P, int M) //繰り返し自乗法
{
    if (P == 0)
        return 1;
    if (P % 2 == 0)
    {
        int t = mpow(N, P / 2, M);
        return t * t % M;
    }
    return N * mpow(N, P - 1, M) % M;
}

int counter(int x) //bit計算
{
    if (x == 0)
        return 0;
    return counter(x >> 1) + (x & 1);
}

vector<bool> prime(maxn + 1, true); //素数テーブル
void prime_table(void)
{
    prime[0] = false;
    prime[1] = false;
    for (int i = 2; i * i <= maxn; i++)
    {
        if (!prime[i])
        {
            continue;
        }
        for (int j = i + i; j <= maxn; j += j + i)
        {
            prime[j] = false;
        }
    }
}

bool IsPrime(int num) //素数判定
{
    if (num < 2)
        return false;
    else if (num == 2)
        return true;
    else if (num % 2 == 0)
        return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }

    return true;
}
vector<int> divisor(int n) //約数列挙
{
    vector<int> ret;
    for (int i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            ret.push_back(i - 1);
            if (i * i != n)
            {
                ret.push_back((n / i) - 1);
            }
        }
    }
    sort(ret.begin(), ret.end());
    return (ret);
}
int numofbits4(int bits)
{
    int num;

    num = (bits >> 1) & 03333333333;
    num = bits - num - ((num >> 1) & 03333333333);
    num = ((num + (num >> 3)) & 0707070707) % 077;

    return num;
}

int N, M, Q, ans;
vector<int> a, b, c, d;
void dfs(vector<int> A)
{
    if (A.size() == N + 1)
    {
        int now = 0;
        rep(i, Q)
        {
            if (A[b[i]] - A[a[i]] == c[i])
                now += d[i];
        }
        ans = max(ans, now);
        return;
    }
    A.push_back(A.back());
    while (A.back() <= M)
    {
        dfs(A);
        A.back()++;
    }
}
int main()
{
    cin >> N >> M >> Q;
    a = b = c = d = vector<int>(Q);
    rep(i, Q)
    {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    dfs(vector<int>(1, 1));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3572
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    if (B <= C || D <= A) cout << 0 << endl;
    else cout << min(B, D) - max(A, C) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>
#include <random>
#include <functional>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define int long long
const int N = 500000;
const long long MOD = 1e9 + 7;

int n, k;
int vv[1500000];
int fact[1500000];

long long inq(long long x, long long y)
{
    if (y == 0) return 1;
    long long l = inq(x, y / 2);
    if (y % 2) return l * l % MOD * x %MOD;
    return l * l % MOD;
}

long long cnk(long long n, long long k)
{
    return fact[n] * vv[k] % MOD * vv[n - k] % MOD;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> k;
    fact[0] = 1, vv[0] = 1;
    for (int i = 1; i <= N; i++) fact[i] = fact[i - 1] * i % MOD, vv[i] = inq(fact[i], MOD - 2);
    if (k + 1 >= n)
    {
        cout << cnk(2 * n - 1, n);
        return 0;
    }
    long long ans = 0;
    for (int l = 0; l <= k; l++)
    {
        ans = (ans + cnk(n, l) * cnk(n - 1, l)) % MOD;
    }
    cout << ans;
}


Measured memory_bytes: 10496
import java.util.Scanner;
import java.lang.Math;

public class Main {
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    long n = scan.nextLong();
    long sum = 0;
    long M = Long.MIN_VALUE;
    long m = Long.MAX_VALUE;
    for (int i = 0; i < n; i++) {
      long tmp = scan.nextLong();
      sum += tmp;
      M = Math.max(M,tmp);
      m = Math.min(m,tmp);
    }
    System.out.printf("%d %d %d\n",m,M,sum);
    scan.close();
  }
}



Measured memory_bytes: 42084
#include<iostream>
#include<vector>
#include<algorithm>
#include<complex>
#include<string.h>
using namespace std;
int main(){
	char a[51], b[51];
	cin >> a >> b;
	for (int i = 0; i < strlen(a); i++){
		cout << a[i];
		if (b[i] != '\0'){
			cout << b[i];
		}
	}
	cout << endl;
	return 0;
}


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

using namespace std;

int main(){
	long long x;
	cin>>x;

	vector<long long> A;
	for(long long i=0;i<=300;i++){
		A.push_back(i*i*i*i*i);
	}

	for(long long i=-300;i<=300;i++){
		long long b=(i*i*i*i*i)*-1;
		long long dis=x-b;

		long long a=-99999999999;
		int l=0,r=A.size()-1;

		while(l<=r){
			int mid=(l+r)/2;

			if(A.at(mid)==dis){
				a=mid;
				break;
			}else if(A.at(mid)<dis){
				l=mid+1;
			}else if(A.at(mid)>dis){
				r=mid-1;
			}
		}

		if(a!=-99999999999 && a*a*a*a*a+b==x){
			cout<<a<<" "<<i<<endl;
			break;
		}
	}

	return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define ld long double
#define F first
#define S second
#define pii pair<ll,ll>

using namespace :: std;

const ll mod=1e9+7;
const ll inf=1e17+500;
const ll maxn=2e5+500;
ll ans=0;

vector<ll> red[maxn];
vector<ll> blu[maxn];
ll minred[maxn];
ll parred[maxn][20];
ll minblu[maxn];
ll parblu[maxn][20];

ll stred[maxn];
ll etred[maxn];

ll stblu[maxn];
ll etblu[maxn];

bool star[maxn];
ll tt=0;

bool mishe[maxn];

void dfsred(ll a,ll p=-1,ll H=0){
    stred[a]=tt++;
    minred[a]=H;
    for(auto v:red[a]){
        if(v!=p){
            parred[v][0]=a;
            dfsred(v,a,H+1);
        }
    }
    etred[a]=tt++;
}
void dfsblu(ll a,ll p=-1,ll H=0){
    stblu[a]=tt++;
    minblu[a]=H;
    for(auto v:blu[a]){
        if(v!=p){
            parblu[v][0]=a;
            dfsblu(v,a,H+1);
        }
    }
    etblu[a]=tt++;
}
bool is_par_red(ll a,ll b){
    return (stred[a]<=stred[b] &&etred[a]>=etred[b]);
}
bool is_par_blu(ll a,ll b){
    return (stblu[a]<=stblu[b] &&etblu[a]>=etblu[b]);
}
ll lca_red(ll a,ll b){
    if(is_par_red(a,b))return a;
    if(is_par_red(b,a))return b;
    for(ll i=19;i>=0;i--){
        if(!is_par_red(parred[a][i],b))
            a=parred[a][i];
    }
    return parred[a][0];
}
ll lca_blu(ll a,ll b){
    if(is_par_blu(a,b))return a;
    if(is_par_blu(b,a))return b;
    for(ll i=19;i>=0;i--){
        if(!is_par_blu(parblu[a][i],b))
            a=parblu[a][i];
    }
    return parblu[a][0];
}
ll fas_red(ll a,ll b){
    ll lc=lca_red(a,b);
    return minred[a]+minred[b]-2*minred[lc];
}
ll fas_blu(ll a,ll b){
    ll lc=lca_blu(a,b);
    return minblu[a]+minblu[b]-2*minblu[lc];
}
ll nazdik_blu(ll a,ll b){
    if(a==b)return a;
    if(!is_par_blu(b,a)){
        return parblu[b][0];
    }
    for(ll i=19;i>=0;i--){
        if(!is_par_blu(parblu[a][i],b))
            a=parblu[a][i];
    }
    return a;
}
void dfs_mishe(ll a,ll b,ll p=-1){
    if(a==b){
        return;
    }
    ans=max(ans,minred[a]*2+fas_blu(a,b)*2);
    mishe[a]=1;
    for(auto v:red[a]){
        if(v!=p){
            dfs_mishe(v,nazdik_blu(v,b),a);
        }
    }
}
int main(){
    ll n,x,y;
    cin>>n>>x>>y;
    vector<pii> yal;
    for(ll i=1;i<n;i++){
        ll v,u;
        cin>>v>>u;
        yal.pb(mp(v,u));
        red[u].pb(v);
        red[v].pb(u);
    }
    for(ll i=1;i<n;i++){
        ll v,u;
        cin>>v>>u;
        blu[u].pb(v);
        blu[v].pb(u);
    }
    tt=0;
    parred[x][0]=x;
    dfsred(x);
    tt=0;
    parblu[y][0]=y;
    dfsblu(y);
    for(ll i=1;i<20;i++){
        for(ll j=1;j<=n;j++){
            parred[j][i]=parred[parred[j][i-1]][i-1];
            parblu[j][i]=parblu[parblu[j][i-1]][i-1];
        }
    }
    for(auto e:yal){
        ll v=e.F;
        ll u=e.S;
        if(fas_blu(v,u)>2){
            star[v]=1;
            star[u]=1;
        }
    }
    dfs_mishe(x,y);
    for(ll i=1;i<=n;i++){
        if(star[i] && mishe[i]){
            cout<<-1;
            return 0;
        }
    }
    cout<<ans<<endl;
}




Measured memory_bytes: 106732
#include <bits/stdc++.h>
#include <set>
#include <numeric>
#define rep(i,n) for (int i=0; i < (n); ++i)
#define all(a) a.begin(), a.end()
using ll = long long;
using namespace std;
 
// ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }


// const double PI = acos(-1);
// int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
// int a[12][12];
//平方根　= sqrt

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

  if(n%2==0) {
    cout << n << endl;
  }
  else {
    cout << 2*n << endl;
  }
}


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


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <unordered_map>
#include <vector>
using namespace std;
using ll = int64_t;

int main() {
  ll n;
  cin >> n;
  if (n & 1)
    cout << n * 2;
  else
    cout << n;
  cout << endl;
  return 0;
}

Measured memory_bytes: 3636