akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)
#define rem(i, m, n) for (int i = m; i >= n; --i)
typedef long long ll;

int N, K;
vector<ll> a;
vector<ll> s;

void dfs(int i, ll v) {
  s.push_back(v + a[i]);
  if(i == N - 1) return;
  dfs(i + 1, v + a[i]);
}

int main() {
  cin >> N >> K;
  a.resize(N);
  rep(i, 0, N) cin >> a[i];
  rep(i, 0, N) dfs(i, 0);
  ll ans = 0;
  rem(i, 50, 0) {
    int cnt = 0;
    ll mask = ans | (1LL << i);
    rep(j, 0, s.size()) if((s[j] & mask) ==  mask) cnt++;
    if(cnt >= K) ans |= mask;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6260
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
#define fi first
#define se second
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=998244353;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
signed main(){
    ll h,w,k;cin>>h>>w>>k;
    vector<vector<ll> >d(h+2,vector<ll>(w+2));
    vector<vector<ll> >ans(h+2,vector<ll>(w+2,inf));
    queue<pll>q;
    ll x,y;cin>>x>>y;
    q.push(mp(x,y));
    ans[x][y]=0;
    cin>>x>>y;
    rep(i,h){
        rep(j,w){
            char c;cin>>c;
            if(c=='.')d[i+1][j+1]=1;
        }
    }
    while(!q.empty()){
        pll p=q.front();
        ll nx=p.fi,ny=p.se;
        q.pop();
        rep(i,4){
            REP(j,1,k+1){
                ll xx=nx+dx[i]*j,yy=ny+dy[i]*j;
                if(d[xx][yy]==0)break;
                if(ans[xx][yy]<ans[nx][ny]+1)break;
                if(ans[xx][yy]==ans[nx][ny]+1)continue;
                if(ans[xx][yy]==inf){
                    ans[xx][yy]=ans[nx][ny]+1;
                    q.push(mp(xx,yy));
                }
            }
        }
    }
    if(ans[x][y]<inf){
        cout<<ans[x][y]<<endl;
    }else{
        cout<<-1<<endl;
    }
}


Measured memory_bytes: 57932
#include<iostream>
int main()
{
	using namespace std;
	int n, a[200], i, r=0;
	cin >> n;
	for (i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	for (i = 0; i < n; i++)
	{
		if (a[i] % 2 == 0)
		{
			if (a[i] % 3 == 0 || a[i] % 5 == 0)
				r = 0;
			else
			{
				r = 1;
				break;
			}
		}
	}
	if (r == 1)
		cout << "DENIED";
	else

		cout << "APPROVED";

}

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

const int mod = 998244353;

const int max_N = 3005;

using LL = long long;

int A, B, C, D;

LL dp[max_N][max_N];

int main() {
    scanf("%d%d%d%d", &A, &B, &C, &D);
    dp[A][B] = 1;
    for (int i = A; i <= C; ++i) {
        for (int j = B; j <= D; ++j) {
            if (i == A && j == B) {
                continue;
            }
            dp[i][j] = (dp[i - 1][j] * j + dp[i][j - 1] * i - dp[i - 1][j - 1] * (i - 1) * (j - 1)) % mod;
        }
    }
    printf("%lld\n", (dp[C][D] + mod) % mod);
}

Measured memory_bytes: 74104
#include <cstdio>
using namespace std;

namespace zyt
{
	int work()
	{
		int n, id = 0;
		scanf("%d", &n);
		while ((1 << id) <= n)
		{
			if (n == (1 << id))
			{
				puts("No");
				return 0;
			}
			++id;
		}
		--id;
		puts("Yes");
		printf("1 2\n2 3\n3 %d\n%d %d\n%d %d\n", n + 1, n + 1, n + 2, n + 2, n + 3);
		for (int i = 4; i + 1 <= n; i += 2)
		{
			printf("%d %d\n", i, n + 1);
			printf("%d %d\n", i + 1, i);
			printf("%d %d\n", n + 1, i + n + 1);
			printf("%d %d\n", i + n + 1, n + i);
		}
		if (!(n & 1))
		{
			printf("%d %d\n", n, 1 << id);
			printf("%d %d\n", n << 1, n - (1 << id) + 1 == 3 ? 3 : n * 2 - (1 << id) + 1);
		}
		return 0;
	}
}
int main()
{
	return zyt::work();
}

Measured memory_bytes: 2688
from collections import defaultdict
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

H, W, M = map(int, input().split())
row = [0] * (H + 1)
col = [0] * (W + 1)

hw = []
d = defaultdict(int)

for _ in range(M):
    h, w = map(int, input().split())
    d[(h, w)] = 1
    row[h] += 1
    col[w] += 1

r_max = 0
ri = []
c_max = 0
ci = []

for i, cnt in enumerate(col):
    if not cnt:
        continue
    if cnt > c_max:
        c_max = cnt
        ci = [i]
    elif cnt == c_max:
        ci.append(i)

for i, cnt in enumerate(row):
    if not cnt:
        continue
    if cnt > r_max:
        r_max = cnt
        ri = [i]
    elif cnt == r_max:
        ri.append(i)

ans = c_max + r_max


for r in ri:
    for c in ci:
        if not d[(r, c)]:
            print(ans)
            exit()

print(ans - 1)

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

#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define lfs <<fixed<<setprecision(10)<<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = n; i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = n - 1; i >= (ll)(m); i--)
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>v,ll n){cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
template<typename T>
void emp(map<T,ll>&m, T x){m.emplace(x,0).first->second++;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

int main(){
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  ll res=0,res1=INF,res2=-INF,buf=0;
  bool judge = true;
  ll n;cin>>n;
  vector<ll>a(n);
  rep(i,0,n)cin>>a[i];
  rep(i,0,n){
    res+=a[i]/2;
    a[i]=a[i]%2;
    if(i!=n-1){
      ll x=min(a[i],a[i+1]);
      res+=x;
      a[i]-=x;
      a[i+1]-=x;
    }
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <cstdio>
#include <stack>
#include <queue>
#include <vector>
#define ll long long
const int N=1e6+10;
using namespace std;
int n;
int flag=0;
int main() {
   cin>>n;
   for(int i=1;i<=9;i++)
       for(int j=1;j<=9;j++){
           if(i*j==n)
               flag++;
       }
   if(flag!=0){
       cout<<"Yes"<<endl;
   } else  cout<<"No"<<endl;
    return 0;
}

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

        int dividedCount = 0;
        int currentDividedCount = 0;
        int tmp = 0;
        int output = 0;
        int target = 0;

        for(int i=givenNumber; i>0; i--) {
            if(givenNumber == 1) {
                output = 1;
                break;
            }
            if(i % 2 == 0) {
                target = i;
                tmp = i;
                while(true) {
                    if(target % 2 != 0) {
                        break;
                    } else {
                        dividedCount += 1;
                        target /= 2;
                    }
                }
                if(currentDividedCount < dividedCount) {
                    currentDividedCount = dividedCount;
                    output = tmp;
                }
                dividedCount = 0;
            }
        }
        System.out.println(output);
    }
}


Measured memory_bytes: 23124
ab1 = list(map(int, input().split()))
ab2 = list(map(int, input().split()))
ab3 = list(map(int, input().split()))
roots = [ab1,ab2,ab3]
rootContainCity = []
rootContainCity.extend(ab1)
rootContainCity.extend(ab2)
rootContainCity.extend(ab3)

viaCityList = []
startOrGoalCityList = []

for i in range(4):
    if rootContainCity.count(i+1) == 2:
        viaCityList.append(i+1)
    else:
        startOrGoalCityList.append(i+1)
if len(viaCityList) == 2 and len(startOrGoalCityList) == 2:
    if [viaCityList[0],viaCityList[1]] in roots or [viaCityList[1],viaCityList[0]] in roots:
        print("YES")
else:
    print("NO")

Measured memory_bytes: 3064
N = int(input())
S = input()

for a in ('SS','SW','WS','WW'):
    for c in S[1:]:
        if a[-1]=='S':
            a += 'W' if (a[-2]=='W') ^ (c=='x') else 'S'
        else:
            a += 'S' if (a[-2]=='W') ^ (c=='x') else 'W'
    if a[0] != a[-1]: continue
    if (a[0]=='W') ^ (S[0]=='x'):
        if a[-2]==a[1]: continue
    else:
        if a[-2]!=a[1]: continue
    print(a[:-1])
    exit()
print(-1)

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

using namespace std;

int main() {
    int h,w;
    cin>>h>>w;
    vector<string>a(h);
    vector<vector<int>>ans(h,vector<int>(w));
    vector<vector<bool>>bom(h,vector<bool>(w));
    for (int i = 0; i < h; i++)
    {
        cin>>a[i];
        for (int j = 0; j < w; j++)
        {
            if (a[i][j]=='#'){
                for (int x = -1; x < 2; x++)
                {
                    for (int y = -1; y < 2; y++)
                    {
                        if(i+x>=0 && i+x<h && j+y>=0 && j+y<w){
                            ans[i+x][j+y]++;
                        }
                    }
                    
                }
                bom[i][j]=true;
                
            }
        }
        
    }
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {   
            if (bom[i][j]){
                cout<<'#';
            }
            else{
            cout<<ans[i][j];
            }
        }
        cout<<endl;
    }   
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(a);i<=(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(b);i>=(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
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;}

#define N 305
ll n;
ll w[N];
ll dp[N][N];
ll f(ll l,ll r){
    if(r-l<2)return 0;
    if(dp[l][r]!=-1)return dp[l][r];
    ll ret=0;
    if(abs(w[l]-w[r-1])<=1&&f(l+1,r-1)==r-l-2)ret=r-l;
    fore(i,l+1,r-1){
        ll tmp=f(l,i)+f(i,r);
        chmax(ret,tmp);
    }
    return dp[l][r]=ret;
}
void solve(){
    while(1){
        cin>>n;
        if(n==0)return;
        rep(i,n)cin>>w[i];

        memset(dp,-1,sizeof(dp));
        cout<<f(0,n)<<endl;
    }
}

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



Measured memory_bytes: 3828
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if x ==  500 * i + 100 * j + 50 * k:
                 count += 1
print(count)

Measured memory_bytes: 9060
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 1000000000000000
#define bpc(x) __builtin_parityll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;

ll powa(ll a, ll b, ll c)
{
    a%=c;
    if(a<0)
	a+=c;
    ll res = 1;
    while(b>0)
    {
        if(b&1)
            res*=a, res%=c;
        a*=a, a%=c;
        b>>=1;
    }
    return res;
}
 
#define N 200005
 
ll fact[N];
ll ifact[N];
 
ll ncr(ll n, ll r)
{
    if(r>n)
        return 0;
    ll ans = fact[n];
    ans*=ifact[r];
    ans%=mod;
    ans*=ifact[n-r];
    ans%=mod;
    return ans;
}

int main()
{
   FAST/**/
   
   fact[0] = 1;
   for(ll i=1;i<N;i++)
        fact[i] = fact[i-1]*i, fact[i]%=mod;
   for(ll i=0;i<N;i++)
        ifact[i] = powa(fact[i],mod-2,mod);
   
   ll s;
   cin>>s;
   
   ll ans = 0;
   for(ll i=1;i<=(s)/3;i++)
   {
       if(s-2*i-1<i-1)
            break;
       ans+=ncr(s-2*i-1,i-1);
       ans%=mod;
   }
   cout<<ans;
   
   
   return 0;        
}  
   

Measured memory_bytes: 6772
#[allow(unused_imports)]
use std::cmp::Ordering::{Equal, Greater, Less};
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;

// author: Seong Yong-ju <sei40kr@gmail.com>

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn f(x: u64) -> u64 {
    let t = (x + 1) / 2;

    if x % 2 == 0 {
        x ^ (t % 2)
    } else {
        t % 2
    }
}

fn main() {
    input! {
        a: u64,
        b: u64,
    };

    let fa = if 1 <= a { f(a - 1) } else { 0 };
    let fb = f(b);
    let ans = fa ^ fb;

    println!("{}", ans);
}


Measured memory_bytes: 4352
use std::io::Read;

fn binary_search(s: &[i32], x: i32) -> bool {
    let mut left = 0;
    let mut right = s.len();
    while right - left > 1 {
        let mid = (left + right) / 2;
        if s[mid] <= x {
            left = mid;
        } else {
            right = mid;
        }
    }
    s[left] == x
}

fn solve(_n: usize, s: &mut [i32], _q: usize, t: &[i32]) -> usize {
    s.sort();
    t.iter().filter(|&&x| binary_search(s, x)).count()
}

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();
    let mut s = (0..n).map(|_| iter.next().unwrap().parse().unwrap()).collect::<Vec<_>>();
    let q: usize = iter.next().unwrap().parse().unwrap();
    let t = (0..q).map(|_| iter.next().unwrap().parse().unwrap()).collect::<Vec<_>>();
    let r = solve(n, &mut s, q, &t);
    println!("{}", r);
}



Measured memory_bytes: 7088
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
typedef pair<int, int> p;



long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

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

    ll mod = pow(10, 9) + 7;

    ll H, W, A, B;
    cin >> H >> W >> A >> B;

    ll b = 1;
    ll c = 1;

    for(ll i = H - A - 1LL + B; i > B; i--) {
        b *= i;
        b %= mod;
    }

    for(ll i = 2LL; i <= H - A - 1LL; i++) {
        b *= modpow(i, mod - 2LL, mod);
        b %= mod;
    }

    for(ll i = W + A - B - 2LL; i > W - B - 1LL; i--) {
        c *= i;
        c %= mod;
    }

    for(ll i = 2LL; i <= A - 1LL; i++) {
        c *= modpow(i, mod - 2LL, mod);
        c %= mod;
    }

    ll b1 = H - A + B;
    ll b2 = B + 1LL;

    ll c1 = W - B - 1LL;
    ll c2 = W + A - B - 2LL;

    ll ans = 0;

    for(ll i = B; i < W; i++) {
        ans += b * c;
        ans %= mod;

        b *= b1;
        b %= mod;
        b *= modpow(b2, mod - 2LL, mod);
        b %= mod;

        b1++;
        b2++;

        c *= c1;
        c %= mod;
        c *= modpow(c2, mod - 2LL, mod);
        c %= mod;

        c1--;
        c2--;
    }

    cout << ans << endl;
}

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

void Main()
{
    int n;
    cin >> n;
    long max_z = -1e10;
    long min_z = 1e10;
    long max_w = -1e10;
    long min_w = 1e10;
    for (int i = 0; i < n; i++)
    {
        long x, y;
        cin >> x >> y;
        max_z = max(max_z, x+y);
        min_z = min(min_z, x+y);
        max_w = max(max_w, x-y);
        min_w = min(min_w, x-y);
    }
    
    cout << max(max_z-min_z, max_w-min_w) << endl;
}

int main(int argc, char **argv)
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    Main();
    return 0;
}


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

#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <numeric>
#include <string>
#include <array>

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

using namespace std;
typedef long long int ll;

int main() {
  ll b, n;
  cin >> n;
  ll befsum =10000000000;
  for (ll a = 1; a < n; ++a) {
    b=n-a;
    string sb=to_string(b), sa=to_string(a);
    ll sum =0;
    for (int i = 0; i < sa.size(); ++i) {
      sum += stoi(sa.substr(i,1));
    }
    for (int i = 0; i < sb.size(); ++i) {
      sum += stoi(sb.substr(i,1));
    }
    if(befsum>sum)
      befsum=sum;
  }


  cout << befsum << endl;


  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define INF (ll)1e18
#define pii pair<ll,ll>
#define mod 1000000007 //998244353
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fb(i,a,b) for(ll i=a;i>b;i--)
#define ff first
#define ss second
#define PI 3.141592653589793238
#define pq priority_queue<ll>
#define pqr priority_queue<ll,vector<ll>,greater<ll>()>
using namespace std;
ll pow_mod(ll a,ll b)
{
	ll res=1;
	while(b!=0)
	{
		if(b&1)
		{
			res=(res*a)%mod;
		}
		a=(a*a)%mod;
		b/=2;
	}
	return res;
}
void solve()
{
    ll n;
    cin>>n;
    
    ll a[n];
    
    for(ll i=0;i<n;i++)
    cin>>a[i];
    
    multiset<ll>st;
    
    for(ll i=0;i<n;i++){
        st.insert(-a[i]);
        
        auto it=st.upper_bound(-a[i]);
        
        if(it!=st.end()){
            st.erase(it);
        }
    }
    
    ll ans=st.size();
    
    cout<<ans<<endl;
}
int32_t main()
{    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);
     
//Start from Here.

  ll t;
  t=1;
 // cin>>t;
  while(t--)
  solve();
  
//Good Bye!
    return 0;
}

Measured memory_bytes: 9072
package main

import (
	"fmt"
	"math"
)

func main() {
	var A, B, H, M int
	fmt.Scanf("%d %d %d %d", &A, &B, &H, &M)

	angleH := float64(H)/12.0*360.0 + (float64(M) / 60.0 * (360.0 / 12))
	angleM := float64(M) / 60.0 * 360.0
	angleAB := math.Abs(angleH - angleM)

	AA := float64(A*A) + float64(B*B) - (2.0 * float64(A) * float64(B) * math.Cos(angleAB*math.Pi/180))
	fmt.Println(math.Sqrt(AA))
}


Measured memory_bytes: 1820
/** omgursocute **/
#include <bits/stdc++.h>

using namespace std;
typedef int64_t ll;
typedef uint64_t ull;
typedef long double ld;

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

	int k, x;
	cin >> k >> x;
	for(int i = x-k+1; i <= x+k-1; i++)
		cout << i << ' ';

	cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << " ms.\n";
}

// g++ o .cpp -O2 -std=c++11 -D cute -Wall -Wno-unused-result



Measured memory_bytes: 256
//??????????????°???????????\??????????§£???
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define int long long
using namespace std;

int powmod(int a, int n, int mod) {
	if (n == 0) return 1;
	if (n % 2 == 0) return powmod((a * a) % mod, n / 2, mod);
	return (powmod(a, n - 1, mod) * a) % mod;
}

void setRollingHash(string &s, int rolling[], int base, int mod) {
	int n = s.length();
	rolling[0] = 1;
	for (int i = 1; i <= n; i++) {
		rolling[i] = (rolling[i - 1] + s[i - 1] * powmod(base, i, mod)) % mod;
	}
}

int base = 114514901;
int mod[3] = {1000000007, 500000003, 1145141923};
int rolling[3][300001];

int n, m;
string s;
string query;
int l, r;		//[l, r), 0-indexed

int getHash(int l, int r, int type) {
	//(rolling[type][r] - rolling[type][l]) / base^l
	int x = (rolling[type][r] - rolling[type][l] + mod[type]) % mod[type];
	return (x * powmod(base, l * (mod[type] - 2), mod[type])) % mod[type];
}

signed main() {
	cin >> n >> m >> s;
	l = 0, r = 1;
	
	for (int type = 0; type < 3; type++) setRollingHash(s, rolling[type], base, mod[type]);
	
	vector<vector<int>> hashs;
	hashs.resize(m);
	for (int i = 0; i < m; i++) {
		cin >> query;
		if (query == "L++") l++;
		if (query == "L--") l--;
		if (query == "R++") r++;
		if (query == "R--") r--;
		for (int j = 0; j < 3; j++) {
			hashs[i].push_back(getHash(l, r, j));
		}
	}
	
	sort(hashs.begin(), hashs.end());
	hashs.erase(unique(hashs.begin(), hashs.end()), hashs.end());
	cout << hashs.size() << endl;
	return 0;
}

Measured memory_bytes: 31340
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>

using namespace std;

#define rep(i, n) for(int (i) = 0; (i) < (n); (i) ++)

int main(){
    int n;
    cin >> n;
    int ans = 0;
    rep(i, n){
        int tmp;
        cin >> tmp;
        ans += tmp - 1;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){

   int a,b,c;      // define variable,  1<= a, b, c <= 10000,  a <= b
   int i;             // define loop counter
   int cnt=0;         // define answer

   scanf("%d %d %d", &a, &b, &c);

   for(i=a;i<=b;i++){
      if(c%i == 0) cnt++;
    }

    printf("%d\n", cnt);
    return 0;
}

Measured memory_bytes: 596
figure=input()
math=input()
flg=False
 
figure=figure.split(' ')
if figure[3]>figure[4]:
  flg=True
  
for i in range(max(int(figure[3]),int(figure[4]))-1):
  if math[i]=='#' and math[i+1]=='#':
    if i>int(figure[1]) and i<int(figure[3])-1 or i>int(figure[2]) and i<int(figure[4])-1:
    	print('No')
    	exit()
    
  if flg and i>=int(figure[2])-2 and i<int(figure[4])-1 and math[i]=='.' and math[i+1]=='.' and math[i+2]=='.':
    flg=False

if not flg:
	print('Yes')
else:
  print('No')

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

//Binomial Coefficients
const long long c_max = 1000003;
const long long mod = 1e9+7;
long long fac[c_max], finv[c_max], inv[c_max];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (long long i = 2; i < c_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;
    }
}
// 二項係数計算
long long COM(long long comn, long long comk){
    if (comn < comk) return 0;
    if (comn < 0 || comk < 0) return 0;
    return fac[comn] * (finv[comk] * finv[comn - comk] % mod) % mod;
}

void solve_A(){
	int r;
    cin >> r;
    cout << r*r << endl;
}

void solve_B(){
	int n,i;
    char c[505];
    bool ans=true;
    cin >> n >> c;
    if(n%2==1){
        cout << "No" << endl;
        ans=false;
    } else {
        for(i=0;i<n/2;i++){
            if(c[i]!=c[n/2+i]){
                cout << "No" << endl;
                ans=false;
            }
        }
    }
    if(ans) cout << "Yes" << endl;
}

void solve_C(){
	int n,i,f=1;
    double x[15],y[15],ans=0;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> x[i] >> y[i];
        f*=(i+1);
    }
    vector<int> p;
    for(i=0;i<n;i++) p.push_back(i);
    do{
        double memo;
        for(i=1;i<n;i++){
            memo=(x[p[i-1]]-x[p[i]])*(x[p[i-1]]-x[p[i]])+(y[p[i-1]]-y[p[i]])*(y[p[i-1]]-y[p[i]]);
            memo=sqrt(memo);
            ans+=memo;
        }
    }while(next_permutation(p.begin(),p.end()));
    ans=ans/(double)f;
    printf("%.13lf\n",ans);
}

void solve_D(){
	long long x,y,n,i;
    bool t=true;
    cin >> x >> y;
    if((x+y)%3!=0){
        cout << "0" << endl;
    } else {
        n=(x+y)/3;
        if(x-n<0||2*n-x<0){
            cout << "0" << endl;
        } else {
            COMinit();
            cout << COM(n,x-n) << endl;
        }
    }
}

int main() {
	// your code goes here
	solve_A();
    //solve_B();
    //solve_C();
    //solve_D();
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int D;cin>>D;
  if(D==25)cout<<"Christmas"<<endl;
  else if(D==24)cout<<"Christmas Eve"<<endl;
  else if(D==23)cout<<"Christmas Eve Eve"<<endl;
  else cout<<"Christmas Eve Eve Eve"<<endl;
}

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

int main() {
    int r;
    cin >> r;
    if (r < 1200){
        cout << "ABC" << endl;
    } else if(r < 2800){
        cout << "ARC" << endl;
    } else {
        cout << "AGC" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int a[100010];
int main(){
    int n;
    while(cin>>n){
        ll ans=0;
        set<string>s, s1;
        s.insert("a");
        for(int i=2; i<=n; ++i){
        	for(auto it:s){
        		int mx=0;
        		for(int j=0; j<it.size(); ++j){
        			mx=max(mx, it[j]-'a');
        			s1.insert(it+it[j]);
        		}
        		s1.insert(it+char(mx+1+'a'));
        	}
        	s=s1;
        	s1.clear();
        }
        for(auto it:s){
        	cout<<it<<endl;
        }
    }
  return 0;
}




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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  int ans = 1;
  if (a !=b) {
    ans++;
    if (a != c && b != c) ans++;
  } else if (a != c || b != c) ans++;
  cout << ans << endl;
}

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

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

ll H,W,K;
string s[10];
string t[10];

int main(){
    ll ans = 0;
    cin >> H >> W >> K;
    for(int i=0;i<H;i++) cin >> s[i];
    for(int i=0;i<(1<<(H+W));i++){
        bitset<12> b(i);
        for(int h=0;h<H;h++) t[h] = s[h];
        for(int h=0;h<H;h++){
            if(b[h] == 0) continue;
            for(int w=0;w<W;w++) t[h][w] = 'x';
        }
        for(int w=0;w<W;w++){
            if(b[H+w] == 0) continue;
            for(int h=0;h<H;h++) t[h][w] = 'x';
        }
        ll c = 0;
        for(int h=0;h<H;h++){
            for(int w=0;w<W;w++){
                if(t[h][w] == '#') c++;
            }
        }
        if(c==K) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
s = raw_input()
A = 0
Z = 0
for i in range(0, len(s)):
	if s[i] == 'A':
		A = i
		break
for i in range(0, len(s)):
	if s[-1-i] == 'Z':
		Z = len(s) - i - 1
		break

print Z - A + 1

Measured memory_bytes: 9188
#include <bits/stdc++.h>
using namespace std;
#define PI 3.141592653589793
#define MOD 1000000007
typedef long long ll;
typedef long double ld;

#define rep(i, n) for (int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()

int main() {
    ll N, P;
    cin >> N >> P;
    ll cnt = 0;
    vector<ll> A(N,0);
    rep(i,N) cin >> A[i];
    ll ans = 0;
    rep(i,N){
        if(A[i] % 2 == 0){
            cnt++;
        }
    }
    if(cnt == N){
        if(P == 0){
            ans = pow(2,N);
        }
    }
    else{
        ans = pow(2,N - 1);
    }
    cout << ans << endl;
}


Measured memory_bytes: 4036
#include <iostream>
using namespace std;
int main(){
  string A;
  cin >> A;
  if(A != "AAA"){
       if(A != "BBB"){
          cout << "Yes" << endl;
      }else{
          cout << "No" << endl;
      }
  }else{
      cout << "No" << endl;
  }
}


Measured memory_bytes: 256
import java.util.*;
import java.util.stream.IntStream;

public class Main {
        static boolean[][] f;
        static  int[][] p;
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int k = scan.nextInt();
        Map<Integer, Tama> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            int num = scan.nextInt();
            if(map.containsKey(num)) {
                Tama tmp = map.get(num);
                tmp.count++;
            }
            else {
                Tama tmp = new Tama(num, 1);
                map.put(num, tmp);
            }
        }
        if(map.size() - k <= 0) {
            System.out.println(0);
            return;
        }
        System.out.println(map.values().stream().sorted(Comparator.comparingInt(x -> x.count)).limit(map.size() - k).mapToInt(x -> x.count).sum());

    }

    public static class Tama{
        int num;
        int count;

        public Tama(int num, int count) {
            this.num = num;
            this.count = count;
        }
    }
}



Measured memory_bytes: 106844
#include<iostream>
#include<unordered_map>
#include<string>
#include<algorithm>
using namespace std;

struct masu {
	int hiku;
	unordered_map<char, int>tasu;
};
masu t[1000][1000];
int main() {
	int a, b;
	cin >> a >> b;
	string c[1000];
	for (int d = 0; d < a; d++)cin >> c[d];
	string f[2];
	cin >> f[0] >> f[1];
	int sum = 0;
	for (int g = 0; g < a - 1; g++) {
		for (int h = 0; h < b - 1; h++) {
			int l = 0; bool r[2][2]{};
			for (int i = 0; i < 2; i++) {
				for (int j = 0; j < 2; j++) {
					if (c[g + i][h + j] == f[i][j]) {
						l++;
						r[i][j] = true;
					}
				}
			}
			if (l == 4) {
				sum++;
				for (int i = 0; i < 2; i++) {
					for (int j = 0; j < 2; j++) {
						if (c[g + i][h + j] == f[i][j]) {
							t[g + i][h + j].hiku++;
						}
					}
				}
			}
			else if (l == 3) {
				for (int i = 0; i < 2; i++) {
					for (int j = 0; j < 2; j++) {
						if (!r[i][j])t[g + i][h + j].tasu[f[i][j]]++;
					}
				}
			}
		}
	}
	int MAX = 0;
	for (int i = 0; i < a; i++) {
		for (int j = 0; j < b; j++) {
			MAX = max(MAX, max({ t[i][j].tasu['J'],t[i][j].tasu['O'] ,t[i][j].tasu['I'] })-t[i][j].hiku);
		}
	}
	cout << sum + MAX << endl;
}

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

using namespace std;

#define ll long long
#define pii pair<int,int>

int main()
{
	
	string s;
	cin>>s;
	long long i =0;
	long long sum  =0;
	while(s[i] != '\0')
	{
		sum += (s[i]-'0');
		i++;
	}
	if(sum %9 == 0)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
}

Measured memory_bytes: 3704
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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

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

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

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------
int main(){
    ll n;
    cin>>n;
    ll ans=infll;
    for(int i=0;i<=n;i++){
        ll cnt=0;
        ll tmp=i;
        while(tmp>0){
            cnt+=tmp%6;
            tmp=tmp/6;
        }
        tmp=n-i;
        while(tmp>0){
            cnt+=tmp%9;
            tmp=tmp/9;
        }
        chmin(ans,cnt);
    }
    cout<<ans<<endl;
}






Measured memory_bytes: 256
<?php

$N = trim(fgets(STDIN));

$del = explode(" ", trim(fgets(STDIN)));

$res = 0;

   for($i = 0; $i < $N; $i++ ) {

             for ($j = 0; $j < $N; $j++) {
                       
                   if ($i < $j) {
                               $res += $del[$i] * $del[$j] ;
                  }
                       
        }

}


echo $res;


?>

Measured memory_bytes: 4604
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1<<30;
const ll inf_l = 1LL<<61;
const int MAX = 1e5;

ll modpow(ll base, ll exp, ll mod) {
    ll res = 1;
    while (exp > 0) {
        if (exp & 1) res = res * base % mod;
        base = base * base % mod;
        exp >>= 1;
    }
    return res;
}

int main() {
    ll n, x; cin >> n >> x;
    int m; cin >> m;
    vll data = {x};
    set<int> st;
    st.insert(x);
    int ct = 1;
    while (ct < n) {
        x = modpow(x,2,m);
        if (st.count(x)) break; 
        data.push_back(x);
        st.insert(x);
        ct++;
    }
    vll sum(data.size()+1,0);
    REP(i,data.size()+1) {
        sum[i] += sum[i-1] + data[i-1];
    }
    int id;
    rep(i,data.size()) if (data[i] == x) id = i;
    int len = data.size() - id;
    n -= data.size();
    ll ans = 0;
    ans += sum[data.size()];
    ans += (sum[data.size()] - sum[id]) * (n/len);
    n %= len;
    ans += sum[id+n] - sum[id];
    cout << ans << endl;
}

Measured memory_bytes: 6264
#include<bits/stdc++.h>
using namespace std;
//define
#define int unsigned long long
#define vint vector<int>
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define Rep(x,y) for(int k=x;k<y;k++)
#define all(x) x.begin(),x.end()
#define pb() push_back()
#define mod 100000007
#define elif else if
#define str string

//dp
template<class T>inline bool chmin(T& a,T b){
  if(a>b){
    a=b;
    return true;
  }
  return false;
}
template<class T>inline bool chmax(T& a,T b){
  if(a<b){
    a=b;
    return true;
  }
  return false;
}
const long long INF=1LL<<60;
long long dp[100010];

//main
signed main(){
  int N,M,O,Q,count=0,count2=0,count3=0;
  for(int i=0;i<100010;i++)dp[i]=INF;
  dp[0]=0;
  double D=0;
  int c='A'-'a';
  char C;
  str S="No",T;
  cin>>N;
  rep(1,10){
    REP(1,10){
      if(i*j==N)S="Yes";
    }
  }
  cout<<S<<endl;
}


Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define PI 3.14159265359
typedef long long LL;

template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> void print_vector(vector<T> vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << vec[i] << " ";
	}
	cout << "]" << endl;
}
template<class T> void print_pair_vector(vector<pair<T, T> > vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << "(" << vec[i].first << "," << vec[i].second << ") ";
	}
	cout << "]" << endl;
}

const int INF = 1 << 30;

int calculate_digits_total(int x) {
	int digits_total = 0;
	while (x) {
		digits_total += x % 10;
		x /= 10;
	}

	return digits_total;
}


int main(void) {
	int N;
	cin >> N;

	if (N%calculate_digits_total(N) == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

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

#define MOD 1000000007
#define pb push_back
#define all(v) (v.begin(), v.end());
#define ff first
#define ss second
#define db(x) cerr << #x << " = "  << x << '\n'
#define ooo cerr << "---------------------\n"

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> iil;

void goooooo()
{
	int n, m, res = 0;
	cin >> n >> m;
	for(int i = 1; i <= sqrt(m); i ++)
	{
		if(m % i == 0)
		{
			if(n <= i)
				res = max(res, m/i);
			else
			if(n <= m/i)
				res = max(res, i);
		}
	}
	cout << res;
}

int main()
{
	int abcdefghijklmnopqrstuvwxyz = 1;
//	cin >> abcdefghijklmnopqrstuvwxyz;
	for(;abcdefghijklmnopqrstuvwxyz;abcdefghijklmnopqrstuvwxyz --)
		goooooo();
	getchar();
	getchar();
}

Measured memory_bytes: 256
n=int(input())
a=[0]+list(map(int,input().split()))+[0]

dist=[]

for i in range(len(a)-1):
  dist.append(abs(a[i+1]-a[i]))
  
xxx=sum(dist)

for i in range(n):
  ans=xxx
  ans-=dist[i]
  ans-=dist[i+1]
  ans+=abs(a[i+2]-a[i])
  print(ans)

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

int main(void){
    int n,i,sq,end;
    sq = 0;

    cin >> n;
    end = floor(sqrt(n));

    for(i=1; i*i <= n; i++){
        sq = i*i;
    }
    cout << sq << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
int main(){
    int x; cin>>x;
    int a[4];
    a[0]=x%10;
    a[1]=(x/10)%10;
    a[2]=(x/100)%10;
    a[3]=(x/1000)%10;
    if(a[0]==a[1]&&a[1]==a[2]||a[1]==a[2]&&a[2]==a[3])cout<<"Yes";
    else{cout<<"No";}
return 0;}


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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define ALL(v) v.begin(), v.end()

ll W, H, x, y;

int main() {
    cin >> W >> H >> x >> y;
    cout << W*H/2.0l << " ";
    if (x*2 == W && y*2 == H) cout << 1;
    else cout << 0;
    cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int H,W;
    std::cin >> H>>W;
    std::vector<string>a ;
    for(int i=0;i<H;i++){
        string s;
        std::cin >> s;
        s="#"+s+"#";
        a.push_back(s);
    }
    string sh;
    sh="";
    for(int i=0;i<W+2;i++)sh=sh+"#";
    std::cout << sh << std::endl;
    for(int i=0;i<H;i++){
        std::cout << a.at(i) << std::endl;
    }
    std::cout << sh << std::endl;
}

Measured memory_bytes: 256
n=int(input())
f=[list(map(int,input().split())) for _ in range(n)]
p=[list(map(int,input().split())) for _ in range(n)]

def rekkyo(l):
    if len(l)==10:
        if max(l) == 0: return -1*(10**9)
        ret = 0
        for i in range(n):
            tp = 0
            for j in range(10):
                if l[j] & f[i][j] == 1:
                    tp += 1
            ret += p[i][tp]
        return ret
    else:
        ret1 = rekkyo(l+[0])
        ret2 = rekkyo(l+[1])
        return max(ret1,ret2)

print(rekkyo([]))

Measured memory_bytes: 43228
#include <stdio.h>
int main(void){
	char a[5];
	scanf("%s",a);
	if(a[1]==a[2]){
		if((a[0]==a[1])||(a[2]==a[3])){
			printf("Yes");
		}else{
			printf("No");
		}
	}else{
		printf("No");
	}
	return 0;
}

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

int main(){
    string s;
    cin >> s;
    int ans = 0;
    for(int i = 0; i < 4; i++){
        if(s[i] == '+'){
            ans++;
        }
        else{
            ans--;
        }
    } 
    cout << ans  << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
int main(){
	ll num;
	cin >> num;
	int ans = 999999;
	int number[10];int h = -1;
	for(int i = 0; i < 10; i++){
		if(num%10)h++;
		number[i]=num%10;
		num/=10;
	}
	for(int i = 0; i+2 <= h; i++){
		ans = min(ans,abs(753-number[i+2]*100-number[i+1]*10-number[i]));
	}
	cout << ans << endl;
    return 0;
}

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

using namespace std;

const int max_n = 100111, inf = 1000111222;

int n;

void write(int x, int to) {
    if (x % 2) {
        x += n;
    }
    printf("%d %d\n", x, to);
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    scanf("%d", &n);
    int x = 1;
    while (2 * x <= n) {
        x *= 2;
    }
    if (x == n) {
        puts("No");
        return 0;
    }
    puts("Yes");
    for (int i = 2; i < n; i += 2) {
        printf("1 %d\n", i);
        printf("%d %d\n", i, i + 1);
        printf("1 %d\n", n + i + 1);
        printf("%d %d\n", n + i + 1, n + i);
    }
    printf("3 %d\n", n + 1);
    if (n % 2 == 0) {
        int y = n ^ x ^ 1;
        write(x, n);
        write(y, 2 * n);
    }
    return 0;
}


Measured memory_bytes: 2304
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int[] num = new int[3];
    for(int i = 0; i < 3; i++) num[i] = Integer.parseInt(sc.next());
    Arrays.sort(num);
    int temp = (num[2] - num[0]) + (num[2] - num[1]);
    int ans;
    if(temp % 2 == 0) ans = temp / 2;
    else ans = 2 + temp / 2;
    System.out.println(ans);
  }
}


Measured memory_bytes: 23508
n,m = map(int,input().split())
cost = [0,2,5,5,4,5,6,3,7,6]
a = list(map(int,input().split()))
dp = [-1 for _ in range(n+1)]
dp[0] = 0
for i in range(n+1):
  if dp[i] == -1: continue
  for j in a:
    if i+cost[j] <= n:
      dp[i+cost[j]] = max(dp[i+cost[j]], dp[i]*10+j)
print(dp[-1])
    
 

Measured memory_bytes: 14692
import java.util.*;

public class Main{
    public static void main(String[] args){

	Scanner sc = new Scanner(System.in);

	int[] coins = new int[3];
	
	for(int i=0;i<3;i++){
	    coins[i] = sc.nextInt();
	}

	int x = sc.nextInt();
	
	
	int  count = 0;
	
	for(int i=0;i<=coins[0];i++){

		for(int j=0;j<=coins[1];j++){
		  
		    
			for(int k=0;k<=coins[2];k++){

			    if(((500*i)+(100*j)+(50*k)==x))count++;
			}
		}
	    
	}

	System.out.println(count);
	
	
    }
}


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

#define ll long long int
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define all(A) A.begin(), A.end()
#define sz(A) (int)A.size()
typedef vector <int> vi;
typedef vector <ll> vl;
typedef pair <int, int> pii;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;
const int inf = 1e9;
//const ll inf = 1e18;
const int N = 2e5;
int a[N];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int x;
    cin >> x;
    int res = (x / 500) * 1000 + ((x % 500) / 5) * 5;
    cout << res << "\n";
 	return 0;
}

Measured memory_bytes: 256
def coins(A: int, B: int, C: int, X: int) -> int:
    count = 0
    for a in range(A + 1):
        if X < 500 * a:
            break
        for b in range(B + 1):
            c = (X - 500 * a - 100 * b) // 50

            if c < 0:
                break

            if 0 <= c and c <= C and 500 * a + 100 * b + 50 * c == X:
                count += 1

    return count


if __name__ == "__main__":
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())
    ans = coins(A, B, C, X)
    print(ans)


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

long long int a[100001] = {0};

long long int knapsack(vector<vector<long long int> > arr, long long int& w, long long int& n){
    for(long long int i = 0; i < arr.size(); i++){
        for(long long int j = w; j >= arr[i][0]; j--){
            a[j] = max(a[j], a[j-arr[i][0]]+arr[i][1]);
        }
    }
    for(long long int j = w; j >= 0; j--){
            if(a[j]) return a[j];
    }
    
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    long long int n, w;
    cin >> n >> w;
    
    vector<vector<long long int> > arr(n, {0,0});
    
    for(long long int i = 0; i < n; i++){
        cin >> arr[i][0] >> arr[i][1];
    }
    
    cout << knapsack(arr, w, n);
    
    return 0;
}

Measured memory_bytes: 4412