akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000, boost::int128_type>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

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; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }
template<class T> inline bool isSosuu(const T& n) { if (n == T(1)) { return false; } for (T i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } return true; }
template<class T> vector<vector<T>> split (const vector<T>& S, T delim) { vector<vector<T>> ret{}; vector<T> buff{}; for (auto c : S) { if (c == delim) { if (!buff.empty()) ret.push_back(buff); buff.clear(); } else { buff.push_back(c); } } if (!buff.empty()) ret.push_back(buff); return ret; }
template<class T> inline void printYesNo(const T& t) { cout << (t ? "Yes" : "No") << CRLF; }
template<class T = int64_t> T modpow(T N, T P, T M) { T ret{1}; N %= M; while (P) { if (P & 0x01) { ret *= N; ret %= M; } P >>= 1; N *= N; N %= M; } return ret; }

/** code for assert debug begin */
int gErr = 0;
#define ASSERT(p) if(!(p)){ gErr = 1; }else{ ; }
/** code for assert debug end */

struct Tmp
{
public:
  int N;
  Tmp(int N)
  : N(N)
  {}
};

void solve(void)
{
  string N; cin >> N;
  auto ans = "ABC" + N;
  cout << ans << CRLF;
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    int d;
    cin >> d;

    while(--d >= 0){
        vector<unsigned> n(9);
        for(int i=0; i<9; ++i){
            string s;
            cin >> s;
            for(unsigned j=0; j<s.size(); ++j){
                n[i] <<= 4;
                if('0' <= s[j] && s[j] <= '9')
                    n[i] += s[j] - '0';
                else
                    n[i] += s[j] - 'a' + 10;
            }
        }

        unsigned k = 0;
        for(int i=0; i<32; ++i){
            int a = 0;
            for(int j=0; j<8; ++j)
                a += n[j] ^ k;
            if((a & (1<<i)) != (n[8] & (1<<i)))
                k |= 1 << i;
        }

        string ret(8, ' ');
        for(int i=7; i>=0; --i){
            if(k % 16 <= 9)
                ret[i] = k % 16 + '0';
            else
                ret[i] = k % 16 - 10 + 'a';
            k /= 16;
        }
        int i = ret.find_first_not_of('0');
        if(i == -1)
            cout << 0 << endl;
        else
            cout << ret.substr(i) << endl;
    }

    return 0;
}

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

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
#define pb push_back

using namespace std;
using ll=long long;
using pii= pair<int, int>;
mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());
template<typename... T> void rd(T&... args) {((cin>>args), ...);}
template<typename... T> void wr(T... args) {((cout<<args<<" "), ...);cout<<endl;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin>>n;
    map<string,int> mp;
    forn(i,n){
        string s;
        cin>>s;
        mp[s]++;
    }
    cout<<"AC x "<<mp["AC"]<<endl;
    cout<<"WA x "<<mp["WA"]<<endl;
    cout<<"TLE x "<<mp["TLE"]<<endl;
    cout<<"RE x "<<mp["RE"]<<endl;
    return 0;
}



Measured memory_bytes: 3664
#include<bits/stdc++.h>
#define ll long long int
#define N (ll)(1e9+7)
#define T int
#define P pair<T,T>
#define umap unordered_map<T,T>
#define uset unordered_set<T>
#define rep(i,n) for(i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define print(v) for(auto x:v) cout<<x<< " "
#define pb push_back
using namespace std;

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

    string s;
    cin>>s;
    int a=0;
    int b=s.length()-1;
    int ans=0;
    while(a<b)
    {
        if(s[a]!=s[b])
            ++ans;
        ++a;
        --b;
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  long H;
  int N;
  scanf("%ld%d",&H,&N);
  int A[N],i;
  long tot=0;
  for(i=0;i<N;i++)
  {
    scanf("%d",&A[i]);
    tot=tot+(long)A[i];
  }
  if(tot>=H)
    printf("Yes");
  else
    printf("No");
  return 0;
}

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

long long minimumPress(const vector<int> &a, const vector<int> &b){
    long long foo = 0LL;
    const int n = a.size();
    for(int i=n-1; i>=0; i--){
        foo += (a[i]*1LL+foo+b[i]*1LL-1LL)/b[i]*b[i]-a[i]*1LL-foo;
    }
    return foo;
}

int main(){
    int n;
    while(scanf("%d", &n)!=EOF){
        vector<int> a(n, 0);
        vector<int> b(n, 0);
        for(int i=0; i<n; i++){
            scanf("%d%d", &a[i], &b[i]);
        }
        printf("%lld\n", minimumPress(a, b));
    }
    return 0;
}

Measured memory_bytes: 1024
import sys

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * 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.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

input = sys.stdin.readline
N, M = map(int, input().split())
uf = UnionFind(N)
for _ in range(M):
    a, b = map(int, input().split())
    uf.union(a-1, b-1)

print(uf.group_count() - 1)

Measured memory_bytes: 12776
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,x,y) for(int i=(int)(x);i<(int)(y);++i)
#define FORE(i,x,y) for(int i=(int)(x);i<=(int)(y);++i)
#define FORD(i,x,y) for(int i=(int)(x);i>=(int)(y);--i)
#define PB push_back
#define MP make_pair
#define ST first
#define ND second
typedef long long ll;
typedef pair<int,int> pii;
const int INF=2e9;
const int MOD=1e9+7;
const int MAXN=1e6+7;

ll ans=0;
ll n,m,k,q;
ll a,b;
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    cin>>n>>a>>b;
    ll x=n/(a+b);
    n-=x*(a+b);
    ans+=x*a;
    ans+=min(a,n);
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <string>
#include <set>
#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

int main(){
    int n;
    string str;
    cin >> n >> str;
    string s1,s2;
    int ans = 0;
    reps(i,1,n){
        s1 = str.substr(0,i);
        s2 = str.substr(i,n);
        vector<int> v1(26),v2(26);
        int tmp = 0,cnt = 0;
        rep(j,s1.length()){
            tmp = s1[j] - 'a';
            v1[tmp]++;
        }
        rep(j,s2.length()){
            tmp = s2[j] - 'a';
            v2[tmp]++;
        }
        rep(j,26){
            if(v1[j] > 0 && v2[j] > 0){
                cnt++;
            }
        }
        ans = max(ans,cnt);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
pair <int,double> v[5];
int main()
{
    long long q,h,s,d,q1,h1,s1,pret=0,i;
    double n;
    cin>>q>>h>>s>>d>>n;
    q1=8*q;
    h1=4*h;
    s1=2*s;
    v[1].first=q1;
    v[2].first=h1;
    v[3].first=s1;
    v[4].first=d;
    v[1].second=0.25;
    v[2].second=0.50;
    v[3].second=1.00;
    v[4].second=2.00;
    sort(v+1,v+5);
    for(i=1;i<=4&&n;i++)
    {
      if(v[i].second==0.25)
      pret+=q*(int)(n/v[i].second);
      if(v[i].second==0.5)
      pret+=h*(int)(n/v[i].second);
      if(v[i].second==1)
      pret+=s*(int)(n/v[i].second);
      if(v[i].second==2)
      pret+=d*(int)(n/v[i].second);
      n=n-(int)(n/v[i].second)*v[i].second;
    }
    cout<<pret;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int n,m,cnt,tot;
int fns[100010],wz[100010],b[100010],roadl[400010],roadto[400010],road[400010];


void dfs(int num,int st)
{
  if(b[num])
    {
      if(st!=fns[num]) cnt=1;
      return;
    }
  b[num]=1,fns[num]=st;
  int t=wz[num];
  while(t)
    {
      dfs(road[t],st+roadl[t]);
      t=roadto[t];
    }
}

int main()
{ 
  int i,j,x,y,z;
  scanf("%d%d",&n,&m);
  for(i=1;i<=m;i++) 
  {
    scanf("%d%d%d",&x,&y,&z);
    roadto[++tot]=wz[x],road[tot]=y,wz[x]=tot,roadl[tot]=z;
    roadto[++tot]=wz[y],road[tot]=x,wz[y]=tot,roadl[tot]=-z;
  }
  for(i=1;i<=n;i++)
    {
      if(!b[i]) dfs(i,0);
    }
  if(cnt) printf("No\n");
  else printf("Yes\n");
}

Measured memory_bytes: 7936
def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n

def lcm(m, n):
    return m//gcd(m, n)*n
MOD = 10**9+7
n = int(input())
a = list(map(int, input().split()))
l = a[0]
for x in a:
    l = lcm(x, l)
ans = 0
for x in a:
    ans += l*pow(x, MOD-2, MOD)%MOD
print(ans%MOD)


Measured memory_bytes: 4084
using System;
using System.Collections.Generic;

namespace cswork
{

    class Program
    {
        public Program() { }

        Scanner cin;

        void Omame()
        {
            cin = new Scanner();
            int n = cin.nextInt();
            long y = cin.nextLong();

            for (int i = 0; i <= n; i++)
            {
                for (int j = 0; j <= n - i; j++)
                {
                    int k = n - i - j;
                    if (10000 * i + 5000 * j + 1000 * k == y)
                    {
                        Console.WriteLine(i + " " + j + " " + k);
                        return;
                    }
                }
            }

            Console.WriteLine("-1 -1 -1");
        }

        static void Main(string[] args)
        {
            new Program().Omame();
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();

            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next();
        }

        public int nextInt()
        {
            return int.Parse(next());
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }
    }
}

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

int a[200005];
struct node{
	vector<int>v;
};
node an,bn;
int res[200005];
int r=0;
void solve(int n){
	
	if(n&1){
		for(int i=n;i>=1;i-=2){
			res[++r]=i;
		}
		for(int i=2;i<=n-1;i+=2){
			res[++r]=i;
		}
	}
	else{
		for(int i=n;i>=2;i-=2){
			res[++r]=i;
		}
		for(int i=1;i<=n-1;i+=2){
			res[++r]=i;
		}
	}
	
}
int main(){
int n;
scanf("%d",&n);
for(int i=1;i<=n;i++){
	scanf("%d",&a[i]);
	}
	if(n==1){
		printf("%d ",a[1]);
	
		return 0;
	}
	solve(n);
	for(int i=1;i<=r;i++){
		cout<<a[res[i]]<<" ";
	}
//		an.v.push_back(1);
//		bn.v.insert(bn.v.begin(),1);
		
//	for(int i=2;i<=n;i++){
//if(i&1){
//     an.v.push_back(i);
//	 bn.v.insert(bn.v.begin(),i);
//}
//else{
//	  bn.v.push_back(i);
//	  an.v.insert(an.v.begin(),i);
//	
//}
//if(i==n){
//	if(n&1){
//		int t=bn.v.size()-1;
//		for(int x=0;x<=t;x++){
//			printf("%d ",a[bn.v[x]]);
//			
//		}
//	}
//	else{
//			int t=an.v.size()-1;
//		for(int x=0;x<=t;x++){
//			printf("%d ",a[an.v[x]]);
//			
//		}
//	}
//}
//		}
	
	

	
	return 0;
}

Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
int main(){
  double t1,t2;
  double gm[7],sm[7];
  string ans[8]={"AAA","AA","A","B","C","D","E","NA"};
  gm[0]=35.5;gm[1]=37.5;gm[2]=40.0;gm[3]=43.0;gm[4]=50.0;gm[5]=55.0;gm[6]=70.0;
  sm[0]=71.0;sm[1]=77.0;sm[2]=83.0;sm[3]=89.0;sm[4]=105.0;sm[5]=116.0;sm[6]=148.0;
  while(cin>>t1>>t2){
    int i;
    for(i=0;i<7;i++){
      if(gm[i]>t1&&sm[i]>t2)
	break;
    }
    cout<<ans[i]<<endl;
  }
  return 0;
}

Measured memory_bytes: 3196
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pi pair<int ,int >
#define pl pair<ll ,ll >
#define pb push_back
#define vl vector <long long int >
#define vi vector <int >
#define vp vector <pi>
#define Mod 1000000007
#define eps 1e-9
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define _ <<" "<<
#define forn(x,	n) for(int x = 0; x < n ;++ x) 
#define forn1n(x,n) for(int x = 1; x <= n ;++ x)
#define forn1(x,n) for(int x = 1; x < n ;++ x)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#pragma GCC optimize ("Ofast")
void scan(){}
template<typename F, typename... R> void scan(F &f,R&... r){cin>>f;scan(r...);}
int di_; string dnms_, co_ = ",";
void debug_(){cout<<endl;}
template<typename F, typename... R> void debug_(F &f, R&... r){while(dnms_[di_] != ',')cout<<dnms_[di_++];di_++;cout<<": "<<f<<",";debug_(r...);}
#define debug(...) dnms_=#__VA_ARGS__+co_,di_=0,debug_(__VA_ARGS__)

template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){
    return out<<"("<<a.first<<","<<a.second<<")";}
template<class A> ostream& operator<<(ostream& out, const vector<A> &a){
	out<<"";for(auto it=a.begin();it!=a.end();it++){if(it!=a.begin())out<<" ";out<<*it;}out<<"";
	return out;}
template<class A, class B> istream& operator>>(istream& in, pair<A,B> &a){in>>a.first>>a.second;return in;}
template<class A> istream& operator>>(istream& in, vector<A> &a){for(A &i:a)in>>i;return in;}

class Polyhash
{
public:
	static ll base;
	static ll mod;
	static ll modl;
	vl hash;
	vl hashl;
	vl pw;
	vl pwl;

	Polyhash(string& s)
	{
		int n = s.size();
		hash.resize(n);
		hashl.resize(n);
		pw.resize(n);
		pwl.resize(n);

		hash[0] = s[0] -'a' +1;
		hashl[0] = s[0] -'a' +1;
		pw[0] = 1;
		pwl[0] = 1;

		for(int i=1;i<n;i++)
		{
			hash[i] = (hash[i-1]*base + (s[i]-'a' +1))%mod;
			hashl[i] = (hashl[i-1]*base + (s[i]-'a' +1))%modl;
			pw[i] = (pw[i-1]*base)%mod;
			pwl[i] = (pwl[i-1]*base)%modl;
		}
	}

	pair<ll,ll> operator ()(int l, int r)
	{
		if(l==0)
		{
			return {hash[r]%mod,hashl[r]%modl};
		}
		else
		{
			return {((hash[r] - hash[l-1]*pw[r-l+1])%mod + mod)%mod,((hashl[r] - hashl[l-1]*pwl[r-l+1])%modl + modl)%modl};
		}
	}

};
ll Polyhash::base = 31;
ll Polyhash::mod =1e9+123;
ll Polyhash::modl  = 1e9+7;
struct HASH{
  size_t operator()(const pair<ll,ll>&x)const{
    return hash<long long>()(((long long)x.first)^(((long long)x.second)<<32));
  }
};
int main(){
	IOS

	ll n;
	cin>>n;
	string s;
	cin>>s;
	
	Polyhash p(s);

	bool flag = false;
	int ans=0;

	for(int l=n/2;l>0;l--)
	{
		unordered_map<pair<ll,ll>,ll,HASH>mp;
		for(int i=0;i<n-l+1;i++)
		{
			auto hash = p(i,i+l-1);
			if(mp.find(hash)==mp.end())
			{
				mp[hash] = i;
			}
			else
			{
				if(mp[hash]+l-1<i)
				{
					flag = true;
					break;
				}
			}
		}
		if(flag)
			{
				ans = l;
				break;
			}
	}
	cout<<ans;
 
	return 0;	
}

Measured memory_bytes: 832
package main
import "fmt"
var (v1,v2 int
     arr [100000]int
    )
func main(){
  
  fmt.Scan(&v1,&v2)
  for i:=0;i<v1;i++{
    fmt.Scan(&arr[i])
  }
  var res uint64 = 0
  for i:=0;i < v1 - 1;i++{
    t:=arr[i]+arr[i+1]
    if t > v2 {
      p:=t - v2
      res += uint64(p)
      if arr[i+1] >= p{
      	arr[i+1] -= p
      }else{
      	arr[i+1] = 0
      }
    }
  }
  fmt.Println(res)
  
  
}


Measured memory_bytes: 6272
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n; scanf("%d", &n); std::vector<int> a(n);
	for(int i = 0; i < n; i++) scanf("%d", &a[i]);

	bool ans = true;
	for(int i = 0; i < n; i++) {
		if(a[i] & 1) continue;
		if(!(a[i] % 3) or !(a[i] % 5)) continue;

		ans = false;
	}

	if(ans) printf("APPROVED\n");
	else printf("DENIED\n");
	return 0;
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    int h,w;cin >>h>>w;
    int sh,sw;cin >>sh>>sw;
    sh--;sw--;
    int gh,gw;cin >>gh>>gw;
    gh--;gw--;
    vector<string>s(h);
    for (int i = 0; i < h; ++i) {
        cin >>s[i];
    }
    queue<P>que;que.push({sh,sw});
    queue<P>que2;que2.push({sh,sw});
    vector<vector<int>>d(h+100,vector<int>(w+100,INF));
    d[sh][sw]=0;
    int dx[4]={1,-1,0,0};
    int dy[4]={0,0,1,-1};
    ll now=0;
    while(1) {
        while (!que.empty()) {
            pair<int,int>pos = que.front();que.pop();
            que2.push({pos.first,pos.second});
            now=d[pos.first][pos.second];
            for (int i = 0; i < 4; ++i) {
                int nd = d[pos.first][pos.second];
                ll nh = pos.first + dy[i];
                ll nw = pos.second + dx[i];
                if (nh < 0||nh>=h)continue;
                if (nw < 0||nw>=w)continue;
                if(s[nh][nw]=='#')continue;
                if (d[nh][nw]>nd) {
                    que.push({nh, nw});
                    d[nh][nw] = nd;
                }
            }
        }
        bool flg=false;
        if(que2.empty())break;
        while(!que2.empty()){
            auto pos=que2.front();que2.pop();
            ll nh=pos.first;
            ll nw=pos.second;
            for (ll i = nh-2;i <=nh+2; ++i) {
                for (ll j =nw-2; j <=nw+2; ++j) {
                    if(i<0||i>=h)continue;
                    if(j<0||j>=w)continue;
                    if(s[i][j]=='#')continue;
                    if(d[i][j]>now+1){
                        flg=true;
                        d[i][j]=now+1;
                        que.push({i,j});
                    }
                }
            }
        }
        if(d[gh][gw]!=INF){
            cout <<d[gh][gw]<<endl;
            return 0;
        }
        if(!flg)break;
    }
//    for (int i = 0; i < h; ++i) {
//        for (int j = 0; j < w; ++j) {
//            cout<<d[i][j]<<" ";
//        }
//        cout <<endl;
//    }
    cout <<-1<<endl;
}


Measured memory_bytes: 10448
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x,h,w) (y) < 0 || (h) <= (y) || (x) < 0 || (w) <= (x)
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
const long double pi = acos(-1);
const long double eps = 1e-10;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
//ate
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }

int main() {
    init();

    //int n; ll k; cin >> n >> k;
    //VL a(n); cin >> a;

    int n, m; cin >> n >> m;
    string s; cin >> s;
    reverse(all(s));

    int cnt = 0, Max = 0;
    eFOR(i, 0, n) {
        if (s[i] == '1')++cnt;
        else {
            chmax(Max, cnt);
            cnt = 0;
        }
    }

    if (m <= Max){
        cout << "-1\n";
        return 0;
    }

    VI ans;
    for (int now = 0; now < n;) {
        erFOR(i, 1, min(m, n - now)) {
            int to = now + i;
            if (s[to] == '1')continue;
            ans.push_back(i);
            now += i;
            break;
        }
    }

    reverse(all(ans));
    int len = ans.size();
    FOR(i, 0, len)cout << ans[i] << ENDL(i, len);
}


Measured memory_bytes: 1096
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9) + 7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int main() {
	int out = 0;
	string s; cin >> s; int n = s.length();
	int rest = 0;
	rep(i, n) {
		if (s[i] == 'S') {
			rest++;
		}
		else {
			if (rest > 0)rest--;
			else out += 2;
		}
	}
	cout << out << endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
using ll=long long;
const ll MOD=100000007;
#define rep(i,a,b) for(ll i=a;i<b;i++)
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline constexpr int intpow(ll a,ll b){
    if(b==0) return 1;
    ll ans=intpow(a,b/2);
    return ans*ans%MOD*(b&1?a:1)%MOD;
}
inline constexpr int modf(ll n){
    ll ans=1;
    rep(i,0,n) {ans=ans*(n-i)%MOD;}
    return ans;
}
int main(){
    vector<ll> h(5);
    rep(i,0,5) cin>>h[i];
    ll k;
    cin>>k;
    if(h[4]-h[0]<=k) cout<<"Yay!";
    else cout<<":(";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define UP(a,b,i) for(int i=(a);i<=(b);i++)
#define DOWN(a,b,i) for(int i=(a);i>=(b);i--)
#define rep(a,b,i) UP(a,b-1,i)
ll ma=0x80000000;
ll mi=0x7fffffff;
const ll zfc=0xffffffff;
const ll mod=1e9+7;
using namespace std;
inline void input(ll &x)
{
    x=0;
    int f=1;
    char ch=getchar();
    while(!isdigit(ch))
	{
		if(ch=='-')f=-f;
		ch=getchar();
	}
    while(isdigit(ch))
	{
		x=x*10+(ch-'0');
		ch=getchar();
	}
    x*=f;
}
inline void output(ll x)
{
	if(x<0)
    {
        x=-x;
        putchar('-');
    }
    if(x/10>0)output(x/10);
    putchar(x%10+'0');
}
#define I(n) cin>>(n);
#define O(n) cout<<(n);
#define Enter() cout<<endl;
ll n;
int main()
{
	I(n);
	cout<<(ll)sqrt(n)*(ll)sqrt(n);
	Enter();
    return 0;
}

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

#define MOD 10000007
#define f first
#define s second
#define es " "
#define pb push_back
#define endl "\n"
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define ll long long int
#define fastio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)

ll dp[3005][6005];
int n;
pair<int, int> v[3005];

ll solve(int obj, int time){
    if(dp[obj][time]!=-1){
        return dp[obj][time];
    }
    if(obj>n){
        return dp[obj][time]=0;
    }
    ll nao, pega;
    nao=solve(obj+1, time);
    if(time>=3000){
        pega=solve(obj+1, time-v[obj].f)+v[obj].s;
        return dp[obj][time]=max(pega, nao);
    }
    return dp[obj][time]=nao;
}

int main(){
    fastio;
    int t;
    memset(dp, -1, sizeof(dp));
    cin >> n >> t;
    t--;
    for(int i=1; i<=n; i++){
        cin >> v[i].f >> v[i].s;
    }
    sort(v+1, v+n+1);
    cout << solve(1, 3000+t) << endl;
    return 0;
}

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

#define INF 2147483647
#define LINF 9223372036854775807

#define MOD 1000000007
#define MOD2 998244353

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

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

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

typedef long long ll;

typedef pair<int,int> P;
typedef pair<int,P> iP;
typedef pair<P,P> PP;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}

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

int main(){

    bool flag=true;
    ll ans=0,sum=0;

    string s;
    cin>>s;


    int p=0;
    while(p < s.length()){
        if(s.substr(p,5) == "dream"){
            p += 5;

            if(s.substr(p,2) == "er"){
                if(s.substr(p,5) != "erase")p+=2;
            }

        }else if(s.substr(p,5) == "erase"){
            p += 5;

            if(s.substr(p,1) == "r")++p;

        }else{
            flag=false;
            break;
        }
    }

    //cout <<fixed<<setprecision(16)<< << endl;

    if(flag)cout << "YES" <<endl;
    else cout << "NO" <<endl;

    return 0;
}


Measured memory_bytes: 512
n = int(input())
a = list(map(int, input().split()))

b = {}
for i, aa in enumerate(a):
    b[aa] = i + 1
b = sorted(b.items())
ans = ''
for k, v in b:
    if ans != '':
        ans += ' '
    ans += str(v)
print(ans)

Measured memory_bytes: 24284
#include<stdio.h>
int main()
{
    int h,w,i,j;
    while(1)
    {
     scanf("%d%d",&h,&w);
     if(h==0&&w==0)
        break;
     for(i=1;i<=h;i++)
     {    if(i%2!=0)
        {
            for(j=1;j<=w;j++)
            if(j%2!=0)
            printf("#");
         else
            printf(".");
     }
     else
        {
            for(j=1;j<=w;j++)
            if(j%2==0)
            printf("#");
         else
            printf(".");
     }
        printf("\n");
    }
    printf("\n");
    }

    return 0;
}




Measured memory_bytes: 2032
#include<bits/stdc++.h>
using namespace std;
int main(){
        char st[1000];
        scanf("%s",&st);
        int l=strlen(st);
        if(st[l-2]=='e'|| st[l-1]=='s')
            cout<<st<<"es"<<endl;
        else
            cout<<st<<"s"<<endl;
}


Measured memory_bytes: 3760
odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']

inputs = input()

result = None
for i, s in enumerate(inputs):
    if (i + 1) % 2 == 0 and s in even:
        result = 'Yes'
    elif (i + 1) % 2 != 0 and s in odd:
        result = 'Yes'
    else:
        result = 'No'
        break

print(result)

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



int main(){
    string S, T; cin >> S >> T;
    string ans;
    int ns = S.size(), nt = T.size();
    int dp[3000 + 1][3000 + 1] = {0};
    for (int i = 0; i <= ns; i++)
    {
        dp[i][0] = 0;
    }
    for (int i = 0; i <= nt; i++)
    {
        dp[0][i] = 0;
    }
    
    
    for (int i = 1; i <= ns; i++)
    {
        for (int j = 1; j <= nt; j++)
        {
            dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
            if(S[i-1] == T[j-1]) dp[i][j] = max(dp[i][j], dp[i-1][j-1] + 1);
        }
    }
    int ts = ns, tt = nt;
    while(ts >= 1 && tt >= 1){
        while( ts >= 1 && dp[ts][tt] == dp[ts-1][tt]) ts--;
        while( tt >= 1 && dp[ts][tt] == dp[ts][tt-1]) tt--;
        
        if(ts > 0)ans.push_back(S[ts-1]);
        ts--, tt--;
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
    
    
}

Measured memory_bytes: 35456
l = list(input())

dic = {}
for i, v in enumerate(l):
    if v in dic:
        dic[v] += 1
    else:
        dic[v] = 1

li = list(dic.values())
if li[0] == 2 and li[1] == 2:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 2940
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
	    int n = scan.nextInt();
	    int h[]= new int[n];
	    for(int i=0;i<n;i++) {
	    	h[i]=scan.nextInt();
	    }
	    scan.close();
	    int cnt=0;
	    int max=0;
	    for(int i=n-2;i>=0;i--) {
	    	if(h[i+1]<=h[i])cnt++;
	    	else cnt=0;
	    	if(cnt>max)max=cnt;
	    }

	    System.out.println(max);

	}

}


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

using namespace std;

constexpr int MAX = 1000000;
bool isprime[MAX];

int main()
{
    for (int i = 2; i < MAX; i++) {
        isprime[i] = true;
    }
    for (int i = 2; i < MAX; i++) {
        if (isprime[i]) {
            for (int j = 2; i * j < MAX; j++) {
                isprime[i * j] = false;
            }
        }
    }

    while (true) {
        int a, d, n;
        cin >> a >> d >> n;
        if (a == 0 and d == 0 and n == 0) {
            break;
        }
        int cnt = 0;
        int prime = a - d;
        while (cnt < n) {
            prime += d;
            if (isprime[prime]) {
                cnt++;
            }
        }
        cout << prime << endl;
    }
    return 0;
}

Measured memory_bytes: 4012
#include<iostream>

using namespace std;

int main()
{
	int N;
	int *x,*y,*t;

	cin >> N;

	x = new int[N+1];
	y = new int[N+1];
	t = new int[N+1];

	x[0] = y[0] = t[0] = 0;

	for(int i=0;i<N;i++)
	{
		cin >> t[i+1] >> x[i+1] >> y[i+1];
	}

	bool can = true;

	for(int i=0;i<N;i++)
	{
		int dt = t[i+1] - t[i];
		int dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i]);
		if(dt < dist)can = false;
		if(dt%2 != dist%2)can = false;

		if(!can)break;
	}

	if(can)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	return 0;
}

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

#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif


signed main(){

  int h,w,s,t; cin >> h >> w >> s >> t;
  bool judge = true;
  if(h%2 == 1 && w%2 == 1){
    if((s+t)%2 == 1) judge = false;
  }
  cout << (judge ? "Yes" : "No") << endl;

  return 0;
}



Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
int main(){
int N, T, c, t, m=1001; cin >> N >> T;
for(int i=0; i<N; i++){ cin >> c >> t; if(t<=T){m=min(m, c);} }
if(m<=1000){ cout << m << "\n"; }else{ cout << "TLE\n"; }
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b , a % b);
}

const ll MOD = 1000000007;
const ll MAX = 2000001;

ll mod(ll a){
  return a % MOD;
}

ll lcm(ll a,ll b){
  return (a*b)/gcd(a,b);
}

ll fac[MAX], finv[MAX], inv[MAX];

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

vector<pair<ll,ll>> prime_factorize(ll n){
  vector<pair<ll,ll>> res;
  
  for(ll i=2; i*i <= n; i++){
    if(n % i != 0) continue;
    
    ll ex = 0;
    while(n % i == 0){
      ex++;
      n /= i;
    }
    
    res.push_back({i,ex});
  }
  
  if(n != 1) res.push_back({n,1});
  
  return res;
  
}




int main(){
  ll n; cin >> n; vl num(n); vl numd(n);
  
  rep(i,n){
    cin >> numd[i];
    num[i] = numd[i];
  }
  
  sort(all(numd));
  
  ll a,b; a = numd[n/2 - 1]; b = numd[n/2];
  
  for(ll i=0; i < n; i++){
    if(num[i] <= a) cout << b << endl;
    else cout << a << endl;
  }
  
}

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

int main () {
int r, d, x;
  cin >> r >> d >> x;
  rep(i,10) {
  x = r*x  - d;
  cout << x << endl;
  }
}


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

template <typename T> void max_self(T& a,T b){
  a = max(a,b);
}

const int MOD = 1e9+7;
int main(){
    int h,w;
    cin>>h>>w;
    vector<vector<int>> dp(h,vector<int>(w,0));
    dp[0][0] = 1;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            char cell;
            cin>>cell;
            if(cell=='#'){
                dp[i][j] = 0;
            }else{
                if(j>0)
                    dp[i][j] = (dp[i][j]+dp[i][j-1])%MOD;
                if(i>0)
                    dp[i][j] = (dp[i][j]+dp[i-1][j])%MOD;
            }
        }
    }
    cout<<dp[h-1][w-1];
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T> inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

int main() {
    init();

    FOR(i, 0, 7) {
        int a, b;
        cin >> a >> b;
        cout << a - b << "\n";
    }
}


Measured memory_bytes: 3144
#include <bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include<cmath>
#include<string>
#define pb push_back
#define ll long long
#define ull unsigned long long
#define deb(x) cerr<<#x<<" "<<x<<"\n"
#define debi cerr<<"hey sparky\n"
#define x first
#define y second
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define eps (double)1e-9
#define all(x) x.begin(),x.end()
#define int long long
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> pdbs;
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
//void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
// look for  all edge cases
//search for a pattern

 


signed main() {    
    ios::sync_with_stdio(0);
    cout.tie(0);
    cin.tie(0);
		
	int n;
	cin >> n;
	vector<int> v(n);
	
	for(int i =0 ; i < n; i++){
		cin >> v[i];
	}	
	
	sort(all(v));
	int ans = 0;
	for(int i = 0 ; i < n - 2; i++){
		for(int j = i+1 ;j  < n-1 ; j++){
			for(int k = j +1 ;k< n ;k++){
				int val1 = v[i] , val2 = v[j] , val3 = v[k];
				set<int> s;
				s.insert(val1);
				s.insert(val2);
				s.insert(val3);
				if((int)s.size() == 3 && val1 + val2 > val3){
					ans += 1;
				}
			}
		}
	}
	
	cout<<ans;
   
   return 0;
}


Measured memory_bytes: 3664
//Written by Zhu Zeqi
//Come on,baby
//Hack,please
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define CLR(x) memset(x,0,sizeof x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define MAX 1000000000000000000
#define MOD 1000000007
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f
typedef long long ll;
//orz yht
using namespace std;
string i_s(int x){
	if(x==0)
	return "0";
	string ret="";
	while(x){
		ret=ret+(char)(x%10+'0');
		x/=10;
	}
	reverse(ret.begin(),ret.end());
	return ret;
}
string add(string a,string b){
	if(a=="")
	a="0";
	if(b=="")
	b="0";
	if(a.length()<b.length())
	swap(a,b);
	while(b.length()<a.length()){
		b='0'+b;
	}
	for(int i=0;i<a.length();i++){
		a[i]=a[i]+(b[i]-'0');
	}
	bool big=false;
	for(int i=a.length()-1;i>=0;i--){
		if(big){
			a[i]++;
		}
		big=false;
		if(a[i]>'9'){
			a[i]=a[i]-10;
			big=true;
		}
	}
	if(big)
	a='1'+a;
	return a;
}
string mul(string a,string b){
	vector<int> va,vb;
	if(a=="0" || b=="0")
	return "0";
	string ans;
	for(int i=0;i<a.length();i++){
		va.push_back(a[i]-'0');
	}
	for(int i=0;i<b.length();i++){
		vb.push_back(b[i]-'0');
	}
	reverse(va.begin(),va.end());
	reverse(vb.begin(),vb.end());
	vector<int> res;
	res.clear();
	res.resize(1005);
	for(int i=0;i<a.length();i++){
		for(int j=0;j<b.length();j++){
			res[i+j]+=(va[i]*vb[j]);
		}
	}
	for(int i=0;i<1005;i++){
		if(res[i]>9){
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	for(int i=0;i<1005;i++){
		ans+=(res[i]+'0');
	}
	reverse(ans.begin(),ans.end());
	int k=0;
	while(ans[k]=='0'){
		k++;
	}
	ans=ans.substr(k);
	return ans;
}
bool is_prime(int n){
	if(n<2)
    return false;
    for(int i=2;i*i<=n;i++)
    if(n%i==0)
    return false;
    return true;
}
int a,b;
string s;
int main(){
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);
	cin>>a>>b>>s;
	if(s.size()!=a+b+1){
		cout<<"No";
		return 0;
	}
	if(s[a]!='-'){
		cout<<"No";
		return 0;
	}
	for(int i=0;i<s.size();i++){
		if(!isdigit(s[i]) && i!=a){
			cout<<"No";
			return 0;
		}
	}
	cout<<"Yes";
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
A,B=map(int,input().split())
ans=1
x=A
if B==1:
  print(0)
  exit()
if x>=B:
  print(ans)
  exit()
for i in range(B):
  x+=(A-1)
  ans+=1
  if x>=B:
    print(ans)
    exit()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define dummy (int)1e8
using namespace std;

struct data {
  int num, lef, righ, par;
};

int t;
string s;
vector<data> v;
vector<int> pre, in, pos;

void insert(int x);
void print();
void rec(int p);
bool find(int x);
void del(int x);

int main() {
  cin >> t;
  v.push_back({dummy, dummy, dummy, dummy});
  while(t--) {
    cin >> s;
    if(s == "print")
      print();
    else if(s == "find") {
      int x;
      cin >> x;
      if(find(x))
        cout << "yes" << endl;
      else
        cout << "no" << endl;
    }
    else if(s == "delete") {
      int x;
      cin >> x;
      del(x);
    }
    else {
      int x;
      cin >> x;
      insert(x);
    }
  }
  return 0;
}

void insert(int x) {
  int id = 0;
  while(!v.empty() && v[id].num != dummy) {
    int nownum = v[id].num;
    if(nownum > x) {
      if(v[id].lef == dummy) {
        v[id].lef = v.size();
        v.push_back({dummy, dummy, dummy, id});
      }
      else
        id = v[id].lef;
    }
    else if(nownum < x) {
      if(v[id].righ == dummy) {
        v[id].righ = v.size();
        v.push_back({dummy, dummy, dummy, id});
      }
      else
        id = v[id].righ;
    }
  }
  v[id].num = x;
}

void print() {
  pre.clear();
  in.clear();
  pos.clear();
  rec(0);
  for(int i = 0; i < pos.size(); ++i) cout << " " << in[i];
  cout << endl;
  for(int i = 0; i < pre.size(); ++i) cout << " " << pre[i];
  cout << endl;
}

void rec(int p) {
  pre.push_back(v[p].num);
  if(v[p].lef != dummy) rec(v[p].lef);
  in.push_back(v[p].num);
  if(v[p].righ != dummy) rec(v[p].righ);
  pos.push_back(v[p].num);
}

bool find(int x) {
  int id = 0;
  while(id != dummy && v[id].num != dummy) {
    if(v[id].num == x) return 1;
    if(v[id].num > x)
      id = v[id].lef;
    else if(v[id].num < x)
      id = v[id].righ;
  }
  return 0;
}

void del(int x) {
  int id = 0;
  while(id != dummy && v[id].num != dummy) {
    if(v[id].num == x) {
      int par = v[id].par;
      if(v[id].lef == v[id].righ && v[id].lef == dummy) {
        v[id].num = dummy;
        if(v[par].lef == id)
          v[par].lef = dummy;
        else
          v[par].righ = dummy;
      }
      else if(v[id].lef == dummy) {
        int chil = v[id].righ;
        v[chil].par = par;
        if(v[par].lef == id)
          v[par].lef = chil;
        else
          v[par].righ = chil;
        v[id].num = dummy;
      }
      else if(v[id].righ == dummy) {
        int chil = v[id].lef;
        v[chil].par = par;
        if(v[par].lef == id)
          v[par].lef = chil;
        else
          v[par].righ = chil;
        v[id].num = dummy;
      }
      else {
        int chil = v[id].lef, num;
        num = v[chil].num;
        del(v[chil].num);
        v[id].num = num;
      }
    }
    if(v[id].num > x)
      id = v[id].lef;
    else if(v[id].num < x)
      id = v[id].righ;
  }
  return;
}


Measured memory_bytes: 18548
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline ll read()
{
	ll x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

char s[maxn];
ll a[maxn],v[65];

inline void ins(ll x)
{
	for(ll i=63;i>=0;i--)
	{
		if(x&(1ll<<i))
		{
			if(!v[i]) {v[i]=x; break;}
			else x^=v[i];
		}
	}
}

inline bool q(ll x)
{
	for(ll i=63;i>=0;i--) if(x&(1ll<<i)) x^=v[i];
	if(x) return false; return true;
}

int main()
{
	int T=read();
	while(T--)
	{
		ll n=read(),F=0; rep(i,1,n) a[i]=read(); scanf("%s",s+1);
		rep(i,0,63) v[i]=0;
		per(i,n,1)
		{
			if(s[i]=='0') ins(a[i]);
			else if(!q(a[i])) {F=1; break;}
		}
		if(F) puts("1"); else puts("0");
	}
	return 0;
}

Measured memory_bytes: 3604
from bisect import bisect_right

def divisor(n):
    ass = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            if i**2 == n:
                continue
            ass.append(n//i)
    ass.sort()
    return ass 

N,M = map(int,input().split())
a = M//N

li = divisor(M)

x = bisect_right(li,a)

print(li[x-1])


Measured memory_bytes: 3316