akhauriyash/Code-Regression huggingface dataset:
// https://cp-algorithms.com/algebra/prime-sieve-linear.html
#include <iostream>
#include <vector>
using namespace std;

typedef long long ll;

pair<vector<ll>, vector<ll>> linearSieve(ll maxToCheck) {
    ll n = maxToCheck;
    // Assume all numbers are initially prime
    vector<ll> minimumPrimeFactor(n + 1, 0);
    vector<ll> primes;
    // vector<vector<ll>> factorizations(n + 1);
    vector<ll> cd(n + 1, 1);

    for (ll i = 2; i <= n; i++) {
        if (minimumPrimeFactor[i] == 0) {
            // i is prime, there are not any smaller prime factors for i
            minimumPrimeFactor[i] = i;
            primes.push_back(i);
        }
        // We iterate over all primes less than the minimum prime factor of i
        for (auto prime : primes) {
            if (i * prime > n || prime > minimumPrimeFactor[i]) break;
            minimumPrimeFactor[i * prime] = prime;
        }

        int expo = 0; // el del minimumPrimeFactor[i]
        int curMpf = minimumPrimeFactor[i];
        int withoutMpf = i;
        while (minimumPrimeFactor[withoutMpf] == curMpf) {
            withoutMpf /= curMpf;
            expo++;
        }
        cd[i] = (expo + 1) * cd[withoutMpf];
        // factorizations[i].push_back(minimumPrimeFactor[i]);
        // for (auto factor : factorizations[i / minimumPrimeFactor[i]]) {
        //     factorizations[i].push_back(factor);
        // }
        // int j = 0;
        // int k = 0;
        // vector<int>& restFactors = factorizations[i / minimumPrimeFactor[i]];
        // int restSize = restFactors.size();
        // while (j < restSize) {
        //     while (k < restSize && restFactors[j] == restFactors[k]) {
        //         k++;
        //     }

        // }
    }
    return {primes, cd};
}

ll countDivisors(const vector<ll>& factorization) {
    ll numFactors = factorization.size();
    ll i = 0;
    ll j = 0;
    ll ans = 1;
    while (i < numFactors) {
        while (j < numFactors && factorization[i] == factorization[j]) {
            j++;
        }
        ll exponent = j - i;
        ans *= (exponent + 1);
        i = j;
    }
    return ans;
}

int main() {
    ll n;
    cin >> n;
    auto [primes, cd] = linearSieve(n);
    ll ans = 0;
    for (ll k = 1; k <= n; k++) {
        ans += k * cd[k];
    }
    cout << ans << "\n";
}

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

int main(){
 int N,K;
  cin>>N>>K;
  if(N>=10){
    cout<<K<<endl;
  }
  else{
    cout<<K+100*(10-N)<<endl;
  }
}

Measured memory_bytes: 256
#akash mandal: jalpaiguri government engineering college
import sys,math

def ii(): return int(input())
def mii(): return map(int,input().split())
def lmii(): return list(mii())


def main():
    n=ii()
    print(0 if n==1 else 1)
if __name__=="__main__":
    main()

Measured memory_bytes: 61928
#include <bits/stdc++.h>
using namespace std;
void Main();

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define ALL(v) v.begin(), v.end()
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

void Main() {
    i32 N;
    cin >> N;
    bool ans = false;
    for (i32 i = 1; i < 10; i++) {
        for (i32 j = 1; j < 10; j++) {
            if (i * j == N) {
                ans = true;
            }
        }
    }
    if (ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;

const int M_N=200001;

struct UnionFind{
    int par[M_N];
    int rank[M_N];

    void init(int n){
        for(int i=0;i<n;i++){
            par[i]=i;
            rank[i]=0;
        }
    }

    int find(int x){
        if(par[x]==x){
            return x;
        }
        else{
            return par[x]=find(par[x]);
        }
    }

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

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


int main(){
    int N,M;
    cin >> N >> M;
    UnionFind uf;
    uf.init(N);
    int p[N];
    for(int i=0;i<N;i++){
        cin >> p[i];
        p[i]--;
    }
    P t[N];
    for(int i=0;i<M;i++){
        int x,y;
        cin >> x >> y;
        uf.unite(x-1,y-1);
    }
    int ans=0;
    for(int i=0;i<N;i++){
        if(uf.same(p[i],i)) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2944
#include <iostream>
#include <algorithm>
#define rep(i,n) for(int i = 0 ; i < n ; ++i)
#define rep1(i,n) for(int i = 1 ; i <= n ; ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e+9+7;
struct mint{
  ll x;
  mint(ll x=0):x(x%MOD){}
  mint& operator+=(const mint a){
    if((x+=a.x)>=MOD) x-=MOD;
    return *this;
  }
  mint& operator-=(const mint a){
    if((x += MOD-a.x)>=MOD) x-=MOD;
    return *this;
  }
  mint& operator*=(const mint a){
    (x*=a.x)%=MOD;
    return *this;
  }
  mint operator+(const mint a) const{
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const{
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const{
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const{
    if(!t) return 1;
    mint a = pow(t>>1);
    a*=a;
    if(t&1) a*=*this;
    return a;
  }
  
  //for prime mod
  mint inv() const{
    return pow(MOD-2);
  }
  mint& operator/=(const mint a){
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const{
    mint res(*this);
    return res/=a;
  }
};

int n;
ll k;
mint a[2][60][60];
mint dp[2][60][60];
int main()
{
  cin >> n >> k;
  rep(i,n) rep(j,n) cin >> a[0][i][j].x;

  rep(i,n) rep(j,n){
    a[1][i][j] = 0;
    dp[0][i][j] = ( i==j ? 1 : 0);
    dp[1][i][j] = 0;
  }
  
  
  while(k > 0){
    if(k&1){
      rep(i,n) rep(j,n) rep(l,n) dp[1][i][j] += dp[0][i][l]*a[0][l][j];
      rep(i,n) rep(j,n){
	dp[0][i][j] = dp[1][i][j];
	dp[1][i][j] = 0;
      }
    }
    rep(i,n) rep(j,n) rep(l,n) a[1][i][j] += a[0][i][l]*a[0][l][j];
    rep(i,n) rep(j,n){
      a[0][i][j] = a[1][i][j];
      a[1][i][j] = 0;
    }
    k /= 2;
  }

  mint res = 0;
  rep(i,n) rep(j,n) res += dp[0][i][j];
  cout << res.x << "\n";
  
  return 0;
}


Measured memory_bytes: 892
let arr=readLine()!.split{$0==" "}.map{Int(String($0))!}
var a=arr[0]
var b=arr[1]
var c=arr[2]
var d=arr[3]
 
while(true){
    
    c -= b
    if c <= 0 {
          print("Yes")
          break
      }
    a -= d
    if a <= 0 {
        print("No")
        break
    }
}

Measured memory_bytes: 7776
#include <cstdio>
#include <iostream>
#include <cstring>
#define maxn
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
inline void read(int& x)
{	char c=getchar();x=0;int y=1;
	while(c<'0'||c>'9'){if(c=='-') y=-1;c=getchar();}
	while(c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
	x*=y;
}
bool mk;
char T[5][18];
int main()
{   for(int i=1;i<=2;++i)
		scanf("%s",T[i]+1);
	for(int i=1;i<=3;++i)
		if(T[1][i]!=T[2][3-i+1])
		{	mk=1;break;
		}
	if(!mk) puts("YES");
	else puts("NO");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define IOS ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
#define ff first
#define ss second
#define pb push_back
#define debug(val) cerr << "The Value Of " << #val << " is : " << val << '\n';
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 0x3f3f3f3f;
const ll mininf = -922337203685477;
const ll nax = 0;
ll n, arr[105], ans=0;
vector<ll>v;
	
int main(){
	IOS
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> arr[i];
		ans+=arr[i];
		if(arr[i]%10!=0){
			v.pb(arr[i]);
		}
	}
	if(ans%10!=0){
		cout << ans << '\n';
		return 0;
	}
	else{
		if(v.empty()){
			cout << 0 << '\n';
			return 0;
		}
		sort(v.begin(), v.end());
		if(v[0]>ans) cout << 0 << '\n';
		else cout << ans-v[0] << '\n';
	}
}


Measured memory_bytes: 3628
#include <cmath>
#include <iostream>

using namespace std;
using ll = long long;

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

void solve(ll a, ll b, ll c, ll d) {
  bool pred = abs(a - c) <= d || (abs(a - b) <= d && abs(b - c) <= d);
  cout << (pred ? YES : NO) << endl;
}

int main() {
  ll a;
  cin >> a;
  ll b;
  cin >> b;
  ll c;
  cin >> c;
  ll d;
  cin >> d;
  solve(a, b, c, d);
  return 0;
}


Measured memory_bytes: 256
P = 10**9+7

fact = [1 for _ in range(2000001)]
inv = [1 for _ in range(2000001)]
fact_inv = [1 for _ in range(2000001)]

for i in range(2, 2000001):
    fact[i] = (fact[i-1]*i) % P
    inv[i] = P - (inv[P % i] * (P // i)) % P
    fact_inv[i] = (fact_inv[i-1] * inv[i]) % P

K = int(input())
S = input()
N = K + len(S)
p = 1
ans = 0
for i in range(K+1):
    ans += p * (fact[N] * fact_inv[N-i] * fact_inv[i] % P)
    ans = ans % P
    p *= 25
    p = p % P

print(ans)

Measured memory_bytes: 233756
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll sf[100001],ni[100001],wa[100002];
int main(void){
	ll q,l,r,i,j,cnt,x;
	for(i=2;i<=100000;i++)sf[i]=1,ni[i]=0;
	sf[1]=0;
	for(i=2;i*i<=100000;i++){
		if(sf[i]!=0){
			for(j=i*2;j<=100000;j+=i) sf[j]=0;
		}
	}
	ni[1]=0;
	for(i=3;i<=100000;i+=2){
		x=(i+1)/2;
		if((sf[i]==1&&sf[x]==1)||i==2017) ni[i]=1;
	}
	wa[0]; wa[1]=0;
	for(i=3;i<=100000;i++) wa[i]=wa[i-1]+ni[i];
	cin>>q;
	for(i=0;i<q;i++){
		cin>>l>>r;
		x=wa[r]-wa[l-1];
		cout<<x<<endl;
	}
	return 0;
}

Measured memory_bytes: 2944
#include<stdio.h>
int main()
{
    int a,b,c,d=0,i;
    scanf("%d %d %d",&a,&b,&c);
    for(i=a;i<=b;i++)
    {
       if(c%i==0)
       {
           d+=1;
       }
    }
    printf("%d\n",d);
//1803090


    return 0;
}



Measured memory_bytes: 2060
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  string s,t;
  cin>>s;
  cin>>t;
  int n=s.size();
  int m=t.size();
  bool ans=false;
  for(i=n-m;i>=0;i--){
    bool c=true;
    rep(j,m)
      if(s[i+j]!=t[j] && s[i+j]!='?')c=false;
    if(c){
      rep(j,m)s[i+j]=t[j];
      ans=true;
      break;
    }

  }
  if(ans){
    rep(i,n)
      if(s[i]=='?')cout<<"a";
      else cout<<s[i];
    cout<<endl;
  }else{
    cout<<"UNRESTORABLE"<<endl;
  }
}


Measured memory_bytes: 256
S=input()
from collections import deque
QUE=deque()

for s in S:
    QUE.append(s)

    while len(QUE)>=2 and  QUE[-1]!=QUE[-2]:
        QUE.pop()
        QUE.pop()

print(len(S)-len(QUE))
    

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

int main(){
  int n,i,l,sum;
  cin >> n >> l;
  vector<int> ans(n);
  sum=0;
  for(i=0;i<n;++i){
    ans[i]=l+i;
  }
  sort(ans.begin(),ans.end());
  for(i=0;i<n;++i){
    if(ans[0]<0 && ans[n-1]>=0){
      if(ans[i]!=0){
        sum=sum+ans[i];
      }
    }else if(ans[n-1]<0){
      if(i!=n-1){
        sum=sum+ans[i];
      }
    }else{
      if(i!=0){
        sum=sum+ans[i];
      }
    }
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <vector>
#include <deque>
#include <list>
#include <forward_list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <tuple>
#include <functional>
#include <limits>
#include <utility>
#include <string>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cstring>

// use printf, scanf instead of cout, cin.

using namespace std;

int main()
{
    deque<pair<string, int>> processes1;
    vector<pair<string, int>> processes2;

    int n, q;
    scanf("%d %d", &n, &q);

    for(size_t i(0); i < n; ++i)
    {
        char name[16];
        int time;

        scanf("%s %d", name, &time);

        processes1.emplace_back(name, time);
    }

    int time(0);
    while(!processes1.empty())
    {
        if (processes1.front().second > q)
        {
            time += q;

            processes1.front().second -= q;
            processes1.push_back(processes1.front());
            processes1.pop_front();

            
        }
        else
        {
            time += processes1.front().second;

            processes2.emplace_back(processes1.front().first, time);
            processes1.pop_front();
        }
    }

    for(const auto& process : processes2)
    {
        printf("%s %d\n", process.first.c_str(), process.second);
    }

    return 0;
}

Measured memory_bytes: 7040
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define STRING_LENGTH 100
#define ARRAY_SIZE (STRING_LENGTH + 1)

void solve(char s[ARRAY_SIZE], char t[ARRAY_SIZE]);
int comp(const void *x, const void *y);
int reverse_comp(const void *x, const void *y);


int main()
{
  char s[ARRAY_SIZE], t[ARRAY_SIZE];

  scanf("%s %s", &s, &t);
  solve(s, t);

  return 0;
}

void solve(char s[ARRAY_SIZE], char t[ARRAY_SIZE])
{
  char v[strlen(s) + 1], w[strlen(t) + 1];

  strncpy(v, s, strlen(s));
  v[sizeof(v) - 1] = '\0';
  strncpy(w, t, strlen(t));
  w[sizeof(w) - 1] = '\0';
  qsort(v, sizeof(v)/sizeof(v[0]) - 1, sizeof(v[0]), comp);
  qsort(w, sizeof(w)/sizeof(w[0]) - 1, sizeof(w[0]), reverse_comp);
  
  v[sizeof(v) - 1] = '\0';
  w[sizeof(w) - 1] = '\0';
  
  if (strcmp(v, w) < 0)
    {
      printf("Yes\n");
    }
  else
    {
      printf("No\n");
    }
}
  

int comp(const void *x, const void *y)
{
  return *(char *)x - *(char *)y;
}

int reverse_comp(const void *x, const void *y)
{
  return *(char *)y - *(char *)x;
}


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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main()
{
	int n;cin>>n;
  while(n!=0)
  {
    int i;
    vector<int> dots(n);
    vector<int> mark(n);
    rep(i,n)
    {
      string s;
      cin>>s;
      dots[i]=s.size()-1;
      char back=s[s.size()-1];
      if(back=='+')mark[i]=-1;
      else if(back=='*')mark[i]=-2;
      else mark[i]=back-'0';
    }
    int lmax=-1;
    int lind=0;
    rep(i,n)
    {
      if(dots[i]>lmax)
      {
        lmax=dots[i];
        lind=i;
      }
    }
    while(lmax>0)
    {
      if(mark[lind-1]==-1)
      {
        int now=lind;
        int num=0;
        while(now<dots.size()&&dots[now]==dots[lind-1]+1)
        {
          num+=mark[now];
          mark.erase(mark.begin()+now);
          dots.erase(dots.begin()+now);
        }
        mark[lind-1]=num;
      }
      else if(mark[lind-1]==-2)
      {
        int now=lind;
        int num=1;
        while(now<dots.size()&&dots[now]==dots[lind-1]+1)
        {
          num*=mark[now];
          mark.erase(mark.begin()+now);
          dots.erase(dots.begin()+now);
        }
        mark[lind-1]=num;
      }
      lmax=-1;
      lind=0;
      rep(i,dots.size())
      {
        if(dots[i]>lmax)
        {
          lmax=dots[i];
          lind=i;
        }
      }
    }
    cout<<mark[0]<<endl;
    cin>>n;
  }
}



Measured memory_bytes: 3152
import itertools

n, m, q = map(int, input().split())
abcd = [list(map(int, input().split())) for _ in range(q)]

ml = [i for i in range(1, m+1)]
ans = 0
for i in itertools.combinations_with_replacement(ml, n):
    point = 0
    for a, b, c, d in abcd:
        if i[b-1] - i[a-1] == c:
            point += d
    ans = max(ans, point)

print(ans)


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

int main(){
    ll n,c;
    cin>>n>>c;
    vector<ll>x(n),v(n);
    rep(i,n)cin>>x[i]>>v[i];
    ll now=0;
    vector<ll>suml(n),sumr(n),ansl(n),ansr(n);
    suml[0]=v[0]-(x[0]-now);
    now=x[0];
    for(int i=1; i<n; ++i){
        suml[i]=suml[i-1]+v[i]-(x[i]-now);
        now=x[i];
    }
    now=c;
    sumr[n-1]=v[n-1]-(now-x[n-1]);
    now=x[n-1];
    for(int i=n-2; i>=0; --i){
        sumr[i]=sumr[i+1]+v[i]-(now-x[i]);
        now=x[i];
    }
    ansl[0]=max(0LL,suml[0]);
    for(int i=1; i<n; ++i){
        ansl[i]=max(ansl[i-1],suml[i]);
    }
    ansr[n-1]=max(0LL,sumr[n-1]);
    for(int i=n-2; i>=0; --i){
        ansr[i]=max(ansr[i+1],sumr[i]);
    }
    ll ans=0;
    rep(i,n){
        if(i!=n-1)ans=max({ans,suml[i],sumr[i],suml[i]-x[i]+ansr[i+1]});
        else ans=max({ans,suml[i],sumr[i]});
    }
    rep(i,n){
        if(i!=0)ans=max({ans,suml[i],sumr[i],sumr[i]-(c-x[i])+ansl[i-1]});
        else ans=max({ans,suml[i],sumr[i]});
    }
    cout<<ans<<endl;
}

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

using namespace std;
#ifdef ONLINE_JUDGE
#define cerr if(false)cerr
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#endif

#define int long long
#define ld1 long double
#define faster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL),cout<<setprecision(14);
#define vint vector<int>
#define all(v) (v).begin(), (v).end()
#define pii pair<int,int>
#define pb push_back
#define mm0(X) memset((X), 0, sizeof((X)))
#define mm1(X) memset((X), -1, sizeof((X)))
#define INF (int)1e9
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)
#define endl '\n'
#define vcc vector<char>
#define rep(i,a,b) for(int i=a;i<b;i++)

// if you have no idea just guess the appropriate well-known algo instead of doing nothing -- Benq inspiration
const int mod=998244353;
inline int add(int a,int b){a+=b;if(a>=mod)a-=mod;return a;}
inline int sub(int a,int b){a-=b;if(a<0)a+=mod;return a;}
inline int mul(int a,int b){return (a*1ll*b)%mod;}
inline int powmod(int a,int b){int rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}
inline int inv(int a){return powmod(a,mod-2);}
int gcd(int a,int b){return b?gcd(b,a%b):a;}

const int N=(int)1e6+1;

int vis[N];
void solve(){
    int n; cin >> n;
    set<int> s;
    map<int,int> mp;
    int a[n]; for(int i=0;i<n;i++) {
        cin >> a[i];
        mp[a[i]]++;
        s.insert(a[i]);
    }

    int final=n*(n-1)/2;

    int ans=0;
    set<int> final1;

    for(auto k:mp){
        int tmp=0;
        for(int j=2*k.first;j<=(int)1e6;j+=k.first){
            if(s.find(j)!=s.end()) vis[j]=1;
        }
        if(k.second>=2){
            vis[k.first]=1;
        }
        final-=tmp;
        if(tmp==0 && k.second==1) {
            cerr<<k.first<<" ";
            ans+=k.second;
        }
    }

    int count=0;
    for(int i=0;i<N;i++) if(vis[i]) count++;
    cout<<mp.size()-count<<endl;
}

int32_t main() {
    faster;

#ifndef ONLINE_JUDGE
    READ("input.txt");
    WRITE("output.txt");
    double beg=clock();
#endif

    int t=1;
//    cin>>t;

    while(t--){
        solve();
    }

#ifndef ONLINE_JUDGE
    double endd=clock();
    cout<<endl;
    cerr<<"*** Total time = "<<(endd-beg)/CLOCKS_PER_SEC;
#endif
}


Measured memory_bytes: 32772
import static java.lang.System.*;
import java.util.*;
 
public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int a=sc.nextInt(), b=sc.nextInt(), c=sc.nextInt(), k=sc.nextInt();
		int total = a+b+c;
		int max = max(a,b,c);
		int pow = (int)Math.pow(2,k);
		out.println((total-max)+max*pow);
	}
	
	static int max(int... ar) {
		Arrays.sort(ar);
		return ar[ar.length-1];
	}
}

Measured memory_bytes: 23124
#include <iostream>



using namespace std;


int main()
{
   int bin[18];
   long double bin2[18];
   bin[0]=1;
   bin2[0]=1;
   for(int i=1;i<18;i++){
	   bin[i]=bin[i-1]*2;
	   bin2[i]=bin2[i-1]*0.5;
	   //cout << bin2[i] <<endl;
   }

	int n,k;
	long double P,P_temp,temp;
	cin >> n >> k;

	P=0;
	for(int i=1;i<=n;i++){
		temp=(double)k/i;
		for(int j=0;j<18;j++){
			if(temp<=bin[j]){
				P_temp=bin2[j];
				break;
			}
		}
		P+=P_temp;
	}
	cout.precision(20);
	cout << P/n << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
char S[10];
  int i;
  int a=0,b=0;
  scanf("%s", S);
  for(i=0;i<10;i++){
    if(S[i]=='A'||S[i]=='T'||S[i]=='C'||S[i]=='G'){
      a++;
    }
    else{
      if(a>=b){
      b=a;
      }
      a=0;
    }
  }
  if(a>=b){
      b=a;
      }
  printf("%d", b);
      
    
  return 0;
}

Measured memory_bytes: 128
gets.to_i
a = gets.split.map(&:to_i)
gets.to_i
m = gets.split.map(&:to_i)

arr = [0]
a.each{|i|
  arr += arr.clone.map{|j| j+i}
  arr.uniq!
}

m.each{|num|
  if arr.index(num) == nil then
    puts "no"
  else
    puts "yes"
  end
}

Measured memory_bytes: 8688
#include <iostream>
#include <set>

using namespace std;

char grid[105][105];
int idel[105];
int jdel[105];
int H, W;

bool checki(int ith)
{
    for (int j=0; j<W; j++)
    {
        if (grid[ith][j]=='#')
            return false;
    }
    return true;
}

bool checkj(int jth)
{
    for (int i=0; i<H; i++)
    {
        if (grid[i][jth]=='#')
            return false;
    }
    return true;
}

int main() {
    cin >> H >> W;
    for (int i=0; i<H; i++)
    {
        for (int j=0; j<W; j++)

        {
            cin >> grid[i][j];
        }
    }
    int m = H>W ? H : W;
    for (int i=0; i<m; i++)
    {
        if (checki(i))
        {
            idel[i]=1;
        }
        if (checkj(i))
        {
            jdel[i]=1;
        }
    }

    for (int i=0; i<H; i++)
    {
        for (int j=0; j<W; j++)
        {
            if ( !(idel[i]==1 || jdel[j]==1))
                cout << grid[i][j];
        }
        if (idel[i]!=1)
            cout << "\n";
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		while(true){
			int n = stdIn.nextInt();
			if(n==0){
				return;
			}
			int pr = 0;
			for(int i=0;i<n;i++){
				int lng = stdIn.nextInt();
				lng += stdIn.nextInt();
				lng += stdIn.nextInt();
				int w = stdIn.nextInt();
				if(lng>160||w>25){
					continue;
				}
				else if(lng>140||w>20){
					pr+=1600;
				}
				else if(lng>120||w>15){
					pr+=1400;
				}
				else if(lng>100||w>10){
					pr+=1200;
				}
				else if(lng>80||w>5){
					pr+=1000;
				}
				else if(lng>60||w>2){
					pr+=800;
				}
				else{
					pr+=600;
				}
			}
			System.out.println(pr);
		}
	}
}

Measured memory_bytes: 12000
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;


const long long MOD = 1000000007;

ll cntOne(ll msk){
    ll res=0;
    REP(i, 64){
        res += (msk >> i) & 1;
    }
    return res;
}

void solve(long long N, std::vector<std::vector<long long>> a){
    vector<vll> dp(N+1, vll(1LL<<N, 0));
    dp[0][0] = 1;
    REP(i, N){
        REP(msk, 1LL<<N){
            if(__builtin_popcount(msk) == i+1){
                REP(j, N){
                    if(a[i][j] && ((msk >> j) & 1)){
                        dp[i+1][msk]+= dp[i][msk&(~(1LL<<j))];
                    }
                    dp[i+1][msk] %= MOD;
                }
            }
        }
    }
    cout << dp[N][(1LL<<N)-1]<<endl;
    return;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<std::vector<long long>> a(N, std::vector<long long>(N));
    for(int i = 0 ; i < N ; i++){
        for(int j = 0 ; j < N ; j++){
            scanf("%lld",&a[i][j]);
        }
    }
    solve(N, std::move(a));
    return 0;
}


Measured memory_bytes: 377216
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;


int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n; cin >> n;
	vector<int> arr(n);
	long long sum = 0;
	long long sumo = 0;
	for (int i = 0; i < n; ++i) {
		cin >> arr[i];
		sum += arr[i];
		if (i % 2 != 0) sumo += arr[i];
	}

	long long x1 = sum - 2 * sumo;
	cout << x1 << " ";

	for (int i = 1; i < n; ++i) {
		x1 = 2 * arr[i - 1] - x1;
		cout << x1 << " ";
	}
	cout << "\n";
	
	
	return 0;
}

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

#define CON_MAX 51

int main() {

	long long int con[ CON_MAX ][ CON_MAX ];
	for ( long long int i = 0; i < CON_MAX; i++ ) {
		con[0][i] = 1;
		for ( long long int j = 1; j < CON_MAX; j++ ) {
			con[j][i] = con[j-1][i] * ( i - j + 1 ) / j;
		}
	}

  long long int n, a, b;
  cin >> n >> a >> b;

  vector< long long int > v;

  for ( long long int i = 0; i < n; i++ ) {

    long long int in;
    cin >> in;
    v.push_back( in );

  }

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

  long long int av = 0;
  for ( long long int i = 0; i < a; i++ ) {
    av += v[ v.size() - 1 - i ];
  }
  long double ave = 1.00;
  ave *= av;
  ave /= a;
  cout << fixed << setprecision(10) << ave << endl;


  long long int ans = 0;

  for ( long long int k = a; k <= b; k++ ) {

    long long int avk = 0;
    for ( long long int i = 0; i < k; i++ ) {
      avk += v[ v.size() - 1 - i ];
    }
    if ( avk * a != av * k ) break;

    long long int mi = v[ v.size() - k ];
    long long int cnt = 0;
    long long int ma = 0;
    for ( long long int i = 0; i < n; i++ ) {
      if ( v[i] == mi ) {
	cnt++;
	ma = i;
      }
    }

    ans += con[ ma - ( v.size() - k ) + 1 ][cnt];

  }

  cout << ans << endl;

  return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define MKP make_pair
#define int ll
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef tuple<int,int,int> tpiii;

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

int fpow(int a,int b,int m)
{
	if(b==0) return 1;
	if(b==1) return a;
	int tmp=fpow(a,b/2,m);
	if(b%2) return a*tmp%m*tmp%m;
	return tmp*tmp%m;
}

struct Case
{
	int i,j,k,s;
	Case(int ni,int nj,int nk,int ns)
	{
		i=ni; j=nj; k=nk; s=ns;
	}
};

struct cmp2
{
	bool operator() (Case a,Case b)
	{
		return a.s<b.s;
	}
};

bool cmp(int a,int b) { return a>b; }

int32_t main()
{
	//ios::sync_with_stdio(false);
	//cin.tie(0);
	
	int x,y,z,lim; cin>>x>>y>>z>>lim;
	vector<int> a(x),b(y),c(z);
	For(i,0,x-1) cin>>a[i];
	For(i,0,y-1) cin>>b[i];
	For(i,0,z-1) cin>>c[i];
	sort(all(a),cmp);
	sort(all(b),cmp);
	sort(all(c),cmp);
	
	//priority_queue<int> pq;
	priority_queue<Case,vector<Case>,cmp2> que;
	set<tpiii> app;
	int cnt=0;
	que.emplace(0,0,0,a[0]+b[0]+c[0]);
	while(cnt<lim)
	{
		Case ca=que.top(); que.pop();
		tpiii tp=make_tuple(ca.i,ca.j,ca.k);
		if(app.count(tp)) continue;
		else app.insert(tp);
		cout<<ca.s<<"\n";
		cnt++;
		if(ca.i<x-1) que.emplace(ca.i+1,ca.j,ca.k,ca.s-a[ca.i]+a[ca.i+1]);
		if(ca.j<y-1) que.emplace(ca.i,ca.j+1,ca.k,ca.s-b[ca.j]+b[ca.j+1]);
		if(ca.k<z-1) que.emplace(ca.i,ca.j,ca.k+1,ca.s-c[ca.k]+c[ca.k+1]);
	}
	return 0;
}




















Measured memory_bytes: 768
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;

constexpr auto M = 1000000007;

main() {
    int64_t n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;

    vector<vector<int64_t>> combi(n + 1);
    combi[0].resize(1, 1);
    for (auto i : irange(1L, n + 1)) {
        combi[i].resize(i + 1);
        combi[i][0] = 1;
        combi[i][i] = 1;
        for (auto j : irange(1L, i)) {
            combi[i][j] = combi[i - 1][j - 1] + combi[i - 1][j];
            combi[i][j] %= M;
        }
    }

    // K人を全てのグループがi人以下であるようにグループ分けする数 = dp[i][K]
    vector<vector<int64_t>> dp(b + 1, vector<int64_t>(n + 1));
    dp[0][0] = 1;
    for (auto i : irange(0L, a)) {
        dp[i][0] = 1;
    }
    // k人からg個のi人のグループを作る数 = dp2[k][g]
    vector<vector<int64_t>> dp2(n + 1, vector<int64_t>(n));
    for (auto i : irange(a, b + 1)) {
        dp[i][0] = 1;
        dp2[0][0] = 1;
        for (auto k : irange(1L, n + 1)) {
            dp2[k][0] = 1;
            dp[i][k] = dp[i - 1][k];
            // i人ちょうどのグループがg個あるとする
            for (auto g = 1L; g < c; ++g) {
                if (k < i) {
                    dp2[k][g] = 0;
                } else {
                    dp2[k][g] = (((i * g <= k - 1) ? dp2[k - 1][g] : 0) +
                             (dp2[k - i][g - 1] * combi[k - 1][i - 1]) % M) %
                            M;
                }
            }
            for (auto g = c; i * g <= k && g <= d; ++g) {
                dp2[k][g] = (((i * g <= k - 1) ? dp2[k - 1][g] : 0) +
                             (dp2[k - i][g - 1] * combi[k - 1][i - 1]) % M) %
                            M;
                dp[i][k] += (dp2[k][g] * dp[i - 1][k - g * i]) % M;
                dp[i][k] %= M;
            }
        }
    }

    for (auto i : irange(0L, b + 1)) {
        for (auto j : irange(0L, n + 1)) {
            // cerr << i << "," << j << ":" << dp[i][j] << "\n";
        }
    }

    cout << dp[b][n] << endl;
}


Measured memory_bytes: 19968
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

int main()
{
	string p;
	string s; 
	int judge = 0;
	
	cin >> p >> s;
	
	p += p;

	for (int j = 0; j < p.size()-s.size(); j++) {
		if (s == p.substr(j, s.size())) {
			judge = 1;
		}			
	}

	if (judge == 1) {
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	
	return 0;

}


Measured memory_bytes: 3228
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,c=0;
    string s;
    cin>>n>>s;
    for(i=0;i<s.size();i++)
    {
        if(s.substr(i,3)=="ABC")
            c++;
    }
    cout<<c<<endl;
}


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

using namespace std;

vector<long long> divisors(long long n) {
    vector<long long> res;
    for(long long i = 1; i * i <= n; ++i) {
        if(n % i != 0) continue;
        res.push_back(i);
        if(n / i == i) continue;
        res.push_back(n / i);
    }
    sort(res.begin(), res.end());
    return res;
}

int main(){
	long long N, P, ans = 0; cin >> N >> P;
	vector<long long> div = divisors(P);
	for(long long i = 0; i < (long long)div.size(); ++i){
		for(long long j = 0; j < (long long)div.size(); ++j){
			if((long long)pow(div[i], N) == P / div[j]) ans = max(ans, div[i]);
		}
	}
	cout << ans << endl;
}

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

int main(){
    vector<int> prime(60000, 1);
    prime[0] = 0;prime[1] = 0;
    for(int i = 2; i < 300; i++){
        if(prime[i] == 1){
            for(int l = 2 * i; l < 60000; l += i){
                prime[l] = 0;
            }
        }
    }
    for(int i = 2; i < 60000; i++){
        if(prime[i] == 1 && i % 5 != 1){
            prime[i] = 0;
        }
    }
    int n; cin >> n;
    while(1){
        int f = 0;
        for(int i = 11; i < 55555; i++){
            if(prime[i] == 1){
                cout << i << ' ';
                n--;
            }
            if(n == 0){
                f = 1;
                break;
            }
        }
        if(f == 1){
            break;
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 512
#line 1 "template.cpp"
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

int main() {
  int a, b, k;
  cin >> a >> b >> k;
  FOR(i, a, a + k) {
    if (i >= 0 && i <= b)
      cout << i << endl;
  }
  FOR(i, b - k + 1, b + 1) {
    if (i >= 0 && a + k <= i && i <= b) {
      cout << i << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <cmath>
#include <limits>
using namespace std;
int main() {
  double n, d;
  double ans = 0;
  cin >> n >> d;
  vector<double> x(n), y(n);
  for (int i=0; i<n; i++) {
    cin >> x[i] >> y[i];
    if (sqrt(x[i]*x[i]+y[i]*y[i]) <= d) ans++;
  }
  cout << ans << endl;

}

Measured memory_bytes: 6144
while 1:
	try:
		h=[input() for i in [1]*5]
		l=set(h)
		if 1 in l and 2 in l:w=1
		elif 1 in l and 3 in l:w=3
		else:w=2
		if len(l)!=2:
			for i in h:print 3
		else:
			for i in h:print 1 if i==w else 2
	except:break

Measured memory_bytes: 4216
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    vector<int> a(3);
    for (int i = 0; i < 3; i++) {
        cin >> a[i];
    }
    SORT(a);
    pr(a[0]+a[1]);
}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			String s = sc.next();

			Map<String, Integer> map = new HashMap<String, Integer>();
			for (int i = 0; i < 4; i++) {
				String tmp = s.substring(i, i + 1);
				if(map.containsKey(tmp)) {
					map.put(tmp, map.get(tmp) + 1);
				} else {
					map.put(tmp, 1);
				}
			}

			if (map.keySet().size() != 2) {
				System.out.println("No");
				return;
			}
			for (String key : map.keySet()) {
				if(map.get(key) != 2) {
					System.out.println("No");
					return;
				}
			}
			System.out.println("Yes");
		}
	}
}


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

const double PI = 3.14159265358979323846;

int main(){
  int a,b,h,m;
  cin >> a >> b >> h >> m;
  double x_a = PI*h/6.0 + PI*m/360.0;
  double x_b = PI*m/30.0;
  double x = fabs(x_a-x_b);
  double ans = sqrt(pow(a,2)+pow(b,2)-2*a*b*cos(x));
  printf("%.20f\n",ans);
  return 0;
}

Measured memory_bytes: 4164
N = int(input())
XYUs = [list(map(str,input().split())) for _ in range(N)]

for i in range(len(XYUs)):
    XYUs[i][0] = int(XYUs[i][0])
    XYUs[i][1] = int(XYUs[i][1])


def check_the_conflict(XYUs):
    slopes = [[] for _ in range(400001)]
    for XYU in XYUs:
        if XYU[2] == "R" or XYU[2] == "D":       
            slopes[int(XYU[1])-int(XYU[0])+200000].append([int(XYU[0]),XYU[2]])    
    return slopes

def rotate_matrix(XYUs):
    converted = []
    for XYU in XYUs:
        if XYU[2] == "R":
            direction = "D"
        elif XYU[2] == "D":
            direction = "L"
        elif XYU[2] == "L":
            direction = "U"
        elif XYU[2] == "U":
            direction = "R"
        converted.append([XYU[1], 200000-XYU[0], direction])
    return converted
    
min_val = int(1e+10)

for i in range(4):
    if i > 0:
        XYUs = rotate_matrix(XYUs)
    slopes = check_the_conflict(XYUs)
    for slope in slopes:
        now_R = -int(1e+10)
        slope = sorted(slope)
        for airplane in slope:
            if airplane[1] == "R":
                now_R = airplane[0]
            elif airplane[1] == "D":
                candidate = (airplane[0] - now_R)*10
                if candidate < min_val:
                    min_val = candidate
    if i in [0,1]:
        rows = [[] for _ in range(200001)]
        for XYU in XYUs:
            rows[XYU[0]].append([XYU[1],XYU[2]])
        for row in rows:
            now_U = -int(1e+10)
            row = sorted(row)
            for airplane in row:
                if airplane[1] == "U":
                    now_U = airplane[0]
                elif airplane[1] == "D":
                    candidate = (airplane[0] - now_U)*5
                    if candidate < min_val:
                        min_val = candidate
if min_val < 3000000:
    print(min_val)
else:
    print("SAFE")

Measured memory_bytes: 369816
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    int n,x,s=0;
    cin>>n;
    vector<int>v;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        s+=x;
        v.push_back(x);
    }
    x=s/n;
    int y=x-1,z=x+1;
    int s1=0,s2=0,s3=0;
    for(int i=0;i<n;i++)
    {
        s1+=(v[i]-x)*(v[i]-x);
        s2+=(v[i]-y)*(v[i]-y);
        s3+=(v[i]-z)*(v[i]-z);
    }
    cout<<min(s1,min(s2,s3))<<endl;
    return 0;
}


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

using namespace std;

#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(i, a, b) for(int i = (a); i < (b); i++)

typedef long long ll;

const int maxn = 1e5 + 5;

ll x, y;

int main(int argc, char* argv[]) {
    if (argc > 1) {
        freopen(argv[1], "r", stdin);
    }
    
    cin >> x >> y;

    int ans = 0;

    for (ll i = x; i <= min(y, x + 10000ll); i++) {
        ll cur = i;
        
        int cnt = 1;
        while (cur * 2ll <= y) {
            cur = cur * 2ll;
            cnt++;
        }
        ans = max(ans, cnt);
    }

    cout << ans;

    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
static const int N = 100;

int Selection_Sort(int a[], int n)
{
    int sw = 0;
    for (int i = 0; i < n; i++)
    {
        int minv = i;
        for (int j = i; j < n; j++)
        {
            if (a[j] < a[minv])
                minv = j;
        }
        if (minv != i)
        {
            int tmp = a[i];
            a[i] = a[minv];
            a[minv] = tmp;
            sw ++;
        }

    }
    return sw;
}
int main()
{
    int n;
    int a[N];

    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
    }
    int sw = Selection_Sort(a, n);
    for (int i = 0; i < n; i++)
    {
        if (i > 0) printf(" ");
        printf("%d", a[i]);
    }
    printf("\n%d\n", sw);

    return 0;
}



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

int main(){
    int n;
    int v[100010];
    int dp[100010];
    cin >> n;
    for (int i = 1; i <= n; i++){
        cin >> v[i];
    }

    for (int i = 1; i <= n; i++){
        dp[v[i]] = i;
    }

    for (int i = 1; i <= n; i++){
        cout << dp[i] << " ";
        
    }
}

Measured memory_bytes: 1536
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll n;
  cin>>n;
  
  ll ans=1e12+7;
  for(ll i=1;i*i<=n;i++){
    if(n%i==0){
      ans=min(ans,i+n/i);
    }
  }
  
  cout<<ans-2<<endl;
  
  return 0;
}

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

#define ll long long
#define ar array

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

    int a,b;
    cin >> a>> b;
  	for (int i =1 ; i<1e4;++i){
          int x = i*8/100,y = i*10/100;
          if(x==a&&y==b){
              cout << i ;
              return 0;
          } 
      }
    cout << -1;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long
const int INF = 1LL << 60;

signed main(){

  int n; cin >> n;
  vector<double> x(n), y(n);
  for(int i = 0; i < n; i++){
    cin >> x[i] >> y[i];
  }

  vector<int> order(n);
  iota(order.begin(),order.end(),0);

  double ans = 0;
  do{
    double res = 0;
    for(int i = 0; i < n-1; i++){
      int u = order[i], v = order[i+1];
      res += sqrt( (x[u] - x[v]) * (x[u] - x[v]) + (y[u] - y[v])  * (y[u] - y[v]) );
    }
    ans += res;
  }while(next_permutation(order.begin(),order.end()));

  int t = 1, r = 1;
  while(n--) t *= r++;
  //cout << (double)ans / t << endl;
  printf("%.7f\n",(double)ans / t);

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int L = Integer.parseInt(sc.next());
		double edge = L / 3.0;
		double ans = edge * edge * edge;
		System.out.printf("%.12f\n", ans);
	}

}


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

int main() {
    ll X, K, D;
    cin >> X >> K >> D;

    ll Xa = abs(X);
    if (Xa / D >= K) {
        if (X >= 0) cout << abs(X - K * D) << endl;
        else       cout << abs(X + K * D) << endl;
        return 0;
    }

    if ((Xa / D) % 2 == K % 2) {
        if (X >= 0) cout << abs(X - (Xa / D) * D) << endl;
        else        cout << abs(X + (Xa / D) * D) << endl;
    } else {
        if (X >= 0) cout << abs(X - (Xa / D + 1) * D) << endl;
        else        cout << abs(X + (Xa / D + 1) * D) << endl;

    }
    
    return 0;
}


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

namespace program
{
    class Program
    {
        static void Main()
        {
            int a = Input.ScanInt();
          int b = Input.ScanInt();
          int h = Input.ScanInt();
          Console.WriteLine((a+b)*h/2);
        }
    }

    static class Input
    {
        static public int ScanInt() { return int.Parse(Console.ReadLine()); }
        static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
        static public long ScanLong() { return long.Parse(Console.ReadLine()); }
        static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
        static public int[] ScanIntArray() { return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); }
        static public uint[] ScanUintArray() { return Console.ReadLine().Split(' ').Select(x => uint.Parse(x)).ToArray(); }
        static public long[] ScanLongArray() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray(); }
        static public ulong[] ScanUlongArray() { return Console.ReadLine().Split(' ').Select(x => ulong.Parse(x)).ToArray(); }

        static public string ScanStr() { return Console.ReadLine(); }
        static public string[] ScanStrArray() { return ScanStr().Split(' '); }
    }

    static class MyMath
    {
        public static int GCD(int a, int b)
        {
            Func<int, int, int> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static ulong GCD(ulong a, ulong b)
        {
            Func<ulong, ulong, ulong> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static int LCM(int a, int b)
        {
            return a * b / GCD(a, b);
        }
        public static ulong LCM(ulong a, ulong b)
        {
            return a * b / GCD(a, b);
        }
    }
}


Measured memory_bytes: 11092
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int[] nums = new int[10];
		
		while(sc.hasNext()){
			String s = sc.next();
		
			for(int i=0; i<10; i++)
				nums[i] = Integer.parseInt("" + s.charAt(i));
			
			for(int i=0; i<9; i++){
				for(int j=0; j<9-i;	j++){
					nums[j] = (nums[j] + nums[j+1])%10;	
				}
			}
		
			System.out.println(nums[0]);
		}
	
	}
}

Measured memory_bytes: 17148
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

vector<vector<int>> to;

void dfs(int v, vi& dist, int p=-1) {
    for (int i = 0; i < to[v].size(); ++i) {
        int nv = to[v][i];
        if (nv == p) continue;
        dist[nv] += dist[v] + 1;
        dfs(nv, dist, v);
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    to.resize(n);
    rep(i, n-1) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }

    vector<int> dist1(n);
    vector<int> dist2(n);
    dist1[0] = 0;
    dfs(0, dist1);
    dist2[n-1] = 0;
    dfs(n-1, dist2);

    int f_cnt = 0, s_cnt = 0;
    rep(i, n) {
        if (dist1[i] <= dist2[i]) f_cnt++;
        else s_cnt++;
    }

    if (f_cnt > s_cnt) cout << "Fennec" << endl;
    else cout << "Snuke" << endl; 

}

Measured memory_bytes: 12800
n = int(input())
p = [int(input()) for i in range(n)]
p_max = p[0]
for j in range(1, n):
    if p[j] >= p_max:
        p_max = p[j]
for k in range(n):
    if p[k] == p_max:
        p[k] = int(p[k] / 2)
        break
print(sum(p))



Measured memory_bytes: 3060
import itertools

N = int(input())
P = map(int,input().split())
Q = map(int, input().split())
listX = []
for x in range(N):
    listX.append(x+1)

tupleP = tuple(P)
tupleQ = tuple(Q)

per = itertools.permutations(listX)
count = 0
countP = 0
countQ = 0

for x in itertools.permutations(listX):
    if x == tupleP:
        countP=count
    if x == tupleQ:
        countQ=count
    count += 1

print(abs(countP-countQ))

Measured memory_bytes: 3064