akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<stdlib.h>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
char in[1100000];
int to[1100000][27];
vector<int>g[1100000];
int segtree[1<<22];
int query(int a,int b,int c,int d,int e){
	if(d<a||b<c)return mod;
	if(c<=a&&b<=d)return segtree[e];
	return min(query(a,(a+b)/2,c,d,e*2),query((a+b)/2+1,b,c,d,e*2+1));
}
void update(int a,int b){
	a+=(1<<21);
	while(a){
		segtree[a]=min(segtree[a],b);
		a/=2;
	}
}
int rev[1100000];
int val[1100000];
int eu[2100000];
int fi[1100000];
int num;
int sz;
void dfs(int a){
	val[a]=num;
	rev[num++]=a;
	fi[a]=sz;
	eu[sz++]=val[a];
	for(int i=0;i<g[a].size();i++){
		dfs(g[a][i]);
		eu[sz++]=val[a];
	}
}
int h[1100000];
int main(){
	scanf("%s",in);
	int n=strlen(in);
	int a;scanf("%d",&a);
	for(int i=0;i<27;i++)to[n][i]=-1;
		//printf("%d: %d %d %d\n",n,to[n][24],to[n][25],to[n][26]);
	for(int i=n-1;i>=0;i--){
		for(int j=0;j<27;j++){
			if(in[i]>'a'+j){
				to[i][j]=-1;
				continue;
			}
			if(in[i]=='a'+j){
				to[i][j]=i+1;
			}else{
				if(to[i][j-1]!=-1&&to[to[i][j-1]][j-1]!=-1)to[i][j]=to[to[i][j-1]][j-1];
				//else if(to[i][26]!=-1)to[i][j]=to[to[i][26]][j];
				else to[i][j]=-1;
			}
		}
		for(int j=0;j<26;j++){
			if(to[i][j]==-1&&to[i][26]!=-1)to[i][j]=to[to[i][26]][j];
		}
		//printf("%d: %d %d %d\n",i,to[i][24],to[i][25],to[i][26]);
		if(~to[i][26]){
			h[i]=1;
			g[to[i][26]].push_back(i);
		}
	}
	for(int i=0;i<(1<<22);i++)segtree[i]=mod;
	for(int i=0;i<=n;i++){
		if(h[i]==0)g[n+1].push_back(i);
	}

	dfs(n+1);
	for(int i=0;i<sz;i++)update(i,eu[i]);

	while(a--){
		int p,q;scanf("%d%d",&p,&q);
		p--;
		int at=rev[query(0,(1<<21)-1,min(fi[p],fi[q]),max(fi[p],fi[q]),1)];
		//printf("%d %d: %d\n",p,q,at);
		if(at==p||at==q){
			printf("Yes\n");
		}else printf("No\n");
	}
}


Measured memory_bytes: 146688
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long

int main(){
    int a1, a2, a3; cin>>a1>>a2>>a3;
    cout << max(a1, max(a2, a3)) - min(a1, min(a2, a3)) << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <bitset>
#include <limits>

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;
#define REP(i,a,n) for(int i = (a); i < (int)(n); ++i)
#define REPM(i,n,a) for(int i = ((n) - 1); i >= (a); --i)
#define FLOAT setprecision(16)
#define INSIDE(i,j,H,W) ((i) >= 0 && (i) < (H) && (j) >= 0 && (j) < (W))
const int INF = 0x3FFFFFFF;
const LL INFLL = 0x3FFFFFFF3FFFFFFF;
const double INFD = 1.0e+308;
const double EPS = 1.0e-9;

template <class T, class U>
istream& operator>>(istream& ist, pair<T, U>& right) { return ist >> right.first >> right.second; }
template <class T, class U>
ostream& operator<<(ostream& ost, pair<T, U>& right) { return ost << right.first << ' ' << right.second; }
template <class T, class TCompatible, size_t N>
void Fill(T(&dest)[N], const TCompatible& val) { fill(begin(dest), end(dest), val); }
template <class T, class TCompatible, size_t M, size_t N>
void Fill(T(&dest)[M][N], const TCompatible& val) { for (int i = 0; i < M; ++i) Fill(dest[i], val); }
// all_of

#if 1234567891
#include <array>
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;	// コスト小を優先
template<class T>
struct IsIterable {
private:
	template<class Iterable>
	static auto Is_iterable(Iterable subject) -> decltype(std::begin(subject), std::end(subject), std::true_type()) {}
	static auto Is_iterable(...) -> decltype(std::false_type()) {}
public:
	typedef decltype(Is_iterable(std::declval<T>())) type;
	static bool const value = type::value;
};
template <class Container>
typename std::conditional<true, std::ostream&, typename std::enable_if<IsIterable<Container>::value>::type>::type
operator<<(ostream& ost, const Container& container) {
	for (auto it = begin(container); it != end(container); ++it) {
		if (it != begin(container)) ost << ' ';
		ost << *it;
	}
	return ost;
}
#endif

#if _DEBUG
#include "IntMod.h"
#include "Union_Find.h"
#include "Graph.h"
#endif
LL N, K;
LL A[100000], C[100000];

LL calc(LL n) {
	LL sum = 0;
	REP(i, 0, N) {
		bool ok = true;
		REP(d, 0, 31) {
			if (A[i] & (1 << d) && !(n & (1 << d))) ok = false;
		}
		if(ok) sum += C[i];
	}
	return sum;
}

int main() {
	cin >> N >> K;
	REP(i, 0, N) {
		cin >> A[i] >> C[i];
	}

	LL MAX = calc(K);
	REP(d, 0, 31) {
		if (K & (1 << d)) {
			LL n = (K ^ (1 << d)) | ((1 << d) - 1);
			MAX = max(MAX, calc(n));
		}
	}

	cout << MAX << endl;
	return 0;
}

Measured memory_bytes: 1792
h,w = map(int,input().split())
grid = []
for i in range(h):
    grid.append(list(input()))
h_b = []
w_b = []
for i in range(h):
    if "#" in grid[i]:
        h_b.append(i)
grid_t = [list(x) for x in zip(*grid)]
for i in range(w):
    if "#" in grid_t[i]:
        w_b.append(i)
ans = []
for i in h_b:
    crt = []
    for j in w_b:
        crt.append(grid[i][j])
    ans.append(crt)
for i in range(len(ans)):
    print("".join(ans[i]))



Measured memory_bytes: 39152
#include<iostream>
using namespace std;
int main() {
	int n;
	cin >> n;
	int a[3000];
	int ans = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		ans += a[i] - 1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int i,j,a,b;
    while(1){

    scanf("%d%d",&a,&b);
    if(a==0&&b==0)
        break;
    for(i=0;i<a;i++)
    {
        for(j=0;j<b;j++){
            printf("#");}

    printf("\n");}
    printf("\n");}

    return 0;
}



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

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vll;
const int INF = 0x3f3f3f3f;

int main() {
    ll N, Q;
    cin >> N >> Q;
    string s;
    cin >> s;
    vector<int> dp(s.length() + 10, 0);
    dp[0] = 0;
    for (int i = 1; i <= s.length(); ++i) {
        if (s[i - 1] == 'A' && s[i] == 'C') {
            dp[i] = dp[i - 1] + 1;
        } else {
            dp[i] = dp[i - 1];
        }
    }
    // for (int i = 0; i <= N; ++i) {
        // cout << dp[i] << " ";
    // }
    // cout << endl;
    ll l, r;
    while (Q--) {
        cin >> l >> r;
        cout << dp[--r] - dp[--l] << endl;
    }
    return 0;
}


Measured memory_bytes: 1408
def partition(A, p, r):
    x = A[r]
    i = p - 1
    for j in range(p, r):
        if A[j] <= x:
            i += 1
            A[i], A[j] = A[j], A[i]
    A[i + 1], A[r] = A[r], A[i + 1]
    return i + 1

n = int(input())
A = list(map(int, input().split()))
q = partition(A, 0, n - 1)
print(" ".join(map(str, A[:q])), "[{0}]".format(A[q]),
      " ".join(map(str, A[q + 1:])))

Measured memory_bytes: 18228
#include <stdio.h>

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

void swap(int *a, int *b) {
    int tmp = *b;
    *b = *a;
    *a = tmp;
}

int gcd(int a, int b) {
    if (a < b)swap(&a, &b);
    return b == 0 ? a : gcd(b, a % b);
}

void solver() {
    int x,y;
    scanf("%d %d",&x,&y);
    printf("%d\n",gcd(x,y));
}

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


Measured memory_bytes: 1796
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define wzh(x) cerr<<#x<<' '<<x<<endl
int l,r,d;
int main() {
  ios::sync_with_stdio(false);
  cin>>l>>r>>d;
  cout<<(r/d)-(l-1)/d<<'\n';
 	return 0;
}

Measured memory_bytes: 3588
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (true) {
            int a = scanner.nextInt();
            int b = scanner.nextInt();
            if (a == 0 & b == 0)
                break;
            for (int i = 0; i < a; i++) {
                for (int j = 0; j < b; j++) {
                    if (i % 2 == 0 && j % 2 == 0 || i % 2 == 1 && j % 2 == 1)
                        System.out.print("#");
                    else
                        System.out.print(".");
                }
                System.out.println();
            }
            System.out.println();
        }
    }
}


Measured memory_bytes: 35024
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <climits>
#include <fstream>
#include <bitset>
#include <time.h>
#include <assert.h>

#define LL long long
#define VI vector<int>
#define VB vector<bool>
#define VL vector<long long>
#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#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())
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define EPS 1e-14

const std::string YES = "YES";
const std::string Yes = "Yes";
const std::string NO = "NO";
const std::string No = "No";

using namespace std;

template <class T> int find_index(T x, const std::vector<T> &v) {
    auto it = std::find(v.begin(), v.end(), x);
    if (it != v.end()) { return (int)std::distance(v.begin(), it); }
    return -1;
}

template <class T> void print(T x) {
    std::cout << x << std::endl;
}
// 4近傍（右, 下, 左, 上）
vector<int> dy = { 0, -1, 0, 1 };
vector<int> dx = { 1, 0, -1, 0 };

bool can_reach(int p, vector<int> v) {
    set<int> now;
    now.insert(0);

    FOE(x, v) {
        set<int> next;
        FOE(n, now) {
            next.insert(n - x);
            next.insert(n + x);
        }
        now = set<int>(next);
    }

    FOE(x, now) {
        if (x == p) {
            return true;
        }
    }

    return false;
}

vector<pair<char, int>> run_length_encoding(string s) {
    vector<pair<char, int>> v;
    s += "$";   // add dummy
    int num = 1;
    FOR(i, 0, s.size() - 1) {
        if (s[i] == s[i + 1]) {
            num++;
        }
        else {
            v.push_back(make_pair(s[i], num));
            num = 1;
        }
    }
    return v;
};


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

    string s;
    int x, y;
    cin >> s;
    cin >> x >> y;
    vector<pair<char, int>> type_num = run_length_encoding(s);

    if (type_num[0].first == 'F') {
        x -= type_num[0].second;
        type_num.erase(type_num.begin());
    }

    int now = 1;
    vector<int> h, v;
    FOE(p, type_num) {
        if (p.first == 'F') {
            if (now == 1) {
                h.emplace_back(p.second);
            }
            else {
                v.emplace_back(p.second);
            }
        }
        else {
            if (p.second % 2 != 0) {
                now *= -1;
            }
        }
    }

    if (can_reach(y, v) && can_reach(x, h)) {
        print("Yes");
        return 0;
    }
    print("No");
    return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    cin >> a >> b;
    if(0<a&&a<=b){
        cout << "Positive" << endl;
    }else if(a<=b&&b<0){
        int tmp;
        tmp = b-a+1;
        if(tmp%2==0){
            cout << "Positive" << endl;
        }else{
            cout << "Negative" << endl;
        }
    }else if(a<=0&&0<=b){
        cout << "Zero" << endl;
    }
    return 0;
}




Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) {
			System.out.println("Possible");
		} else {
			System.out.println("Impossible");
		}
	}

}


Measured memory_bytes: 21844
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) > (b) ? (b) : (a))
#define abs(x) ((x) > 0 ? (x) : -(x))
#define MOD 1000000007 //10^9 + 7
#define endl printf("\n")
typedef long long ll;
#define MAX_N (1 << 17)

int
main(int argc, char *argv[])
{
  int a; char s[100];
  scanf("%d", &a);
  scanf("%s", s);

  if (a >= 3200) printf("%s\n", s); 
  else printf("red\n"); 

  return 0;
}


Measured memory_bytes: 128
private fun readStrings() = readLine()!!.split(" ")
private fun readInts() = readStrings().map { it.toInt() }

fun abs(a: Double) = if (a > 0) a else -a

fun main(args: Array<String>) {
    val n = readInts()[0]
    val a = readInts().sorted()
    val N = a.last()
    val half = N.toDouble() / 2
    val closestToHalf = a.dropLast(1).minBy { abs(half - it) }!!
    print("$N $closestToHalf")
}

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


int main()
{
	int r, c, A[101][101];
	cin >> r >> c;
	for (int i = 0; i < 101; i++) {
		for (int j = 0; j < 101; j++) {
			A[i][j] = 0;
		}
	}
	int cnt;

	for (int i = 0; i < r; i++) {
		cnt = 0;
		for (int j = 0; j < c; j++) {
			cin >> A[i][j];
			cnt += A[i][j];
		}
		A[i][c] = cnt;
	}

	int sum;
	for (int j = 0; j < c+1; j++) {
		sum = 0;
		for (int i = 0; i < r; i++) {
			sum += A[i][j];
		}
		A[r][j] = sum;
	}

	for (int i = 0; i < r + 1; i++) {
		for (int j = 0; j < c + 1; j++) {
			if (j != 0) {
				cout << " " << A[i][j];
			}
			else {
				cout << A[i][j];
			}
		}
		cout << endl;
	}

	


	return 0;
}



Measured memory_bytes: 3128
#18 C - Takahashi's Information
c = [list(map(int,input().split())) for _ in range(3)]

cnt = 0
if (c[0][0] - c[1][0]) == (c[0][1] - c[1][1]) == (c[0][2] - c[1][2]):
    cnt += 1
if (c[1][0] - c[2][0]) == (c[1][1] - c[2][1]) == (c[1][2] - c[2][2]):
    cnt += 1
if (c[2][0] - c[0][0]) == (c[2][1] - c[0][1]) == (c[2][2] - c[0][2]):
    cnt += 1
if cnt == 3:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9124
#include<bits/stdc++.h>
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define range(i,l,h) for(int i=l;i<h;i++)
#define endl '\n'
#define I INT_MAX
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define ll long long
#define ull unsigned long long
#define ff first
#define ss second
#define vt vector
using namespace std;
using std::ios;
constexpr int MOD=1e9+7;
constexpr int mod=998244353;
template<typename T> T power(T a,T b){T r=1;while(b){if(b&1)r*=a;b/=2;a*=a;}return r;}


int main()
{
  fastio;
 

  int n;
  cin>>n;

  int c=0;
  for(int i=1;i<=n;i++)
  {
    for(int j=1;j<=n/i;j++)
    {
      if(i*j<n)c++;
      //if(j*(n/i)<n)c++;
    }
  }
  cout<<c;
}

Measured memory_bytes: 3648
//code By PMD
#include<bits/stdc++.h>
#define faster() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(a) cout << #a " is " << (a) << endl;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
using namespace std;
typedef long long i64;
typedef pair < int,int > pii;
const int N = 1e5+5;
const i64 mod = 1e9+7;
const i64 inf = 1e18+7;

inline i64 Gcd(i64 a, i64 b) {i64 r; while(b){ r = a % b; a = b; b = r;} return a;}
inline i64 modPow(i64 n, i64 k) {i64 r = 1; for(; k; k >>= 1, n = n * n % mod){if(k & 1) r = r * n % mod;} return r;}
inline i64 C(int k, int n){i64 r = 1;for (int i=1;i<=k;i++,n--)r=r*n%mod*modPow(i,mod-2)%mod;return r%mod;}

int dx[] = {-1,0,0,1};
int dy[] = {0,-1,1,0};
int n;
void input() {
    cin >> n;
    
}
 
void solve(){
    int tmp = n/2;
    if ( n % 2 ) tmp++;
    printf  ("%.6lf",1.0*tmp/n);
}
main(){
	//freopen("INPUT.in", "r", stdin);
    //freopen("OUTPUT.out", "w", stdout);
	faster();
	int t=1;
	//cin>>t;
	while(t--){
		input();
		solve();
	}
}
//Code By PMD
  

Measured memory_bytes: 256
N = int(input())
abc = []
for _ in range(N):
    abc.append(tuple(map(int, input().split())))

dp = [[0] * 3 for _ in range(N+1)]
for i in range(1, N+1):
    for k in range(3):
        for last in range(3):
            if k != last:
                dp[i][k] = max(dp[i][k], dp[i-1][last] + abc[i-1][last])

ans = max(dp[N][k] for k in range(3))
print(ans)


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

#define LL long long
typedef pair<int, int> pii;

template< typename T > inline void read(T &x)
{
    static char _c;
    static bool _f;

    x = 0;
    _f = 0;
    _c = getchar();

    while(_c < '0' || '9' < _c) {if(_c == '-') _f = true; _c = getchar();}
    while('0' <= _c && _c <= '9') {x = (x << 1) + (x << 3) + (_c & 15); _c = getchar();}
    if(_f) x = -x;
}

template < typename T > inline void Min(T &x, T y) {if(y < x) x = y;}
template < typename T > inline void Max(T &x, T y) {if(x < y) x = y;}


#define lowbit(x) ((x) & -(x))
#define lson l,mid,id<<1
#define rson mid+1,r,id<<1|1
#define ls id<<1
#define rs id<<1|1
#define MID(l,r) ((l)+(((r)-(l))>>1))
#define fi first
#define se second
#define mk make_pair
#define pb push_back

const int INF = 0x3f3f3f3f;
const int MOD = (int) 1e9 + 7;
//const int MOD = (int) 998244353;
const int maxn = (int) 2e5 + 20;
const int maxm = (int) 1000000 + 20;
const double pi = (double) acos(-1.0);
const double eps = (double) 1e-8;

inline int sig(double x) {return x < -eps ? -1 : eps < x;}
LL fp(LL a, LL n, LL m = MOD) {LL res = 1; for(; n; n >>= 1, a = a * a % m) if(n & 1) res = res * a % m; return res;}

void work()
{
    int n, m;
    cin >>n >>m;
    puts(n == m ? "Yes" : "No");
}

int main()
{
#ifdef yukihana0416
freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
#endif // yukihana0416
//    get_prime();
    int tc = 1;
//    read(tc);
    for(int ca = 1; ca <= tc; ca++)
    {
//        printf("Case #%d: ", ca);
        work();
    }
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
int main(){
	int N;
	long long A,B,K=0;
	long long X[114514];
	scanf("%d %lld %lld",&N,&A,&B);
	for(int i=1;i<=N;i++){scanf("%lld",&X[i]);}
	for(int i=1;i<N;i++){
		if((X[i+1]-X[i])*A >= B){
			K += B;
		}else{
			K += (X[i+1]-X[i])*A;
		}
	}
	printf("%lld",K);
	return 0;
}

Measured memory_bytes: 896
#include <stdio.h>
int main(void)
{
	int x, y;
	for(int i=1;i<=3000;i++)
	{
		scanf("%d %d", &x, &y);
		if(x==0 && y==0)
		{
			return 0;
		}
		else
		{
			if(x<=y)
			{
				printf("%d %d\n", x, y);
			}
			else
			{
				printf("%d %d\n", y, x);
			}
		}
	}
	return 0;
}

Measured memory_bytes: 2656
#include <stdio.h>
#include <string.h>

int main(void) {
	int n,i,j,k,h,sl,tl,res = 0,f;
	char s[32],t[128];
	scanf("%d%s",&n,s);
	sl = strlen(s);
	for(i = 1;i <= n;i++){
		f = 0;
		scanf("%s",&t);
		tl = strlen(t);
		for(j = 0;j <= tl-sl;j++){
			for(k = 1;1;k++){
				if(j+k*(sl-1) >= tl){break;}
				for(h = 0;h < sl;h++){
					if(t[j+k*h] != s[h]){break;}
					if(h == sl-1){res++;f = 1;}
				}
				if(f){break;}
			}
			if(f){break;}
		}
	}
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 600
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
int min(int a, int b) { return a < b ? a : b; }
int main(){
    int a,b,c,poison;
    scanf("%d %d %d",&a,&b,&c);
    poison=min(a+b+1,c);
    printf("%d",b+poison);
    return 0;
}

Measured memory_bytes: 128
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto H = readln.chomp.to!long;
    long d, x = 1;
    while (H) {
        d += x;
        x *= 2;
        H /= 2;
    }
    writeln(d);
}

Measured memory_bytes: 256
#include<cstdio>
const int maxx=1e5+5;
const int minn=-1e8;
int n,m,a,b,i,h[maxx],re[maxx];
void add(int a,int b)
{
	if(h[a]>h[b])
	{re[a]++;re[b]=minn;}
	else if(h[a]<h[b])
	{re[a]=minn;re[b]++;}
	else
	{re[a]=minn;re[b]=minn;
	}
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
	scanf("%d",&h[i]);
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d",&a,&b);
		add(a,b);
	}
	int sum=0;
	for(int i=1;i<=n;i++)
	if(re[i]>=0) sum++;
	printf("%d",sum);
}

Measured memory_bytes: 4028
// #includes {{{
#ifdef MY_DEBUG
#include "header/header.hpp"
#else
#include <bits/stdc++.h>
#endif

using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define LET(x,a) __typeof(a) x(a)
//#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair

#define EXIST(e,s) ((s).find(e)!=(s).end())

#define RESET(a) memset((a),0,sizeof(a))
#define SET(a) memset((a),-1,sizeof(a))
#define PB push_back
#define DEC(it,command) __typeof(command) it=command

//debug

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)

typedef long long Int;
typedef unsigned long long uInt;
typedef long double rn;

template<class T>
T inf(){
	return numeric_limits<T>::has_infinity?numeric_limits<T>::infinity():(numeric_limits<T>::max()/2);
}

typedef pair<int,int> pii;

#ifdef MY_DEBUG
#include"print.hpp"
#include"debug.hpp"
#endif
// }}}

Int X;
Int A;

void solve(){
	if(X<A)cout<<0<<endl;
	else cout<<10<<endl;
}

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

	cin >> X;
    cin >> A;
	solve();
	return 0;
}

//}}}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1e5 + 10;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll ans = LLONG_MIN;
    ans = max(ans, a * c);
    ans = max(ans, a * d);
    ans = max(ans, b * c);
    ans = max(ans, b * d);
    cout << ans;
}

Measured memory_bytes: 3644
N, M = [int(i) for i in input().split(" ")]
conds = []
for _ in range(M):
    conds.append([int(i) for i in input().split(" ")])

exists = True
A = [None for _ in range(N)]
for s, c in conds:
    idx = s-1
    if A[idx] != None and A[idx] != c:
        exists = False
        break
    A[idx] = c


def check():
    if not exists:
        return [-1]

    if N == 1:
        if A[0] == None:
            return [0]
        else:
            return A
    else:
        if A[0] == 0:
            return [-1]

    for i in range(N):
        if A[i] == None:
            A[i] = -float("infinity")

    base = [1] + [0] * (N-1)
    res = []
    for i in range(N):
        res.append(max(A[i], base[i]))
    return res


print("".join(str(x) for x in check()))


Measured memory_bytes: 38384
#include<stdio.h>
#include<string.h>

int main(void){
    int m, h;
    char cards[256], temp[256], result[256];
    int i, j = 0, len;
    
    while(1){
        scanf("%s", cards);
        len = strlen(cards);
        if(strcmp(cards, "-") == 0 && len == 1) break;
        scanf("%d", &m);
        for(; m > 0; m--){
            scanf("%d", &h);
            strcpy(temp, cards);
            for(i = 0; i < h; i++){
                cards[len - h + i] = temp[i];
            }
            for(i = 0; i < len - h; i++){
                cards[i] = temp[i + h];
            }
        }
        for(i = 0; i < len; i++){
            result[j++] = cards[i];
        }    
        result[j++] = '\n';
            
    }    
    result[j] = '\0';
    printf("%s", result);
    
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> inline T bis(T ok, T ng, function<bool(T)> f, T eps = 1) { while (abs(ok - ng) > eps) { T mi = (ok + ng) / 2; (f(mi) ? ok : ng) = mi; } return ok; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  int H, A;
  cin >> H >> A;
  cout << (H + A - 1) / A << endl;
}


Measured memory_bytes: 256
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)

N = int(input())
c = "a" + input() + "a"

l = 0
r = len(c)-1

count = 0
while True:
    for i in range(1,N+5):
        if l+i == r:
            print(count)
            sys.exit()
        if c[l+i] == "W":
            break

    l = l + i

    for i in range(1,N+5):
        if l == r-i:
            print(count)
            sys.exit()
        if c[r-i] == "R":
            break

    r = r - i

    count += 1



Measured memory_bytes: 75448
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
#define ALL(a)  (a).begin(),(a).end()
const ll INF = 1e18+18;
const ll MAX = 200000;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;



int main(){
    ll N;
    cin>>N;
    vector<ll> A(N);
    map<ll, ll> Q;
  	map<ll, ll> R;
    rep(i, N){
        cin>>A[i];
      	ll AA=i+1-A[i];
        A[i]+=i+1;
      	auto itr=Q.find(A[i]);
      	if(itr==Q.end()){
          	Q.insert(make_pair(A[i], 1));
        }
      	else{
        	Q.at(A[i])++;
        }
      	auto itr2=R.find(AA);
      	if(itr2==R.end()){
          	R.insert(make_pair(AA, 1));
        }
      	else{
        	R.at(AA)++;
        }
    }
    ll Ans=0;
  	for (auto i = Q.begin(); i != Q.end(); ++i) {
      	ll W=i->first;
      	if(R.find(W)==R.end()){
          	continue;
        }
        ll K=i->second;
        ll L=R.at(W);
      	Ans+=K*L;   	
    }
  	cout<<Ans<<endl;
}

Measured memory_bytes: 27880
#include"bits/stdc++.h"
using namespace std;

#define LL long long
#define VLL vector<long long>
	string strnum = "0123456789";
	string alpS = "abcdefghijklmnopqrstuvwxyz";
	string alpL = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	int sizealp = (int)(alpS.size());
	int mod = 1e9 + 7;
#define SORT(x) sort(x.begin(),x.end())
#define REVE(x) reverse(x.begin(),x.end())
#define rep(i,n) for(int i=0;i<n;i++)
#define COUT(x) cout<<x<<endl
	double pai = 3.1415926535;
	string atc = "atcoder";
	typedef pair<long long, long long> data_t;

int main() {
	int A, B, T;
	cin >> A >> B >> T;
	COUT((T / A)*B);
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);

        int H = in.nextInt();
        int W = in.nextInt();

        while (H != 0 && W != 0) {
            for (int i = 0; i < H; i++) {
                if (i == 0 || i + 1 == H) {
                    for (int j = 0; j < W; j++) {
                        System.out.print("#");
                    }
                } else {
                    System.out.print("#");
                    for (int j = 0; j < W - 2; j++) {
                        System.out.print(".");
                    }
                    System.out.print("#");
                }
                System.out.println();
            }
            System.out.println();

            H = in.nextInt();
            W = in.nextInt();
        }
        System.exit(0);
    }
}



Measured memory_bytes: 34648
use std::io::*;
use std::str::FromStr;
 
//Rustの文字列操作、よくわからん
fn main(){
    let mut s : Vec<char> = read::<String>().chars().collect();
    let mut a : String = "".to_string();
    for i in 0..s.len(){
        a = format!{"{}{}", a, if i==3{'8'} else{s[i]}};
    }
    println!("{}", a)    
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

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

int f(char a, char b, char c){
  if(a == b && b == c) return 0;
  if(a != b && b != c && c != a) return 2;
  return 1;
}

int main(void){
  int n;
  string a, b, c;
  cin >> n >> a >> b >> c;
  int ans = 0;
  for(int i = 0; i < n; i++){
    ans += f(a[i], b[i], c[i]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define FAST ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
 
#define MAXX 10005
 
#define PI   3.14159265358979323846264338327950

#define PB push_back 
#define F first
#define S second
 
#define ll 	 long long int

#define mod  1000000007

vector<ll> v[MAXX];

int main()
{
	FAST;
	ll n, h, w;
	cin >> n >> h >> w;
	ll x = 0;
	
	for(ll i = 0; i < n; i++){
		ll a, b;
		cin >> a >> b;
		if(h <= a && w <= b) x++;
	}
	cout << x;
	return 0;
}

Measured memory_bytes: 3844
#include<iostream>
#include<map>
#include<algorithm>
using namespace std;

int main(){
  
  int q, com, x;
  string key, l, r;
  map<string, int> M;
  
  cin >> q;
  for(int i = 0;i < q;i++){
    cin >> com;
    
    if(com == 0){
      cin >> key >> x;
      M[key] = x;
    }else if(com == 1){
      cin >> key;
      cout << M[key] << endl;
      if(M[key] == 0) M.erase(key);
    }else if(com == 2){
      cin >> key;
      M.erase(key);
    }else if(com == 3){
      map<string, int>::iterator itl, itr;
      
      cin >> l >> r;
      itl = M.lower_bound(l);
      itr = M.upper_bound(r);
      
      for(map<string, int>::iterator it = itl;it != itr;it++) cout << it->first << " " << it->second << endl;
    }
  }
  
  return 0;
}


Measured memory_bytes: 27796
h,w = map(int,input().split())
a = [list(input()) for _ in range(h)]
y= 0
while y < h:
    x = 0
    flag = True
    while x < w:
        if a[y][x]=="#":
            flag = False
        x += 1
    if flag == True:
        a.pop(y)
        h -= 1
        y = 0
    else:
    	y += 1
x = 0
while x < w:
    y = 0
    flag = True
    while y < h:
        if a[y][x]=="#":
            flag = False
        y += 1
    if flag == True:
        for i in range(h):
            a[i].pop(x)
        w -= 1
        x = 0
    else:
    	x += 1

for i in a:
    ans = ''.join(i)
    print(ans)

Measured memory_bytes: 40048
from collections import deque

n, c, k = map(int, input().split())
t = [int(input()) for _ in range(n)]

t.sort()

q = deque(t)
cnt = 1
ans = 1
curr = q.popleft()

while q:
    tmp = q.popleft()
    if tmp - curr <= k and cnt < c:
        cnt += 1
    else:
        ans += 1
        cnt = 1
        curr = tmp

print(ans)

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

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

   if ((B - A) % 2 == 0) cout << (B - A) / 2 << endl;
   else cout << min(A - 1, N - B) + 1 + (B - A - 1) / 2 << endl;
 }


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

bool isPrime(int num){
    if(num == 2) return true;
    if(num % 2 == 0) return false;
    for(int i = 3; i * i <= num; i += 2){
        if(num % i == 0) return false;
    }
    return true;
}

int main(){
    int x;
    cin >> x;
    while(!isPrime(x)) x++;
    cout << x << endl;
}

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

#define STRING(str) #str
#define ll long long

template <typename T >
void print_vec_1d(vector<T> x, string name) {
	cout << name << endl;
	cout << "[ ";
	for (int i=0;i<x.size();i++) {
		cout << x[i];
		if (i != x.size()-1) cout << ", ";
		else cout << " ]" << endl;
	}
}

const ll mod = 998244353;

int main() {
	int N, K;
	cin >> N >> K;

	vector<int> L(K), R(K);
	for (int i=0;i<K;i++) {
		cin >> L[i] >> R[i];
	}

	vector<ll> dp(N, 0LL);
	dp[0] = 1LL;

	ll imos_cnt = 0LL;
	for (int i=0;i<N;i++) {
		imos_cnt += dp[i];
		for (int j=0;j<K;j++) {
			if (i+L[j] < N) {
				dp[i+L[j]] = (dp[i+L[j]]+imos_cnt)%mod;
			}
			if (i+R[j]+1 < N) {
				dp[i+R[j]+1] = (dp[i+R[j]+1]-imos_cnt+mod)%mod;
			}
		}
	}
	cout << dp[N-1] << endl;
}

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

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int x, y;
    cin >> x >> y;
    if (((4 * x - y) / 2) >= 0 && ((float)(4 * x - y) / 2) == ((4 * x - y) / 2) && (x - (4 * x - y) / 2) >= 0)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }

    return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    int n;
    cin >> n;
    vector<tuple<ll, ll, ll>> d(n);
    rep(i, n) {
        int a, b;
        cin >> a >> b;
        d[i] = make_tuple(a+b, a, b);
    }
    sort(rall(d));

    ll T = 0, A = 0;
    rep(i, n) {
        if (!(i&1)) T += get<1>(d[i]);
        else A += get<2>(d[i]);
    }
    ll ans = T-A;

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

Measured memory_bytes: 2560
#include <stdio.h>
#include <math.h>

int main( void ) {
	int i, e, ee, y, z, min;


	for ( ; scanf( "%d", &e ), e; printf( "%d\n", min ) ) {
		min = e;
		for ( z = 0; z * z * z <= e; z++ ) {
			ee = e - z * z * z;
			y = sqrt( ee );

			if ( ee - y * y + y + z < min )
				min = ee - y * y + y + z;
		}
	}

	return 0;
}

Measured memory_bytes: 600
parseint(s) = parse(Int,s)

function solve()
    N=parse(Int,readline())
    cnt=0
    for n = 1:N
        D1,D2=map(parseint,split(readline()))
        if D1==D2
            cnt+=1
            if cnt ==3
                println("Yes")
                return
            end
        else
            cnt=0
        end
    end
    println("No")
end

solve()

Measured memory_bytes: 161992
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define YY cout << "Yes" << endl
#define NN cout << "No" << endl
#define pint pair<int,int>
#define vi(v) rep(i,v.size())cin >> v[i]
#define vc(v) rep(i,v.size())cout << v[i] << endl
#define ni(n) cin >> n
#define nc(n) cout << n << endl
const int INF = 1000000007;
const long double EPS = 1e-15;
const long double PI = acos(-1);
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
using Graph_weighted = vector<vector<pair<int,int>>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
int G[1000][1000];
int solve(){
  int n,m,r;
  cin >> n >> m >> r;
  vector<int>v(r);
  rep(i,r){
    cin >> v[i];
    v[i]--;
  }
  sort(all(v));
  rep(i,n)rep(j,n){
    G[i][j] = INF;
    G[j][i] = INF;
  }
  rep(i,m){
    int a,b,c;
    cin >> a >> b >> c;
    a--,b--;
    G[a][b] = c;
    G[b][a] = c;
  }
  rep(k,n)rep(i,n)rep(j,n)G[i][j] = min(G[i][j],G[i][k] + G[k][j]);
  ll ans = INF;
  do{
    ll tmp = 0;
    rep(i,r - 1)tmp += G[v[i]][v[i + 1]];
    ans = min(ans,tmp);
  }while(next_permutation(all(v)));
  cout << ans << endl;
  return 0;
}
int main(){
  // ios::sync_with_stdio(false);cin.tie(nullptr);
  // cout << fixed;cout << setprecision(16);
  solve();
  return 0;
}


Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;

namespace A
{
    internal static class Program
    {
        private static void Main(string[] args)
        {
            var n = Cint();
            Cout(Math.Ceiling((double) n / 2));
        }

        #region Input and Output

        private static readonly List<string> Buffer = new List<string>();

        private static string Cin()
        {
            ReadBuffer();

            var str = Buffer.First();
            Buffer.RemoveAt(0);

            return str;
        }

        private static IEnumerable<string> CinA() => Console.ReadLine()?.Split();
        private static int Cint() => int.Parse(Cin());
        private static int[] CintA() => CinA().Select(int.Parse).ToArray();
        private static void Cout(object obj) => Console.WriteLine(obj);

        private static void ReadBuffer()
        {
            if (Buffer.Any()) return;

            var line = Console.ReadLine();
            if (line != null && line.Contains(' '))
            {
                Buffer.AddRange(line.Split());
            }
            else
            {
                Buffer.Add(line);
            }
        }

        #endregion

        #region Loops

        private static void Loop(int count, Action<int> action) => Loop(0, count, action);

        private static void Loop(int init, int count, Action<int> action, int step = 1)
        {
            for (var i = init; i < count + init; i += step)
            {
                action(i);
            }
        }

        #endregion
    }
}


Measured memory_bytes: 13268
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <map>

using namespace std;
#define MOD 1000000007
#define rint register int
#define gc() getchar()
inline int read(rint ans = 0, rint sgn = ' ', rint ch = gc())
{
	for(; ch < '0' || ch > '9'; sgn = ch, ch = gc());
	for(; ch >='0' && ch <='9';(ans*=10)+=ch-'0', ch = gc());
	return sgn-'-'?ans:-ans;
}
#define BUF_SIZE 1000000
#define _END fwrite(_Ob,1,_O-_Ob,stdout), _O = _Ob
#define Outc(a) (*_O++ = a)
char _Ob[BUF_SIZE+5], *_O = _Ob, _Os[25], *_Ot;
template <typename T> inline void Out(T x)
{
	if(!x){Outc('0'); return;} if(x < 0) Outc('-'), x = -x;
	for(_Ot = _Os; x; *_Ot++ = x%10+'0', x /= 10);
	for(; _Ot != _Os; Outc(*--_Ot)); if(_O-_Ob >= BUF_SIZE-50) _END;
}
int C[4005][4005], f[4005][4005], g[4005][4005], F[4005], G[4005], A, B, N;
int main()
{
	A = read(), B = read(), N = A+B;
	for(rint i = 0, j; i <= N; i++) for(C[i][0] = 1, j = 1; j <= i; C[i][j] = C[i-1][j]+C[i-1][j-1], C[i][j]<MOD?:C[i][j]-=MOD, j++);
	for(rint a = 0; a <= A; f[a][0] = g[a][0] = 1, a++); for(rint b = 0; b <= B; f[0][b] = g[0][b] = 1, b++); F[0] = G[0] = 1;
	for(rint a = 1, b; a <= A; a++)
		for(b = 1; b <= B; f[a][b] = f[a-1][b]+C[b][a], f[a][b]<MOD?:f[a][b]-=MOD, b++);
	for(rint a = 1, b; a <= A; a++)
		for(b = 1; b <= B; g[a][b] = g[a-1][b]+f[a][b-1], g[a][b]<MOD?:g[a][b]-=MOD, b++);
	for(rint a = 1, j; a <= A; a++)
		for(j = 0; j <= a; F[a] = (F[a]+1ll*C[B-1][j]*g[a-j][j])%MOD, j++);
	for(rint a = 1; a <= A; G[a] = G[a-1]+F[a], G[a]<MOD?:G[a]-=MOD, a++);
	printf("%d\n",G[A]); return 0;
}

Measured memory_bytes: 128768
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using i64 = int64_t;
using ll = long long;
int main() {
  ll N;
  cin >> N;
  if(N == 1){
    cout << 0 <<endl;
    return 0;
  }
  ll ans = 0;
  ll mx = ll(sqrt(N) + 1);
  for(int i = 2;i <= mx;i++){
    int count = 0;
    while(N % i==0){
      count ++;
      N /= i;
    }
    int k = 1;
    while(count - k >=0){
      ans ++;
      count -= k;
      k ++;
    }
  }
  if(ans == 0 || N != 1){
    ans ++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3656
from collections import defaultdict

n = int(input())
a = [int(m) for m in input().split()]
n_buka = defaultdict(int)  # 辞書を作成，デフォルトは0
# d = defaultdict(lambda: float("INF"))

for i in range(n - 1):
    n_buka[a[i]] += 1

for i in range(1, n + 1):
    print(n_buka[i])

Measured memory_bytes: 37612
#include<bits/stdc++.h>                                                                        
using namespace std;
int main()
{
  string s;
  cin >> s;
  int first;
  int end;
  for(int i=0; i<s.size(); i++){
    if(s.at(i)=='A'){
      first=i;
      break;
    }
  }
  for(int i=s.size()-1; i>=0; i--){
    if(s.at(i)=='Z'){
      end=i;
      break;
    }
  }
  cout << end-first+1 << endl;
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.next(), b = sc.next();
		int n = Integer.parseInt(a + b);
		sc.close();

		for (int i = 1; i < 100101; i++) {
			if (i * i == n) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(),(x).end()

using namespace std;
const int M = 1e5+1000;

int n, m, Q, p, comp[M];
int st[M], ft[M];
vector <int> adj[M], topol;

bool mark[M];

void dfs(int v)
{
    mark[v] = 1;
    for(int e : adj[v]) if(st[e]==v && !mark[ft[e]]){
        dfs(ft[e]);
    }
    topol.pb(v);
}

void dfs2(int v)
{
    comp[v] = p;
    for(int e : adj[v]) if(st[e]==v && !comp[ft[e]]){
        dfs2(ft[e]);
    }
}

int main()
{
    scanf("%d %d", &n, &m);
    for(int i = 0; i < m; i++){
        scanf("%d %d", st+i, ft+i);
        adj[st[i]].pb(i), adj[ft[i]].pb(i);
    }

    for(int i=0; i<n; i++) if(!mark[i])
        dfs(i);
    for(int i = 0; i < m; i++)
        swap(st[i], ft[i]);
    for(int i = n-1; ~i; i--)
        if(!comp[topol[i]]) ++p, dfs2(topol[i]);

    scanf("%d", &Q);
    while(Q--)
    {
        int u, v;
        scanf("%d %d", &u, &v);
        printf("%d\n", comp[u]==comp[v]?1:0);
    }
    return 0;
}



Measured memory_bytes: 6736
// AtCoder Beginners Contest
// B - Easy Linear Programming

#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <functional>
#include <random>
#include <vector>

using namespace std;

int main()
{
	long long int A,B,C,K,i,j,k,sum,maximum;

    cin >> A >> B >> C >> K;
	maximum = 0;
	
	// 制約確認
	if (A < 0)  {
        cout << "Aは条件を満たしていません!\n";
        return 0;
    }

	if (B < 0)  {
        cout << "Bは条件を満たしていません!\n";
        return 0;
    }

	if (C < 0)  {
        cout << "Cは条件を満たしていません!\n";
        return 0;
    }

	if (A+B+C < 0 || 2000000000 < A+B+C )  {
        cout << "A+B+Cは条件を満たしていません!\n";
        return 0;
    }

	if (K < 1 || K > A+B+C)  {
        cout << "Kは条件を満たしていません!\n";
        return 0;
    }
	//計算
	i = min(A,K);
	K -= i;
	j = min(B,K);
	K -= j;
	k = K;
	maximum = i - k;
	cout << maximum << endl;
}


Measured memory_bytes: 3648
#include<iostream>
using namespace std;
int main() {
	int N,M,A[10001],i,sum=0;
	cin >> N >> M;
	for (i = 0; i < M; i++) {
		cin >> A[i];
		sum += A[i];
	}
	if (sum > N) cout << -1 << endl;
	else cout << N - sum << endl;
}

Measured memory_bytes: 3676
let prim a n =
  let d = Array.make n max_int in
  d.(0) <- 0;
  let reached_p = Array.make n false in
  let z = Array.make n (-1) in
  let rec doit () =
    let u =
      Array.fold_left (fun (i, m, u) e ->
        if not reached_p.(i) && m > e then (i + 1, e, i) else (i + 1, m, u))
        (0, max_int, (-1)) d
      |> (fun (_, _, u) -> u) in
    if u = (-1) then ()
    else begin
      reached_p.(u) <- true;
      for j = 0 to n - 1 do
        if a.(u).(j) <> (-1) && not reached_p.(j) && d.(j) > a.(u).(j) then begin
          d.(j) <- a.(u).(j);
          z.(j) <- u;
        end
      done;
      doit ()
    end in
  doit ();
  Array.fold_left (fun (i, sum) j ->
    (i + 1, if j = (-1) then sum else sum + a.(i).(j)))
    (0, 0) z
  |> snd

let () =
  let n = read_int () in
  let a = Array.make_matrix n n max_int in
  for i = 0 to n - 1 do
    for j = 0 to n - 1 do
      a.(i).(j) <- Scanf.scanf " %d" (fun x -> x);
    done
  done;
  prim a n |> Printf.printf "%d\n"

Measured memory_bytes: 4480
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>
#define ll long long
#define ull unsigned long long
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define FOR(i,start,stop)  for(int i=(start); i < (stop); i++)
#define FORD(i,start,stop) for(int i=(start); i >= (stop); i--)
#define RIP(i,stop) FOR(i,0,stop)
#define PI 3.141592653589793
#define PRECISION(c,f) fixed << setprecision(c) << f
using namespace std;

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

  string E;
  E = S[S.size()-1];

  if(E != "s") cout << S << "s" << endl;
  else cout << S << "es" << endl;


  return 0;
}


Measured memory_bytes: 3640