akhauriyash/Code-Regression huggingface dataset:
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-12;

//int N, M, K, T, H, W, L, R;
long long int N, M, K, T, H, W, L, R;


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

	cin >> H >> W;
	vector<int>l(H);
	vector<int>r(H);
	for (int i = 0; i < H; i++) {
		cin >> l[i] >> r[i];
	}
	multiset<int>ms;
	set<pair<int, int>>s;
	for (int i = 0; i < W; i++) {
		ms.insert(0);
		s.emplace(i+1, i+1);
	}
	vector<int>ans;
	for (int i = 0; i < H; i++) {
		while (1) {
			auto it = s.lower_bound({ l[i],0 });
			if (it == s.end())break;
			if (it->first <= r[i]) {
				ms.erase(ms.find(it->first - it->second));
				if ((next(it) == s.end() || next(it)->first > r[i]) && r[i] != W) {
		//			cout << "it " << it->first << " " << it->second << endl;
					s.insert({ r[i] + 1,it->second });
					ms.insert(r[i] + 1 - it->second);
				}
		//		cout << "erase " << it->first << " " << it->second << endl;
				s.erase(s.lower_bound({ l[i],0 }));
			}
			else {
				break;
			}
		}
	//	for (auto j : s) {
	//		cout << j.first << " " << j.second << endl;
	//	}
		if (ms.size())cout << *ms.begin() + i + 1 << endl;
		else cout << -1 << endl;
	}
}

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

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    vector<bool> vec(n);
    for (int i=0; i<k; ++i) {
        int d, a;
        cin >> d;
        for (int j=0; j<d; ++j) {
            cin >> a;
            vec[a-1] = true;
        }
    }
    int count = 0;
    for (auto e: vec) {
        if (!e) ++count;
    }
    cout << count << endl;
}


Measured memory_bytes: 3628
#include<iostream>
#include<cstdio>
using namespace std;
int n,a,b,c;
bool flag=1;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{scanf("%d%d%d",&a,&b,&c);
	 a=a-c-b;
	 if(a<0||(a%2==1))
	 flag=0;
	}
    if(flag==0)
	{cout<<"No";
	}
	else
	cout<<"Yes";
	return 0;	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int N;
    cin >> N;
    int ans=0;
    for(int i=5;i<=N;i+=2){
        int cou=0;
        for(int j=3;j<=i;j+=2){
            if(i%j==0)cou++;
        }
        if(cou==7) ans++;
    }
    cout << ans << endl;



}


Measured memory_bytes: 256
function main(){
  var debt = 100000;
 
  for(var i = 0; i < input.trim()-0; i++){
    debt = Math.ceil((debt * 1.05)/1000) * 1000;
  }

  console.log(debt);
}

var
input = '';

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
process.stdin.on('end', function() {
  main();
});

Measured memory_bytes: 7644
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); i++)
#define print(n) cout << n << endl
using namespace std;
using ll = long long;
 
int main()
{
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    
    string S;
    cin >> S;

    if (S[5] == '0' && S[6] - '0' <= 4) print("Heisei");
    else print("TBD");

    return 0;
}


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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    cin >> n;
    long long m = n - 1;

    long long ans = 0;
    for (long long i = 1; i * i <= m; i++) {
        if (m % i == 0) {
            ans++;
            if (m / i != i) ans++;
        }
    }

    for (long long i = 2; i * i <= n; i++) {
        if (n % i != 0) continue;
        long long tmp = n;
        while (tmp % i == 0) {
            tmp /= i;
        }

        if (tmp % i == 1) ans++;
    }

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


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






int main() {
  
  string s;
  cin>>s;
  int cnt=0;
  int max1=0;
  int n=s.size();
  for(int i=0;i<n;i++){
    if(s[i]=='A'||s[i]=='G'||s[i]=='C'||s[i]=='T'){
      cnt++;
      max1=max(max1,cnt);
    }
    else{cnt=0;}
  }
  cout<<max1<<endl;
}



Measured memory_bytes: 256
import numpy as np

N, M, X = list(map(int, input().split()))

CA = []
for i in range(N):
    s = input()
    CA.append(np.fromstring(s, np.int64, sep=" "))

CA = np.asarray(CA)
C = CA[:, 0]
A = CA[:, 1:]

def loop(i, x, total):
    if i == N:
        if (x >= X).all():
            return total
        else:
            return np.inf

    return min(
        loop(i+1, x, total),
        loop(i+1, (x+A[i]).clip(0, X), total+C[i])
    )

ans = loop(0, np.zeros_like(A[0]), 0)
if ans == np.inf:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 27140
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

typedef long long ll;
typedef long long int llt;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

char dif = 'A' - 'a';
int mod = 1e9 + 7;
ll inf = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int m, d;
    cin >> m >> d;
    int sum = 0;
    for (int i = 1; i <= m;i++){
        for (int j = 1; j <= d;j++){
            int a = j / 10, b = j % 10;
            if(a>=2&&b>=2){
                if(a*b==i)
                    sum++;
            }
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
/*
Submitted With (^^) by -> Hossam ^_^
 _____________________
|     ___     ___     |
|    (^_^)   (^_^)    |
|   /( | )\_/( | )\   |
|_____|_|_____|_|_____|
*/

#include <bits/stdc++.h>

using namespace std;

inline void prep()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
}

#define X first
#define Y second
#define ll long long
#define inf (0x7fffffffffffffff)
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " = " << (x) << " ";
#define ZXC cerr << clock() * 1.0 / CLOCKS_PER_SEC << endl;

const int mod = (int)1e9 + 7;
const int MX = (int)1e5 + 5;

int main()
{
    prep();

    int n;
    cin >> n;
    int res = n;
    for(int i = 1; i < n; ++i){
        int j = n - i;
        
        int x = i;
        int s1 = 0;
        while(x){
            s1 += x % 10;
            x /= 10;
        }

        int s2 = 0;
        while(j){
            s2 += j % 10;
            j /= 10;
        }

        res = min(res, s1 + s2);
    }

    cout << res << endl;

    // ZXC
    return 0;
}

Measured memory_bytes: 256
typedef long long int ll;
typedef unsigned long long int ull;
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL);
#define MOD 1000000007
#define M_PI           3.14159265358979323846  /* pi */
#define sec second
#define fir first
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repe(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define entire(a) (a).begin(),(a).end()
#define pb push_back
#define pii pair<int,int>
#include<bits/stdc++.h>
#include<cmath>
using namespace std;

void solve() {
	ll n;
	cin >> n;
	ll vac[n][3];
	rep(i, n)rep(j, 3)cin >> vac[i][j];
	ll dp[n][3];
	rep(i, 3)
	dp[0][i] = vac[0][i];

	for (int i = 1; i < n; ++i) {
		for (int j = 0; j < 3; ++j) {
			dp[i][j] = vac[i][j] + max(dp[i - 1][(j + 1) % 3], dp[i - 1][(j + 2) % 3]);
			// cout<<dp[i][j]<<" ";
		}
		// cout<<endl;
	}
	cout << max(dp[n - 1][0] , max(dp[n - 1][1] , dp[n - 1][2])) << endl;
}

int main() {

	fast
	int T = 1;
	// cin >> T;
	while (T--)
	{
		solve();
	}
	return 0;
}


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

using namespace std;

#define MAX 100010
#define INF LLONG_MAX/4
typedef long long ll;

struct State{
  ll v,cost;

  State(ll v,ll cost) :
    v(v),cost(cost) {}

  bool operator > (const State &s)const{
    return cost > s.cost;
  }
};

struct P{
  ll idx,cost;
  P(ll idx,ll cost) :
    idx(idx),cost(cost) {}
  bool operator < (const P &p)const{
    return cost < p.cost;
  }
};

struct Edge{
  ll to,cost;

  Edge(ll to,ll cost) :
    to(to),cost(cost) {}
};

ll N,M,d[MAX];
vector<Edge> G[MAX];

void dijkstra(){
  fill(d,d+N,INF);
  d[0] = 0;
  priority_queue<State,vector<State>,greater<State> > Q;
  Q.push(State(0,0));
  while(!Q.empty()){
    State s = Q.top(); Q.pop();
    ll v = s.v;
    if(d[v] < s.cost){ continue; }
    for(int i = 0 ; i < (int)G[v].size() ; i++){
      Edge e = G[v][i];
      if(d[v] + e.cost < d[e.to]){
        d[e.to] = d[v] + e.cost;
        Q.push(State(e.to,d[e.to]));
      }
    }
  }
}

int main(){
  ll C,a,b,c,sum = 0;
  cin >> N >> M >> C;
  for(int i = 0 ; i < M ; i++){
    cin >> a >> b >> c;
    a--; b--;
    G[a].push_back(Edge(b,c));
    G[b].push_back(Edge(a,c));
    sum += c;
  }
  dijkstra();
  vector<P> v;
  for(int i = 0 ; i < N ; i++){
    v.push_back(P(i,d[i]));
  }
  sort(v.begin(),v.end());
  ll res = INF,dist = 0;
  set<ll> st;
  for(int i = 0 ; i < N ; i++){
    ll idx = v[i].idx;
    for(int j = 0 ; j < (int)G[idx].size() ; j++){
      if(st.find(G[idx][j].to) != st.end()){
        dist += G[idx][j].cost;
      }
    }
    st.insert(idx);
    res = min(res,sum-dist+v[i].cost*C);
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 20236
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b)-1);i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))

int main(void){
	int n, m;
	cin >> n;
	int t[n];
	rep(i, n) cin >> t[i];
	cin >> m;
	
	int a = 0;
	rep(i, n) a += t[i];
	
	int p, x;
	rep(i, m){
		cin >> p >> x; 
		cout << a-t[p-1]+x << endl;
	}

	return 0;
}

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

int main() {
	bool isNormal = true;
	int q = 1, t, f;
	char c;

	string s, pre = "", post = "";

	cin >> s;
	// cout << s;
	cin.tie(0);
	ios::sync_with_stdio(false);

	scanf("%d", &q);
	// printf("%d ", q);

	for (int i = 0; i < q; i++) {
		scanf("%d", &t);
		// printf("%d  ", t);
		if (t == 1) {
			isNormal = !isNormal;
			// printf("\n");
			continue;
		}

		scanf("%d %c", &f, &c);
		// printf("%d %c  %d ", f, c, isNormal);
		if (((f == 2 && isNormal) || (f == 1 && !isNormal)) == true) {
			post.append(1, c);
			// printf("post = %s\n", post.c_str());
		} else {
			pre.append(1, c);
			// printf("pre = %s\n", pre.c_str());
		}
	}
	if (isNormal) {
		reverse(pre.begin(), pre.end());
		printf("%s%s%s", pre.c_str(), s.c_str(), post.c_str());
	} else {
		reverse(s.begin(), s.end());
		reverse(post.begin(), post.end());
		printf("%s%s%s", post.c_str(), s.c_str(), pre.c_str());
	}

	return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
using namespace std;

using ll = long long;

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; }
const int INF = 1e9;
const long long INFLL = 1LL<<60;

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

struct combination {
  vector<mint> fact, ifact;  // 階乗と階乗の逆元
  combination(int n):fact(n+1),ifact(n+1) {  // 階乗と階乗の逆元を n まで求める
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

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

  ll n, k;
  cin >> n >> k;

  cout << (n <= k) << endl;

  return 0;
}



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

using namespace std;

int main()
{
  int n;
  cin>>n;
  vector<int> a1;
  vector<int> a2;
  for(int i=0;i<n;i++)
  {
    int x;
    cin>>x;
    if(i%2==0)
      a1.push_back(x);
    else
      a2.push_back(x);
  }
  sort(a1.begin(),a1.end());
  sort(a2.begin(),a2.end());
  int a11=-1;
  int a12=-1;
  int size11=0;
  int size12=0;
  int tmp=-1;
  int tmpsize=0;
  for(int i=0;i<a1.size();i++)
  {
    int now=a1[i];
    if(tmp==now)
    {
      tmpsize++;
    }
    else
    {
      tmpsize=1;
      tmp=now;
    }
    if(tmpsize>=size11)
    {
      if(tmp!=a11)
      {
      a12=a11;
      a11=tmp;
      size12=size11;
      }
      size11=tmpsize;
    }
    else if(tmpsize>=size12)
    {
      a12=tmp;
      size12=tmpsize;
    }
  }
  int a21=-1;
  int a22=-1;
  int size21=0;
  int size22=0;
  tmp=-1;
  tmpsize=0;
  for(int i=0;i<a2.size();i++)
  {
    int now=a2[i];
    if(tmp==now)
    {
      tmpsize++;
    }
    else
    {
      tmpsize=1;
      tmp=now;
    }
    
    if(tmpsize>=size21)
    {
      if(a21!=tmp)
      {
      a22=a21;
      a21=tmp;
      size22=size21;
      }
      size21=tmpsize;
    }
    else if(tmpsize>=size22)
    {
      a22=tmp;
      size22=tmpsize;
    }
  }
  if(a11!=a21)
      cout<<a1.size()-size11+a2.size()-size21<<endl;
  else
      cout<<min(a1.size()-size11+a2.size()-size22,a1.size()-size12+a2.size()-size21)<<endl;
}

Measured memory_bytes: 892
#include <iostream>
using namespace std;
int main(void){
    int n;
    int b, f, r, v;

    int oh[4][3][10] = {{{0}}};
    
    cin >> n;
    while(cin >> b >> f >> r >> v){
        oh[b-1][f-1][r-1] += v;
    }
    
    int i,j,k;
    for(i = 0; i < 4; i++){
        for(j = 0; j < 3; j++){
            for(k = 0; k < 10; k++){
                cout << " " << oh[i][j][k];
                
            }
            cout << endl;
        }
        if(i != 3) cout << "####################" << endl;
    }
    return 0;
}

Measured memory_bytes: 3032
//package com.company;
import java.util.*;
import java.lang.*;
import java.io.*;
//****Use Integer Wrapper Class for Arrays.sort()****
 class Main {
    public static void main(String[] Args){
        FastReader scan=new FastReader();
        int r=scan.nextInt();
        System.out.println(2*3.14159*r);
    }
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

}


Measured memory_bytes: 33232
#include<iostream>
#include<cmath>
using namespace std;
int n,m,sum,a[10001],ans1,ans2,ans3;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i],sum+=a[i];
	int p=sum/n;
    int k=0;
    for(int i=1;i<=n;i++) ans1+=(a[i]-p)*(a[i]-p), ans2+=(a[i]-p-1)*(a[i]-p-1),ans3+=(a[i]-p+1)*(a[i]-p+1);
    if(ans1<ans2) k=ans1; else k=ans2;
    if(k>ans3) k=ans3;
    cout<<k;
}


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

using namespace std;

char MapData[100][100];
int Cost[100][100];
queue<pair<int, int> > QueueData;


void solve(int totalRow, int totalCol) {
	int curtRow, curtCol, cost;
	int dx[] = { 1,0,-1,0 };
	int dy[] = { 0,1,0,-1 };

	//cout << QueueData.front().first << " " << QueueData.front().second << endl;
	while (!QueueData.empty()) {
		pair<int, int> current = QueueData.front();
		QueueData.pop();
		for (int j = 0; j < 4; j++) {
			curtRow = current.first + dy[j];
			curtCol = current.second + dx[j];
			if (curtRow<0 || curtRow>totalRow - 1 || curtCol<0 || curtCol>totalCol - 1) {
				continue;
			}
			cost = Cost[current.first][current.second];
			if (MapData[curtRow][curtCol] == '#' && MapData[current.first][current.second] == '.') {
				++cost;
			}
			if (cost >= Cost[curtRow][curtCol]) {
				continue;
			}
			Cost[curtRow][curtCol] = cost;
			QueueData.push(make_pair(curtRow, curtCol));
		}
	}
}

int main() {
	int m, n, cnt;

	while (cin >> n >> m, n) {
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < n; j++) {
				cin >> MapData[i][j];
				Cost[i][j] = 10000000;
				if (MapData[i][j] == '&') {
					MapData[i][j] = '.';
					Cost[i][j] = 0;
					QueueData.push(make_pair(i, j));
				}
			}
		}
		solve(m, n);
		cnt = 10000000;
		for (int i = 0; i < m; i++) {
			cnt = min(cnt, Cost[i][0]);
			cnt = min(cnt, Cost[i][n - 1]);
		}
		for (int i = 0; i < n; i++) {
			cnt = min(cnt, Cost[0][i]);
			cnt = min(cnt, Cost[m - 1][i]);
		}
		cout << cnt << endl;
	}

	return 0;
}



Measured memory_bytes: 3108
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
//#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
//#include<list>
#include<queue>
#include<deque>
#include<algorithm>
//#include<numeric>
#include<utility>
#include<complex>
//#include<memory>
#include<functional>
#include<cassert>
#include<set>
#include<stack>

const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;

const int MAXN = 1001;
int d[MAXN];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> d[i];
    vector<ll> v;
    for (int i = 0; i < n; i++) {
        for (int j = i; j < min(n, i+10); j++) {
            ll tmp = 0;
            for (int k = i; k <= j; k++) {
                tmp = tmp*10+d[k];
            }
            v.push_back(tmp);
        }
    }
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    ll ans = 0;
    for (ll el : v) {
        if (el != ans) {
            cout << ans << endl;
            break;
        }
        ans++;
    }
    return 0;
}

Measured memory_bytes: 3360
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,a,b) for(int i=(a),_end_=(b);i<=_end_;i++)
#define DREP(i,a,b) for(int i=(a),_end_=(b);i>=_end_;i--)
#define EREP(i,u) for(int i=start[u];i;i=e[i].next)
#define fi first
#define se second
#define mkr(a,b) make_pair(a,b)
#define SZ(A) ((int)A.size())
template<class T>inline void chkmin(T &a,T b){ if(a>b)a=b;}
template<class T>inline void chkmax(T &a,T b){ if(a<b)a=b;}
inline int read()
{
	int s=0,f=1; char ch=getchar();
	while(!isdigit(ch) && ch!='-')ch=getchar();
	if(ch=='-')ch=getchar(),f=-1;
	while(isdigit(ch))s=s*10+ch-'0',ch=getchar();
	return ~f?s:-s;
}

const int maxn=1e4+20;
const int mod=998244353;

int n,m;

int f[maxn][maxn],jc[maxn],jcn[maxn],inv[maxn];

inline void init()
{
	jc[0]=jc[1]=jcn[0]=jcn[1]=inv[1]=1;
	REP(i,2,1e4)jc[i]=(ll)i*jc[i-1]%mod,inv[i]=(ll)(mod-mod/i)*inv[mod%i]%mod,jcn[i]=(ll)jcn[i-1]*inv[i]%mod;
	char A[maxn],B[maxn];
	scanf("%s",A+1);
	int len=strlen(A+1);
	scanf("%s",B+1);
	REP(i,1,len)if(A[i]=='1')
	{
		if(B[i]=='1')n++;
		else m++;
	}
}

inline void doing()
{
	f[0][0]=1;
	REP(i,0,n)REP(j,0,m)
	{
		if(i)
		{
			//f[i][j]=(f[i][j]+(ll)f[i-1][j]*i)%mod;
			if(j)f[i][j]=(f[i][j]+(ll)f[i-1][j]*i*j)%mod;
		}
		if(j)f[i][j]=(f[i][j]+(ll)f[i][j-1]*j*j)%mod;
	}
	int ans=0;
	REP(i,0,n)
	{
		ans=(ans+(ll)jc[n]*jcn[i]%mod*jcn[n-i]%mod*jc[i]%mod*jc[i]%mod*jc[n+m]%mod*jcn[i]%mod*jcn[n+m-i]%mod*f[n-i][m])%mod;
	}
	printf("%d\n",ans);
}

int main()
{

	init();
	doing();
	return 0;
}


Measured memory_bytes: 389760
#include <cstdio>
#include <cstdlib>
#include <cstring>

struct Node {
  int key;
  Node *next, *prev;
};

Node *nil;

Node* listSearch(int key) {
  Node *cur = nil->next;
  while(cur != nil && cur->key != key) {
    cur = cur->next;
  }
  return cur;
}

void init(void) {
  nil = (Node *)malloc(sizeof(Node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(void) {
  Node *cur = nil->next;
  int isf = 0;
  while(1) {
    if(cur == nil) break;
    if(isf++>0) printf(" ");
    printf("%d",cur->key);
    cur = cur->next;
  }
  printf("\n");
}

void deleteNode(Node *t) {
  if(t==nil) return;
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}

void deleteFirst(void) {
  deleteNode(nil->next);
}

void deleteLast(void) {
  deleteNode(nil->prev);
}

void deleteKey(int key) {
  deleteNode(listSearch(key));
}

void insert(int key) {
  Node *x = (Node *)malloc(sizeof(Node));
  x->key = key;
  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
}

int main(void) {
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for(i=0;i<n;i++) {
    scanf("%s%d",com, &key);
    if (com[0] == 'i') { insert(key); np++; size++; }
    else if(com[0]=='d') {
      if(strlen(com) > 6) {
        if(com[6] == 'F') deleteFirst();
        else if(com[6] == 'L') deleteLast();
      } else {
        deleteKey(key); nd++;
      }
      size--;
    }    
  }
  
  printList();
  
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using v = vector<T>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
void dump_debug(T list) {
#ifdef MY_DEBUG
    each(e, list) cout << e << " ";
    printf("\n");
#endif
}

inline ll inl() {
    ll x;
    cin >> x;
    return x;
}

inline string ins() {
    string x;
    cin >> x;
    return x;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        ll n = inl();
        vl a(n);
        rep(i, n) cin >> a[i];
        ll tmp = a[0];
        for (long long i = 1; i < n; ++i) {
            tmp ^= a[i];
        }
        if (tmp == 0) cout << "Yes" << endl;
        else cout << "No" << endl;
        
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

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

int bbottlem;

int sbottlem;

int needwater;

int result = INT_MAX;

void buy(int water, int bb, int sb, bool bs) {
  if (bs) {
    water += 1000;
    bb++;
  } else {
    water += 500;
    sb++;
  }
  if (water >= needwater) {
    if (bb*bbottlem+sb*sbottlem<result)
      result = bb*bbottlem+sb*sbottlem;
    return;
  }
  buy(water, bb, sb, true);
  buy(water, bb, sb, false);
}

int main() {
  cin >> bbottlem >> sbottlem >> needwater;

  buy(0, 0, 0, true);
  buy(0, 0, 0, false);

  cout << result << endl;
}




Measured memory_bytes: 3084
#include <cstdio>
#include <cstring>
#include <vector>
#include <iostream>
#include <functional>
#include <algorithm>
#include <queue>
#include <string>
#include <set>

using namespace std;
using ii = pair<int, int>;

int N, M, K;
int tcase;

int ansN, ansM;

int main()
{
	cin >> N >> M;
	for (int i = 1; i <= N; i++)
	{
		for (int j = 1; j <= M; j++)
		{
			string in;
			cin >> in;
			if (in == "snuke")
			{
				ansN = i;
				ansM = j;
			}
		}
	}

	printf("%c%d", ansM + 'A' - 1, ansN);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if(a>b){
    swap(a,b);
  }
  if(a<c&&c<b) 
    cout << "Yes" << endl;
  else 
   cout << "No" << endl;
}

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

int main() {
  string S;
  cin >> S;
  int ans = 0;
  int l = 0;
  
  for(int i = 0; i < S.size(); i++){
    if(S.at(i) == 'A' || S.at(i) == 'C' || S.at(i) == 'G' || S.at(i) == 'T') l++;
    
    else l = 0;
    ans = max(ans,l);
  }
  cout << ans << endl;
  
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
    int i, j, v, N;
    scanf("%d",&N);
    int A[N];
    for(i=0;i<N;i++) {
        scanf("%d", &A[i]);
        printf("%d", A[i]);
        if(i!=N-1) {
                printf(" ");
            }
    }
    printf("\n");
    
    for(i=1;i<N;i++) {
        v = A[i];
        j = i -1;
        while(j >= 0 && A[j]>v) {
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
        for(j=0; j<N; j++) {
            printf("%d", A[j]);
            if(j!=N-1) {
                printf(" ");
            } 
        }
        printf("\n");
    }
    
    return 0;
}


Measured memory_bytes: 2100
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b;
    c=a+b;
    if(c<10){
        cout<<c<<endl;
    }
    else{
    cout<<"error"<<endl;
    }

    return 0;
}


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

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

int main() {
    int n; cin >> n;
    while (n > 1) {
        int temp = n % 10;
        if (temp == 9) {
            cout <<"Yes";
            return 0;
        }
        n /= 10;
    }
    cout << "No";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	while (true) {
		int n, x;
		cin >> n >> x;
		if (n == 0 && x == 0) break;
		else {
			int ans = 0;
			for (int i = 1; i <= n-2; i++) {
				for (int j = i + 1; j <= n-1; j++) {
					for (int k = j + 1; k <= n; k++) {
						if (i + j + k == x) ans++;
					}
				}
			}
			cout << ans << endl;
		}
	}
}


Measured memory_bytes: 3084
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}

int main() {
    int d, n;
    cin >> d >> n;
    if (d == 0) {
        if (n != 100) {
            cout << n << endl;
        } else {
            cout << 101 << endl;
        }
    } else if (d == 1) {
        if (n != 100) {
            cout << n * 100 << endl;
        } else {
            cout << 10100 << endl;
        }
    } else {
        if (n != 100) {
            cout << n * 10000 << endl;
        } else {
            cout << 1010000 << endl;
        }
    }
    return 0;
}

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

int main() {
  int A, B;
  cin >> A >> B;

  for (int i = 1; i <= 1250; i++) {
    int aa = i * 0.08;
    int bb = i * 0.1;
    if (aa == A && bb == B) {
      cout << i << endl;
      return 0;
    }
  }

  cout << "-1" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll n;

int main()
{
	
	
  
  cin>>n;
  
for(ll i=2;i*i<=n;i++)
{
	
	if(n%i==0)n++,i=1;
}

cout<<n;


  
  
}


Measured memory_bytes: 256
n,m = map(int,input().split())
ls = [[int(x) for x in input().split()] for _ in range(m)]
ls1 =[]
lsn =[]


for i in range(m):
	if ls[i][0]==1:
		ls1.append(ls[i][1])
	elif ls[i][1]==1:
		ls1.append(ls[i][0])
	elif ls[i][0]==n:
		lsn.append(ls[i][1])
	elif ls[i][1]==n:
		lsn.append(ls[i][0])

if len(set(ls1)&set(lsn))!=0:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')

Measured memory_bytes: 103512
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

ll m_pow(ll x, ll n){
  if(n == 0) return 1;
  return m_pow(x*x, n/2) * ((n%2)?x: 1);
}

int main(){
  ll n, p; cin >> n >> p;

  ll ans = 1;

  for(ll i=2; i*i <= p; i++){
    ll cnt = 0;
    while(p % i == 0){
      p /= i;
      cnt++;
    }
    if(cnt){
      ans *= m_pow(i, cnt / n);
    }
  }

  if(p > 1) ans *= m_pow(p, 1 / n);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string S, T;
    cin >> S;
    cin >> T;
    T.pop_back();
    if (S == T)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

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

inline int c2i(char c){
    return c - 'a';
}

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

    string in; cin >> in;
    int n = (int)in.size();
    const int M = 'z' - 'a' + 1;

    vi memo(1 << M, inf);
    memo[0] = 0;

    int stat = 0;
    rep(i, n){
        int ci = c2i(in[i]);
        stat ^= (1 << ci);
        rep(k, M){
            chmin(memo[stat], memo[stat ^ (1 << k)] + 1);
        }
    }
    memo[0] = 1;
    cout << memo[stat] << endl;

    return 0;
}


Measured memory_bytes: 262804
if __name__ == "__main__":
    # num = list(map(int, input().split())) 

    N = int(input())

    if(N % 10 == 3):
        print("bon")
    elif(N % 10 == 0 or N % 10 == 1 or N % 10 == 6 or N % 10 == 8):
        print("pon")
    else:
        print("hon")


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

using namespace std;

int main() {
	int n, d, x;
	cin >> n >> d >> x;
	int e, sum = x;
	for (int i = 0; i < n; i++) {
		cin >> e;
		sum += (((d - 1) / e) + 1);
	}
	cout << sum << "\n";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T> >;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define repb(i, n) for(ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for(ll i = (a); i < (b); i++)
#define reprb(i, a, b) for(ll i = (b)-1; i >= (a); i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
const ld EPS = 1e-12L;
const ld PI = 3.1415926535897932385L;
inline ll GCD(ll a, ll b){ return b?GCD(b, a % b):a; }
inline ll LCM(ll a, ll b){ return a/GCD(a, b)*b; }
inline ll powint(ull x, ll y){ ll r=1; while(y){ if(y&1) r*=x; x*=x; y>>=1; } return r; }
inline ll powmod(ll x, ll y, ll m = MOD){ ll r=1; while(y){ if(y&1) r*=x; x*=x; r%=m; x%=m; y>>=1; } return r; }
template<class S, class T>inline bool chmax(S &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class S, class T>inline bool chmin(S &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif

void Pr(bool f){
    cout << (f ? "Possible" : "Impossible") << endl;
}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n, l;
    cin >> n >> l;
    vll a(n);
    rep(i, n){
        cin >> a[i];
    }
    
    ll core = -1;
    rep(i, n-1){
        if(a[i]+a[i+1] >= l){
            core = i+1;
            break;
        }
    }
    if(core == -1){
        Pr(0);
        return 0;
    }
    Pr(1);
    repr(i, 1, core){
        cout << i << "\n";
    }
    reprb(i, core+1, n){
        cout << i << "\n";
    }
    cout << core << endl;
    return 0;
}

Measured memory_bytes: 1664
# n, m, l = map(int, input().split())

# list_n = list(map(int, input().split()))

# n = input()
# list = [input() for i in range(N)

# list = [[i for i in range(N)] for _ in range(M)]

import sys
input = sys.stdin.readline

A = int(input())
B = int(input())

if A > B:
    print("GREATER")
elif B > A:
    print("LESS")
else:
    print("EQUAL")


Measured memory_bytes: 9104
a,b,c=map(int,input().split())
s=[[0]*b for i in range(a+1)]
s[0][0]=1
k=[[1,1,1],[2,1,1,1,2],[3,2,2,1,2,2,3],[5,3,3,2,4,2,3,3,5],[8,5,5,3,6,4,6,3,5,5,8],[13,8,8,5,10,6,9,6,10,5,8,8,13],[21,13,13,8,16,10,15,9,15,10,16,8,13,13,21]]
if b==1:
    print(1)
elif c-a>=2:
    print(0)    
else:
    d=k[b-2]
    for i in range(1,a+1):
        s[i][b-1]=s[i-1][b-1]*d[2*(b-1)]+s[i-1][b-2]*d[2*(b-1)-1]
        for j in range(0,b-1):
            if j==0:
                s[i][0]=s[i-1][0]*d[0]+s[i-1][1]*d[1]
            else:    
                s[i][j]=s[i-1][j-1]*d[2*j-1]+s[i-1][j]*d[2*j]+s[i-1][j+1]*d[2*j+1]
    print(s[a][c-1]%(10**9+7)) 

Measured memory_bytes: 3188
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef long double ld;

template <class T>
using lim = numeric_limits<T>;

bool can[10];
int cost[10] = {0,2,5,5,4,5,6,3,7,6};
char num[10] = {'0','1','2','3','4','5','6','7','8','9'};

struct bigInt{
	string s;
	
	bigInt(){s="0";}
	bigInt(string a){s=a;}
	
	bigInt append(char a){
		return bigInt(s+a);
	}
	
	bool operator<(const bigInt &other)const{
		int n = s.length();
		int m = other.s.length();
		if (n != m) return n < m;
		for (int i = 0; i < n; i++){
			if (s[i] == other.s[i]) continue;
			return (int)s[i]-'0' < (int)other.s[i]-'0';
		}
		return true;
	}
	
	friend ostream& operator<<(ostream &os, const bigInt a);
};

ostream& operator<<(ostream& os, const bigInt a){
	os << a.s;
	return os;
}

int main() {
	ios_base::sync_with_stdio(false) ;
	cin.tie(0);
	
	memset(can, 0, sizeof can);
	
	int n, m;
	cin >> n >> m;
	
	bigInt dp[n+1];
	dp[0] = bigInt("");
	for (int i = 0; i < m; i++){
		int a; cin >> a;
		can[a] = true;
	}
	
	for (int i = 0; i < n; i++){
		for (int j = 1; j < 10; j++){
			if (!can[j] || dp[i].s=="0" || i + cost[j] > n) continue;
			dp[i+cost[j]] = max(dp[i+cost[j]], dp[i].append(num[j]));
		}
	}
	
	cout << dp[n] << endl;
}



Measured memory_bytes: 44800
#include<stdio.h>
int main(void){
 int a;
 int b;
 scanf("%d",&a);
 scanf("%d",&b);
 if(6<=a&&a<=12){
     b=b/2;
 }
 if(a<=5){
 b=0;
 }
 printf("%d",b);
 return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define For(i, a, b) for (int(i) = (int)(a); (i) < (int)(b); ++(i))
#define rFor(i, a, b) for (int(i) = (int)(a)-1; (i) >= (int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
T div_floor(T a, T b) {
    if (b < 0) a *= -1, b *= -1;
    return a >= 0 ? a / b : (a + 1) / b - 1;
}
template <class T>
T div_ceil(T a, T b) {
    if (b < 0) a *= -1, b *= -1;
    return a > 0 ? (a - 1) / b + 1 : a / b;
}

constexpr lint mod = 1000000007;
constexpr lint INF = mod * mod;
constexpr int MAX = 100010;

int main() {
    string s;
    cin >> s;
    cout << s + (s.back() == 's' ? "es" : "s") << "\n";
}

Measured memory_bytes: 3624
class PriorityQueue
  def initialize es = [], &block
    block = proc { |a, b| a < b } unless block_given?
    @fun = block
    @tree = []
    @n = 0

    es.each do |e| enqueue e end
  end

  def enqueue e
    @tree[@n] = e
    i = @n
    @n += 1
    until i.zero?
      j = (i-1)/2
      if @fun.(@tree[i], @tree[j])
        @tree[i], @tree[j] = @tree[j], @tree[i]
        i = j
      else
        break
      end
    end
    self
  end

  alias push enqueue
  alias << enqueue
  alias insert enqueue

  def dequeue
    return nil if @n.zero?
    @n -= 1
    @tree.first.tap do
      @tree[0] = @tree.pop
      i = 0
      loop do
        l = i*2+1
        r = i*2+2
        break if @tree[l].nil?
        j =
          if @tree[r].nil?
            l
          else
            @fun.(@tree[r], @tree[l]) ? r : l
          end
        if @fun.(@tree[j], @tree[i])
          @tree[i], @tree[j] = @tree[j], @tree[i]
          i = j
        else
          break
        end
      end
    end
  end

  alias pop dequeue
  alias remove dequeue

  def peek
    @tree.first
  end

  alias first peek
  alias top peek

  def to_a
    [].tap do |arr|
      while e = dequeue
        arr << e
      end
    end
  end

  def empty?
    @n == 0
  end
end

v, e, r = gets.split.map(&:to_i)
g = Array.new(v) { [] }
e.times do
  s, t, d = gets.split.map(&:to_i)
  g[s] << [t, d]
end

arr = Array.new(v) { Float::INFINITY }
arr[r] = 0

pq = PriorityQueue.new([[r, 0]]) { |(_, a), (_, b)| a < b }
while h = pq.pop
  i, d1 = h
  g[i].each do |j, d2|
    next if arr[j] <= d1+d2
    arr[j] =d1+d2
    pq.push [j, d1+d2]
  end
end

puts arr.map { |i| i == Float::INFINITY ? "INF" : i }


Measured memory_bytes: 60060
#include <iostream>
#include <unordered_map>

const unsigned long long mod = 1000000007;
std::unordered_map<unsigned long long, unsigned long long> map;

unsigned long long solve(unsigned long long max) {
  auto p = map.find(max);
  if (p != map.end()) { return p->second; }
  if (max == 0) { return 1; }
  if (max == 1) { return 2; }
  auto ret = solve(max / 2) + solve((max - 1) / 2) + solve((max - 2) / 2);
  ret %= mod;
  map.insert(std::make_pair(max, ret));
  return ret;
}

int main() {
  unsigned long long N;
  std::cin >> N;
  std::cout << solve(N) << std::endl;
  return 0;
}

Measured memory_bytes: 256
'use strict'

const main = (input) => {
    input = input.split('\n')
    const n = parseInt(input[0])
    const p = input.slice(1, n + 1).map(v => parseInt(v)).sort((a, b) => b - a)

    let sum = 0
    p.forEach((v, i) => {
        if(i === 0){
            sum += v / 2
        }else{
            sum += v
        }
    })
    console.log(sum)
}

main(require('fs').readFileSync('/dev/stdin', 'utf-8'))

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

int main() {
    int bingo[3][3];

    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            int a; cin >> a;
            bingo[i][j] = a;
        }
    }

    int n; cin >> n;
    map<int, int> column;
    map<int, int> row;

    int sp1 = 0, sp2 = 0;

    for (int i = 0; i < n; i++) {
        int b; cin >> b;

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (bingo[i][j] == b) {
                    column[i]++;
                    row[j]++;

                    if (i == j) sp1++;
                    if (i == 2 - j) sp2++;
                }
            }
        }
    }

    if (column[0] == 3 || column[1] == 3 || column[2] == 3) {
        cout << "Yes" << endl;
    } else if (row[0] == 3 || row[1] == 3 || row[2] == 3) {
        cout << "Yes" << endl;
    } else if (sp1 == 3 || sp2 == 3) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

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

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define sz(a) ((int)a.size())
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijoMOD(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll div_num(ll n){
  vl div(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      div[i]++;
    }
  }
  if(n!=1)div[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=div[i];
  }
  return num;
}
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}
long long lopow(ll a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a ;
        a = a * a ;
        n >>= 1;
    }
    return res;
}

        
//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//vc Alp ={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
//cout<<""<<endl;
int N,M,Q,ans;
vi a,b,c,d;
void dfs(vector<int> &A) {
    if (A.size() == N){
      int now =0;
      rep(i,Q){
        if(A[b[i]]-A[a[i]]==c[i])now+=d[i];
      }
      ans=max(now,ans);
      return;
    }

    int prev_last = (A.empty() ? 1 : A.back());
    for (int v = prev_last; v <= M; ++v) {
        A.push_back(v);
        dfs(A);
        A.pop_back();
    }
}
int main(){
  cin>>N>>M>>Q;
  vi e(Q),ff(Q),g(Q),h(Q);
  a=e;
  b=ff;
  c=g;
  d=h;
  rep(i,Q){
    cin>>a[i]>>b[i]>>c[i]>>d[i];
    a[i]--;b[i]--;
  }
  
  ans=0;
  vi B={};
  dfs(B);
  cout<<ans<<endl;
    
}






Measured memory_bytes: 3612
import sys,collections,math,random;sys.setrecursionlimit(10**7)
from fractions import gcd
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

x,y = Is()
print((x * y) // gcd(x, y))


Measured memory_bytes: 5420
N=int(input())
A=[int(input()) for _ in range(N)]

lmax=[0]*N
rmax=[0]*N

for i in range(1,N):
  lmax[i]=max(lmax[i-1],A[i-1])
for i in range(N-2,-1,-1):
  rmax[i]=max(rmax[i+1],A[i+1])

for i in range(N):
  print(max(lmax[i],rmax[i]))


Measured memory_bytes: 92972
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,K;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>K;
	
	
	ll ret=0;
	for(int b=K+1;b<=N;b++) {
		ret+=N+1;
		if(K) for(x=0;x<=N;x+=b) ret-=min(N-x+1,K);
		else ret--;
	}
	cout<<ret<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256