akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
//#include <stack>
//#include <queue>
//#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
//#include <list>
#include <iomanip>

using namespace std;

#define IOS ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define prec std::cout << std::fixed << std::setprecision(15);
#define endl "\n"
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define ssort(z) sort(z.begin(), z.end())
#define rsort(z) sort(z.rbegin(), z.rend())
#define eerase(z) z.erase(unique(z.begin(), z.end()), z.end())
#define ccnt(z, w) count(z.begin(), z.end(), w)
#define rep(i,a,n) for(Int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(Int (i)=(a); (i)<=(n); (i)++)
const int MAX_N = 1000000;
const Int MAX_N_Int = 1000000000000;

template <typename T>
void printV(const std::vector<T>& v, const char * const separator = " ")
{
    if(!v.empty())
    {
        std::copy(v.begin(),
                  --v.end(),
                  std::ostream_iterator<T>(std::cout, separator));
        std::cout << v.back() << "\n";
    }
}

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;
}
Int gcd(Int a, Int b) {
    return b != 0 ? gcd(b, a % b) : a;
}

Int lcm(Int a, Int b) {
    return a / gcd(a, b) * b;
    //a*bは64bit integer overflow
}

int Max(int a, int b, int c) {
    int temp = max(a, b);
    return max(temp, c);
}

int Min(int a, int b, int c) {
    int temp = min(a, b);
    return min(temp, c);
}

bool integer(double num) {
    return floor(num) == num;
}

Int fact(int num) {
    if (num == 0)
        return 1;
    else
        return num * fact(num - 1);
}

Int yakusu(int n) {
    int cnt = 0;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            cnt++;
            if (i * i != n) cnt++;
        }
    }
    return cnt;
}


Int fact_mod(Int n, Int mod) {
    Int f = 1; repq(i,2,n) f = f * (i % MOD) % MOD;
    return f;
}

// 繰り返し二乗法 (modの世界での累乗)
Int mod_pow(Int x, Int n, Int mod) {
    Int res = 1;
    while(n > 0) {
        if(n & 1) res = (res * x) % mod;
        x = (x * x) % mod;
        n >>= 1;
    }
    return res;
}

// 組み合わせ nCr を求める
Int combination_mod(Int n, Int r, Int mod) {
    if(r > n-r) r = n-r;
    if(r == 0) return 1;
    Int a = 1;
    rep(i, 0, r) a = a * ((n-i) % mod) % mod;
    Int b = mod_pow(fact_mod(r, mod), mod-2, mod);
    return (a % mod) * (b % mod) % mod;
}

int main() {
    //COMinit();
    IOS;
    prec;
    Int a,b,c,n,m,k,x,y=0,ans=1;
    string str,s="hon",t,u;
    cin>>a>>b;
    cout<<a*b;


       cout<<endl;
    return 0;
}




Measured memory_bytes: 3672
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define double long double
#define low lower_bound
#define upp upper_bound
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define Rep(i,n) for (int i = (int)(n); i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define rever(vec) reverse(all(vec));
#define cend printf("\n");
#define prique(T) priority_queue<T, vector<T>, greater<T>>
#define prique2(T) priority_queue<T>
struct edge { int to, cost; };
using P = pair<int, int>;
using PP = pair<P, int>;
using D = pair<double, double>;
const int mod2 = 998244353;
const int mod = (int)1e9 + 7, inf = (int)1e16;
const string sp = " ";

int modpow(int x, int n) {
	int ans = 1;
	while (n > 0) {
		if (n & 1) {
			ans *= x;
			if (mod <= ans) ans %= mod;
		}
		x *= x;
		if (mod <= x) x %= mod;
		n >>= 1;
	}
	return ans;
}

int fact[1000000];
void f_init(int n) {
	if (1000000 <= n) return;
	fact[0] = fact[1] = 1;
	for (int i = 2; i <= n; ++i) {
		fact[i] *= fact[i - 1];
		if (mod <= fact[i]) fact[i] %= mod;
	}
	return;
}

int comb(int n, int r) {
	if (n < r) return 0;
	int ans = fact[n] * modpow(fact[n - r], mod - 2) % mod * modpow(fact[r], mod - 2);
	if (ans < 0) return ans + mod;
	return ans;
}

int perm(int n, int r) {
	if (n < r) return 0;
	if (n - r < r) r = n - r;
	int ans= fact[n] * modpow(fact[n - r], mod - 2) % mod;
	if (ans < 0) return ans + mod;
	return ans;
}

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

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

bool pri(int p) {
	for (int i = 2; i * i <= p; ++i) if (p % i == 0) return false;
	return p > 1;
}

map<int, int> factring(int n) {
	map<int, int>ans;
	for (int i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			n /= i;
			++ans[i];
		}
	}
	if (n != 1) ++ans[n];
	return ans;
}

P operator+(const P& a, const P& b) {
	return P(a.first + b.first, a.second + b.second);
}
P operator-(const P& a, const P& b) {
	return P(a.first - b.first, a.second - b.second);
}

class unionfind {
private:
	int par[200010], rankth[200010], sizeth[200020];
public:
	void init(int n) {
		rep(i, n) {
			par[i] = i;
			rankth[i] = 0;
			sizeth[i] = 1;
		}
	}
	int root(int x) {
		while (par[x] != x) {
			x = par[x] = par[par[x]];
		}
		return x;
	}

	bool same(int x, int y) {
		return root(x) == root(y);
	}

	void unite(int x, int y) {
		x = root(x);
		y = root(y);
		if (x == y) return;
		if (rankth[x] < rankth[y]) {
			par[x] = y;
			sizeth[y] += sizeth[x];
		}
		else {
			par[y] = x;
			if (rankth[x] == rankth[y]) rankth[x]++;
			sizeth[x] += sizeth[y];
		}
	}
};

int h, w, ans;
int d[10][10], a[210][210];
signed main() {
	cin >> h >> w;
	rep(i, 10) {
		rep(j, 10) {
			cin >> d[i][j];
		}
	}
	rep(k, 10) {
		rep(i, 10) {
			rep(j, 10) {
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
	rep(i, h) {
		rep(j, w) {
			cin >> a[i][j];
			if (abs(a[i][j]) != 1) {
				ans += d[a[i][j]][1];
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
using namespace std;
 
int main()
{
    while(true){
        string s1;
        cin >> s1;
 
        if(s1==".")
            break;
 
        string s2;
        cin >> s2;
 
        if(s1==s2){
            cout << "IDENTICAL" << endl;
            continue;
        }
 
        string t1 = s1;
        string t2 = s2;
 
        while(true){
            size_t d1b = t1.find('\"');
            if(d1b==string::npos)
                break;
            t1.replace(d1b, 1, "@");
 
            size_t d1e = t1.find('\"');
            t1.replace(d1e, 1, "@");
 
            size_t d2b = t2.find('\"');
            if(d2b==string::npos)
                break;
            t2.replace(d2b, 1, "@");
 
            size_t d2e = t2.find('\"');
            t2.replace(d2e, 1, "@");
 
            string u1 = s1;
            u1.replace(d1b+1, d1e-d1b-1, "");
            string u2 = s2;
            u2.replace(d2b+1, d2e-d2b-1, "");
 
            if(u1==u2){
                t1 = u1;
                t2 = u2;
                break;
            }
        }
         if(t1==t2){
            cout << "CLOSE" << endl;
        }
        else{
            cout << "DIFFERENT" << endl;
        }
    }
 
    return 0;
}


Measured memory_bytes: 3204
#include <algorithm>
#include <cmath>
#include <climits>
#include <functional>
#include <iostream>
#include <queue>
#include <string>
#include <numeric>
#include <vector>
#include <unordered_map>

using namespace std;
using ll = long long;
template<typename T> void print(T t) {cout << t << endl;}


int main() {
	int N, Q, a;
	ll sum = 0, b, c;
	vector<ll> alist(100001, 0);
	
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a;
		alist[a]++;
		sum += a;
	}

	cin >> Q;
	for (int i = 0; i < Q; i++) {
		cin >> b >> c;
		sum += alist[b] * (c - b);
		alist[c] += alist[b];
		alist[b] = 0;
		print(sum);
	}
}

Measured memory_bytes: 3880
#include  <functional>
#include  <algorithm>
#include  <exception>
#include  <stdexcept>
#include  <streambuf>
#include  <iterator>
#include  <string.h>
#include  <stdlib.h>
#include  <typeinfo>
#include  <valarray>
#include  <iostream>
#include  <sstream>
#include  <istream>
#include  <stdio.h>
#include  <climits>
#include  <clocale>
#include  <complex>
#include  <csetjmp>
#include  <csignal>
#include  <cstdarg>
#include  <cstddef>
#include  <ctype.h>
#include  <cassert>
#include  <cstdlib>
#include  <utility>
#include  <cstring>
#include  <numeric>
#include  <ostream>
#include  <cwctype>
#include  <fstream>
#include  <iomanip>
#include  <math.h>
#include  <bitset>
#include  <cctype>
#include  <string>
#include  <vector>
#include  <limits>
#include  <memory>
#include  <cerrno>
#include  <time.h>
#include  <iosfwd>
#include  <cfloat>
#include  <cstdio>
#include  <cwchar>
#include  <cmath>
#include  <ctime>
#include  <deque>
#include  <queue>
#include  <stack>
#include  <ios>
#include  <map>
#include  <set>
#include  <new>
#define fi first
#define se second
#define pb push_back
#define ll long long
#define pii pair<int,int>
using namespace std;
const int maxn=5005;
int n,k;
int a[maxn];
bool dp[maxn][maxn];
bool check(int mid)
{
    if(a[mid]>k)
    return 1;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<k;j++)
        {
            if(!dp[i][j])
            continue;
            if(i!=mid)
            {
                int next=min(a[i]+j,k);
                dp[i+1][next]=1;
            }
            dp[i+1][j]=1;
        }
    }
    for(int i=k-a[mid];i<k;i++)
    {
        if(dp[n][i])
        return 1;
    }
    return 0;
}
int main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    int l=-1,r=n,mid;
    while(l+1<r)
    {
        mid=(l+r)/2;
        memset(dp,0,sizeof(dp));
        dp[0][0]=1;
        if(check(mid))
        r=mid;
        else
        l=mid;
    }
    cout<<l+1;
    return 0;
}


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

int main() {
    int N;
    cin >> N;
    vector<long> A;
    for (int i = 0; i < N; ++i) {
        long a;
        cin >> a;
        A.push_back(a);
    }
    long b1 = 0;
    for (int i = N - 1; i >=0; i--) {
        if (i % 2 == 0) {
            b1 += A[i];
        } else {
            b1 -= A[i];
        }
    }
    cout << b1;
    int pre_b = b1;
    for (int i = 1; i < N; i++) {
        int b = 2 * A[i - 1] - pre_b;
        cout << " " << b;
        pre_b = b;
    }
    cout << "\n";
    return 0;
}


Measured memory_bytes: 2164
N = int(input())
A = list(map(int, input().split()))
l = [0] * 10000001
for i in A:
    l[i] += 1
s = 0
for i in range(N + 1):
    i = l[i]
    s += i * (i - 1) // 2
for a in A:
    a = l[a]
    print(s - (a * (a - 1) // 2) + ((a - 1) * (a - 2) // 2))


Measured memory_bytes: 94304
#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';


template<typename T,T MOD = 1000000007>
struct Mint{
  static constexpr T mod = MOD;
  T v;
  Mint():v(0){}
  Mint(signed v):v(v){}
  Mint(long long t){v=t%MOD;if(v<0) v+=MOD;}

  Mint pow(long long k){
    Mint res(1),tmp(v);
    while(k){
      if(k&1) res*=tmp;
      tmp*=tmp;
      k>>=1;
    }
    return res;
  }

  static Mint add_identity(){return Mint(0);}
  static Mint mul_identity(){return Mint(1);}

  Mint inv(){return pow(MOD-2);}

  Mint& operator+=(Mint a){v+=a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator-=(Mint a){v+=MOD-a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator*=(Mint a){v=1LL*v*a.v%MOD;return *this;}
  Mint& operator/=(Mint a){return (*this)*=a.inv();}

  Mint operator+(Mint a) const{return Mint(v)+=a;}
  Mint operator-(Mint a) const{return Mint(v)-=a;}
  Mint operator*(Mint a) const{return Mint(v)*=a;}
  Mint operator/(Mint a) const{return Mint(v)/=a;}

  Mint operator-() const{return v?Mint(MOD-v):Mint(v);}

  bool operator==(const Mint a)const{return v==a.v;}
  bool operator!=(const Mint a)const{return v!=a.v;}
  bool operator <(const Mint a)const{return v <a.v;}

  static Mint comb(long long n,Int k){
    Mint num(1),dom(1);
    for(Int i=0;i<k;i++){
      num*=Mint(n-i);
      dom*=Mint(i+1);
    }
    return num/dom;
  }
};
template<typename T,T MOD> constexpr T Mint<T, MOD>::mod;
template<typename T,T MOD>
ostream& operator<<(ostream &os,Mint<T, MOD> m){os<<m.v;return os;}

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  Int n,k;
  cin>>n>>k;

  using M = Mint<Int>;
  M ans{0};
  for(Int i=k;i<=n+1;i++){
    Int x=(i-1)*i/2;
    Int y=(n+n-i+1)*i/2;
    ans+=M(y)-M(x)+M(1);
  }
  cout<<ans<<newl;
  return 0;
}


Measured memory_bytes: 3660
#include <stdio.h>

int main(void) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    if((a==5 && b==5 && c==7) || (a==5 && b==7 && c==5) || (a==7 && b==5 && c==5))
        printf("YES");
    else
        printf("NO");
    return 0;
}


Measured memory_bytes: 128
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
point = 0

for i in range(n):
    add = 0
    if i != 0:
        if a[i] == a[i - 1] + 1:
            add = add + c[a[i] - 2]
    add = add + b[i]
    point = point + add

print(point)

Measured memory_bytes: 3064
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
    std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
    std.random, std.typecons, std.container;

ulong MAX = 1_000_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "a", long, "b");
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);

void main()
{
    long n, k;
    scan(n, k);
    long r, s, p;
    scan(r, s, p);
    auto t = sread();
    long sum;
    auto check = new bool[](k);
    foreach (i; iota(k))
    {
        switch (t[i])
        {
        case 'r':
            sum += p;
            break;
        case 's':
            sum += r;
            break;
        case 'p':
            sum += s;
            break;
        default:
            assert(0);
        }
    }
    foreach (i; iota(k, n))
    {
        switch (t[i])
        {
        case 'r':
            if (t[i - k] != 'r' || check[i % k])
            {
                sum += p;
                check[i % k] = false;
            }
            else
            {
                check[i % k] = true;
            }
            break;
        case 's':
            if (t[i - k] != 's' || check[i % k])
            {
                sum += r;
                check[i % k] = false;
            }
            else
            {
                check[i % k] = true;
            }
            break;
        case 'p':
            if (t[i - k] != 'p' || check[i % k])
            {
                sum += s;
                check[i % k] = false;
            }
            else
            {
                check[i % k] = true;
            }
            break;
        default:
            assert(0);
        }
    }
    sum.writeln();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


Measured memory_bytes: 2556
#include<iostream>
using namespace std;
int main()
{
	int n;
	cin >> n;
	long long s=0;
	int i,j;
	for (i=1;;i++)
	{
		s+=i;
		if (s>n) break;
	}
	int c=s-n;
	for (j=1;j<=i;j++)
	{
		if (j!=c) cout << j <<endl;
	}
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(){
	string A;
	cin >> A;
	int N = A.size();
	long long ans = (long long) N * (N + 1) / 2 + 1;
	vector<int> cnt(26, 0);
	for (int i = 0; i < N; i++){
		cnt[A[i] - 'a']++;
	}
	for (int i = 0; i < 26; i++){
		ans -= (long long) cnt[i] * (cnt[i] + 1) / 2;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3768
#include<stdio.h>

int main(void){
  int a,b,d,r;
  double f;
  scanf("%d %d",&a,&b);
  d=a/b;
  r=a%b;
  f=(double)a/b;
  printf("%d %d %f\n",d,r,f);
  return 0;
}

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

int main(void){

    int A,B,C,X; cin>>A>>B>>C>>X;
    int cnt=0;

    for (int i = 0; i <= A; ++i) {
        for (int j = 0; j <= B; ++j) {
            for (int k = 0; k <= C; ++k) {
                if(i*500 + j*100 + k*50 == X) cnt++;
            }
        }
    }
    cout<<cnt<<endl;

    return 0;
}

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

using namespace std;

#define ll long long int
#define get(a) ll a; cin >> a;
#define show(a) cout << a << endl;
#define full(p) p.begin(), p.end()
#define sz(a) (ll)(a.size())
#define pb push_back

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(10);
	cout<<fixed;
	////////////////////////////////
	get(t);
	get(x);

	cout << double((double)t/x) << endl;	

	return 0;
}

Measured memory_bytes: 3800
# Problem C - Snuke Festival

import bisect

# input
N = int(input())
A_list = list(map(int, input().split()))
B_list = list(map(int, input().split()))
C_list = list(map(int, input().split()))

# initialization
A_list = sorted(A_list)
B_list = sorted(B_list)
C_list = sorted(C_list)
ans = 0

# b search
for i in range(N):
    b = B_list[i]
    a_nums = bisect.bisect_left(A_list, b)
    c_nums = N - bisect.bisect_right(C_list, b)
    ans += a_nums * c_nums

# output
print(ans)


Measured memory_bytes: 107108
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#define PI 3.14159265359
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pai;
typedef pair<ll, ll> pal;
const int MOD = 1e9+7;
const int MODD = 998244353;
const ll LLINF = 1e18;

ll dub[62][200001];

int main(){
	ll n, k;
	cin >> n >> k;
	vector<int> a(n);
	for (int i = 0; i < n; i++){
		cin >> a[i];
		a[i]--;
	}

	int log_k = log2(k);

	for (int i = 0; i < n; i++){
		dub[0][i] = a[i];
	}
	
	for (int i = 1; i <= log_k; i++){
		for (int j = 0; j < n; j++){
			dub[i][j] = dub[i-1][dub[i-1][j]];
		}
	}

	ll ans = 0;
	for (int i = 0; i <= log_k; i++){
		if (k & (1LL<<i)){
			ans = dub[i][ans];
		}
	}
	cout << ans+1 << endl;
	return 0;
}


Measured memory_bytes: 97824
n,m = map(int,input().split())
broken = [0]*(n+1)
for i in range(m):
    a = int(input())
    broken[a]=1
dp = [0]*(n+2)
dp[n]=1
for i in range(n-1,-1,-1):
    if broken[i]==1: continue
    dp[i] = (dp[i+1]+dp[i+2])%1000000007
print(dp[0])

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

int main()
{

  ll N;
  cin >> N;
  ll ans = 0;
  rep(i, N + 1)
  {
    if (i % 15 == 0 || i % 5 == 0 || i % 3 == 0)
    {
      continue;
    }
    ans += i;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3620
import sys
from io import StringIO
import unittest


def resolve():
    # s = input()
    n = int(input())
    a = list(map(int, input().split()))
    # l = [list(map(int, input().split())) for _ in range(n)]

    print(1 / sum([1/aa for aa in a]))


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """2
10 30"""
        output = """7.5"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """3
200 200 200"""
        output = """66.66666666666667"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """1
1000"""
        output = """1000"""
        self.assertIO(input, output)


if __name__ == "__main__":
    # unittest.main()
    resolve()


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define vec vector
#define ll long long

int main(void)
{
  int n;
  cin >> n;
  vec<ll> a(n);
  rep(i, n) cin >> a[i];

  ll sum = 0;
  rep(i, n) sum += a[i];
  sum /= 2;
  vec<ll> b(n, 0);
  b[0] = sum;
  for (int i = 2; i < n; i += 2) b[0] -= a[i];
  for (int i = 1; i < n; i++) {
    b[i] = a[i] - b[i - 1];
  }
  cout << b[n - 1] * 2;
  rep(i, n - 1) cout << " " << b[i] * 2;
  cout << endl;
  return 0;
}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b % mod; if (a >= mod) a -= mod; }
template<class T> void operator += (vector<T>& v, vector<T> v2) { rep(i, sz(v2)) v.eb(v2[i]); }

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(12); // debuged
    int T;
    T = 1;
    while (T--) solve();
}

template<typename T>
vector<pair<T, int> > prime_factorize(T n) {
    T tmp = n;
    vector<pair<T, int> > v;
    for (T i = 2; i * i <= n; ++i) {
        ll cnt = 0;
        while (tmp % i == 0) {
            tmp /= i;
            cnt++;
        }
        if (cnt) v.eb(i, cnt);
    }
    if (tmp != 1) v.eb(tmp, 1);
    return v;
}

void solve() {
    int k;
    cin >> k;
    if (k % 2 == 0 || k % 5 == 0) {
        cout << -1 << endl;
        return;
    }
    ll x = 0;
    rep3(i, 1, 1000005) {
        (x += 7LL * modpow(10, i, k)) %= k;
        if (x == 0) {
            cout << i << endl;
            return;
        }
    }
}



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

using namespace std;

typedef long long ll;
typedef pair< ll, ll > pll;
typedef pair< int, int > pii;

const double pi = 3.14159265358979323846;

// #define fio() cin.tie(0); ios::sync_with_stdio(false);
// 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 (a>b) { a = b; return 1; } return 0; }
#define MOD 1000000007LL
#define PS(p) cout << setprecision(15) << fixed << p << endl;
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
#define ALL(c) c.begin(), c.end()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define TG0 get< 0 >
#define TG1 get< 1 >
#define TG2 get< 2 >
#define F first
#define S second
#define VL vector< ll >

// to_string(123)
// atoi("123"); atoi(s.c_str());
// "abc".size()
// s.find('+') == string::npos
// 1e18

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

  string S;
  cin >> S;

  bool isA = false;
  bool isB = false;
  for (auto c : S) {
    if (c == 'A') {
      isA = true;
    }
    if (c == 'B') {
      isB = true;
    }
  }

  if (isA && isB) {
    cout << "Yes" << endl;

  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
typedef long long ll;
int a[223456];
int n,k;
bool check(int t){
	ll sum=0;
	for(int i=1;i<=n;i++){
		sum+=(int)ceil(a[i]*1.0/t)-1;
	}
	if(sum>k)return false;
	return true;
}
string s;
int main(){
	int n;
	cin>>n;
	int sum=0,cnt=0;
	cin>>s;
	for(int i=0;i<n;i++){
		if(s[i]=='W')sum++;
	}
	for(int i=n-sum;i<n;i++)if(s[i]=='W')cnt++;
	cout<<sum-cnt<<endl;
} 


Measured memory_bytes: 3740
W,H,N=map(int,input().split())
l=[["w" for i in range(W)] for j in range(H)]
for i in range(N):
  x,y,a=map(int,input().split())
  if a==1:
    for i in range(x):
      for j in range(H):
        l[j][i]="b"
  elif a==2:
    for i in range(x,W):
      for j in range(H):
        l[j][i]="b"
  elif a==3:
    for i in range(y):
      for j in range(W):
        l[i][j]="b"
  else:
    for i in range(y,H):
      for j in range(W):
        l[i][j]="b"
cnt=0
for i in range(H):
  cnt+=l[i].count("w")
print(cnt)    

Measured memory_bytes: 3064
import itertools
N,K=map(int,input().split())
if K > (N-1)*(N-2)//2:
    print(-1)
    exit()
# M = N-2-K + N-1
# print(M)
# for i in range(1,N):
#     print(i,i+1)
# for i in range(1,N-2-K):
#     print(i,i+2)
ans = []
for i in range(2,N+1):
    ans.append((1,i))
L = (N-1)*(N-2)//2 - K
i = 0
if L > 0:
    for pair in itertools.combinations(range(2,N+1),2):
        ans.append(pair)
        i+=1
        if i >= L:
            break
print(len(ans))
for a in ans:
    x,y = a
    print(x,y)


Measured memory_bytes: 3992
#include<stdio.h>
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    int n,m;
    int c=0,i=0,all=0;
  
  	scanf("%d %d",&n,&m);
  
    vector<int> vec(n);
  	for (i = 0; i < n; i++) {
    	cin >> vec.at(i);
      	all+=vec.at(i);
  	}
  i=0;
    for(i=0;i<n&&c<m;i++)
    {
        if(all<=vec.at(i)*m*4)
        c+=1;
    }
    if(c>=m)
    printf("Yes");
  	else
    printf("No");
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define rep(i,n)   for (int i = 0; i < (n); ++i)
#define sort(a)    sort((a).begin(), (a).end());
#define uniq(a)    SORT(a);(a).erase(unique((a).begin(), (a).end()), (a).end());
#define find(a,x)  find((a).begin(), (a).end(), (x)) != (a).end()
#define reverse(a) reverse((a).begin(), (a).end());
#define out(d) cout << (d);
#define outl(d) std::cout<<(d)<<"\n";
#define Yes() printf("Yes\n");
#define No() printf("No\n");
#define YES() printf("YES\n");
#define NO() printf("NO\n");
#define ceil(x, y) ((x + y - 1) / (y))

using namespace std;
using ll = long long;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));

  ll a, b, c; cin >> a >> b >> c;
  set<ll> s;
  s.insert(a);
  s.insert(b);
  s.insert(c);
  outl(s.size())
}


Measured memory_bytes: 888
#include<cstdio>
#include<cstring>
const int M=1e5+7;
struct node
{
	int to,next;
}e[M*2];
int cnt;
int first[M];
inline void insert(int u,int v)
{
	e[++cnt]=(node){v,first[u]};first[u]=cnt;
	e[++cnt]=(node){u,first[v]};first[v]=cnt;
}
inline int read()
{
	int ans=0,f=1;char t=getchar();
	while(t<'0'||t>'9')	f=(t=='-'?-1:1),t=getchar();
	while(t>='0'&&t<='9')	ans=ans*10+t-'0',t=getchar();
	return ans*f;
}
int color[M];
int ans[2];
bool f;
void dfs(int x)
{
	if(!f)	return;
	int c=color[x];
	for(int k=first[x];k;k=e[k].next)
	if(color[e[k].to]==-1)	color[e[k].to]=c^1,ans[c^1]++,dfs(e[k].to);
	else if(color[e[k].to]==c)	f=0;
}
int main()
{
	int n,m;
	int u,v;
	scanf("%d %d",&n,&m);
	memset(color,-1,sizeof(color));
	f=1;
	for(int i=1;i<=m;i++)
	{
		u=read(),v=read();	
		insert(u,v);
	}
	color[1]=0;ans[0]++;
	dfs(1);
	
	if(!f)	printf("%lld\n",(long long )n*(n-1)/2-m);
	else printf("%lld\n",(long long )ans[0]*ans[1]-m);
	return 0;
}

Measured memory_bytes: 3072
#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n-1;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
int main(){
  ll n,m;
  cin>>n>>m;
  vll fi(200010);
  vll la(200010);
  rep(i,m){
    ll a,b;
    cin>>a>>b;
    if(a==1){
      fi[b]++;
    }
    if(b==n){
      la[a]++;
    }
  }
  vll ab(200010);
  rep(i,200010){
    ab[i]=fi[i]+la[i];
  }
  ll cu=0;
  rep(i,200010){
    if(ab[i]==2){
      COUT("POSSIBLE");
      cu++;
    }
  }
  if(cu==0) COUT("IMPOSSIBLE");
}
  


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

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

using namespace std;

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

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

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

  int n;
  while (cin >> n) {
    vector<int> a(n);
    cin >> a;
    map<int, int> cnt;
    each (i, a) ++cnt[i];
    int sum = 0;
    each (i, cnt) {
      if (i.first <= i.second) {
        sum += min(i.second - i.first, i.second);
      } else {
        sum += i.second;
      }
    }
    cout << sum << endl;
  }
  
  return 0;
}


Measured memory_bytes: 5120
#include<stdio.h>

int main()
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if((a<=b)&&(b<=c))
	printf("%d %d %d\n",a,b,c);
	else if((a<=c)&&(c<=b))
	printf("%d %d %d\n",a,c,b);
	else if((b<=a)&&(a<=c))
	printf("%d %d %d\n",b,a,c);
	else if((b<=c)&&(c<=a))
	printf("%d %d %d\n",b,c,a);
	else if((c<=a)&&(a<=b))
	printf("%d %d %d\n",c,a,b);
	else
	printf("%d %d %d\n",c,b,a);
return 0;
}

Measured memory_bytes: 596
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<iostream>
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
int main()
{

    int n, m;
    cin >> n >> m;
    map<int, int> mp;
    mp.clear();
    int a, b;
    for(int i = 0; i < m; i++)
    {
        scanf("%d%d",&a,&b);
        mp[a]++;mp[b]++;
    }
    for(int i = 1; i <= n; i++)
        printf("%d\n",mp[i]);
    return 0;
}



Measured memory_bytes: 384
//package abc136;
import java.io.*;
import java.util.*;

public class Main {
	// ------------------------
	
	public static void main(String[] args) {
		MyScanner sc = new MyScanner();
		out = new PrintWriter(new BufferedOutputStream(System.out));
		// ------------------------
		int n = sc.nextInt(), k = sc.nextInt();
		long sum = 0;
		long[] a = new long[n];
		for(int i = 0; i < n; i++)
			sum += a[i] = sc.nextInt();
		TreeSet<Long>set = new TreeSet<Long>();
		for(int i = 1; i * i <= sum; i++)
			if(sum % i == 0) {
				set.add((long)i);
				set.add(sum / i);	
			}
		while(!set.isEmpty())
			if(works(a, k, set.last())) {
				out.println(set.last());
				break;
			} else
				set.pollLast();
		// ------------------------
		out.close();
	}
	//------------------------
	public static boolean works(long[] a, int k, long x) {
		long[] b = new long[a.length];
		for(int i = 0; i < b.length; i++)
			b[i] = a[i] % x;
		Arrays.sort(b);
		int add = b.length - 1, sub = 0, i = 0;
		while(i < k){
			while(add >= 0 && b[add] == x)
				add--;
			while(sub < b.length && b[sub] == 0)
				sub++;
			if(add <= sub)
				break;
			long d = Math.min(k - i, Math.min(b[sub], x - b[add]));
			b[add] += d;
			b[sub] -= d;
			i += d;
		}
		for(long l : b)
			if(l % x != 0)
				return false;
		return true;
	}
	public static PrintWriter out;
	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;
		public MyScanner() {
			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: 31080
n=int(input())
a=list(map(int,input().split()))

ans = 0
block = 1
no_block = False

for i in range(n):   
    if a[i]!=block:
        ans+=1
    else:
        no_block = True
        block+=1

if no_block is False:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 26268
N, M = map(int, input().split())

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

A.sort()
ans = sum(A)
P = [0]*M
for i in range(M):
  P[i] = list(map(int, input().split()))

P.sort(key=lambda x: x[1],reverse=True)

n = 0
import bisect

while len(A)>0 and n<M:
  ind = bisect.bisect_left(A,P[n][1])
  for _ in range(min(ind,P[n][0])):
    a = A.pop(0)
    ans += P[n][1]-a
  if ind <= P[n][0]:
    break
  n+=1

print(ans)

Measured memory_bytes: 32964
#include<bits/stdc++.h>
using namespace std;
const int N=100;
const int NIL =-1;
struct node
{
	int p,r,l;
};
node T[N];
int leve[N];
int high[N];
void setDepth(int u,int d)//求结点的深度
{
    if(u==NIL)
        return ;
    leve[u]=d;
    setDepth(T[u].l,d+1);
    setDepth(T[u].r,d+1);
}
int setHeight(int u)//结点的高
{
    int h1=0,h2=0;
    if(T[u].l!=NIL)
        h1=setHeight(T[u].l)+1;
    if(T[u].r!=NIL)
        h2=setHeight(T[u].r)+1;
    return high[u]=h1>h2?h1:h2;
}
int getSibling(int u)//返回兄弟结点
{
    if(T[u].p==NIL)
        return NIL;
    if(T[T[u].p].l!=u&&T[T[u].p].l!=NIL)
        return T[T[u].p].l;
    if(T[T[u].p].r!=u&&T[T[u].p].r!=NIL)
        return T[T[u].p].r;
    return NIL;
}
void print(int u)
{
    cout<<"node "<<u<<": ";
    cout<<"parent = "<<T[u].p<<", ";
    cout<< "sibling = " <<getSibling(u)<<", ";
    int deg=0;
    if(T[u].l!=NIL)
        deg++;
    if(T[u].r!=NIL)
        deg++;
    cout<<"degree = "<<deg<<", ";
    cout<<"depth = "<<leve[u]<<", ";
    cout<<"height = "<<high[u]<<", ";
    if(T[u].p==NIL)
        cout<<"root"<<endl;
    else if(T[u].l==NIL&&T[u].r==NIL)
        cout<<"leaf"<<endl;
    else
        cout<<"internal node"<<endl;
}
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++) T[i].p=NIL;
	for(int i=0;i<n;i++){
		int v,l,r;
		cin>>v>>l>>r;
		T[v].l=l;
		T[v].r=r;
		if(l!=NIL) T[l].p=v;
		if(r!=NIL) T[r].p=v;
	}
	int id=0;
	for(int i=0;i<n;i++){
		if(T[i].p==NIL) id=i;
	}
	setDepth(id,0);
	setHeight(id);
	for(int i=0;i<n;i++) print(i);
	return 0;
}


Measured memory_bytes: 3088
//Dragon_warrior7(IITK)
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pb push_back
#define nl cout << '\n'
#define sor(x) sort(x.begin(), x.end())
#define rev(v) reverse(v.begin(), v.end())
#define maxin(v) *max_element(v.begin(), v.end())
#define minin(v) *min_element(v.begin(), v.end())
#define sumall(vect) accumulate(vect.begin(), vect.end(), 0)
#define count(x, vect) count(vect.begin(), vect.end(), x)
#define lb(v, temp) lower_bound(v.begin(), v.end(), temp)
#define ub(v, temp) upper_bound(v.begin(), v.end(), temp)
#define fi first
#define se second
#define llmax 100000000000000000
#define deb(x) cout << #x << " " << x << "\n"
#define pll pair<ll, ll> 
#define vll vector<ll> 
#define rub cout << "------------------------------------\n"
#define min(a, b, c) min(a, min(b, c))
#define max(a, b, c) max(a, max(b, c))
void read(vector<ll> &v)
{
	for (int i = 0; i < v.size(); i++)
		cin >> v[i];
}

void print(vector<ll> v)
{
	for (int i = 0; i < v.size(); i++)
		cout << v[i] << " ";
}
ll n,m,a,b,temp;
string str;
set<ll> s;
vll v;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n;
	m=n;
	while(n)
	{
	  a+=n%10;
	  n/=10;
	}
	if(m%a==0)
	cout<<"Yes";
	else
	cout<<"No";
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
    int a = 0, b = 0, ab = 0, o = 0, tmp;
    char type[5];
    while(scanf("%d%s",&tmp,type) != EOF ) {
        if(type[1] == 'A') {
            if(type[2] == 'B') {
                ab++;
            } else {
                a++;
            }
        } else if(type[1] == 'B') {
            b++;
        } else if(type[1] == 'O') {
            o++;
        }
        type[2] == '0';
    }
    printf("%d\n%d\n%d\n%d\n",a,b,ab,o);
    return 0;
}

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

int main() {
	int N,M,X,Y;
	bool ans = false;
	cin >> N >> M >> X >>Y;
	vector<int> x(N),y(M);
	for(int i = 0; i < N; i++){
		cin >> x.at(i);
	}
	for(int i = 0; i < M; i++){
		cin >> y.at(i);
	}
	sort(x.begin(),x.end());
	sort(y.begin(),y.end());
	for(int i = X + 1; i <= Y; i++){
		if(x.at(N - 1) < i && i <= y.at(0)){
			ans = true;
			break;
		}
	}
	if(ans){
		cout << "No War" << endl;
	} else {
		cout << "War" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    while(cin>>a>>b){
        if((a+b)%2==0) cout<<(a+b)/2<<endl;
        else{
            int c=(a+b)/2;
            if(a+b-2*c<=1) cout<<c+1<<endl;
            else cout<<c<<endl;
        }
    }
    return 0;
}

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

bool is_prime(long long _Num){
    if(_Num < 2)return false;
    if(_Num % 2 == 0){
        if(_Num == 2)return true;
        else return false;
    }
    bool prime = true;
    for(long long i = 3; i <= sqrt(_Num); i += 2){
        if(_Num % i == 0){
            prime = false;
            break;
        }
    }
    return prime;
}

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

  while (1) {
    if (is_prime(x)) {
      cout << x << endl;
      return 0;
    }
    x++;
  }
  
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx")

#include <bits/stdc++.h>
#define pb push_back
#define pp pop_back()
#define mp make_pair
#define f first
#define s second
#define y1 yasfasf
#define kz ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FILE "substring"
#define fr freopen(FILE".in", "r", stdin); freopen(FILE".out", "w", stdout);
using namespace std;
typedef pair <int, int> pii;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef struct node* treap;

const int N = 1e5 + 11, inf = 1e9;
const ll linf = 1e18, mod = 1e9 + 7;

string s;

int main(){
	cin >> s;
	for(int i = 0; i < s.size(); i += 2)
		cout << s[i];
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph=vector<vector<int>>;
using pp=pair<ll,pair<ll,ll>>;
#define MAX 1000000
#define MOD 1000000007
#define INF 1000000000

void dfs(Graph &G,int v,vector<int> &depth){
  for(auto nv:G[v]){
    if(depth[nv]==-1){
      depth[nv]=depth[v]+1;
      dfs(G,nv,depth);
    }
  }
}

int main(){
  int N;
  cin>>N;
  Graph G(N);
  for(int i=0;i<N-1;i++){
    int a,b;
    cin>>a>>b;
    a--;b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  vector<int> depth(N,-1);
  depth[0]=0;
  dfs(G,0,depth);
  int v=0;
  for(int i=0;i<N;i++){
    if(depth[i]>depth[v]){
      v=i;;
    }
  }
  for(int i=0;i<N;i++){
    depth[i]=-1;
  }
  depth[v]=0;
  dfs(G,v,depth);
  int dia=0;
  for(int i=0;i<N;i++){
    dia=max(dia,depth[i]);
  }

  if(dia%3==1){
    cout<<"Second"<<endl;
  }else{
    cout<<"First"<<endl;
  }
}


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

int main() {
	int H, W;
	while(1){
		cin >> H >> W;
		if(H==0 && W==0) break;
		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				if(i==0 || i==H-1 || j==0 || j==W-1) cout << "#";
				else cout << ".";
			}
			cout << endl;
		}
		cout << endl;
	}
    return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
  
#define repd(i,a,b) for (int i=(a);i<=(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    rep(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}
  
int main()
{
  int n,d;
  cin >> n >> d;
  d = d * 2 + 1;

  if(d >= n){cout << 1 << endl; return 0;}

  int ans = n / d;
  if(n % d > 0){ans++;}
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>
#include <cstdio>
#include <cstring>
using namespace std;
typedef long long ll;
const int MAXN = 105;
const double INF = 1e15;


int main()
{
    ll n, m, ans;
    cin >> n >> m;
    if(m <= 2 * n)
    {
        ans = m / 2;
    }
    else
    {
        ans = n + (m - 2 * n) / 4;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
A = input()
B = input()
C = input()
turn = 'a'
while True:
    if turn == 'a':
        if len(A) == 0:
            print('A')
            break
        else:
            turn = A[0:1]
            A = A[1:]
    elif turn == 'b':
        if len(B) == 0:
            print('B')
            break
        else:
            turn = B[0:1]
            B = B[1:]
    elif turn == 'c':
        if len(C) == 0:
            print('C')
            break
        else:
            turn = C[0:1]
            C = C[1:]


Measured memory_bytes: 3064
use std::io;
use std::io::BufRead;

fn main() {
    let stdin = io::stdin();
    for (i, line) in stdin.lock().lines().enumerate() {
        let x: i32 = line.unwrap().trim().parse().unwrap_or(0);
        if x == 0 {
            return;
        }
        println!("Case {}: {}", i + 1, x);
    }
}



Measured memory_bytes: 5072
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
typedef long long LL;
const int MaxN = 1e5;
using namespace std;
int n, K;
int a[MaxN + 5], b[MaxN + 5];
int main() 
{
	while(~scanf("%d%d", &n, &K)) {
		K++;
		for (int i = 1; i <= n; i++) scanf("%d%d", &a[i], &b[i]);
		LL ans = 0, now = 0;
		for (int P = 30; P >= 0; P--) {
			if(K & (1 << P)) {
				now ^= (1 << P);
				LL tmp = 0;
				for (int i = 1; i <= n; i++) {
					if((a[i] & now) == 0) tmp = tmp + b[i];
				}
				ans = max(ans, tmp);
				now ^= (1 << P);
			}
			else {
				now ^= (1 << P);
			}
		}
		printf("%lld\n", ans);
	}
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
const long long INF = 0x3f3f3f3f3f3f3f3fLL;
int main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  long long n,minv=INF;
  cin>>n;
  for(long long i=1;i*i<=n;i++){
    if(n%i==0){
      minv=min(minv,i+n/i-2);
    }
  }
  cout<<minv<<'\n';
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define maxn 205
#define maxp 10000007
using namespace std;

int a[maxn],cnt,n;
int pr[maxp],vis[maxp],cnt_pr;
int usd[maxn],mat[maxn];

int dfs(int u){
	for(int i=1;i<=cnt;i++) if(vis[abs(a[u]-a[i])] == 0 && !usd[i]){
		usd[i] = 1;
		if(!mat[i] || dfs(mat[i])){
			mat[i] = u , mat[u] = i;
			return 1;
		}
	}
	return 0;
}

int main(){
	for(int i=2;i<maxp;i++){
		if(!vis[i]) pr[cnt_pr++] = i;
		for(int j=0;pr[j]*i<maxp;j++){
			vis[i*pr[j]] = 1;
			if(i % pr[j] == 0) break;
		}
	}
	vis[2] = vis[0] = vis[1] = 1;
	scanf("%d",&n);
	int p = -10;
	for(int i=1;i<=n;i++){int x;
		scanf("%d",&x);
		if(x != p + 1){
			if(p>0)a[++cnt] = p + 1;
			a[++cnt] = x;
		}
		p = x;
	}
	a[++cnt] = p+1;
	int s[2] = {};
	for(int i=1;i<=cnt;i++) assert(a[i] > 0) , s[a[i] % 2] ++;
	int ans = 0;
	for(int i=1;i<=cnt;i++) if(a[i]%2 && !mat[i]) memset(usd,0,sizeof usd),ans += dfs(i);
	ans += 2 * ((s[0] - ans) / 2 + (s[1] - ans) / 2);
	ans += 3 * ((s[0] - ans) % 2 && (s[1] - ans) % 2);
	printf("%d\n",ans);
}

Measured memory_bytes: 43392
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <cctype>
#include <tuple>
#include <climits>
#include <bitset>
#include <cassert>
#include <random>
#include <complex>

#ifdef _MSC_VER
#include <agents.h>
#endif

#define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define REV(v) v.rbegin(), v.rend()
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define UNIQUE(v) (v).erase(unique(ALL(v)), (v).end())
#define MP make_pair
#define MT make_tuple

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int N = 110;
int dist[N][N];

vector<P> G[N];

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

	int n, m, c;
	while (cin >> n >> m >> c, n){
		rep(i, N) G[i].clear();
		rep(i, m){
			int a, b, cost;
			cin >> a >> b >> cost;
			--a, --b;
			G[a].push_back(MP(b, cost));
			//G[b].push_back(MP(a, cost));
		}

		rep(i, N) rep(j, N) dist[i][j] = 1e9;
		dist[0][0] = 0;

		typedef tuple<int, int, int> T;
		priority_queue<T, vector<T>, greater<T>> q;
		q.push(MT(0, 0, 0));

		while (!q.empty()){
			int cnt, cost, v;
			tie(cnt, cost, v) = q.top();
			q.pop();

			if (dist[v][cnt] < cost) continue;
			if (v == n - 1 && dist[v][cnt] <= c){
				cout << cnt << endl;
				break;
			}

			for (auto edge : G[v]){
				rep(i, 2){
					int ncost = cost + (i ? 0 : edge.second);
					int ncnt = cnt + i;
					if (dist[edge.first][ncnt] <= ncost) continue;
					dist[edge.first][ncnt] = ncost;
					q.push(MT(ncnt, ncost, edge.first));
				}
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 1276