akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>

int main(int argc, const char * argv[]) {
    int a=0, b=0;
    char str[1001];
    char req[8];    //replace, reverse, printのどれかが入る
    char rep[1001]; //replace用
    char ptr;       //reverce用
    int q=0;
    
    scanf("%s", str);
    scanf("%d", &q);

    
    for (int i=0; i<q; i++) {
        scanf("%s %d %d", req, &a, &b);
        if (strcmp(req, "replace") == 0) {
            scanf("%s", rep);
            for (int j=0; j<(b-a+1); j++) {
                str[a+j] = rep[j];
            }
        }else if (strcmp(req, "reverse") == 0) {
            
            for (int j=0; j<(b-a+1)/2; j++) {
                ptr = str[a+j];
                str[a+j] = str[b-j];
                str[b-j] = ptr;
            }
            
            
        }else if (strcmp(req, "print") == 0) {
            for (int j=0; j<(b-a+1); j++) {
                printf("%c", str[a+j]);
            }
            printf("\n");
        }
    }
    
    return 0;
}


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

const ll INF = 0x3f3f3f3f3f3f3f3f, MAX_N = 500;
ll memo[MAX_N][MAX_N];
ll a[MAX_N];
int N;
ll ps[MAX_N]; //prefix sum [0,i)

ll dp(int i, int j)
{
	if(i>=j) return 0;
	ll& res = memo[i][j];
	if(res != -1) return res;
	res = INF;
	for(int k=i; k<=j;++k){
		res = min(res, dp(i,k)+dp(k+1,j));
	}
	res += ps[j+1]-ps[i];
	return res;
}

void solve()
{
	for(int i=0;i<N;++i) ps[i+1]=ps[i]+a[i];
	memset(memo, -1, sizeof(memo));
	cout << dp(0, N-1) << endl;
}

int main()
{
	cin >> N;
	for(int i=0;i<N;++i)cin >> a[i];
	solve();
	return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define ll long long 
#pragma GCC optimize("Ofast", "unroll-loops")
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1; i>=0; i--)
#define pii pair<int,int>
#define SZ(x) x.size()
#define ALL(x) x.begin(), x.end()
#define ull unsigned ll 
#define pb push_back
#define f first 
#define s second
using namespace std;
/*int main (){
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	int n; cin>>n;
	stringstream ss;
	ss<<n;
	string str;
	ss>>str;
	double siz=str.size();
	ll sum=0;
	if (siz==1) cout<<n<<endl;
	else {
	RREP(i,siz-1){
		if ((i+1)%2) sum+=(pow(10,i)*9);
	}
	int last=pow(10,siz-1);
	int si=siz;
	if (si%2) sum+=n-(((int)str[0]-48)*last)+1;
	cout<<sum<<'\n';
}	

}
*/
int main (){
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	int n; cin>>n;
	int sum=0;
	FOR (i,1,n+1){
		stringstream ss;
		ss<<i;
		string str;
		ss>>str;
		int siz=str.size();
		if (siz%2==1) sum++;
	}
	cout<<sum<<endl;
}	


Measured memory_bytes: 256
#include<bits/stdc++.h>
namespace ZDY{
    #pragma GCC optimize(3)
    #define il __inline__ __attribute__ ((always_inline))
    #define rg register
    #define ll long long
    #define ull unsigned long long
    #define db double
    #define sht short
    #define MB template <class T>il
    #define Fur(i,x,y) for(int i=x;i<=y;++i)
    #define Fdr(i,x,y) for(int i=x;i>=y;--i)
    #define fl(i,x) for(int i=head[x],to;to=e[i].to,i;i=e[i].nxt)
    #define clr(x,y) memset(x,y,sizeof(x))
    #define cpy(x,y) memcpy(x,y,sizeof(x))
    #define fin(s) freopen(s".in","r",stdin)
    #define fout(s) freopen(s".out","w",stdout)
    #define fcin ios::sync_with_stdio(false)
    #define l2(n) (int(log2(n)))
    #define inf 0x3f3f3f3f
    MB T ABS(T x){return x>0?x:-x;}
    MB T MAX(T x,T y){return x>y?x:y;}
    MB T MIN(T x,T y){return x<y?x:y;}
    MB T GCD(T x,T y){return y?GCD(y,x%y):x;}
    MB void SWAP(T &x,T &y){T t=x;x=y;y=t;}
}using namespace ZDY;using namespace std;
namespace IO{const char* ln="\n";const int str=1<<20;struct IN{char buf[str],*s,*t;bool _;IN():s(buf),t(buf),_(0){}il char gc(){return s==t&&((t=(s=buf)+fread(buf,1,str,stdin))==s)?EOF:(*s++);}IN&operator>>(char&ch){if(_)return *this;char c;while((c=gc())!=EOF&&isspace(c));if(c==EOF)_=1;else ch=c;return *this;}IN& operator>>(char* ch){clr(ch,0);if(_)return *this;char c;while((c=gc())!=EOF&&isspace(c));if(c==EOF)return _=1,*this;*ch=c;ch++;while((c=gc())!=EOF&&!isspace(c))*ch=c,ch++;if(c==EOF)_=1;return *this;}IN& operator>>(string& ch){if(_)return *this;char c;while((c=gc())!=EOF&&isspace(c));if(c==EOF)return _=1,*this;ch+=c;while((c=gc())!=EOF&&!isspace(c))ch+=c;if(c==EOF)_=1;return *this;}template<typename T>IN&operator>>(T&x){if(_)return *this;char c=gc();bool ff=0;while(c!=EOF&&(c<'0'||c>'9'))ff^=(c=='-'),c=gc();if(c==EOF){_=1;return *this;}x=0;while(c!=EOF&&'0'<=c&&c<='9')x=(x<<3)+(x<<1)+c-48,c=gc();if(c==EOF)_=1;if(ff)x=-x;return *this;}}in;struct OUT{char buf[str],*s,*t;OUT():s(buf),t(buf+str){}~OUT(){fwrite(buf,1,s-buf,stdout);}void pt(char c){(s==t)?(fwrite(s=buf,1,str,stdout),*s++=c):(*s++=c);}OUT&operator<<(const char*s){while(*s)pt(*s++);return *this;}OUT&operator<<(char*s){while(*s)pt(*s++);return *this;}OUT&operator<<(string s){for(int i=0;s[i];i++)pt(s[i]);return *this;}template<typename T>OUT&operator<<(T x){if(!x)return pt('0'),*this;if(x<0)pt('-'),x=-x;char a[30],t=0;while(x)a[t++]=x%10,x/=10;while(t--)pt(a[t]+'0');return *this;}}out;}using namespace IO;
#define N 1011
int n,m,a[N],b[N];
int f[1<<13];
int main(){
    in>>n>>m;
    Fur(i,1,m){
        int k,v;
        in>>a[i]>>k;
        int x=0,y;
        while(k--)in>>y,x|=(1<<(y-1));
        b[i]=x;
    }
    Fur(i,0,(1<<13)-1)f[i]=inf;
    f[0]=0;
    Fur(i,0,(1<<13)-1){
        Fur(j,1,m){
            int x=i|b[j];
            f[x]=MIN(f[x],f[i]+a[j]);
        }
    }
    if(f[(1<<n)-1]==inf)out<<"-1\n";
    else out<<f[(1<<n)-1]<<ln;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF LLONG_MAX
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define lower_bound lowb
#define upper_bound upb
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a*b/gcd(a,b);};
int mod(int a,int b){return (a+b-1)/b;};
int month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};



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

	int a;
	string s;
	cin >> a >> s;
	if(a >= 3200) cout << s << endl;
	else cout << "red" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>

int main() {
  std::vector<int> nums(3);
  for (auto& num : nums)
    std::cin >> num;
  std::sort(nums.begin(), nums.end());
  int sum = nums[2] - nums[0] + nums[2] - nums[1];
  if (sum % 2 == 0) {
    std::cout << sum / 2 << std::endl;
  } else {
    std::cout << (sum + 1) / 2 + 1 << std::endl;
  }
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class ABC
	{
		private const int mod = 1000000007;  // 10^9+7

		static void Main(string[] args)
		{
			//System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); stopwatch.Start();
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			//string s = Console.ReadLine();
			int n = int.Parse(Console.ReadLine());
			//long x = long.Parse(Console.ReadLine());
			//int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();
			Dictionary<int, int> memo = new Dictionary<int, int>();
			int ans = 0;
			for (int i = 1; i <= n; i++) {
				for (int j = 1; j <= n; j++) {
					for (int k = 1; k <= n; k++) {
						int a, b, c;
						if (i < j && i < k) {
							a = i;
							b = Math.Min(j, k);
							c = Math.Max(j, k);
						} else if (j < i && j < k) {
							a = j;
							b = Math.Min(i, k);
							c = Math.Max(i, k);
						} else {
							a = k;
							b = Math.Min(i, j);
							c = Math.Max(i, j);
						}
						int key = a * 1000000 + b * 1000 + c;
						if (!memo.ContainsKey(key)) {
							int gcd = (int)GCD(a, GCD(b, c));
							memo.Add(key, gcd);
						} else {
						}
						ans += memo[key];
					}
				}
			}
			Console.WriteLine(ans);


			Console.Out.Flush();
			//System.Diagnostics.Debug.WriteLine(stopwatch.Elapsed);
		}

		#region 最大公約数 long GCD(long a, long b)
		public static long GCD(long a, long b)
		{
			if (b == 0) { return a; }

			long tmp = a % b;
			while (tmp != 0) {
				a = b;
				b = tmp;
				tmp = a % b;
			}
			return b;
		}
		#endregion

	}
}


Measured memory_bytes: 80428
#include <cstdio>
#include <algorithm>
using namespace std;
int f[105][11];
int p[105][11];
int state[105];
int n;
int ans=0x80000000;
void dfs(int step, int c){
	int i, j, k;
	if(step>10){
		if(!c)
			return;
		j=0;
		for(i=1; i<=n; i++)
			j+=p[i][state[i]];
		ans=max(ans, j);
		return;
	}
	dfs(step+1, c);
	for(i=1; i<=n; i++)
		state[i]+=f[i][step];
	dfs(step+1, c+1);
	for(i=1; i<=n; i++)
		state[i]-=f[i][step];
}
int main(){
	int i, j;
	
	scanf("%d", &n);
	for(i=1; i<=n; i++)
		for(j=1; j<=10; j++)
			scanf("%d", &f[i][j]);
	for(i=1; i<=n; i++)
		for(j=0; j<=10; j++)
			scanf("%d", &p[i][j]);
			
	dfs(1, 0);
	printf("%d", ans);
	return 0;
} 

Measured memory_bytes: 888
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		long N = stdIn.nextLong();
		int K = stdIn.nextInt();
		int ans = 1;
		for(;;){
			if(N < K){
				break;
			}
			N /= K;
			ans++;
		}
		System.out.println(ans);
		stdIn.close();
	}
}

Measured memory_bytes: 35720
struct T{int a,b;}A[3333];long P[3333],M=1e9+7,F[2<<17],I[2<<17];i,j,k,t;
c(a,b)struct T*a,*b;{t=a->a-b->a?:a->b-b->b;}
p(a,b){return b?p(a%M*a%M,b/2)%M*(b%2?a:1)%M:1;}
f(a,b){return F[a+b]*I[a]%M*I[b]%M;}
main(s)
{
	for(*F=*I=1;++k<2<<17;)I[k]=p(F[k]=F[k-1]*k%M,M-2);
	for(k=A;~scanf("%d",k);k+=4)i++-1||gets(P);
	for(qsort(A,i/=2,8,c);j<i;j++)
		for(P[k=j]=f(s=A[j].a-=1,t=A[j].b-=1);k--;)t>=A[k].b?P[j]=(P[j]-f(s-A[k].a,t-A[k].b)*P[k]%M+M)%M:0;
	printf("%d",P[i-1]);
}

Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_138
{
    class E
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            string s = Read();
            string t = Read();
            List<int>[] poses = new List<int>[26];
            for (int i = 0; i < 26; i++) poses[i] = new List<int>();
            for(int i = 0; i < s.Length; i++)
            {
                poses[s[i] - 'a'].Add(i);
            }
            for (int i = 0; i < t.Length; i++)
            {
                if (poses[t[i] - 'a'].Count == 0)
                {
                    WriteLine(-1);
                    return;
                }
            }
            for (int i = 0; i < 26; i++) poses[i].Add(s.Length + 10);
            long res = 0;
            int pos = -1;
            for(int i = 0; i < t.Length; i++)
            {
                int bottom = -1;
                int c = t[i] - 'a';
                int top = poses[c].Count-1;
                while (bottom + 1 < top)
                {
                    int mid = (bottom + top + 1) / 2;
                    if (pos < poses[c][mid]) top = mid;
                    else bottom = mid;
                }
                if (top == poses[c].Count-1)
                {
                    res += s.Length - pos;
                    res += poses[c][0];
                    pos = poses[c][0];
                }
                else
                {
                    res += poses[c][top] - pos;
                    pos = poses[c][top];
                }
            }
            WriteLine(res);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 13268
#include <iostream>
#include <math.h>
using namespace std;

int main()
{
    int A, B;
    cin >> A >> B;
    if (A >= 13) {
        cout << B << endl;
    }
    else if (A >= 6) {
        cout << B / 2 << endl;
    }
    else {
        cout << 0 << endl;
    }

    return 0;
}


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

int main(){
	int k,n;
	cin>>k>>n;
	for(int i=1;i<=n;i++){
		int x;
		cin>>x;
		k-=x;
	}
	if(k<0){
		cout<<-1<<endl;
	}else{
		cout<<k<<endl;
	}
}


Measured memory_bytes: 3620
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string>
#include<cctype>
#include<math.h>
using namespace std;

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

Measured memory_bytes: 1164
#include<iostream>
#include<map>
using namespace std;
int main()
{
    map<long long,long long>m;
    long long n,i,x,f=0;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>x;
        m[x]++;
        if(m[x]>1)
        {
            f++;
        }
    }
    if(f>0)
    {
        cout<<"NO"<<endl;
    }
    else
    {
        cout<<"YES"<<endl;
    }
    return 0;
}

Measured memory_bytes: 16076
import sys

readline = sys.stdin.readline

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
        self.rank = [0] * n
    
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return
        
        if self.rank[x] < self.rank[y]:
            self.parents[x] = y
        else:
            self.parents[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

def main():
    N, M = map(int, readline().split())
    nodelist = []
    for _ in range(M):
        a, b = map(int, readline().split())
        a -= 1; b -= 1
        nodelist.append([a, b])

    ans = 0
    for i in range(M):
        uf = UnionFind(N)
        for j, node in enumerate(nodelist):
            if j == i:
                continue
            uf.union(node[0], node[1])
        parent = []
        for k in range(N):
            parent.append(uf.find(k))
        if len(set(parent)) > 1:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<array>
#include<algorithm>

int const INF = 1e9;

int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  int D; std::cin >> D;
  int c[26];
  for(int& ci: c) std::cin >> ci;
  std::vector<std::array<int,26>> s(D);
  for(int d = 0; d < D; ++d) {
    for(int& si: s[d]) std::cin >> si;
  }

  int ans = 0;

  int last[26];
  std::fill_n(last, 26, -1);
  for(int d = 0; d < D; ++d) {
    int ma = -INF, t = 0;
    for(int T = 1; T <= 26; ++T) {
      int cur = s[d][T-1];
      int sv = last[T-1];
      last[T-1] = d;
      for(int cx = 0; cx < 26; ++cx) {
        cur -= (d-last[cx])*c[cx];
      }
      last[T-1] = sv;
      if(cur > ma) { ma = cur; t = T; }
    }
    ans += ma;
    std::cout << t << "\n";
    last[t-1] = d;
  }
  return 0;
}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//cout << fixed << setprecision(17) << res << endl;
 
int main() {
    ll n,m;
    cin >> n >> m;
    vector<ll> A(m);
    for (auto & a : A) {
        cin >> a;
    }
    ll sum = 0;
    for (auto & a : A) {
        sum += a;
    }
    auto res = n - sum;
    if (res < 0) res = -1;
    cout << res << endl;
}


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

ll N,res=0;
string S;

void calc(vector<int>v){
  string s=S;
  
  int j=0;
  for(int i=0;i<N-1;i++){
    if(v.at(i)==1){
      s.insert(i+j+1,"+");
      j++;
    }
  }
  
  ll sum=0,segment=0;
  
  for(int i=0;i<s.size();i++){
    int a=s.at(i)-'0';
    
    
    if(i==s.size()-1){
      segment*=10;
      segment+=a;
      sum+=segment;
    }
    
    else if(a>=0 && a<=9){
      segment*=10;
      segment+=a;
    }
    
    else{
      sum+=segment;
      segment=0;
    }
    
  }
  
  res+=sum;
  
  //cout<<sum<<endl;
  //cout<<s<<endl;
  //cout<<v.at(0)<<v.at(1)<<endl;
}

void dfs(int depth, vector<int>v){
  if(depth==N-1){
    calc(v);
    return;
  }
  
  for(int i=0;i<2;i++){
    v.at(depth)=i;
    dfs(depth+1,v);
  }
  
}

int main(){
  cin>>S;
  N=S.size();
  vector<int>v(N-1);
  
  dfs(0,v);
  
  cout<<res;
}
  

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i > 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
using namespace std;

int main(){
    ll n, d,cnt = 0;
    ll x,y;

    cin >> n >> d ;
    REP(i,n) {
        cin >> x >> y ;
        if(pow((pow(x, 2.0) + pow(y, 2.0)), 0.5) <= d) cnt++;
    }
    cout << cnt << endl;

}


Measured memory_bytes: 4164
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 1e9;
// const int MOD = 1e9 + 7;

int main() {
    string S;
    cin >> S;
    int n = (int)S.size();
    vector<int> A(n, 1);
    for (int i = 0; i < n - 2; i++) {
        if (S[i] == 'R' && S[i + 1] == 'R') {
            A[i + 2] += A[i];
            A[i] = 0;
        }
    }
    for (int i = n - 1 - 1; i > 0; i--) {
        if (S[i + 1] == 'L' && S[i] == 'L') {
            A[i - 1] += A[i + 1];
            A[i + 1] = 0;
        }
    }
    for (int i = 0; i < n; i++) {
        cout << A[i];
        if (i != n - 1) { cout << " "; }
    }
    cout << endl;
}


Measured memory_bytes: 1024
def main():
    top = list(map(int, input().split()))
    middle = list(map(int, input().split()))
    bottom = list(map(int, input().split()))
    N = int(input())
    taken = []
    for f in range(N):
        taken.append(int(input()))
    
    bingo = []
    bingo.append(top)
    bingo.append(middle)
    bingo.append(bottom)
    temp = [top[0], middle[0], bottom[0]]
    bingo.append(temp)
    temp = [top[1], middle[1], bottom[1]]
    bingo.append(temp)
    temp = [top[2], middle[2], bottom[2]]
    bingo.append(temp)
    temp = [top[0], middle[1], bottom[2]]
    bingo.append(temp)
    temp = [top[2], middle[1], bottom[0]]
    bingo.append(temp)
    
    if bingo[0][0] in taken and bingo[0][1] in taken and bingo[0][2] in taken:
        print('Yes')
    elif bingo[1][0] in taken and bingo[1][1] in taken and bingo[1][2] in taken:
        print('Yes')
    elif bingo[2][0] in taken and bingo[2][1] in taken and bingo[2][2] in taken:
        print('Yes')
    elif bingo[3][0] in taken and bingo[3][1] in taken and bingo[3][2] in taken:
        print('Yes')
    elif bingo[4][0] in taken and bingo[4][1] in taken and bingo[4][2] in taken:
        print('Yes')
    elif bingo[5][0] in taken and bingo[5][1] in taken and bingo[5][2] in taken:
        print('Yes')
    elif bingo[6][0] in taken and bingo[6][1] in taken and bingo[6][2] in taken:
        print('Yes')
    elif bingo[7][0] in taken and bingo[7][1] in taken and bingo[7][2] in taken:
        print('Yes')
    else:
        print('No')
main()

Measured memory_bytes: 9176
a, b, c = gets.split.map(&:to_i)

ans = 0

ans += [a, c].min
c -= a

if c <= 0
  ans += b
else
  e = [b, c].min
  ans += 2 * e
  c -= e
  b -= e

  if c > 0
    ans += 1
  elsif b > 0
    ans += b
  end
end

puts ans


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
#define fo(i,a,n) for(i=a;i<n;i++)
#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define sortrev(x) sort(all(x),greater<int>())
#define pi 3.1415926535897932384626

typedef pair<int,int> pii;
typedef pair<ll, ll> pl;
typedef vector<int>	vi;
typedef vector<bool> vb;
typedef vector<ll>	vl;
typedef vector<pii>	vpii;
typedef vector<pl>	vpl;
typedef vector<vi>	vvi;
typedef vector<vl>	vvl;
typedef vector<double> vd;


const int mod = 1000000007;
const int inf = 1000000000;
const int N = 100007, M = N;
ll i,j,cnt,par;
vi temp[N];

void dfs(int u , vi &vis) {
    vis[u] = 1;
    for(int v : temp[u]) {
        if(!vis[v]) dfs(v , vis);
    }
}

void solve() {
    int n,m;
    cin>>n>>m;

    ll x,y;
    for(int i=0;i<m;i++) {
        cin>>x>>y;
        temp[x].pb(y);
        temp[y].pb(x);
    }

    vi vis(n+1 , 0);
    ll cnt = 0;
    for(int i=1;i<=n;i++) {
        if(!vis[i]) cnt++ , dfs(i,vis);
    }
    cout<<cnt - 1<<"\n";
}


int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

    int t = 1;
    //cin >> t;
    while(t--) {
        solve();
    }

    return 0;
}




Measured memory_bytes: 9580
cnt = 0

def insertionSort(A, n, g):
    global cnt

    for i in range(g, n):
        v = A[i]
        j = i - g
        while (j >= 0) and (A[j] > v):
            A[j + g] = A[j]
            j = j - g
            cnt += 1
        
        A[j + g] = v


def shellSort(A, n):
    G = [1]
    for i in range(1, 100):
        G.append(G[i - 1] * 3 + 1)

    G = list(reversed([g for g in G if g <= n]))
    m = len(G)
    print(m)
    if G:
        print(*G)

    for i in range(m):
        insertionSort(A, n, G[i])

    print(cnt)



n = int(input())
A = [int(input()) for _ in range(n)]

shellSort(A, n)

[print(a) for a in A]


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

int M;
bool check(VI xs, int A, int B){
  vector<bool> use(M+1);
  REP(i,M){
	int x = xs[i];
	if(!(1 <= x && x <= M) || use[x]) return false;
	use[x] = true;
  }

  VI lis(M+1, 1e9);
  REP(i,M) *lower_bound(ALL(lis), xs[i]) = xs[i];
  if(lower_bound(ALL(lis), 1e9) - begin(lis) != A) return false;
  
  fill(ALL(lis), 1e9);
  reverse(begin(xs), begin(xs)+M);
  REP(i,M) *lower_bound(ALL(lis), xs[i]) = xs[i];
  if(lower_bound(ALL(lis), 1e9) - begin(lis) != B) return false;

  return true;
}

bool solve(int g, int i, int ub, int A, int B, VI& xs){
  int n = M - i;
  int x = n - B + g + 1;
  if(0 <= x && x <= A){
	REP(k,x)
	  xs[i+k] = ub + k - (x-1);
	FOR(k,i+x,M)
	  xs[k] = -k + (M-1) + 1;
	
	return true;
  }
  if(x < 0) return false;

  REP(d,A){
	xs[i] = ub + d - (A-1);
	++i;
  }
  
  return solve(g+1, i, ub-A, A, B, xs);
}

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

  int A, B;
  cin >> M >> A >> B;

  VI xs(2e6);
  if(solve(0, 0, M, A, B, xs) && check(xs, A, B)){
	REP(i,M) cout << (i?" ":"") << xs[i];
	cout << endl;

	return 0;
  }

  swap(A, B);
  fill(ALL(xs), 0);
  if(solve(0, 0, M, A, B, xs) && check(xs, A, B)){
	reverse(begin(xs), begin(xs)+M);
	REP(i,M) cout << (i?" ":"") << xs[i];
	cout << endl;
	return 0;
  }

  cout << -1 << endl;

  return 0;
}


Measured memory_bytes: 17152
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

func main() {
	fmt.Printf("%d\n", resolve(parseProblem(os.Stdin)))
}

type none struct{}

var mark none = struct{}{}

type edge struct{ x, y int }

type edgeSet map[edge]none

func (es edgeSet) exist(e edge) bool {
	x, y := min(e.x, e.y), max(e.x, e.y)
	_, ok := es[edge{x, y}]
	return ok
}

func (es edgeSet) Add(e edge) {
	x, y := min(e.x, e.y), max(e.x, e.y)
	es[edge{x, y}] = mark
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func parseProblem(r io.Reader) (n, m int, es edgeSet) {
	const (
		initialBufSize = 100000
		maxBufSize     = 1000000
	)
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines

	es = edgeSet{}

	n = scanInt(sc)
	m = scanInt(sc)
	for i := 0; i < m; i++ {
		x, y := scanInt(sc)-1, scanInt(sc)-1
		es.Add(edge{x, y})
	}
	return n, m, es
}

func resolve(n, m int, es edgeSet) int {
	num := 0
	for l := range permutations(n - 1) {
		if allExists(es, l) {
			num++
		}
	}
	return num
}

func allExists(es edgeSet, l []int) bool {
	cur := -1
	for i := 0; i < len(l); i++ {
		next := l[i]
		if !es.exist(edge{cur + 1, next + 1}) {
			return false
		}
		cur = next
	}
	return true
}

func permutations(l int) chan []int {
	ch := make(chan []int)
	go func() {
		dfsPermutations(0, make([]bool, l), []int{}, func(perm []int) bool {
			p := make([]int, len(perm))
			copy(p, perm)
			ch <- p
			return false
		})
		close(ch)
	}()
	return ch
}

func dfsPermutations(pos int, used []bool, perm []int, atLeaf func(perm []int) (halt bool)) (halt bool) {
	l := len(used)
	if pos == l {
		if atLeaf(perm) {
			return true
		}
	}

	for i := 0; i < l; i++ {
		if used[i] {
			continue
		}
		used[i] = true
		if dfsPermutations(pos+1, used, append(perm, i), atLeaf) {
			return true
		}
		used[i] = false
	}
	return false
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1152
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#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 vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100;

int A[MAX+2];

int main() {
	int n;cin>>n;
	A[0]=A[n+1]=0;
	rep(i,n) cin>>A[i+1];
	int D[MAX+1],sum_d=0;
	rep(i,n+1){D[i]=abs(A[i+1]-A[i]);sum_d+=D[i];}
	rep(i,n) cout<<sum_d-D[i]-D[i+1]+abs(A[i+2]-A[i])<<endl;
}


Measured memory_bytes: 2048
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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;}

const ll mod=1e9+7;

int main(){
    ll n;
    cin >> n;
    vector<pll> a(n),c(n);
    vector<ll> d(n);
    
    rep(i,n){
        cin >> a[i].fi >> a[i].se;
    }
    rep(i,n){
        cin >> c[i].fi >> c[i].se;
    }
    sort(a.begin(),a.end());
    sort(c.begin(),c.end());
    ll ans=0;
    rep(i,n){
        ll x=-1,y=-1,num=-1;
        rep(j,n){
            if(c[i].fi>a[j].fi && c[i].se>a[j].se && d[j]==0){
                if(a[j].se>=y){
                    x=a[j].fi;
                    y=a[j].se;
                    num=j;
                }
            }
        }
        if(num==-1) continue;
        d[num]=1;
        ans++;
    }
    cout << ans << endl;
} 

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

#define int long long
#define ci(m)     for(int i=0;i<m;i++)
#define cj(m)     for(int j=0;j<m;j++)
#define ck(m)     for(int k=0;k<m;k++)
#define gcd            __gcd
#define endl           "\n"
#define pb             emplace_back
#define setbits(x)     __builtin_popcountll(x)
#define zrobits(x)     __builtin_ctzll(x)
#define mod            1000000007
#define mod2           998244353
#define maxe           *max_element
#define mine           *min_element
#define inf            1e18
#define deci(x, y)      fixed<<setprecision(y)<<x
#define w(t)           int t; cin>>t; while(t--)
#define nitin          ios_base::sync_with_stdio(false); cin.tie(NULL)
#define PI             3.141592653589793238
using namespace std;

int32_t main() {
    nitin;
    int n,m;
    cin>>n>>m;
    string s;
    string t;
    cin>>s>>t;
    int ans=gcd(n,m);
    ans=(n*m)/ans;
    map<int,int>o;
    int cnt=0;
    for(int i=0;i<=(n-1)*(ans/n);i+=(ans/n))
    {
        o[i]=s[cnt++];
    }
    cnt=0;
    for(int i=0;i<=(m-1)*(ans/m);i+=(ans/m))
    {
        if(o.count(i))
        {
            if(o[i]!=t[cnt])
            {
                cout<<-1<<endl;
                return 0;
            }
        }
        cnt++;
    }
    cout<<ans<<endl;
    return 0;
}

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

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; }

int main() {
    int N; cin >> N;
    vector<long long> a(N);
    for (int i = 0; i < N; ++i) cin >> a[i];
    int num_minus = 0;
    long long mi = 1LL<<60;
    long long sum = 0;
    for (int i = 0; i < N; ++i) {
        if (a[i] < 0) ++num_minus;
        chmin(mi, abs(a[i]));
        sum += abs(a[i]);
    }
    if (num_minus % 2 == 0) cout << sum << endl;
    else cout << sum - mi*2 << endl;
}


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

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

    int ans = (int)1e9;
    for(int d=1; d<=100; d++){
        int now = 0;
        for(auto dd: x){
            now += (dd - d) * (dd - d);
        }
        ans = min(ans, now);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1000000007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define rep(i, n) for(ll i=0; i<(ll)(n); i++)
#define repd(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=b-1; (ll)(a)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

struct UnionFind{

    vector<ll> par;
    UnionFind(ll n) : par(n, -1){}
    

    int root(int x){
        if(par[x]<0) return x;
        return par[x] = root(par[x]);
    }

    bool same(int a, int b){
        return root(a)==root(b);
    }
    void unite(int a, int b){
        int x=root(a), y=root(b);
        if(same(x, y)) return;
        if(y<x) swap(x, y);
        par[x] += par[y];
        par[y] = x;
    }
    int size(int x){
        return -par[root(x)];
    }

};

int main(){
    ll n, m;    cin >> n >> m;
    UnionFind tree = UnionFind(n);
    rep(i, m){
        ll a, b;    cin >> a >> b;
        a--, b--;
        tree.unite(a, b);
    }
    ll res=0;
    rep(i, n){
        res = max(res, (ll)tree.size(i));
    }
    cout << res << endl;
}

Measured memory_bytes: 4772
N=int(input())
a=list(map(int,input().split()))
ans=0

while True:
  flag=0
  for i in range(N):
    if a[i]%2==0:
      a[i]=a[i]//2
      ans+=1
      flag=1
  else:
      if flag==0:
          break

print(ans)


Measured memory_bytes: 4148
#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() {
    int c[3][3];
    rep(i, 3) rep(j, 3) cin >> c[i][j];
    vector<int> h(3), w(3);
    rep(i, 3) rep(j, 3) {
        h[i] += c[i][j];
        w[j] += c[i][j];
    }
    if(h[0]%3==h[1]%3&&h[1]%3==h[2]%3 &&
    w[0]%3==w[1]%3&&w[1]%3==w[2]%3) cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<math.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
const long long INF = 1LL << 60;

int main() {
	int a, b;
	cin >> a >> b;

	if (b == 1) {
		cout << 0 << endl;
		return 0;
	}

	int ans = 1;
	int goukei = a;
	while (goukei < b) {
		ans++;
		goukei += a;
		goukei--;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
local mod = 1000000007
local mfl = math.floor

local function bmul(x, y)
  local x1, y1 = mfl(x / 31623), mfl(y / 31623)
  local x0, y0 = x - x1 * 31623, y - y1 * 31623
  return (x1 * y1 * 14122 + (x1 * y0 + x0 * y1) * 31623 + x0 * y0) % mod
end

local function badd(x, y)
  return (x + y) % mod
end

local function bsub(x, y)
  return x < y and x - y + mod or x - y
end

local function modpow(src, pow)
  local res = 1
  while 0 < pow do
    if pow % 2 == 1 then
      res = bmul(res, src)
      pow = pow - 1
    end
    src = bmul(src, src)
    pow = mfl(pow / 2)
  end
  return res
end

local n = io.read("*n")
local r1 = modpow(8, n)
local r2 = modpow(9, n)
local all = modpow(10, n)
print((all - r2 - r2 + r1) % mod)


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define rep(i, n) REP(i, 0, n)
const ll INF=1e9;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    string s;
    cin>>n>>s;
    ll ans=0;

    rep(i,n){
        if(i==0){
            ans++;
            continue;
        }
        if(s[i]!=s[i-1]){
            ans++;
        }
    }
    cout<<ans<<endl;
    return  0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <iomanip>
#include <functional>
#include <cassert>

using namespace std;

typedef long long ll;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
#endif
  int n;
  cin >> n;
  vector <int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  vector <ll> dp(n + 1, 0);
  dp[0] = 1000;
  for (int i = 0; i < n; ++i) {
    for (int j = i; j < n; ++j) {
      for (int k = j; k < n; ++k) {
        vector <int> have;
        for (int t = j; t <= k; ++t) have.push_back(a[t]);
        sort(have.begin(), have.end());
        ll cnt = 0;
        ll mn = dp[i];
        for (auto x : have) {
          if (x <= a[k]) {
            cnt += mn / x;
            mn %= x;
          }
        }
        dp[k + 1] = max(dp[k + 1], mn + cnt * a[k]);
      }
    }
  }
  ll ans = 0;
  for (int i = 0; i <= n; ++i) ans = max(ans, dp[i]);
  cout << ans << '\n';
}



Measured memory_bytes: 3644
/*Har Har Mahadev*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define tr(v,it) for(auto it=v.begin(); it!=v.end(); it++)
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define F first
#define S second
#define endl "\n"
#define MOD 1000000007
#define pie 3.141592653589793
#define INF 1e18
using namespace std;

const int N=2e5+10;
int main()
{
        //freopen("input.txt","r",stdin);
        //freopen("output.txt","w",stdout);
        
		        long long a,b;
		        cin>>a>>b;
		        long long res=0;
		        while(a<=b)
		        {
		        	res++;
		        	a=a*2;
		        }
		        cout<<res;

        return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[]args){
      Scanner sc = new Scanner(System.in);

      int d = sc.nextInt();

      if(d==7||d==5||d==3){
        System.out.println("YES");
      }else{
        System.out.println("NO");
      }


  }
}

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

int main()
{

  int n;
  cin >> n;
  vector<int> v(n);

  for(int i = 0; i < n; i++) {
    cin >> v.at(i);
  }
  for(auto itr = v.rbegin(); itr != v.rend(); itr++) {
    cout << *itr;
    if(itr+1 != v.rend()) cout << " ";
  }
  cout << endl;
  return 0;
}



Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(a) int((a).size())

int main()
{
    ll i,j,k,n,ans = 0;
    cin>>n;
    vector<ll> a(n);
    for(i=0;i<n;i++) cin>>a[i];
    for(i=0;i<n;i++)
    {
        for(j=i+1;j<n;j++)
        {
            for(k=j+1;k<n;k++)
            {
                if(a[i]!=a[j] && a[i]!=a[k] && a[j]!=a[k])
                {
                    if(a[i]+a[j]>a[k] && a[i]+a[k]>a[j] && a[j]+a[k]>a[i]) ans++;
                }
            }
        }
    }
    cout<<ans<<"\n";
}

Measured memory_bytes: 3636
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
  public static void main(String[] args) {
	  FastReader sc = new FastReader();
	  int n = sc.nextInt();
	  int[] nums = {111, 222, 333, 444, 555, 666, 777, 888, 999};
	  
	  for (int i = 0; i < nums.length; i++) {
		  if (n <= nums[i]) {
			  System.out.println(nums[i]);
			  System.exit(0);
		  }
	  }
	  
  }
 
  static class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }
  
    String next() { 
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException  e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    long nextLong() {
      return Long.parseLong(next());
    }

    double nextDouble() { 
      return Double.parseDouble(next());
    }

    String nextLine() {
      String str = "";
        try{
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
      }
  }
}

class Work {
	int spend;
	int earn;
	
	public Work(int spend, int earn) {
		this.spend = spend;
		this.earn = earn;
	}
}


Measured memory_bytes: 21332
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using P = pair<int, int>;

int main() {
  char a;
  cin >> a;
  if(a - 'a' >= 0 && a - 'z' <= 0) cout << 'a' << endl;
  else cout << 'A' << endl;
  return 0;
}

Measured memory_bytes: 3592
/*-------------------------------"ANJAN AGARWALA"-----------------------------

         _/_/_/_/    _/_/    _/   _/_/_/_/   _/_/_/_/    _/_/    _/   
        _/    _/    _/ _/   _/         _/   _/    _/    _/ _/   _/        
       _/_/_/_/    _/   _/ _/         _/   _/_/_/_/    _/  _/  _/         
      _/    _/    _/    _/_/   _/    _/   _/    _/    _/    _/_/  
     _/    _/    _/      _/   _/_/_/_/   _/    _/    _/      _/   

-------------------------------------@anjn98---------------------------------*/

//#define opti
#ifdef opti
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,unroll-loops,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#endif

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

typedef long long int ll;
typedef long long int LL;
typedef unsigned long long int ull;
ll power(ll x,ll y,ll p){ll r=1; x=x%p; while(y){ if(y&1) r= r*x%p; y=y>>1; x=x*x%p; } return r; }
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;*/

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int csrand(int l=0, int r=1e9){
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}

#define IO              ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define FILEIO          freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define all(v)          v.begin(),v.end()
#define PR(a)           cout<<"("<<a<<")";
#define ED              cout<<'\n';
#define endl            '\n'
#define loop(j,a,n)     for(int j=a;j<=n;j++)
#define loop1(j,a,n)    for(int j=a;j>=n;j--)
#define fr1(j,n)        for(int j=0;j<n;j++)
#define fr(n)           for(int i=0;i<n;i++)
#define trav(x,s)       for(auto x:s)
#define SC(n)           scanf("%d",&n)
#define PB              push_back
#define MP              make_pair
#define pii             pair<int,int>
#define pll             pair<long long int,long long int>
#define F               first
#define S               second 
#define binf            2000000000000000001
#define mod             1000000007


const int N=1e4+99;

ll dp[N][105][2],d,len; string s;

ll solve(int i,int sum,int tk)
{
    if(i==len) return sum%d==0; 

    if(dp[i][sum][tk]!=-1) return dp[i][sum][tk];
    ll ans=0; int k=s[i]-'0';

    for(int j=0;j<k;j++)
        ans=(ans+solve(i+1,(sum+j)%d,1))%mod;
    ans=(ans+solve(i+1,(sum+k)%d,tk))%mod;

    for(int j=k+1;j<=9 && tk==1;j++)
        ans=(ans+solve(i+1,(sum+j)%d,tk))%mod;

    return dp[i][sum][tk]=ans;
}
int main() 
{
    IO
    memset(dp,-1,sizeof(dp));

    cin>>s>>d;
    len=s.length();

    ll ans=(solve(0,0,0)-1+mod)%mod;

    cout<<ans<<endl;
}




 

Measured memory_bytes: 17792
using System;
using System.IO;

class Solve {
    static void Main(string[] args) {
        var N = int.Parse(Console.ReadLine());
        var robos = new (int right, int left)[N];
        for (int i = 0; i < N; i++) {
            var arr = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            robos[i] = (arr[0] + arr[1], arr[0] - arr[1]);
        }
        Array.Sort(robos);
        var answer = 0;
        var x = int.MinValue;
        for (int i = 0; i < N; i++) {
            if (x > robos[i].left) continue;
            answer++;
            x = robos[i].right;
        }
        var writer = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();
    }
}

Measured memory_bytes: 47256