akhauriyash/Code-Regression huggingface dataset:
//بسم الله الرحمن الرحيم
//* In The Name 0f ALLAH *//* The Most Beneficent *//* The Most Merciful *//*
#include<bits/stdc++.h>
using namespace std;
#define el << endl
typedef long int li;
typedef long long ll;
#define inf 1e9+123
#define tc int T; cin>>T; while(T--)
#define GOOD_BYE return 0;
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define file() freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout)
const int mx = 1e5+123;
const ll MAX = 1e9+5;
//......TEMPLATE TERMINATES HERE......*//*......LET'S BEGIN (-_^)......//
int n,h[mx];
int dp[mx];
int frog(int i){

    if(i>=n) return 0;
    if(dp[i]!=-1) return dp[i];
    int r1=inf,r2=inf;
    if(i+1<=n) r1=abs(h[i]-h[i+1])+frog(i+1);
    if(i+2<=n) r2=abs(h[i]-h[i+2]) +frog(i+2);

    return dp[i]=min(r1,r2);

}

void fn(){

    memset(dp,-1,sizeof(dp));
    cin >> n;
    for(int i=1;i<=n;++i)
        cin >> h[i];
    cout << frog(1) el;
}

int main(){

    //file();
    optimize();
    //tc
        fn();

    GOOD_BYE
}

///////////*  N A Y E M  *///////////

Measured memory_bytes: 9048
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s1,s2;
    cin>>s1>>s2;
    if(s2.length()==s1.length()+1)
    {
        int flag=0;
        for(int i=0;i<s1.length();i++)
        {
            if(s1[i]!=s2[i])
            {
                flag=1;
                break;
            }
        }
        if(flag!=1)
        {
            cout<<"Yes"<<endl;
        }
        else
        {
            cout<<"No"<<endl;
        }
    }
    else
    {
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3628
#include<iostream>
using namespace std;
int H,t[50][6];
int main(){
  while(1){
    cin>>H;
    if(H==0)break;
    for(int i=H-1;i>=0;i--){
      for(int j=0;j<5;j++)cin>>t[i][j];
    }
    int ans=0;
    while(1){
      int tmp=ans;
      for(int i=0;i<H;i++){
	int key=t[i][0],cnt=1;
	t[i][5]=-1;
	for(int j=1;j<6;j++){
	  if(key==t[i][j])cnt++;
	  else{
	    if(cnt>=3&&key!=0)
	      for(int k=0;k<cnt;k++){
		ans+=key;
		t[i][j-k-1]=0;
	      }
	    cnt=1;
	    key=t[i][j];
	  }
	}
      }
      if(tmp==ans)break;
      for(int j=0;j<5;j++){
	int I=0;
	for(int i=0;i<H;i++){
	  if(t[i][j]==0)continue;
	  t[I][j]=t[i][j];
	  I++;
	}
	while(I<H)t[I++][j]=0;
      }
    }
    cout<<ans<<endl;
  }
}

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

using ll = long long;

int main() {
	ll X, Y, Z;
	int K;
	cin >> X >> Y >> Z >> K;
	vector<ll> A(X), B(Y), C(Z);
	for(int i = 0; i < X; ++i) cin >> A[i];
	for(int i = 0; i < Y; ++i) cin >> B[i];
	for(int i = 0; i < Z; ++i) cin >> C[i];
	
	priority_queue<ll, vector<ll> > que;
	for(const auto &a : A) {
		for(const auto &b : B) {
			que.push(a + b);
		}
	}
	
	int k = K;
	vector<ll> ans;
	while(k-- && !que.empty()) {
		ll g = que.top(); que.pop();
		for(const auto &c : C) {
			ans.push_back(g + c);
		}
	}
	sort(ans.begin(), ans.end(), greater<ll>());
	
	for(int i = 0; i < K; ++i) {
		cout << ans[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 43112
#!/usr/bin/env python3

n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))

ini = a1[0]+sum(a2)
ans = ini
for i in range(1, n):
    s = ini - a2[i-1] + a1[i]
    if s >= ans:
        ans = s
    ini = s

print(ans)

Measured memory_bytes: 9088
#include <stdio.h>
using namespace std;
/*
Author : Aditya Mishra 
 */
int main()
{
    //freopen("test.txt","r",stdin);
    char s[3];
    for(long long int i=0;i<3;i++)
        scanf("%c",&s[i]);
    int c=0;
    for(long long int j=0;j<3;j++)
    {
        if(s[j]=='R') c++;
    }
    if(c==3) printf("3");
    else if(c==0) printf("0");
    else if(c==1) printf("1");
    else
    {
        if((s[0]==s[1])||(s[1]==s[2])) printf("2");
        else printf("1");
    }
    
    return 0;
}

Measured memory_bytes: 3116
#include <iostream>
 
int main(void){
	int M_1, D_1, M_2, D_2;
	std::cin >> M_1 >> D_1 >> M_2 >> D_2;
  
  	std::cout << (int)(D_2 - D_1 != 1) << "\n";
  	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#define pi 3.14159265358979

int main(void) {
  int a, b, h, m;
  scanf("%d%d%d%d", &a, &b, &h, &m);
  double hd, md;
  hd = (h / 6.0 + m / 360.0) * pi;
  md = m * pi / 30.0;
  printf("%.12f", sqrt(a * a + b * b - 2 * a * b * cos(hd - md)));
  return 0;
}

Measured memory_bytes: 2600
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!

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

#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

using ll = int64_t; using vll = vector<ll>; using vvll = vector<vll>;
using pll = pair<ll, ll>; using vpll = vector<pll>; using vvpll = vector<vpll>;

// ------------------------------------------------------------------------------------------------

void func() {
    ll r; cin >> r;
    cout << 3 * r * r << endl;
}

int main() {
    fast_io; cout.precision(32);
    ll t = 1; // cin >> t;
    for (ll i = 1; i <= t; i++) {
        func();
    }
}


Measured memory_bytes: 256
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;
const long nPrime = 1000000007;
long Factorial(const long &n){
    //nPrime = 1000000007;
    long nReturn = 1;
    for(long i = 2; i <= n; i++){
        nReturn *= i;
        nReturn %= nPrime;
    }
    return nReturn;
}

long Inverse(const long &n){
    //nPrime = 1000000007;
    if (n % nPrime == 0){
        return 0;
    }
    long a = n, b = nPrime, u = 1, v = 0;
    while (b > 0) {
        long t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= nPrime;
    if (u < 0){
        u += nPrime;
    }
    return u;    
}

long Combination(const long &n, const long &k){
    //nPrime = 1000000007;
    long nCk = Factorial(n - k) * Factorial(k);
    nCk %= nPrime;
    nCk = Factorial(n) * Inverse(nCk);
    nCk %= nPrime;
    return nCk;
}

int main(){
    long n,k;
    scanf("%ld %ld", &n, &k);
    vector<long> viNum(n);
    for(long i = 0; i < n; i++){
        scanf("%ld", &viNum[i]);
    }
    
    sort(viNum.begin(), viNum.end());
    
    long nAns = 0;
    long nComb = Combination(n, k-1);
    for(long i = 1; i <= n-k+1; i++){
        nComb *= Inverse(n-i+1);
        nComb %= nPrime;
        nComb *= (n-i-k+2);
        nComb %= nPrime;
        nAns += (viNum[n-i] - viNum[i-1]) * nComb;
        nAns %= nPrime;
    }
    if(nAns < 0){
        nAns += nPrime;
    }
    
    printf("%ld", nAns);
    return 0;
}


Measured memory_bytes: 3644
#include <stdio.h>
int main(void){
    int a, b, c, i, flag;
    scanf("%d%d", &a, &b);
    if(b < 10){
        c = a * 10 + b;
    }else if(b < 100){
        c = a * 100 + b;
    }else{
        c = a * 1000 + b;
    }
    //printf("%d", c);
    flag = 0;
    for(i = 1; i <= 400; i++){
        if(c == i * i){
            flag = 1;
            //printf("あった");
        }     
        
    }
    if(flag == 1){
        printf("Yes");
    }else{
        printf("No");
    }
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    long long x,n,a[200],i,j,k,s=0,p,q,r,l;
    cin>>x>>n;
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    for(j=x;j>=x;j++)
    {
        s=0;
        for(i=1;i<=n;i++)
        {
            if(j==a[i])
            {
                s++;
            }
        }
        if(s==0)
        {
            p=j;
            break;
        }
    }
    for(k=x;k<=x;k--)
    {
        s=0;
        for(i=1;i<=n;i++)
        {
            if(k==a[i])
            {
                s++;
            }
        }
        if(s==0)
        {
            q=k;
            break;
        }
    }
    r=p-x;
    l=x-q;
    if(r<l)
    {
        cout<<p<<endl;
    }
    else
    {
        cout<<q<<endl;
    }
    return 0;
}

Measured memory_bytes: 3564
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  map<char,int>ma;
  string S;
  cin>>S;
  rep(i,S.length())ma[S[i]]++;
  if(ma.size()==1){cout<<S.length()<<endl<<1<<endl;return 0;}
  vector<int>A(S.length());
  int c = 0;
  for (int i = 1; i < S.size(); i++){
    if (i+A[i-c] < c+A[c]) {
      A[i] = A[i-c];
    } else {
      int j = max(0, c+A[c]-i);
      while (i+j < S.size() && S[j] == S[i+j]) ++j;
      A[i] = j;
      c = i;
    }
  }
  A[0]=S.length();
  vector<bool>G(S.length()+1,0);
  for (int i = 1; i <= S.length(); i++) { G[i] = true; }
  for (int p = 1; p < S.length(); p++)
  {
    if (G[p] == false) { continue; }
    for (int k = 2; (k - 1) * p <= A[p]; k++) { G[k * p] = false;}
  }
  if(G[S.length()]==1){cout<<1<<endl<<1<<endl;return 0;}

  int l=S.size();
  reverse(all(S));
  c = 0;
  fill(all(A),0);
  for (int i = 1; i < S.size(); i++){
    if (i+A[i-c] < c+A[c]) {
      A[i] = A[i-c];
    } else {
      int j = max(0, c+A[c]-i);
      while (i+j < S.size() && S[j] == S[i+j]) ++j;
      A[i] = j;
      c = i;
    }
  }
  A[0]=S.length();
  for (int p = 1; p < S.length(); p++)
  {
    if (G[p] == false) { continue; }
    for (int k = 2; (k - 1) * p <= A[p]; k++) { G[l-k * p] = false;}
  }




  int cnt=0;
  for(auto i:G){cnt+=i;}
  cout<<2<<endl<<cnt<<endl;




  return 0;

}


Measured memory_bytes: 2844
n = int(input())
A = [int(input()) for a in range(n) ]
minA = A[0]
maxsa = A[1] - A[0]
for i in range(1, n):
    s = A[i] - minA
    minA = min(minA, A[i])
    maxsa = max(maxsa, s)

print(maxsa)


Measured memory_bytes: 13592
#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;

const int N = 1e6 + 10;
typedef long long ll;

int main()
{
//	freopen("input.txt", "r", stdin);
	//提交时注释，调试时取消注释！！！ 
	int n;
	cin>>n; 
	map<string,ll> mp;
	string str[N];
	for(int i=0;i<n;i++)
	{
		cin>>str[i];
		sort(str[i].begin(),str[i].end());
		mp[str[i]]++;
	}
	ll ans=0;
	for(auto m:mp)
	{
		ans+=m.second*(m.second-1)/2;
	}
	cout<<ans;
	
	return 0;
}

Measured memory_bytes: 25216
from sys import stdin


def main(inp1, inp2):
    n, k = [int(i) for i in inp1.split(sep=' ')]
    h_list = sorted([int(i) for i in inp2.split(sep=' ')])

    num_enemy = n
    enable_special = k

    if enable_special >= num_enemy:
        return 0
    elif enable_special == 0:
        return sum(h_list)
    else:
        return sum(h_list[:-enable_special])


if __name__ == '__main__':
    input1 = stdin.readline().rstrip()
    input2 = stdin.readline().rstrip()
    ret = main(input1, input2)
    print(ret)

Measured memory_bytes: 27952
#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 10, M=2e6;
const int NB = 31;
typedef long long ll;
const ll mod = (1e9 + 7);
int n,a[N],b[N],cnt=1,g[M][2],fail[M],val[N],track[N][NB];
void newtrie() { cnt = 0; g[0][0] = g[0][1] = val[0] = -1; }
int newnode() { ++cnt; g[cnt][0] = g[cnt][1] = val[cnt] = -1; return cnt; }
void addstr(const string& s, int vval) {
	int cur = 0;
	for (char x : s) {
		int lnk = (x == '0' ? 0 : 1);
		if (g[cur][lnk] == -1)
			g[cur][lnk] = newnode();
		cur = g[cur][lnk];
	}
	val[cur] = vval;
}
void mklink() {
	queue<int> q;
	for (int i=0; i<2; ++i)
		if (g[0][i] != -1) {
			fail[g[0][i]] = 0;
			q.push(g[0][i]);
		}
	while (!q.empty()) {
		int s = q.front(); q.pop();
		for (int i=0; i<2; ++i)
			if (g[s][i] != -1) {
				int state = fail[s];
				while (state > 0 && g[state][i] == -1) state = fail[state];
				state = (g[state][i] == -1 ? state : g[state][i]);
				fail[g[s][i]] = state;
				q.push(g[s][i]);
			}
	}
}
void aho(string text, vector<int> &x0, vector<int> &x1) {
	x0.clear(); x1.clear();
	for (int i = 0; i < n - 1; ++i) text += text[i];
	int cur = 0, i=0;
	for (char x : text) {
		++i;
		int v = (x == '0' ? 0 : 1);
		while (cur > 0 && g[cur][v] == -1) cur = fail[cur];
		cur = (g[cur][v] == -1 ? cur : g[cur][v]);
		if (val[cur] == 0) x0.push_back(i - n);
		if (val[cur] == 1) x1.push_back(i - n);
	}
}
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> n; for (int i = 0; i < n; ++i) cin >> a[i]; for (int i = 0; i < n; ++i) cin >> b[i];
	for (int i = 0; i < n; ++i) fill(track[i], track[i] + NB, -1);
	for (int k = 0; k < NB; ++k) {
		string A, B, nB;
		for (int i = 0; i < n; ++i) {
			A += ((a[i] & (1 << k)) ? '1' : '0');
			B += ((b[i] & (1 << k)) ? '1' : '0');
			nB += ((b[i] & (1 << k)) ? '0' : '1');
		}
		newtrie();
		addstr(B, 0); addstr(nB, 1);
		mklink();
		vector<int> x0, x1;
		aho(A, x0, x1);
		for (int x : x0)
			track[x][k] = 0;
		for (int x : x1)
			track[x][k] = 1;
	}
	for (int k = 0; k < n; ++k) {
		bool emotional = true;
		for (int j=0; j<NB; ++j) 
			if (track[k][j] == -1) {
				emotional = false;
				break;
			}
		if (emotional) {
			int x = 0;
			for (int j = 0; j < NB; ++j)
				if (track[k][j])
					x |= (1 << j);
			cout << k << " " << x << endl;
		}
	}
}

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

int main()
{
  int n;
  cin >> n;
  vector<int> a(n);
  int i;
  int pat = 1;
  int sub = 1;
  for(i = 0; i < n; i++)
  {
    cin >> a.at(i);
    pat *= 3;
    if(a.at(i)%2 == 0)sub *= 2;
  }
  cout << pat - sub << endl;
}

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

int main() {
    long long N;
    cin >> N;
    string str = to_string(N);
    long ans = 0;
    for (int i = str.length() - 1; i > 0; i--) {
        if (str[i] != '9') {
            for (int j = 1; j <= i; j++) {
                if (str[i - j] != '0') {
                    str[i - j] -= 1;
                    break;
                } else {
                    str[i - j] = '9';
                }
            }
        }
        ans += 9;
    }
    ans += str[0] - '0';
    cout << ans << endl;

    return 0;
}

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

int main() {
	string s;
	while (cin >> s) {
		if (s == "#")break;

		string right = "yuiophjklnm";
		int ans = 0;
		int now=2;

		for (int i = 0;i < s.size();i++) {
			int a;
			size_t za = right.find(s[i]);
			if(za!=string::npos){
				a = 1;
			}
			else {
				a = 0;
			}

			if (now == 2)now = a;
			else if (now != a) {
				now = a;
				ans++;
			}

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

Measured memory_bytes: 3164
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline


def main():
    n, k = map(int, input().split())

    l = [[None, None] for i in range(n)]
    for i in range(n):
        a, b = map(int, input().split())
        l[i][0] = a
        l[i][1] = b

    l.sort()

    count = 0
    for index in range(n):
        count += l[index][1]

        if count >= k:
            break

    print(l[index][0])


if __name__ == '__main__':
    main()


Measured memory_bytes: 20036
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    A, V = map(int, readline().split())
    B, W = map(int, readline().split())
    T = int(readline())
    if A>B:
        a = A - V*T
        b = B - W*T
        if a<=b:
            print('YES')
        else:
            print('NO')
    else:
        a = A + V*T
        b = B + W*T
        if a>=b:
            print('YES')
        else:
            print('NO')

if __name__ == '__main__':
    main()

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

int max(int a, int b)
{
  return a > b ? a : b ;
}

int main()
{
  char s[11];
  int i,count=0,ans=0;

  scanf("%s", s);

  for(i=0; i<strlen(s); i++){
    if(s[i] == 'A' || s[i] == 'T' || s[i] == 'G' || s[i] == 'C')
      count++;
    else{
      ans = max(ans,count);
      count = 0;
    }
  }
    ans = max(ans,count);

    printf("%d", ans);
    return 0;
 }


Measured memory_bytes: 1712
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define S 1000001
#define M 1000000007
#define newline cout<<"\n";
#define error  cout<<"\n***********\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test lli t;  cin>>t; while(t--)
lli arr[S];
int main()
{
int h,a;
cin>>h>>a;
double temp=(h*1.0)/(a*1.0);
if(temp==0)
cout<<"1";
else
{
 temp=ceil(temp) ;
 cout<<temp;
}
}


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

int gcd(int a,int b)
{
	if(b == 0) return a;
	return gcd(b,a%b);
}
int main()
{
	int a,b;cin >> a >> b;
	cout << gcd(a,b) << endl;
	return 0;
}


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


typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;

typedef set<int>::iterator sit;
typedef map<int, int>::iterator mit;
typedef vector<int>::iterator vit;

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;

#define _  %  MOD
#define __ %= MOD

#define      each(it,s)        for(auto it = s.begin(); it != s.end(); ++it)
#define      sortA(v)          sort(v.begin(), v.end())
#define      sortD(v)          sort(v.begin(), v.end(), greater<auto>())
#define      fill(a)           memset(a, 0, sizeof (a))

#define      swap(a,b)        {a=a+b;b=a-b;a=a-b;}
#define      rep(i, n)         for(ll i = 0; i < (n); ++i)
#define      repA(i, a, n)     for(ll i = a; i <= (n); ++i)
#define      repD(i, a, n)     for(ll i = a; i >= (n); --i)
#define watch(x) cout << (#x) << " is " << (x) <<endl

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define fbo find_by_order
#define ook order_of_key

#define pv(a)	{rep(i,a.size())	cout<<a[i]<<" "; cout<<endl;}
#define mark(v)	cout<<"Here--"<<v<<endl;

const double EPS = (1e-7);
int dcmp(double x, double y) {	return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1;	}

ll gcd(ll a, ll b) {if (b == 0) return a; else return gcd(b, a % b);}
ll power(ll x, ll y) {ll res = 1; while (y > 0) {if (y & 1) res = res * x; y = y >> 1; x = x * x;} return res;} // modular exponent

int main()
{
	ios_base::sync_with_stdio(false); // don't use printf and scanf
	cin.tie(NULL); // cout<<fixed<<setprecision
	ll x; cin>>x;
	if(x==1){
		cout<<0<<endl;
	}
	else if(x==0){
		cout<<1<<endl;
	}
	return 0;
}

Measured memory_bytes: 3648
//#include <bits/stdc++.h>
//#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <bitset>
#include <algorithm>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <string>
#include <string.h>
#include <cmath>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <cctype>
#include <fstream>

#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define LFOR(i, a, b) for (long long int i = (a); i <= (b); i++)
#define LRFOR(i, a, b) for (long long int i = (a); i >= (b); i--)
#define MOD 1000000007
#define INF 1000000000			 //2000000000
#define LINF 1000000000000000000 //9000000000000000000
#define DINF 1000000000000000.0
#define PI 3.14159265358979
#define MAXI 7500000

//.size()はunsigned int　0-1をするとオーバーフローする

using namespace std;
typedef long long int ll;
typedef pair<long long int  ,long long int> P;

//int dy[5] = { 0,0,1,-1,0 };
//int dx[5] = { 1,-1,0,0,0 };

int dy[5] = {-1, 0, 1, 0, 0};
int dx[5] = {0, -1, 0, 1, 0};


int main(void)
{
	long long int n;
	long long int a, b;
	vector<long long int> dp(100002, 0);
	int maxi = -1;

	cin >> n;
	FOR(i,1,n){
		cin >> a >> b;
		dp[a]++;
		dp[b + 1]--;
	}
	FOR(i,1,100001){
		dp[i] += dp[i - 1];
	}


	FOR(i, 1, 100001)
	{
		if(dp[i]+1>=i){
			maxi = i - 1;
		}
	}

	cout << maxi << endl;
}



Measured memory_bytes: 3448
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a)-1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a)-1; (i) >= (b); (i)--)
#define PI acos(-1.0)
#define DEBUG(C) cout<< C <<endl;
#define VI vector <int>
#define VII vector <VI>
#define VL vector <LL>
#define VLL vector <VL>
#define VD vector <double>
#define VDD vector <VD>
#define PII pair <int, int>
#define PDD pair <double, double>
#define PLL pair <LL, LL>
#define VPII vector <PII>
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define REVERSE(a) reverse(ALL(a))
#define MP make_pair
#define FORE(a,b) for (auto &&a:b)

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int INF = 1e9;
const int MOD = INF + 7;

char cc[] = "abc";

int main(void) {
    map <char, string> mp;
    REP(i, 3) {
        string s; cin >> s;
        mp[cc[i]] = s;
    }
    //FORE(el, mp){cout << el.first << " " << el.second << endl;}
    char turn = 'a';
    while(mp[turn].size()) {
        string sbuf = mp[turn];
        char buf = sbuf[0];
        sbuf.erase(sbuf.begin());
        mp[turn] = sbuf;
        turn = buf;
    }
    cout << char(turn - 32) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int size=1e5;
const int inf=1e9;
int main(){
	int a,b,c; cin>>a>>b>>c;
    cout<<max({a,b,c}) - min({a,b,c})<<endl;
}

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

int main()
{
  set<string> s;
  int n;
  string order, str;
  cin >> n;

  for (int i = 0; i < n; i++)
  {
    cin >> order >> str;
    if (order == "insert")
      s.insert(str);
    else if (s.find(str) != s.end())
      printf("yes\n");
    else
      printf("no\n");
  }
  return 0;
}

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

struct LowestCommonAncestor{
  ll n,h;
  vector< vector<ll> > G,par;
  vector<ll> dep;
  LowestCommonAncestor(){}
  LowestCommonAncestor(ll n):n(n),G(n),dep(n){
    h=1;
    while((1<<h)<=n) h++;
    par.assign(h,vector<ll>(n,-1));
  }

  void add_edge(ll u,ll v){
    G[u].emplace_back(v);
    G[v].emplace_back(u);
  }

  void dfs(ll v,ll p,ll d){
    par[0][v]=p;
    dep[v]=d;
    for(ll u:G[v])
      if(u!=p) dfs(u,v,d+1);
  }

  void build(ll r=0){
    dfs(r,-1,0);
    for(ll k=0;k+1<h;k++)
      for(ll v=0;v<n;v++)
        if(~par[k][v])
          par[k+1][v]=par[k][par[k][v]];
  }

  ll lca(ll u,ll v){
    if(dep[u]>dep[v]) swap(u,v);
    for(ll k=0;k<h;k++)
      if((dep[v]-dep[u])>>k&1)
        v=par[k][v];

    if(u==v) return u;

    for(ll k=h-1;k>=0;k--)
      if(par[k][u]!=par[k][v])
        u=par[k][u],v=par[k][v];

    return par[0][u];
  }

  ll distance(ll u,ll v){
    return dep[u]+dep[v]-dep[lca(u,v)]*2;
  }
};

int main() {
  ll n;
  cin >> n;
  LowestCommonAncestor lca(n);
  for(ll i=0;i<n;i++) {
    ll k;
    cin >> k;
    for(ll j=0;j<k;j++) {
      ll c;
      cin >> c;
      lca.add_edge(i,c);
    }
  }
  lca.build();
  ll q;
  cin >> q;
  for(ll i=0;i<q;i++) {
    ll f,t;
    cin >> f >> t;
    cout << lca.lca(f,t) << endl;
  }
}


Measured memory_bytes: 25880
#include <vector>
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <set>
using namespace std;
//int n;
//int a[100020];
//int b[100020];
const int N = 1e6;
bool ok[N];
void bad() {
    cout << "-1\n";
    exit(0);
}
vector<int> ed[N];
vector<pair<int, int> > ans;
int main() {
    ios_base::sync_with_stdio(0);
    /*cin >> n;
    int mx = -1, nm = 0;
    for (int i = 1; i <= n; i++) {
        int x, y;
        cin >> x >> y; a[i] = x; b[i] = y;
        if (abs(x) + abs(y) > mx) {
            mx = abs(x) + abs(y);
            nm = i;
        }
    }*/
    string w;
    cin >> w;
    int n = w.size();
    for (int i = 1; i <= n; i++) ok[i] = w[i - 1] - '0';
    for (int i = 1; i <= n; i++)
        if (ok[i] ^ ok[n - i] == 1) bad();
    if (ok[1] == 0) bad();
    ed[n].push_back(1);
    int cnt = 1;
    set<int> s;
    for (int i = 1; i <= n; i++)
        if (ok[i]) s.insert(i);
    for (int i = n; i >= 1; i--) {
        if (ed[i].size() > 0) {
            int cur = i - 1;
            while (cur > 0) {
                auto it = s.upper_bound(cur);
                if (it == s.begin()) bad();
                it--;
                cur -= *it;
                for (auto v: ed[i]) {
                    cnt++;
                    ans.push_back(make_pair(v, cnt));
                    ed[*it].push_back(cnt);
                }
            }
        }
    }
    for (int i = 1; i < n; i++) {
        if (ok[i] == 0 && ed[i].size() > 0) bad();
        if (ok[i] == 1 && ed[i].size() == 0) bad();
    }

    for (auto it: ans) cout << it.first << " " << it.second << "\n";

    return 0;
}

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

int main() {
    int x[3];
    int ans = 0, y;

    cin >> x[0] >> x[1] >> x[2];

    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            if (i == j)
                continue;
            for (int k = 0; k < 3; k++) {
                if (j == k || k == i)
                    continue;

                y = (x[i] * 10 + x[j]) + x[k];
                ans = max(y, ans);

                y = x[i] + (x[j] * 10 + x[k]);
                ans = max(y, ans);
            }
        }
    }

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


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){

	int t,sum,s,f,n;

	while(true){
		cin >> t;
		if(t == 0)break;

		cin >> n;

		sum = 0;

		for(int i = 0; i < n; i++){
			cin >> s >> f;
			sum += f-s;
		}

		if(sum >= t){
			cout << "OK" << endl;
		}else{
			cout << t-sum << endl;
		}

	}


    return 0;
}


Measured memory_bytes: 3092
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

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

    vector<int> index(m, -1);
    vector<int> cnt(m, 0);
    vector<int> v;
    for(int i=q-1; i>=0; --i){
        if(index[a[i]] == -1){
            index[a[i]] = v.size();
            v.push_back(a[i]);
        }
        int j = index[a[i]];
        if(j == 0 || cnt[v[j]] < cnt[v[j-1]])
            ++ cnt[a[i]];
    }

    unsigned i = 0;
    while(i < v.size() && cnt[v[i]] >= n)
        ++ i;

    int j = 0;
    while(i < v.size()){
        while(j < m && cnt[j] >= n)
            ++ j;
        if(v[i] != j){
            cout << "No" << endl;
            return 0;
        }
        ++ i;
        ++ j;
    }

    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 2172
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			Question.Exec();
		}
	}

	public static class Question
	{
		public static void Exec()
		{
			var array = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
			int a = array[0];
			int b = array[1];
			double x = ((double)a + b) / 2.0;
			Console.WriteLine($"{(int)Math.Ceiling(x)}");

			Console.ReadKey();
		}
	}
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

signed main(){
	int a,b,c;
	cin >> a >> b >> c;
	cout << max(0ll,c - (a - b)) << endl;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
kosuu=[0]+[1]*n
haitteru=[0]+[1]+[0]*(n-1)
for _ in range(m):
    x,y=map(int,input().split())
    if haitteru[x]==1:
        kosuu[x]-=1
        kosuu[y]+=1
        haitteru[y]=1
        if kosuu[x]==0:
            haitteru[x]=0
    else:
        kosuu[x]-=1
        kosuu[y]+=1
print(haitteru.count(1))


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

using namespace std;

int a, b;

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

	cin >> a >> b;

	for (int i = 1; i < 1251; ++i) {
		int t1 = (i * 8) / 100, t2 = i / 10;

		if (t1 == a && t2 == b)
			return cout << i, 0;
	}

	cout << -1;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.math.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class Main{
    static long mod=1000000007;
    // static int dx[]={1,-1,0,0};
    // static int dy[]={0,0,1,-1};
    // static int dx[]={1,-1,0,0,1,1,-1,-1};
    // static int dy[]={0,0,1,-1,1,-1,1,-1};
    // PriorityQueue<Integer> que = new PriorityQueue<Integer>(); 
    //HashMap<Integer,Integer> map = new HashMap<Integer,Integer>();
    //ArrayList<Integer> lis = new ArrayList<Integer>();
    public  static void main(String[] args)   throws Exception, IOException{
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

        int n=sc.nextInt();
        int m=sc.nextInt();
        long d[][]=new long[2][n];
        d[sc.nextInt()%2][0]++;
        d[0][0]+=1;
        for( int i=1; i<n; i++ ){
            int r=sc.nextInt()%2,q=(r+1)%2;
            d[0][i]=d[0][i-1] + d[0][i-1]*q + d[1][i-1]*r;
            d[1][i]=d[1][i-1] + d[0][i-1]*r + d[1][i-1]*q;
        }
        out.println(d[m][n-1]);       
        out.flush();
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }

    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }
     
    static boolean bit(long x,int k){
        // weather k-th bit (from right) be one or zero
        return  ( 0 < ( (x>>k) & 1 )  )  ? true:false;
    }
}

class XY {
    int x,y,d;
    XY(int x, int y, int d) {
        this.x=x;
        this.y=y;
        this.d=d;
    } 
}

class P implements Comparable<P>{
    int diff,id1,id2;
    P(int diff, int id1,int id2) {
        this.diff=diff;
        this.id1=id1;
        this.id2=id2;
    } 
      
    public int compareTo(P p){
        return diff - p.diff;
    } 
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}

Measured memory_bytes: 25172
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
#define PI 3.1415926535897932384626433
#define mod 1000000007
 
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
 
int lcm(int a, int b) { return a * b / gcd(a, b); }
 
int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if (c - (a - b) <= 0)
    {
        cout << 0 << endl;
        return 0;
    }
    cout <<  c - (a - b) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
	int ans = 0, n, s, last;
	boolean [] used;
	int [] max ;
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		used = new boolean[10];
		while(sc.hasNext()){
			n = sc.nextInt();
			s = sc.nextInt();
			last = n - 1;
			ans = 0;
			Arrays.fill(used, false);
			max = new int[n];
			for(int i = n-1; i >= 0; i--){
				for(int j = i; j < n; j++){
					max[i] += -1 * (9 - (j - i)) * (n - j);
				}
			}
			dfs(0,-1 * s);
			System.out.println(ans);
		}
	}
	
	private void dfs(int deep,int sum) {
		if(deep == n){
			if(sum == 0) ans++;
			return;
		}
		
		for(int i = 9; i >= 0; i--){
			if(! used[i]){
				int value = i * (n - deep) + sum;
				if(value <= 0 && max[deep] <= value){
					used[i] = true;
					dfs(deep + 1, value);
					used[i] = false;
				}
			}
		}
	}

	private void debug(Object... o) { System.out.println("debug = " + Arrays.deepToString(o)); }

	public static void main(String[] args) {
		new Main().doit();
	}
}

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

int main()
{
	ll n;
	cin>>n;
	string s;
	cin>>s;
	ll count =0;
	for(ll i=0;i<=s.length()-3;i++)
	{
		if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')
		{
			count++;
		}
	}
	cout<<count;
}

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

using namespace std;
typedef long long ll;
typedef double ld;

ll n;
ll m;
ll a[200010];
ll era[1000010];
ll cou;
map<ll, ll> chk;
vector<ll> b;
map<ll, ll> no;

int main(void)
{
	scanf("%lld", &n);
	
	for(ll i = 1 ; i <= n ; i++)
	{
		scanf("%lld", &a[i]);
		
		if(chk[a[i]] == 1)
			no[a[i]] = 1;
		
		else if(chk[a[i]] == 0)
		{
			chk[a[i]] = 1;
			b.push_back(a[i]);
		}
	}
	
	m = b.size();
	
	for(ll i = 0 ; i < m ; i++)
	{
		for(ll j = b[i] ; j < 1000010 ; j += b[i])
			era[j] += 1;
	}
	
	for(ll i = 0 ; i < m ; i++)
	{
		if(no[b[i]] == 1)
			continue;
		
		if(era[b[i]] == 1)
			cou++;
	}
	
	printf("%lld", cou);
	return 0;
}

Measured memory_bytes: 39300
/*
By Tianyi Chen. All rights reserved.
Date: 2018-09-02
*/
#include<bits/stdc++.h>
using namespace std;
int L,m=19,j,b,c;
vector<int>bs;vector<pair<int,int>>e[21];
int main(){
 scanf("%d",&L);
 for(int i=0;i<20;++i)if(L>>i&1)bs.push_back(i);
 b=bs.back();bs.pop_back();c=1<<b;
 for(int i=1;i<20;++i)e[i].emplace_back(i+1,0);
 j=1;
 for(int i=0;i<b;++i)++m,e[i+1].emplace_back(i+2,1<<i);
 reverse(bs.begin(),bs.end());
 for(auto x:bs){
  ++m,e[x+1].emplace_back(20,c);
  c+=1<<x;
 }
 printf("20 %d\n",m);
 for(int i=0;i<20;++i)for(auto y:e[i])printf("%d %d %d\n",i,y.first,y.second);
}

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

using namespace std;

int main(){
	int n,k;
	cin>>n>>k;
	vector<int> ball(n);
	map<int,int> maps;

	for(int i=0;i<n;i++){
		cin>>ball.at(i);
		if(maps.count(ball.at(i))) maps.at(ball.at(i))++;
		else maps[ball.at(i)]=1;
	}

	vector<int> num;

	for(auto a:ball){
		if(maps.at(a)!=0){
			num.push_back(maps.at(a));
			maps.at(a)=0;
		}
	}

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

	long long ans=0;

	int cnt=0;

	for(int i=num.size()-1;i>=0;i--){
		if(cnt>=k) break;
		cnt++;

		ans+=num.at(i);
	}

	cout<<n-ans<<endl;

	return 0;
}


Measured memory_bytes: 11516
import java.util.Scanner;

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

		int aa=sc.nextInt();
		int yakusu=0;
		int tmp=0;
		for(int i=1; i<=aa; i+=2) {
			tmp=0;
			for(int j=1; j<=i; j++) {
				if(i%j==0) {
					tmp++;
				}
			}
			if(tmp==8) {
				yakusu++;
			}
		}
		System.out.println(yakusu);
	}
}

Measured memory_bytes: 23124
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let s = itr.next().unwrap();
    if n < 3200 {
        println!("red");
    } else {
        println!("{}", s);
    }
}


Measured memory_bytes: 2108
#include<bits/stdc++.h>
#define rep(i,k,n) for(ll i= (ll) k;i< (ll) n;i++)
#define all(v) (v).begin(), (v).end()
#define SZ(v) (int)((v).size())
#define pb push_back
#define ft first
#define sd second
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const long long INF = 1e18L + 1;
const int IINF = 1e9 + 1;

using namespace std;

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

#ifdef LOCAL
#define DBG(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define DBG(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

const int N = 100;
int n, x, chi[N + 1];

int main()
{
#ifndef LOCAL
	ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
	cin >> n >> x;
	rep(i, 0, n){
		cin >> chi[i];
	}
  	sort(chi, chi + n);
	rep(i, 0, n){
		if(chi[i] > x){
			cout << i << "\n";
			return 0;
		} else {
			x -= chi[i];
		}
	}
	if(x){
		cout << n - 1 << "\n";		
	} else {
		cout << n << "\n";
	}
    return 0;
}


Measured memory_bytes: 256
N = int(input())
H = list(map(int, input().split()))

counter = 0
max_counter = 0

for i in range(N - 1):
    if H[i + 1] - H[i] <= 0:
        counter += 1
        if counter > max_counter:
            max_counter = counter
    else:
        counter = 0
print(max_counter)


Measured memory_bytes: 15020
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000000000000000LL
#define MOD 1000000007
#define writeln(n) cout<<n<<endl;
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
//vector<tuple<long long, long long, long long>>vec;

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

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};


int main()
{
    string w;
    cin>>w;
    vector<int> alf(26,0);

    for(int i=0; i<w.size(); i++)
    {
        ++alf[w[i]-'a'];
    }
    bool ans=true;
    for(int i=0; i<26; i++)
    {
        if(alf[i]%2!=0){ans=false; break;}
    }
    if(ans) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))

count = 0
ans = 0

while 1:
    for x in range(0, n):
        if A[x] % 2 == 0:
            count += 1
    if count == n:
        count = 0
        ans += 1
        for y in range(0, n):
            A[y] /= 2
    else:
        break

print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char x;
  long long int a,b,c;
  cin >> a >> x >> b;
  if(x=='+'){
    c = a + b;
  }else if(x=='-'){
    c= a - b;
  }
  cout << c;
}


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

int n,k;
int arr[5001];
int dp[5001];

void add(int x){
    for(int i=k-1;i>=x;i--){
        dp[i] = dp[i]+dp[i-x];
    }
}

void del(int x){
    for(int i=0;i<k-x;i++){
        dp[i+x] = dp[i+x] - dp[i];
    }
}

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

    for(int i=0;i<n;i++){
        cin>>arr[i];
        arr[i] = min(arr[i],k);
    }
    dp[0] = 1;
    for(int i=0;i<n;i++){
        add(arr[i]);
    }

    int ans = 0;
    for(int i=0;i<n;i++){
        del(arr[i]);
        int f = 0;
        for(int j=k-arr[i];j<k;j++){
            if(dp[j]){
                f = 1;
                break;
            }
        }
        if(!f) ans++;
        add(arr[i]);
    }
    cout<<ans;
}

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

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;


signed main() {
    char c;
    cin >> c;
    c+=1;
    cout << c << endl;
    return 0;
}


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

int n,l;
string s;
vi id;

vi composition(vi a, vi b){
  for(int i=0;i<n*n;i++){
    b[i] = a[b[i]];
  }
  return b;
}

vi pow(vi a, int x){
  vi res = id;
  while(x){
    if(x&1)res = composition(res,a);
    a = composition(a,a);
    x >>= 1;
  }
  return res;
}

int number(int &p){
  int res = 0;
  while(p<l && isdigit(s[p])){
    res = res * 10 + (int)(s[p++]-'0');
  }
  return res;
}

vi operation(int &p){
  if(s[p] == 'L'){
    int i = number(++p) - 1;
    vi res = id;
    for(int k=0;k<n;k++)res[i*n+k] = i*n+(k+1)%n;
    return res;
  }
  else if(s[p] == 'R'){
    int i = number(++p) - 1;
    vi res = id;
    for(int k=0;k<n;k++)res[i*n+k] = i*n+(k+n-1)%n;
    return res;
  }
  else if(s[p] == 'U'){
    int j = number(++p) - 1;
    vi res = id;
    for(int k=0;k<n;k++)res[k*n+j] = (k+1)%n*n+j;
    return res;
  }
  else if(s[p] == 'D'){
    int j = number(++p) - 1;
    vi res = id;
    for(int k=0;k<n;k++)res[k*n+j] = (k+n-1)%n*n+j;
    return res;
  }
  assert(true);
}

vi sequence(int &p){
  if(p==l || s[p] == ')'){
    return id;
  }

  vi a;
  if(s[p] == '('){
    vi t = sequence(++p);
    int x = number(++p);
    a = pow(t,x);
  }else{
    a = operation(p);
  }
  vi b = sequence(p);
  
  return composition(a,b);
}

int main(){
  cin >> n >> l >> s;
  
  id.resize(n*n);
  for(int i=0;i<n*n;i++)id[i] = i;

  int p = 0;
  vi ans = sequence(p);
  
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++) cout << ans[i*n+j] + 1 << " \n"[j==n-1];
  }
}

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

int main() {
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    while (b <= a) {
        b *= 2;
        --k;
    }
    for (int i = 0; i < k; ++i) {
        c *= 2;
    }
    if (b < c) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#define ll long long
#define ull unsigned long long
#define inf 0x3f3f3f3f
#define mod 1000000007
#define PI acos(-1)
#define fi first
#define se second
#define lowbit(x) (x&(-x))
#define mp make_pair
#define pb push_back
#define ins insert
#define eps 1e-8
#define si size()
#define E exp(1.0)
#define fixed cout.setf(ios::fixed)
#define fixeds(x) setprecision(x)
#pragma GCC optimize(2)
using namespace std;
inline ll read(){ll s=0,w=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();return s*w;}
void put1(){ puts("Yes") ;}void put2(){ puts("No") ;}void put3(){ puts("-1"); }
ll qp(ll a,ll b, ll p){ll ans = 1;while(b){if(b&1){ans = (ans*a)%p;--b;}a =
(a*a)%p;b >>= 1;}return ans%p;}
const ull base=2333; const ull pp=19260811; const ull ppp=999998639;

const int manx=1e3+10;



int main(){
    ll n=read();
    double x=n*1.0/3;
    printf("%.7f",x*x*x);
    return 0;
}


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

class Program
{
    public static void Main()
    {
        var line = Console.ReadLine().Split(' ').Select(p => int.Parse(p)).ToArray();

        var A = line[0];
        var B = line[1];

        if(A >=13)
        {
            Console.WriteLine(B);
        }
        else if(A >= 6 && A <= 12)
        {
            Console.WriteLine(B/2);
        }
        else if(A <= 5)
        {
            Console.WriteLine(0);
        }

    }

}

Measured memory_bytes: 13268
#include <stdio.h>
#include <stdlib.h>
long xxx[10][1001][101];

long pattern(int n,int s,int from){
	long i,x=0;
	if(s>100*n)return 0;
	if(xxx[n][s][from]>=0)x=xxx[n][s][from];
	else{
		for(i=(s-100*(n-1)>from?s-100*(n-1):from); i<100 && i<=s ;i++){x+=pattern(n-1,s-i,i+1);}
		xxx[n][s][from]=x;
	}
	return x;
}

int main(void){
	int n,s,i,j,k;
	for(j=0;j<1001;j++){
		for(k=0;k<101;k++){
			xxx[1][j][k]=( (j<=100 && k<=j)?1:0 );
			xxx[2][j][k]=( (2*k<=j && j<=200) ? ((100-k+1)-abs((100-k)-(j-k*2)))/2 : 0 );
		}
	}
	for(i=3;i<10;i++){for(j=0;j<1001;j++){for(k=0;k<101;k++){xxx[i][j][k]=-1;}}}
    while(scanf("%d %d",&n,&s)*(n+s)){
	printf("%ld\n",pattern(n,s,0));}
    return 0;
}

Measured memory_bytes: 7712
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,a,b;
    cin >> n >> a >> b;
    bool aturn = true;
    int turn = 0;
    while(true){
        turn++;
        if(aturn){
            if(a+1 != b)a++;
            else if(a != 1)a--;
            else break;

            aturn = false;
        }else{
            if(b-1 != a)b--;
            else if(b != n)b++;
            else break;

            aturn = true;
        }
        if(turn >= 1000000)break;
    }
    if(turn >= 1000000)cout << "Draw"<<endl;
    else if(aturn)cout<<"Borys"<<endl;
    else cout << "Alice"<<endl;
    
    
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int R;
  cin >> R;
  const double PI = 3.141592653589793238463;

  cout << 2.0 * PI * R << endl;

  return 0;
}


Measured memory_bytes: 3248
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
typedef long long ll;

const int MOD = 1000000007;  // 1 000 000 007


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

    // input
    ll W, A, B;
    cin >> W >> A >> B;
    ll AW = A + W, BW = B + W;
    
    // calculation
    if (A <= B && B <= AW || A <= BW && BW <= AW) {
        cout << 0 << "\n";
    } else {
        if (BW < A) {
            cout << A - BW << "\n";
        } else if (AW < B) {
            cout << B - AW << "\n";
        }
    }
    
    return 0;
}


Measured memory_bytes: 256