akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;

string S;
void input()
{
    cin>>S;
}

void solve()
{
    string ans="No";
    if(S[2]==S[3]&&S[4]==S[5]) ans="Yes";
    cout<<ans<<endl;
}

int main()
{
    cin.tie();
    ios::sync_with_stdio(false);
    input();
    solve();
    return 0;
}

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

int main(){
	int k,a,b;

	cin>>k>>a>>b;

	while(a<=b){
		if(a%k == 0){
			cout<<"OK"<<endl;
			break;
		}

		a++;
	}

	if(a>b){
		cout<<"NG"<<endl;
	}

	return 0;
}

Measured memory_bytes: 3632
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String args[]) throws Exception{
        BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
        String[] str = stdR.readLine().split(" ");
        int A = Integer.parseInt(str[0]);
        int B = Integer.parseInt(str[1]);
        int C = Integer.parseInt(str[2]);
        if(B >= A * C) {
            System.out.println(C);
        }else {
            System.out.println(B / A);
        }
    }
}


Measured memory_bytes: 22356
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long lli;
typedef pair<int, int> pii;
typedef pair<lli, lli> pll;
const lli INF = 2e9 + 19;
int n;

struct TLine
{
    lli l, r;

    bool operator <(const TLine&other) const
    {
        if(r == other.r) return l < other.l;
        return r < other.r;
    }
};

vector<TLine> lines;

void ReadInput()
{
    cin >> n;
    lines.resize(n);
    for(int i = 0; i < n; ++i)
    {
        int x, l;
        cin >> x >> l;
        lines[i] = {(lli)x - l, x + l};
    }
    sort(lines.begin(), lines.end());
}

void Solve()
{
    lli lst = -INF;
    int ans = 0;
    for(int i = 0; i < n; ++i)
        if(lines[i].l >= lst)
        {
            ++ans;
            lst = lines[i].r;
        }
    cout << ans << '\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ReadInput();
    Solve();
}


Measured memory_bytes: 1792
def main():
    X = int(input())
    a_max = None
    a = 1
    while True:
        if a**5 - (a-1)**5 > X:
            a_max = a - 1
            break
        else:
            a += 1
    a_min = None
    a = -1
    while True:
        if a**5 - (a-1)**5 > X:
            a_min = a + 1
            break
        else:
            a -= 1

    for a in range(a_min, a_max+1):
        for b in range(a_min-1, a_max):
            if a**5 - b**5 == X:
                print(a, b)
                exit()


if __name__ == '__main__':
    main()


Measured memory_bytes: 63556
import java.util.*;
import java.lang.*;

class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
      int N = Integer.parseInt(sc.next());
      int[] a = new int[N];
      long sum = 0;
      for(int i = 0; i<N; i++){
        a[i] = Integer.parseInt(sc.next())-(i+1);
        sum += a[i];
      }
      Arrays.sort(a);
      int b = -1;
      if(N%2 == 1) b = a[N/2];
      else b = a[N/2-1];
      long res = 0;
      for(int i = 0; i<N; i++) res+= Math.abs(a[i]-b);
      System.out.println(res);
  }
}

Measured memory_bytes: 48912
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <map>
#include <cstdlib>
using namespace std;
int main()
{
    int a, n;
    cin >> a >> n;
    cout << (a % 500 <= n ? "Yes" : "No") << endl;

    return 0;
}

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

int main(){
  int a,b,c=1,i,array[100000];
  cin>>a;
  for(b=2;b<32;b++){
    if(pow(b,2)>a){
      break;
    }
    for(c=0; ;c++){
      if(pow(b,c)>a){
        array[b-2]=pow(b,c-1);
        break;
      }
    }
  }
  sort(array,array+b-2);
  cout<<array[b-3]<<endl;
}

Measured memory_bytes: 256
stri = list(input())
hantei = 0
hant = 0
han = 0
N = len(stri)

for i in range(int((N-1)/2)):
    if stri[i] != stri[N-i-1]:
        hantei = 1
        break

stri1 = stri[:int((N-1)/2)]
stri2 = stri[int((N-1)/2)+1:]


for i in range(len(stri1)):
    if stri1[i] != stri1[len(stri1)-i-1]:
        hant = 1
        break

for i in range(len(stri2)):
    if stri2[i] != stri2[len(stri2)-i-1]:
        han = 1
        break

if hantei == 0 and hant == 0 and han == 0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 39860
#include <stdio.h>

int main()
{
    int n;
    int math, eng, jap;

    while (scanf("%d", &n), n != 0) {
        for (int i = 0; i < n; i++) {
            scanf("%d %d %d", &math, &eng, &jap);

            if (math == 100 || eng == 100 || jap == 100) {
                puts("A");
            }
            else if ((math + eng) >= 180) {
                puts("A");
            }
            else if ((math + eng + jap) >= 240) {
                puts("A");
            }
            else if ((math + eng + jap) >= 210) {
                puts("B");
            }
            else if ((math + eng + jap) >= 150 &&
                     (math >= 80 || eng >= 80)) {
                puts("B");
            }
            else {
                puts("C");
            }
        }
    }

    return 0;
}



Measured memory_bytes: 2528
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1000000007
typedef long long ll;
const int INF32 = 2147483647;
const ll INF64  = 9223372036854775807;
using namespace std;

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

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

    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;

    vector<int> w;
    vector<int> sato;
    REP(i, f) {
        REP(j, f) {
            int sum = 100 * (a * i + b * j);
            if (sum <= f && count(ALL(w), sum) == 0 && sum > 0) {
                w.push_back(sum);
            }
        }
    }

    REP(i, f) {
        REP(j, f) {
            int sum = c * i + d * j;
            if (sum <= f && count(ALL(sato), sum) == 0) {
                sato.push_back(sum);
            }
        }
    }

    int ans   = 0;
    int m     = 0;
    double nd = -1;
    REP(i, sato.size()) {
        REP(j, w.size()) {
            if (sato[i] <= w[j] / 100 * e && sato[i] + w[j] <= f) {
                double node = (double)(100 * sato[i]) / (sato[i] + w[j]);
                if (chmax(nd, node)) {
                    ans = sato[i] + w[j];
                    m   = sato[i];
                }
            }
        }
    }

    cout << ans << " " << m << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a,b,n,x;
int main(){
    scanf("%lld%lld%lld",&a,&b,&n);
    x=min(n,b-1);
    printf("%lld\n",a*x/b-a*(x/b));
    return 0;
}


Measured memory_bytes: 3704
N=int(input())
num=list(map(int,input().split()))

s=0
for i in range(N):
    if num[i]%2==0 and num[i]%3!=0 and num[i]%5!=0:
        s += 1
if s>0:
    print('DENIED')
else:
    print('APPROVED')

Measured memory_bytes: 3060
#include<iostream>
#include<cmath>
#define int long long
signed main(){
  int N;
  std::cin>>N;
  int ans=N+1;
  int hoge=std::sqrt(N)+1;
  for (int i=1;i<=hoge;i++){
    if(N%i==0){
      ans=std::min(ans,i+N/i);
    }
  }
  ans=ans-2;
  std::cout<<ans<<std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
map<ll, ll> prime_factor(ll n) {
    map<ll, ll> ret;
    for(ll i = 2; i * i <= n; i++) {
        while(n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if(n != 1)
        ret[n] = 1;
    return ret;
}
int main() {
    ll n;
    cin >> n;
    auto res = prime_factor(n);
    ll ans = 0;
    for(auto e : res) {
        ll tmp = 0;
        ll cnt = 0;
        for(int i = 1; i < 1000; i++) {
            if(tmp + i <= e.second) {
                tmp += i;
                cnt++;
            } else {
                break;
            }
        }
        ans += cnt;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <assert.h>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <complex>
#include <iomanip>
#include <stack>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
ll mod=1e9+7;
double eps=1e-7;
ll exp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=(x*x)%mod){if(y&1)ret=(ret*x)%mod;}return ret;}
ull pexp(ull x,ull y){if(y<0) return 0; ull ret=1; for(;y;y>>=1,x=(x*x)){if(y&1)ret=(ret*x);}return ret;}
ll gcd(ll x,ll y){if(!x||!y) return x+y; return x%y==0?y:gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll bsum(ll u,ll b){ll ret=0;if(u<b)return u;while(u){ret+=u%b;u/=b;}return ret;}
ll prival(ll u,ll p){ll cn=0;while(u%p==0){cn++;u=u/p;}return cn;}
ll minv(ll a,ll b){return 1<a?b-minv(b%a,a)*b/a:1;}
ll extm(ll a,ll b){ll ret=0;while(a!=0){if(a%2==1){ret+=b;ret%=mod;}a>>=1;b=(2*b)%mod;}return ret;}   
ll eaphi(ll x){ll t=x,ret=x,i;for(i=2;i*i<=x;i++){if(t%i==0){ret-=ret/i;while(t%i==0) t/=i;}}if(t!=1) ret-=ret/t;return ret;}
ll eadivc(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=2;if(x%i==0 && i*i==x) ret+=1;}return ret;}
ll eadivs(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=i+x/i;if(x%i==0 && i*i==x) ret+=i;}return ret;}
ll ndig(ll x, ll b){ll ret=0;while(x){x/=b; ret++;}return ret;}
ll rev(ll n, ll b){ll ret=0;while(n){ret=b*ret+n%b; n/=b;}return ret;}
ll sq(ll x){ll t=(ll)sqrt(x); for(ll i=t-2 ; i<=t+2 ; i++) if(i*i==x) return abs(i); return -1;}
ll extexp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=extm(x,x)){if(y&1)ret=extm(ret,x);}return ret;}
bool isprime(ll x){if(x<=1) return false; for(ll i=2;i*i<=x;i++){if(x%i==0){return false;}}return true;}
ll n, ans=-1e18, vv[333333];
ll ma[333333];
ll mi[333333];
priority_queue<ll> PQ;

int main(void)
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin>>n; int i, j;
	for(i=1 ; i<=3*n ; i++) cin>>vv[i];
	for(i=1 ; i<=n ; i++) PQ.push(-vv[i]), ma[n]+=vv[i];
	for(i=n+1 ; i<=2*n ; i++)
	{
		PQ.push(-vv[i]); ma[i]=ma[i-1]+vv[i];
		ll x=PQ.top(); PQ.pop(); ma[i]+=x;
	}
	while(!PQ.empty()) PQ.pop();
	for(i=2*n+1 ; i<=3*n ; i++) PQ.push(vv[i]), mi[2*n+1]+=vv[i];
	for(i=2*n ; i>=n+1 ; i--)
	{
		PQ.push(vv[i]); mi[i]=mi[i+1]+vv[i];
		ll x=PQ.top(); PQ.pop(); mi[i]-=x;
	}
	for(i=n ; i<=2*n ; i++) ans=max(ans,ma[i]-mi[i+1]);
	cout<<ans; return 0;
}


// 제출하기 전에 생각햇나요?
// it may be easier/harder than you think
// ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

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

int main() {
    int n,r;
    cin >> n >> r;
    if(n<=9){
        int de = 100*(10-n);
        cout << r + de << endl;
    }else{
        cout << r << endl;
    }
}

Measured memory_bytes: 3584
/**
 * @author torith
 * @date 2018-10-31
 */

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,M; cin >> N >> M;

    if (N < M/2) {
        cout << N + (M - 2*N)/4 << "\n";
    }else if (N >= M/2) {
        cout << M/2 << "\n";
    }

    return 0;
}



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

typedef long long ll;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

const int mx=1e6+11;
const double PI = acos(-1);
#define MOD 1000000007


#define nl '\n'
#define pb push_back
#define F first
#define S second
#define I insert
#define mp make_pair

#define sz(x) x.size()
#define tt int t; cin>>t; while(t--)
#define lo(i,a,b) for(int i=a;i<b;i++)
#define be(a) (a).begin(),(a).end()
#define rbe(a) (a).rbegin(),(a).rend()
#define mem(a,b) memset(a,b,sizeof(a))

#define su ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define frac cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu () {            cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}


int main()
{
   su;
   int n,x=0,y=0;
   cin>>n;
   int v[n],c[n];
   lo(i,0,n)
   {
     cin>>v[i];
   }
   lo(i,0,n)
   {
     cin>>c[i];
   }
   lo(i,0,n)
   {
     if(v[i]>c[i])
     {
       x+=v[i];
       y+=c[i];
     }
   }
   cout<<x-y<<nl;
   return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,0,-1,1,0,0};
const ld PI=abs(acos(-1));
int n,m,a,b,c,d,e;
string s,w;

int main(){
	cin >> s;
	REP(i,0,s.size()-1){
		if(s[i]=='A' and s[i+1]=='C'){cout << "Yes" << endl; return 0;}
	}
	
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;
int gcd(int a,int b){
    if(a*b==0) return a+b;
    return a>b ? gcd(a%b,b):gcd(a,b%a);
}
int main(){
    int a,b;
    cin>>a>>b;
    cout<<gcd(a,b)<<endl;
    return 0;
}


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

int main() {
  string S;
  cin >> S;
  vector<int> num(26, 0);

  for (int i = 0; i < S.size(); i++) {
    num[S[i] - 'a']++;
  }

  bool no = false;
  char ans;

  for (int i = 0; i < 26; i++) {
    if (num[i] == 0) {
      ans = 'a' + i;
      no = true;
      break;
    }
  }

  if (no) cout << ans << endl;
  else cout << "None" << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
vector<ll> vp, vn;

void solve() {
	cin >> N;
	rep(i, 0, N) {
		ll a; cin >> a;
		if(a > 0) vp.pb(a);
		else vn.pb(a);
	}
	sort(all(vp)); reverse(all(vp));
	sort(all(vn));
	if(vp.empty()) {
		vp.pb(vn.back()); vn.pop_back();
	}
	else if(vn.empty()) {
		vn.pb(vp.back()); vp.pop_back();
	}
	ll M = accumulate(all(vp), 0ll) - accumulate(all(vn), 0ll);
	cout << M << "\n";

	if(sz(vp) == 1) {
		ll ts = vp[0];
		rep(i, 0, sz(vn)) {
			cout << ts << " " << vn[i] << "\n";
			ts -= vn[i];
		}
		debug(ts);
	}
	else {
		ll ts = vn[0];
		rep(i, 0, sz(vp) - 1) {
			cout << ts << " " << vp[i + 1] << "\n";
			ts -= vp[i + 1];
		}
		cout << vp[0] << " " << ts << "\n";
		ts = vp[0] - ts;
		rep(i, 0, sz(vn) - 1) {
			cout << ts << " " << vn[i + 1] << "\n";
			ts -= vn[i + 1];
		}
		debug(ts);
	}
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 2804
//                             In The Name Of Allah
//                             	Mohammad Hosseini
//                                     185
#include <bits/stdc++.h>
#define	ss second
#define ff first
#define use_fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ret(n) return cout << n, 0
#define se(n) cout << setprecision(n) << fixed
#define pb push_back
//#define int long long
#define ld long double
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std; 

const int N = 400, OO = 724249387, T = (1 << 20) + 10, M = 998244353, P = 6151, SQ = 280, lg = 24;
typedef pair <int, int> pii;

int32_t main() {
 	use_fast;
	int n;
	cin >> n;
	int t = __gcd(n, 360);
	t = n * 360 / t;
	cout << t / n << endl;
	return 0;
}
/*
be carefull :
1- if not solve after 20 min, read again twice
2- after submit read the code again
3- fun with contest
4- uploaded by ubuntu 20.04 
5- ...
*/


Measured memory_bytes: 3664
n = int(input())
ai = map(int, input().split())

count = 0
for a in ai:
    m = 1
    while (1 << m) <= a:
        if a % (1 << m) == 0:
            # print(a, 1 << m)
            count += 1
        else:
            break
        m += 1
print(count)

Measured memory_bytes: 3828
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll mod=1e9+7;
ll s;
ll dp[2001];
ll func(ll s)
{
	if(s==0)
	{
		return 1;
	}
	if(s<0)
	return 0;
	if(dp[s]!=-1) return dp[s];
	ll ret=0;
	for(int i=3;i<=s;i++)
	{
		ret+=func(s-i);
		ret%=mod;
	}
	return dp[s]=ret;
}
int main()
{
	ll i,j,k,m,t;
	cin>>s;
	for(i=0;i<=s;i++)
	{
		dp[i]=-1;
	}
	cout<<func(s);
}

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

#define pb push_back

void solve(){
   int n; cin>>n; 
 string s; cin>>s; 
 ll x=0;

 ll max=0;
 for(int i=0;i<n;i++)
 {
   if(s[i]=='I') x++;
   else x--;
   if(x>max) max=x;
 }
 cout<<max<<endl;
}


int main() {
   #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif

 ios_base::sync_with_stdio(0);
 cin.tie(0);

int t=1 ;  while(t--)
 solve();

return 0;
}


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

int main(void)
{
    long long n, d, x, y;
    cin >> n >> d;
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> x >> y;
        if ((x * x + y * y) <= (d * d))
        {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
	int n;
	string s;
	cin >> n >> s;
	string ans = "";
	for(int i=0;i<s.size();i++) {
		if(65 <= s[i] && s[i] <= 90) {
			int tmp = (((char)s[i] - 'A') + n) % 26;
			ans += (char)('A' + tmp);
		}else {
			int tmp = (((char)s[i] - 'a') + n) % 26;
			ans += (char)('a' + tmp);
		}
	}
	cout << ans << endl;
}

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

int main(){
    string s;cin >> s;
    auto pre = s.at(0);
    auto ans = 0;

    for (auto i = 1; i < s.size(); ++i) {
        if (pre != s.at(i)){
            ans += 1;
            pre = s.at(i);
        }
    } 
    cout << ans << endl;

}

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

int main(){
  int A, B, C;
  cin >> A >> B >> C;
  int m = max(A,max(B,C));
  int ans;
  if (m==A) ans = 10*A+B+C;
  else if (m==B) ans = 10*B+A+C;
  else ans = 10*C+A+B;
  cout << ans << endl;
}


Measured memory_bytes: 256
#![allow(dead_code, unused_imports, non_snake_case)]

use std::io::*;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::str::FromStr;

const MOD: i32 = 1_000_000_007;

fn main() {
    let n: usize = input();
    let va: Vec<u64> = input();
    let mut cnt: Vec<u64> = vec![0; n];
    let mut cnt_ref: Vec<u64> = vec![0; n];

    for i in 0..n {
        cnt[va[i] as usize] += 1;
    }

    for i in 0..n {
        cnt_ref[((n as i64) - (i as i64) * 2 - 1).abs() as usize] += 1;
    }

    if cnt != cnt_ref {
        println!("{}", 0);
        return
    }

    let mut ans = 1;
    for i in 0..n / 2 {
        ans *= 2;
        ans %= 1_000_000_007;
    }
    println!("{}", ans);
}

trait Read {
    fn read(s: &str) -> Self;
}

fn input<T: Read>() -> T {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    T::read(buf.trim_right())
}

macro_rules! read_impl {
    ($($t:ty)*) => ($(
        impl Read for $t {
            fn read(s: &str) -> $t{
                s.parse().unwrap()
            }
        }
    )*)
}
read_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }

impl Read for String {
    fn read(s: &str) -> Self {
        s.to_string()
    }
}

impl Read for Vec<char> {
    fn read(s: &str) -> Self {
        s.chars().collect()
    }
}

impl<T: Read> Read for Vec<T> {
    fn read(s: &str) -> Self {
        s.split_whitespace().map(T::read).collect()
    }
}

impl<A: Read, B: Read> Read for (A, B) {
    fn read(s: &str) -> Self {
        let tokens: Vec<_> = s.split_whitespace().collect();
        (A::read(tokens[0]), B::read(tokens[1]))
    }
}

impl<A: Read, B: Read, C: Read> Read for (A, B, C) {
    fn read(s: &str) -> Self {
        let tokens: Vec<_> = s.split_whitespace().collect();
        (A::read(tokens[0]), B::read(tokens[1]), C::read(tokens[2]))
    }
}

impl<A: Read, B: Read, C: Read, D: Read> Read for (A, B, C, D) {
    fn read(s: &str) -> Self {
        let tokens: Vec<_> = s.split_whitespace().collect();
        (A::read(tokens[0]), B::read(tokens[1]), C::read(tokens[2]), D::read(tokens[3]))
    }
}

Measured memory_bytes: 8444
// AOJ 0504: Card Game II
// 2017.12.6 bal4u@uu

#include <stdio.h>
#include <string.h>

#define N 6
char s[10015];
int  d[10015];

void frac(char *d, int a, int b, int n)
{
	int i;

	*d++ = a/b, a %= b;
	for (i = 1; a > 0 && i <= n; i++) {
		a *= 10;
		if      (a >= b) *d = a / b, a %= b;
		else if (a == b) *d = 1, a = 0;
		d++;
	}
}

void fracSum(int *d, int a, int b, int n)
{
	int i;

	*d++ += a/b, a %= b;
	for (i = 1; a > 0 && i <= n; i++) {
		a *= 10;
		if      (a >= b) *d += a / b, a %= b;
		else if (a == b) (*d)++, a = 0;
		d++;
	}
}

void sum(char *s, int *d, int n)
{
	int ca = 0, sum;
	char *s0 = s;

	s += n, d += n;
	while (s >= s0) {
		sum = *s + *d + ca;
		*s = sum % 10, ca = sum / 10;
		s--, d--;
	}
}

int main()
{
	int n, k, m, r, i;
	char *ss = s+1;
	int *dd = d+1;

	while (scanf("%d%d%d%d", &n, &k, &m, &r) && n > 0) {
		r += N;

		memset(s, 0, sizeof(s));
		frac(ss, 1, n, r);

		if (m == 1) {
			memset(d, 0, sizeof(d));
			for (i = 1; i < n; i++) fracSum(dd, 1, n*i, r);
			sum(ss, dd, r);
		}
		s[0] = s[1] + '0', s[1] = '.';
		for (i = 1; i <= r; i++) s[i+1] += '0';
		s[r-N+2] = 0;
		puts(s);
	}
	return 0;
}

Measured memory_bytes: 1744
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
//        sc.useDelimiter("\n");
//        DecimalFormat df = new DecimalFormat("0.00000000");
        
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int c = Integer.parseInt(sc.next());
        int temp;
        temp = a;   a = b;  b = temp;
        temp = a;   a = c;  c = temp;
        pw.println(a + " " + b + " " + c);

        pw.flush();
    }
}

Measured memory_bytes: 21716
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(4);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
    string s;
    cin>>s;
    int res=2;
    int n=s.size();
   for(int i=1;i<n-1;i++)if(s[i-1]!=s[i+1])res=n;
  if(res==2){
      cout<< "Second " <<"\n";
  return 0;
}
    if(s[0]==s[n-1])res-=1;
    cout<<(res%2?"First":"Second")<<"\n";
}


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

int main() {
    long int x,n;
    cin>>x>>n;
    long int a[101]={},i,t;
    for(i=0;i<n;i++)
    {
        cin>>t;
        a[t]=1;
    }
    
    if(a[x]==0)
    {
        cout<<x<<endl;
    }
    else
    {
        long int k=0,h=0;
        
        for(i=x;i>=0;i--)
        {
            if(a[i]==0)
            {
               // min=x-i;
                k=i;
               // cout<<min<<endl;
                break;
            }
        }
        for(i=x+1;i<101;i++)
        {
            if(a[i]==0)
            {
                    //min=i-x;
                    h=i;
                   // cout<<min<<endl;
                    break;
            }
        }
        if(h==0)
          h=101;
        int p,q;
        p=x-k;
        q=h-x;
        
        if(p<q)
        {
            cout<<k<<endl;
        }
        else if(p==q)
        {
            cout<<k<<endl;
        }
        else
        {
            cout<<h<<endl;
        }
        
        //cout<<k<<endl;
    }
    return 0;
}

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

int main(){
	long N;
	long ans = 0;
	cin >> N;
	if(N%2 == 1){
		ans = 0;
	}else{
		N = N/2;
		while(true){
			N = N/5;
			ans += N;
			if(N == 0){
				break;
			}
		}
	}
	cout << ans;
	return 0;
}

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

using namespace std;
#define ll long long

int main(){
    ll x1,y1,x2,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    cout << x2+y1-y2 << " " << y2+x2-x1 << " " << x1+y1-y2 << " " << y1+x2-x1;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int x;
	cin >> x;
	int arr[x];
	int a = -1;
	int w = 0;
	for (int i = 0 ; i < x ; i++)
	{
		cin >> arr[i];
		a = max (a , arr[i]);
		if (a - 1 > arr[i])
		{
			w = 1;
		}
	}
	if (w == 1)
	{
		cout << "No";
		return 0;
	}
	cout << "Yes";
	return 0;
}

Measured memory_bytes: 640
require 'complex'

n,d = gets.split.map(&:to_i)
li = []

n.times do 
  li << gets.split.map(&:to_i)
end

ans = 0

li.each_with_index do |v,i|
  li.each_with_index do |b,l|
    if i == l
      next
    end
    calc = 0
    d.times do |di|
      calc += (v[di]-b[di])**2
    end
    calc = Math.sqrt(calc).to_s
    if calc =~ /^[0-9]*\.0$/
      ans += 1
    end
  end
end

puts ans / 2


Measured memory_bytes: 1788
#include<iostream>
#include<string.h>
using namespace std;

int main(){
  int a,b;
  char c;

  while(1){
    cin >> a >> c >> b;
    if(strcmp(&c,"?")==0) break;
    if(strcmp(&c,"+")==0) cout << a+b << endl;
    if(strcmp(&c,"-")==0) cout << a-b << endl;
    if(strcmp(&c,"*")==0) cout << a*b << endl;
    if(strcmp(&c,"/")==0) cout << a/b << endl;
  }

  return 0;
}

Measured memory_bytes: 1160
// https://atcoder.jp/contests/abc137/tasks/abc137_b

#include <iostream>
#include <vector>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <algorithm>
#include <iomanip>

using namespace std;

int main (int argc, char* argv[]) {
	long long k, x;
	cin >> k >> x;

	auto left = max(x - (k - 1), -1000000ll);
	auto right = min(x + (k - 1), 1000000ll);
	for (long long i = left; i <= right; i++) {
		if (i != left) {
			cout << " ";
		}
		cout << i;
	}
	cout << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include <iomanip>
#include <math.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60
const double PI = 3.14159265358979323846;

int p[200009];
int m[200009]; // m[i] : 1からi番目の最小値

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

	int N; cin >> N;
	for (int i = 1; i <= N; i++) cin >> p[i];
	m[1] = p[1];
	for (int i = 2; i <= N; i++) m[i] = min(p[i], m[i - 1]);
	int ans = 0;
	for (int i = 1; i <= N; i++) if (m[i] == p[i]) ans++;
	cout << ans << endl;

	return 0;
}

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

int main(int argc, char const* argv[]) {
	int N;
	long Y;
	scanf("%d", &N);
	scanf("%ld", &Y);
	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= (N - i); j++) {
			if (10000 * i + 5000 * j + 1000 * (N - i - j) == Y) {
				printf("%d %d %d\n", i, j, N - i - j);
				return 0;
			}
		}
	}
	printf("-1 -1 -1\n");

	return 0;
}


Measured memory_bytes: 3768
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdio>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>

using namespace std;
typedef long long ll;
typedef double db;
#define inf 0x3f3f3f3f
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll dp[1 << 13 + 10];
ll _2n[20];
ll n, m;
ll val[1123];
ll a[1123];
signed main() {
	cin >> n >> m;
	ll w, b, i, j, t;
	_2n[0] = 1;
	for (i = 1; i < 15; ++i)_2n[i] = _2n[i - 1] << 1;
	ll tt = 1 << 13 + 5;
	for (i = 0; i < tt; ++i)dp[i] = inf;
	for (i = 0; i < m; ++i) {
		cin >> w >> b;
		val[i] = w;
		for (j = 0; j < b; ++j) {
			cin >> t;
			a[i] += _2n[t-1];
		}
	}
	dp[0] = 0;
	for (i = 0; i < _2n[n]; ++i) {
		for (j = 0; j < m; ++j) {
			dp[i | a[j]] = min(dp[i] + val[j], dp[i | a[j]]);
		}
	}
	if (dp[_2n[n] - 1] >= inf)cout << -1 << endl;
	else cout << dp[_2n[n] - 1] << endl;
	return 0;
}

Measured memory_bytes: 5688
#include<bits/stdc++.h>
#include<vector>
using namespace std;
int main(void){
  int A,B,K;
  cin >> K;
  cin >> A >> B;
  for(int i = A; i < B + 1; i++){
    if(i % K == 0){
      cout << "OK";
      break;
    }
    if(i == B){
      cout << "NG";
    }
  }
}

Measured memory_bytes: 3636
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> P;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+15+7;
ll n,m,l;
string s,t;
ll d[100000],dp[100][100];

int main(){
  vll x,y;
  cin >> n >> m;
  rep(i,0,n){
    ll a,b;
    cin >> a >> b;
    x.pb(a);
    y.pb(b);
  }
  sort(all(x),greater<int>());
  sort(all(y),greater<int>());
  l = 0;
  rep(i,0,n){
    if(x[0] < y[i]){
      m -= y[i];
      l++;
    }
    if(m <= 0)break;
  }
  if(m > 0){
    l += m / x[0];
    if(m % x[0] > 0)l++;
  }
  print(l);
  return 0;
}

Measured memory_bytes: 2036
N, M = map(int, input().split())
LL = []
RR = []
ans = 0

for i in range(M):
    L, R = list(map(int, input().split()))
    LL.append(L)
    RR.append(R)

ans = max(min(RR) - max(LL) + 1, 0)
print(ans)

Measured memory_bytes: 11048
def f(n,i):#i桁目の1の数
    if n==0:return 0
    le = (n+1)//2**i
    return le*2**(i-1) + max(0, n+1-le*2**i-2**(i-1))


a,b = map(int,input().split())
l = len(bin(b))-2
ans = 0
for i in range(1,l+1):
    ca = f(a-1,i)
    cb = f(b,i)
    ans = ans | (ca+cb)%2 * 2**(i-1)
print(ans)


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

int main(int argc, char *argv[])
{
    int stone[999];
    int a, b;
    std::cin >> a >> b;
    for (int i = 0; i < 999; i++) {
        if (i == 0) {
            stone[0] = 1;
        } else {
            stone[i] = stone[i-1] + (i+1); 
        }
    }

    for (int i = 0; i < 999; i++) {
        if (i == 998) {
            break;
        }
        if ((stone[i] - a) == (stone[i+1] - b)) {
            std::cout << stone[i] - a << std::endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MAX_N 1005
typedef long long ll;
ll mod=1e9+7;
ll add(ll a,ll b){ return (a+b+mod)%mod; }
ll mul(ll a,ll b){ return (a*b)%mod; }

string str;
int n,a,b;
char t[MAX_N];
int u[MAX_N];
vector<int> G[MAX_N];

ll solve(int pos,int prev){
  if(t[pos]=='E'){
    ll res=1;
    for(int i=0;i<(int)G[pos].size();i++){
      int to=G[pos][i];
      if(to==prev)continue;
      res=mul(res,solve(to,pos));
    }
    if(u[pos]==2)res=add(res,1);
    return res;
  }else if(t[pos]=='A'){
    ll res=u[pos]-1;
    for(int i=0;i<(int)G[pos].size();i++){
      int to=G[pos][i];
      if(to==prev)continue;
      res=add(res,solve(to,pos));
    }
    return res;
  }else if(t[pos]=='R'){
    ll res=1;
    for(int i=0;i<(int)G[pos].size();i++){
      int to=G[pos][i];
      if(to==prev)continue;
      res=mul(res,solve(to,pos)+1);
    }
    if(u[pos]==1)res=add(res,-1);
    return res;
  }
}

int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>str;
    t[i]=str[0];
    u[i]=str.size();
  }
  for(int i=0;i<n-1;i++){
    cin>>a>>b;
    a--,b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  cout<<solve(0,-1)<<endl;
  return 0;
}

Measured memory_bytes: 1348
#include<bits/stdc++.h>
using namespace std;
#define maxn 105
#define maxk 100005
int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	int a[maxn];
	bool dp[maxk] = {0};
	for(int i=0; i<n; i++)
		scanf("%d",&a[i]);
	for(int i=0; i<=k; i++)
	{
		if(!dp[i])
			for(int j=0; j<n; j++)
				if(i+a[j]<=k)
					dp[i+a[j]] = true;
	}
	if(dp[k]) printf("First\n");
	else printf("Second\n");
	return 0;
}

Measured memory_bytes: 384
N, T = [int(i) for i in input().split()]
t = [int(i) for i in input().split()]
x = T
for i in range(1, N):
    if t[i]-t[i-1] < T:
        x += T - abs(T - (t[i] - t[i - 1]))
    else:
        x += T
print(x)

Measured memory_bytes: 25200
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int a,b;
   stack<int> s;
  while(scanf("%d",&a)!=EOF){

    if(a!=0){
      s.push(a);
    }
    else{
      cout<<s.top()<<"\n";
      s.pop();
    }
  }
}



Measured memory_bytes: 3060
def d_NoNeed(N, K, A):
    a = sorted(A)
    s = t = 0
    # aのうち要素が大きいものから見ていったとき、
    # その要素を入れても総和がK未満のものだけ加えていく
    # 最後に連続して加えた要素の個数が解となる
    # (それら以外の要素の組み合わせでK以上にでき、かつ、
    #  それらの総和がK未満になるため)
    for i in range(N - 1, -1, -1):
        if s + a[i] < K:
            s += a[i]
            t += 1
        else:
            t = 0
    return t

N,K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
print(d_NoNeed(N, K, A))

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

typedef long long LL;
const int N = 200010;

char str[N];
bool vis[N];

int main() {
	
	scanf("%s", str + 1);
	int n = strlen(str + 1);
	for(int i = 1; i <= n; i++) {
		if(str[i] == 'C' && str[i - 1] != 'B') {
			vis[i] = 1;
		}
		if(str[i] == 'B' && str[i + 1] != 'C') {
			vis[i] = 1;
		}
	}
	LL ans = 0;
	for(int l = 1, r; l <= n; l = r + 1) {
		while(vis[l]) {
			++l;
		}
		if(l > n) break;
		r = l;
		while(!vis[r + 1] && r < n) {
			++r;
		}
		LL cnt = 0, t = 0;
		for(int i = l; i <= r; i++) {
			if(str[i] == 'A') {
				++cnt;
			}
			else if(str[i] == 'B' && str[i + 1] == 'C') {
				++i;
				t += cnt;
			}
		}
		ans += t;
	}
	printf("%lld\n", ans);
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n){
     cin >> a.at(i);
  }
 
  int sum=0;
  rep(i, n){
    rep(j, n){
      sum += a.at(i) * a.at(j);
    }
  }
 
  rep(i, n){
    sum -= a.at(i) * a.at(i);
  }

  cout << sum/2 << endl;
}
  


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        
        int first = -1;
        int second = -1;
        for (int i = 0; i < n; i++) {
            int num = sc.nextInt();
            array[i] = num;
            if (num >= first) {
                second = first;
                first = num;
            } else if (num >= second) {
                second = num;
            }
        }
        
        if (first == second) {
            for (int i = 0; i < n; i++) {
                System.out.println(first);
            }
            return;
        }
        
        for (int i = 0; i < n; i++) {
            if (array[i] == first) {
                System.out.println(second);
            } else {
                System.out.println(first);
            }
        }
        
    }
}


Measured memory_bytes: 105216
N,M=map( int, raw_input().split() ) 
A= [ map( int, raw_input().split() )  for i in range(M) ]

A.sort(key=lambda x:(x[0],-x[1]))

ans=0
for i  in range(M):
	x=A[i][0]
	y=A[i][1]
	if i==0:
		l=x
		r=y
		ans+=1
	else:
		if l<=x and x<r:
			#print "x,y,l,r::", x,y,l,r
			l=max(l,x)
			r=min(r,y)
		else:
			ans+=1
			l=x
			r=y
print ans


Measured memory_bytes: 47132
//----->|try=0; while(!success) try++;|<------
//----->|Belief Yourself,Respect Yourself|<----
//----->|Be Proud Of Yourself,You're Doing Your best|<-----
#include<bits/stdc++.h>
using namespace std;
#define uniq(x)  x.erase(unique(x.begin(),x.end()), x.end()) //Unique value find from vector
#define upper(arr,n,fixed) upper_bound(arr,arr+n,fixed)-arr  //Upper value search;
#define lower(arr,n,fixed) upper_bound(arr,arr+n,fixed)-arr  //Lower value search;
#define max3(a,b,c) max(max(a,b),c)//maximum value find three value;
#define min3(a,b,c) min(min(a,b),c)//minimum value find three value;
#define rep(i,intial,n) for(int i=intial; i<(n) ; i++)
#define REP(i,intial,n) for(int i=intial; i<=(n) ; i++)
#define PI acos(-1.0)//PI Calculation
#define LL long long
#define AND(a,b) ((a) & (b))
#define OR(a,b) ((a)|(b))
#define XOR(a,b) ((a) ^ (b))
#define MP make_pair
#define sqr(x) ((x)*(x))
#define sqrt(x) sqrt(1.0*(x))
#define INF_MAX 2147483647
#define INF_MIN -2147483647
#define MX 1000005
#define MOD 1000000007
template<typename T> T POW(T b,T p)          //Pow calculation
{
    T r=1;
    while(p)
    {
        if(p&1)r=(r*b);
        b=(b*b);
        p>>=1;
    }
    return r;
}

template<typename T> T BigMod(T b,T p,T m) //BigMod Calculation
{
    T r=1;
    while(p)
    {
        if(p&1)r=(r*b)%m;
        b=(b*b)%m;
        p>>=1;
    }
    return r;
}

//||--------------------------->||Main_Code_Start_From_Here||<---------------------------------||
int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    char s;
    while(cin>>s)
    {
        if(s=='a' || s=='e' || s=='i' || s=='o' || s=='u')
        {
            cout<<"vowel"<<endl;
        }
        else cout<<"consonant"<<endl;
    }

}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d;
    cin >> a >> b >> c >> d;

	while(1) {
		c = c - b;
		if (c<=0) {
			cout << "Yes" << endl;
			return 0;
		}
		a = a - d;
		if (a<=0) {
			cout << "No" << endl;
			return 0;
		}
	}
    return 0;
}

Measured memory_bytes: 3592
#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 YY cout << "Yes" << endl;
#define NN cout << "No" << endl;
#define v vector
const int INF = 1000000007;
typedef long long ll;
using namespace std;
using Graph = vector<vector<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); }
// *max_element(all(d));
int solve(){ 
  int n;
  cin >> n;
  v<int>d(n),cnt(n);
  rep(i,n)cin >> d[i];
  rep(i,n)++cnt[d[i]];
  int MAX = *max_element(all(d));
  bool can = true;
  if(d[0] != 0 || cnt[0] != 1)can = false;
  ll ans = 1;
  REP(i,1,MAX+1){
    if(cnt[i] == 0)can = false;
    rep(j,cnt[i]){
      ans = ans * cnt[i - 1] % 998244353;
    }
  }
  if(!can)ans = 0;
  cout << ans << endl;
  return 0; 
}
int main(){
  // ios::sync_with_stdio(false);cin.tie(nullptr);
  // cout << fixed;cout << setprecision(16) << endl; 
  solve();
  return 0;
} 

Measured memory_bytes: 1024
package main

import (
	"fmt"
	"sort"
)

func main() {
	mountains := make([]int, 10, 10)

	for i := 0; i < 10; i++ {
		fmt.Scan(&mountains[i])
	}

	sort.Sort(sort.Reverse(sort.IntSlice(mountains)))

	for i := 0; i < 3; i++ {
		fmt.Println(mountains[i])
	}
}



Measured memory_bytes: 1108
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
using namespace std;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
vector<int> vec;

int N, H[101010], dp[101010];
int main() {
    int N, K;
    cin >> N >> K;
    rep(i, 0, N) cin >> H[i];
    rep(i, 0, N) dp[i] = 1000000000;
    dp[0] = 0;
    rep(i, 0, N) {
        rep(j, 1, K+1) {
            chmin(dp[i + j], dp[i] + abs(H[i] - H[i + j]));
        }
    }
    cout << dp[N - 1] << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<cstdlib>

typedef long long ll;

int main(void)
{
	ll x, y;

	while(scanf("%lld%lld", &x, &y)==2)
	{
		printf("%s\n", (labs(x-y)<=1)?"Brown":"Alice");
	}

	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <cmath>
#include <cstring>
#include <assert.h>
#include <utility>
#include <tuple>
#include <array>
#include <bitset>
#include <cstdlib>

using int64 = long long;

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

    int N, Q;
    std::cin >> N >> Q;

    for (int i = 0; i < Q; i++) {
        int v, w;
        std::cin >> v >> w;

        if (N == 1) {
            std::cout << std::min(v, w) << std::endl;
            continue;
        }

        while (v != w) {
            if (v > w) std::swap(v, w);
            w = (w + N - 2) / N;
        }
        std::cout << v << std::endl;
    }

    return 0;
}


Measured memory_bytes: 1280
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define ll int
#define bits_count __builtin_popcountll
#define endl '\n'
#define double long double
#define ld double
#define FOR(i,a,n) for (ll i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (ll i=(n);i>=(a);--i)
#define FI(i,n) for (ll i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define MINUS(a) memset((a),-1,sizeof((a)))
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
#define sz(x) (ll)x.size()
#define pr pair<int,int>
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int MOD = 1e9 + 7;

int power(int x,int y){
    int res = 1;
    while(y){
        if(y&1) res = (res*x)%MOD;
        x = (x*x)%MOD;
        y >>= 1;
    }
    return res;
}

const int MAXN = 1e5 + 10;
int dp[MAXN];

void solve(){

    int n,k; cin>>n>>k;

    RFOR(i,1,k){
        int multiples = k/i;
        dp[i] = power(multiples,n);
        for(int j=2*i;j<=k;j+=i) dp[i] = ((dp[i] - dp[j])%MOD + MOD)%MOD;
    }

    int ans = 0;
    FOR(i,1,k) ans = (ans + (i*dp[i])%MOD)%MOD;
    cout<<ans<<endl;
}

signed main(){

   FastRead; 


    int t = 1; 
    // cin>>t;
    FOR(i,1,t){
        // cout<<"Case #"<<i<<": ";
        solve();
    }
}





Measured memory_bytes: 4360
N = gets.to_i
a = gets.split.map(&:to_i).reverse
ave = a.inject(&:+) / (N * 1.0)
ans = 0
min = 1000000
a.each{|v|
    if (ave - v).abs <= min then
        ans = N
        min = (ave - v).abs
    end
    N -= 1
}
puts ans - 1


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

//#define x .first
//#define y .second



int main()
{
	int mx, my;
	int n;

	int i;

	int gx,gy;
	int x=1, y=1;
	int lx, ly;

	int cnt = 0;

	cin >> mx >> my >> n;

	cin >> x >> y;

	for (i = 1; i < n; i++)
	{
		cin >> gx >> gy;

		if ((gx > x && gy > y) || (gx < x && gy < y))
		{
			lx = (x < gx ? gx - x : x - gx);
			ly = (y < gy ? gy - y : y - gy);

			cnt += max(lx, ly);
		}
		else
		{
			lx = (x < gx ? gx - x : x - gx);
			ly = (y < gy ? gy - y : y - gy);

			cnt += lx + ly;
		}

		x = gx;
		y = gy;
	}

	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 3064