akhauriyash/Code-Regression huggingface dataset:
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//template
//--------------------------------------------
template<typename T>
istream& operator >>(istream& is, vector<T>& vec) {
  for(T& x: vec) is >> x;
  return is;
}
template<typename T>
ostream& operator <<(ostream& os, const vector<T>& vec) {
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : "\t" );
  }
  return os;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<vector<T>>& vv) {
	for (int i = 0; i < vv.size(); ++i) {
		s << vv[i] << endl;
	}
	return s;
}

// 多重vector
// auto dp=make_v<int>(4,h,w) みたいに使える
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

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

// 多重vectorのためのfill
// fill_v(dp,0) みたいに使える
template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

//main code

int main(int argc, char const* argv[])
{
	int n,m;
	cin >> n >> m;
	VVL dp((1<<n), VL(m+1, INT32_MAX));
	dp[0][0] = 0;
	VL a(m+1), b(m+1,0);
	for (int i = 1; i <= m; i++) {
		int bb;
		cin >> a[i] >> bb;
		for (int j = 0; j < bb; j++) {
			int c;
			cin >> c;
			b[i] += (1<<(c-1));
		}
	}

	for (int i = 1; i <= m; i++) {
		for (int j = 0; j < (1<<n); j++) {
			if (dp[j][i-1] != INT32_MAX) {
				dp[(j | b[i])][i] = min(dp[(j | b[i])][i], dp[j][i-1] + a[i]);
				dp[j][i] = min(dp[j][i], dp[j][i-1]);
			}
		}
	}
	if (dp[(1<<n)-1][m] == INT32_MAX) {
		cout << -1 << endl;
	} else {
		cout << dp[(1<<n)-1][m] << endl;
	}

	return 0;
}


Measured memory_bytes: 32384
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
from collections import deque, Counter
def getN():
    return int(input())
def getList():
    return list(map(int, input().split()))
import math
INF = 10 ** 20
MOD = 10**9 + 7
def combmod(n, k, mod=MOD):
    ret = 1
    for i in range(n - k + 1, n + 1):
        ret *= i
        ret %= mod

    for i in range(1, k + 1):
        ret *= pow(i, mod - 2, mod)
        ret %= mod

    return ret

def main():
    n,a,b = getList()
    ans = pow(2, n, MOD) - 1
    ans %= MOD
    # print(ans)
    ca = combmod(n,a)
    cb = combmod(n,b)
    ans += MOD
    ans -= (ca+cb)
    ans %= MOD

    print(ans)

if __name__ == "__main__":
    main()



Measured memory_bytes: 38896
#include <iostream>
#include <iomanip>
//#include <string>
#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
//#define all(v) v.begin(),v.end()
//ll mod = 1000000007 ;
//long double pie = acos(-1) ;
//ll INF = 1000000000000 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

const int MAX = 10000000 ;
// UFTクラスを宣言するときはグローバル変数か、staticをつけて静的変数にすること
class UFT{
public :
	int par[MAX] ;
	int rank[MAX] ;
	int size[MAX] ;
	bool root[MAX] ;
	int tree ;

	void init(int n){
		for(int i=0;i<n;i++){
			par[i] = i ;
			rank[i] = 0 ;
			size[i] = 1 ;
			root[i] = true ;
		}
		tree = n ;
	}

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

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

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

int main(){
	ll n,m;
	cin >> n >> m ;
	vll a(n) ;
	for(auto &i:a) cin >> i ;
	static UFT uft ;
	uft.init(n) ;
	for(int i=0;i<m;i++){
		ll x,y ;
		cin >> x >> y ;
		x-- ; y-- ;
		uft.unite(x,y) ;
	}
	ll ans = 0 ;
	for(int i=0;i<n;i++){
		ans += uft.same(i,a.at(i)-1) ;
	}
	cout << ans << endl ;
}


Measured memory_bytes: 7552
n=int(input())
A=list(map(int,input().split()))

m=max(A)

X=[0]*(m+1)

A.sort()

for i in range(n):
    for j in range(A[i]*2,m+1,A[i]):
        X[j]=2
    X[A[i]]+=1


print(X.count(1))

Measured memory_bytes: 104044
x?(a,b) = if x then a else b

main = do
  s <- getLine
  print $ solve s

solve :: String -> Int
solve s = minimum [from0 s,from1 s]

from0 = df wb
from1 = df bw

df (c:cs) (x:xs) = (c==x)?(0,1)+(null xs)?(0,df cs xs)

wb = cycle ['0','1']
bw = cycle ['1','0']


Measured memory_bytes: 7548
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int a, b;
    cin >> a >> b;

    // a > b → aを2回押せばいい
    // a == b　→ abを1回ずつおす
    // a < b → bを2回おす

    int ans = 0;
    if (a > b) ans = a + (a-1);
    else if (a == b) ans = a + b;
    else ans = b + (b-1);

    cout << ans << endl;
}

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

using namespace std;


int a[3][3];
bool check() {
  bool ret = true;
  int d[3]={};
  for (int i = 0; i < 3; ++i) {
    for (int j = 1; j < 3; ++j) {
      if (i) ret &= d[j]==a[i][j]-a[i][j-1];
      else d[j] = a[i][j]-a[i][j-1];
    }
  }
  return ret;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  bool ans = true;
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < 3; ++j) {
      cin >> a[i][j];
    }
  }
  ans &= check();
  for (int i = 0; i < 3; ++i) {
    for (int j = i; j < 3; ++j) {
      swap(a[i][j], a[j][i]);
    }
  }
  ans &= check();
  cout << (ans ? "Yes": "No") << endl;
  return 0;
}


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

#define REP(i,n) for(ll i=0;i<(ll)n;i++)
#define dump(x)  cerr << "Line " << __LINE__ << ": " <<  #x << " = " << (x) << "\n";
#define spa << " " <<
#define fi first
#define se second
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()

using ld = long double;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<ld, ld>;

template<typename T> using V = vector<T>;
template<typename T> using P = pair<T, T>;
template<typename T> vector<T> make_vec(size_t n, T a) { return vector<T>(n, a); }
template<typename... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec(ts...))>(n, make_vec(ts...)); }
template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){os << "(" << v.first << ", " << v.second << ")"; return os;}
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
template<class T> ostream& operator<<(ostream& os, const vector<vector<T>> &v){ for(auto &e : v){os << e << "\n";} return os;}
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;

template <class T> void UNIQUE(vector<T> &x) {sort(ALL(x));x.erase(unique(ALL(x)), x.end());}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
void fail() { cout << -1 << '\n'; exit(0); }
inline int popcount(const int x) { return __builtin_popcount(x); }
inline int popcount(const ll x) { return __builtin_popcountll(x); }
template<typename T> void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cerr<<v[i][0];for(ll j=1;j<w;j++)cerr spa v[i][j];cerr<<"\n";}};
template<typename T> void debug(vector<T>&v,ll n){if(n!=0)cerr<<v[0];
for(ll i=1;i<n;i++)cerr spa v[i];
cerr<<"\n";};

const ll INF = (1ll<<62);
// const ld EPS   = 1e-10;
// const ld PI    = acos(-1.0);
const ll mod = (int)1e9 + 7;
//const ll mod = 998244353;

using S = long long;
using F = long long;

S op(S a, S b){ return std::max(a, b); }
S e(){ return -INF; }
S mapping(F f, S x){ return max(f, x); }
F composition(F f, F g){ return max(f, g); }
F id(){ return -INF; }

int main(){

    ll N, K;
    cin >> N >> K;
    V<ll> A(N);
    REP(i, N) cin >> A[i];

    const ll MA = 303030;
    V<ll> v(MA, -INF);
    REP(i, N) v[A[i]] = 1;
    
    lazy_segtree<S, op, e, F, mapping, composition, id> seg(v);

    // auto print_seg = [&](){
    //     REP(i, 10){
    //         ll val  = seg.get(i);
    //         cout <<  (val == -INF ? -1 : val) << " ";
    //     }
    //     cout << endl;
    // };

    ll res = 1;
    REP(i, N-1){
        ll lb = max(A[i]-K, 0ll);
        ll ub = min(A[i]+K+1, MA);
        ll val = seg.get(A[i]);
        seg.apply(lb, ub, val+1);
        // print_seg();
        ll tmp = seg.get(A[i+1]);
        // dump(tmp)
        chmax(res, tmp);
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 20384
#include <iostream>
#include <cstdio>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

int main() {
  long long n, m, d; cin >> n >> m >> d;
  long long a = 0;
  if (d == 0 || 2 * d > n) a = n;
  else a = (n - 2 * d) * 2 + 2 * d;
  double ans = a * (m - 1) / (double)(n * n);
  printf("%.10lf\n", ans);
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
using namespace std;

#define N  100005

void solve()
{
	ll a,b,n;
	cin>>a>>b>>n;
	if(b-1<=n){
		ll a1=(a*(b-1))/b;
		cout<<a1;
		return;
	}	
	else{
		ll a1=(a*n)/b;
		cout<<a1;
	}
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 3648
n = int(input())
red_point = []
blue_point = []

for _ in range(n):
    x, y = map(int, input().split())
    red_point.append((x, y))

for _ in range(n):
    x, y = map(int, input().split())
    blue_point.append((x, y))

red_point = sorted(red_point, key = lambda x: x[1], reverse = True)
blue_point.sort()

ans = 0

for i in range(n):
    for j in range(len(red_point)):
        if blue_point[i][0] > red_point[j][0]:
            if blue_point[i][1] > red_point[j][1]:
                ans += 1
                del red_point[j]
                break
print(ans)

Measured memory_bytes: 3064
K=int(input())
r,q=divmod(K,50)
A=[r+49]*50

def update():
    M=A.index(min(A))
    for i in range(50):
        if i==M:
            A[i]+=50
        else:
            A[i]-=1
        #print(i,A)

for i in range(q):
    update()
print(50)
print(*A)

Measured memory_bytes: 3064
a, b, c, x, y = map(int, input().split())
 
ans_min = x * a + y * b
i = 0
while x - i > -1 or y - i > -1:
    ans = i * 2 * c + max(0, x - i) * a + max(0, y - i) * b
    if ans < ans_min:
        ans_min = ans
    i += 1
print(ans_min)

Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;
typedef pair<int,int> pii;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define vi vector<int>
#define pb push_back

vector<vector<int>> data(10,vi(10));
int ans=0;
int h,w,c;

void paint(int y, int x, vector<vi> &tmp,int color, int origin_color){
    tmp[y][x] = color;
    int dy[]={1,0,-1,0}, dx[]={0,1,0,-1};
    
    rep(i,4){
        int ddy = y+dy[i], ddx = x+dx[i];
        if( ddx<0 || ddy<0 || ddx>=w || ddy>=h || tmp[ddy][ddx]!=origin_color )continue;
        paint( ddy, ddx, tmp, color, origin_color );
    }
}


int count(int y,int x, vector<vi> tmp,vector<vector<bool>> &used, int color){
    used[y][x]=true;
    int c=1;
    int dy[]={1,0,-1,0}, dx[]={0,1,0,-1};
    
    rep(i,4){
        int ddy = y+dy[i], ddx = x+dx[i];
        if( ddx<0 || ddy<0 || ddx>=w || ddy>=h || used[ddy][ddx] || tmp[ddy][ddx]!=color )continue;
        c+=count( ddy, ddx, tmp, used, color);
    }
    return c;
}


void solve(vi changed){
    vector<vi> tmp = data;
    
    rep(i,changed.size()){
        if( tmp[0][0]==changed[i] )continue;
        paint(0,0,tmp,changed[i],tmp[0][0]);
    }
    
    vector<vector<bool>> used(10,vector<bool>(10,false));
    ans = max( count(0,0,tmp,used,tmp[0][0]) , ans );
}


void dfs(int f,vi changed){
    if(f>=4){
        changed.pb(c);
        solve(changed);
        return ;
    }
    rep(i,6){
        changed.pb(i);
        dfs(f+1,changed);
        changed.pop_back();
    }
}


int main(){
    while(cin>>h>>w>>c&&(h||w||c)){
        c--;
        ans=0;
        rep(i,10)rep(j,10)data[i][j]=-1;
        rep(i,h) rep(j,w){
            cin>>data[i][j];
            data[i][j]--;
        }
        
        vi changed;
        dfs(0,changed);
        
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 3204
#include <bits/stdc++.h>
using namespace std;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define ll long long
#define pb emplace_back
#define mp make_pair
#define nt _int128
#define ld long double
long double PI =3.14159265358979323846;


const ll modo=1e9+7;
const ll inf=1e16;
const ll ms=(1e6) +5;



int main()
{
    idfc;

    ll n,a,b;
    cin>>n>>a>>b;

    ll ss=a+b;
    ll dd=n/ss;
    ll ans=(dd*a);
    ll md=n%ss;
    ans+=min(md,a);
    cout<<ans;

    return 0;
}

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

int main() {
  int N;
  int a[110];
  cin >> N;
  for (int i = 0; i < N; i++) cin >> a[i];
  
  sort(a, a + N, greater<int>());
  
  int Alice = 0;
  int Bob = 0;
  for (int i = 0; i < N; i++) {
    if (i % 2 == 0) {
      Alice += a[i];
    } else {
      Bob += a[i];
    }
  }
  cout << Alice - Bob << endl;
}

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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define MOD 1000000007

typedef long long ll;
typedef pair<ll,ll> P;

int dp[111111];

int main(){
	
	int n;cin >> n;
	
	for(int i = 0;i < 111111;i++)dp[i] = 1000000000;
	dp[0] = 0;
	
	
	for(int i = 0; i < 111111;i++){
		dp[i+1] = min(dp[i+1],dp[i]+1);
		int tmp = 6;
		while(1){
			if(i + tmp > 100000)break;
			dp[i+tmp] = min(dp[i+tmp],dp[i]+1);
			tmp *= 6;
		}
		tmp = 9;
		while(1){
			if(i + tmp > 100000)break;
			dp[i+tmp] = min(dp[i+tmp],dp[i]+1);
			tmp *= 9;
		}
	}
		
	cout << dp[n] << endl;

	return 0;
}

Measured memory_bytes: 640
//Nihal Mittal - nihal_47
//Strike First , Strike Hard , No Mercy !!
 
/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define l long
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(),(v).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define pii pair<int,int>
#define maxn 100005
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
using namespace std;
using namespace __gnu_pbds;
ll ma[5][100005];
signed main()
{
    fast;
    
    ll n,i;
    cin>>n;
    ll a[n+2],cn=0,ma=1000000007;
    for(i=1;i<=n;i++)
    {
        ll x;
        cin>>x;
        if(x<=ma) cn++;
        ma = min(ma,x);
    }
    cout<<cn;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long long INF = 1e15;

#include <math.h>
#define PI 3.14159265358979323846264338327950L

bool isPrime(long long x) {
    if (x == 1) return true;
    for (long long i = 2; i*i <= x; i++) {
        if (x % i == 0) return false;
    }
    return true;
}

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

vector<long long> common_divisors(long long a, long long b) {
    long long n = gcd(a, b);
    vector<long long> ans;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            if (n / i == i) {
                ans.push_back(i);
            }
            else {
                ans.push_back(n / i);
                ans.push_back(i);
            }
        }
    }
    return ans;
}

bool is_sorted(vector<int> a) {
    int n = a.size();
    for (int i = 0; i < n - 1; i++) {
        if (a[i + 1] < a[i]) return false;
    }
    return true;
}

int main() {
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        int x = i;
        int cnt = 0;
        while (x) {
            x /= 10;
            cnt++;
        }
        if (cnt % 2) ans++;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3604
#include<stdio.h>
#include<math.h>
#include<string.h> 
int main() {
	int a,b,w;
	scanf("%d %d %d",&w,&a,&b);
	if(a>b){
		int temp=a;
		a=b;
		b=temp;
	}
	if(a+w<b){
		printf("%d",b-w-a);
	}else{
		printf("0");
	}
	return 0;
}

Measured memory_bytes: 128
#include<cmath>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
using namespace std;

const int inf = 0x3f3f3f3f;
typedef long long ll;
const double pi=4*atan(1.0);
int main()
{
    double r;
    scanf("%lf",&r);
    printf("%lf\n",2*pi*r);

    return 0;
}


Measured memory_bytes: 3828
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e18 // 4倍しても(4回足しても)long longを溢れない
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())

int main() {
  string s,t;
  cin >> s;
  cin >> t;
  int n = s.size(), m = t.size();

  vector<vector<int> > dp(3001, vector<int>(3001,0)), pre(dp);
  // dp[i][j] = s1...si, t1...tjまでのLCS
  // vectorのコピーコンストラクタ -> 同じ要素数を確保
  
  s = '+' + s; // s[0] != t[0] and s[i] != t[0] and s[0] != t[i]
  t = '*' + t;

  for (int si = 1; si <= n; ++si) {
    for (int ti = 1; ti <= m; ++ti) {
      if (s[si] == t[ti]) {
        dp[si][ti] = dp[si-1][ti-1] + 1;
        pre[si][ti] = 1;
      } else if (dp[si-1][ti] > dp[si][ti-1]) {
        dp[si][ti] = dp[si-1][ti];
        pre[si][ti] = 2;
      } else {
        dp[si][ti] = dp[si][ti-1];
        pre[si][ti] = 3;
      }
    }
  }

  // cout << dp[n][m] << endl;
  // 復元
  string ans = "";
  int i = n, j = m;
  while (i >= 1 and j >= 1) {
    if (pre[i][j] == 1) {
      ans += s[i];
      i--, j--;
    } else if (pre[i][j] == 2) {
      i--;
    } else {
      j--;
    }
  }
  reverse(ans.begin(), ans.end());
  for (auto itr : ans) {
    cout << itr;
  } END;
}


Measured memory_bytes: 70784
import itertools

n,m = map(int,input().split())
path = [[] for i in range(n+1)]
for i in range(m):
    a,b = map(int,input().split())
    path[a].append(b)
    path[b].append(a)

ans = 0
l = [i for i in range(2,n+1)]
for v in itertools.permutations(l,n-1):
    flag = True
    if v[0] not in path[1]:
        flag = False
        continue
    for k in range(1,n-1):
        if v[k] not in path[v[k-1]]:
            flag = False
            continue
    if flag:
        ans += 1

print(ans)


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

int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int n, r;
    cin >> n >> r;
    if(n >= 10){
        cout << r << "\n";
    }else{
        cout << r + 100 * (10-n) << "\n";
    }
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define INF (1<<28)
#define DEKAI 1000000007
#define lp(i,n) for(int i=0;i<n;i++)
#define int long long
struct UnionFind{
  int n;//要素数
  vector<int> csize;//子の数(include 自分)
  vector<int> parent;//親
  int setnum;//集合の数

  UnionFind();
  UnionFind(int v){
    n=v;
    setnum=v;
    csize.assign(v+1,1);    
    parent.assign(v+1,0);
    iota(parent.begin(),parent.end(),0);
  }
  int find(int x){
    return (x==parent[x]?x:parent[x]=find(parent[x]));
  }
  bool same(int x,int y){
    return find(x)==find(y);
  }
  bool unite(int x,int y){
    x=find(x);
    y=find(y);
    if(x==y) return false;
    if(csize[x]<csize[y]) swap(x,y);
    csize[x]+=csize[y];
    parent[y]=x;
    setnum--;
    return true;
  }
  //if already united, return false;
  int size(int x){
    return csize[find(x)];
  }
  int count(){
    return setnum;
  }
};

int a[100000];
signed main(){
  int n,m;
  cin>>n>>m;
  UnionFind UF(n);
  lp(i,m){
    int a,b,c;
    cin>>a>>b>>c;
    UF.unite(a,b);
  }
  cout<<UF.count()<<endl;
  return 0;
}

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

X = a[0]
Y = a[1]
 
if (Y-2*X) % 2 == 0 and (Y-2*X) >= 0 and (4*X-Y) % 2 == 0 and (4*X-Y) >= 0:
	print('Yes')
else:
    print('No')

Measured memory_bytes: 9116
//Code By: pratibha_899 (Pratibha Shrivastav)

/********   All Required Header Files ********/
#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

//All the Loops and defines required
typedef long long int ll;
#define FOR(i, j, k, in) for (ll i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (ll i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define ff first
#define ss second
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007

//All the declarations using typedef

typedef pair<ll, ll> PII;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<ll, ll> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int l;
typedef unsigned long int ul;
typedef unsigned long long int  ull;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,k;
	cin>>n>>k;
	ll arr[n+1];
	for(ll i=1;i<=n;i++)
		cin>>arr[i];
	ll min_cost[n+1];
	min_cost[1]=0;
	for(ll i=2;i<=n;i++){
		if(i==2)
			min_cost[i]=abs(arr[2]-arr[1]);
		else{
			ll mcost=MOD,cost;
			for(ll j=i-1;(i-j)<=k && j>=1;j--){
				cost = min_cost[j]+abs(arr[i]-arr[j]);
				if(cost<mcost)
					mcost=cost;
			}
			min_cost[i]=mcost;
		}
	}
	cout<<min_cost[n];
	return 0;
}

Measured memory_bytes: 1792
n = int(input())

if 400 <= n <= 599:
    print(8)
elif 600 <= n <= 799:
    print(7)
elif 800 <= n <= 999:
    print(6)
elif 1000 <= n <= 1199:
    print(5)
elif 1200 <= n <= 1399:
    print(4)
elif 1400 <= n <= 1599:
    print(3)
elif 1600 <= n <= 1799:
    print(2)
elif 1800 <= n <= 1999:
    print(1)

Measured memory_bytes: 61624
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
using namespace std;

int main(){
	int paper[14][14] = {};
	int x,y,s;
	char s1,s2;
	while(cin >> x >> s1 >> y >> s2 >> s){
		x += 2;
		y += 2;
		if(s == 1){
			paper[x][y - 1]++;
			paper[x - 1][y]++;
			paper[x][y]++;
			paper[x + 1][y]++;
			paper[x][y + 1]++;
		}else if(s == 2){
			for(int i = - 1; i <= 1; i++){
				for(int j = - 1; j <= 1; j++){
					paper[x + i][y + j]++;
				}
			}
		}else if(s == 3){
			for(int i = - 1; i <= 1; i++){
				for(int j = - 1; j <= 1; j++){
					paper[x + i][y + j]++;
				}
			}
			paper[x][y - 2]++;
			paper[x - 2][y]++;
			paper[x + 2][y]++;
			paper[x][y + 2]++;
		}
	}
	int white = 0, max = 0;
	for(int i = 2; i < 12; i++){
		for(int j = 2; j < 12; j++){
			if(paper[i][j] == 0){
				white++;
			}
			if(paper[i][j] > max){
				max = paper[i][j];
			}
		}
	}
	cout << white << endl << max << endl;
}


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

void solve()
{
    int a, b, x;
    cin >> a >> b >> x;
    if (a <= x && x <= a + b)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}

int main()
{
    solve();
    return 0;
}

Measured memory_bytes: 3592
// Copyright 2020 yaito3014
#include <bits/stdc++.h>
#include <boost/heap/fibonacci_heap.hpp>
using namespace std;

int main() {
	cin.tie(nullptr); ios::sync_with_stdio(false);
	int N, M, S;
	cin >> N >> M >> S;
	vector<deque<tuple<int, int, int>>> graph(N);
	int A_max = 0;
	for(int i = 0; i < M; ++i) {
		int U, V, A, B;
		cin >> U >> V >> A >> B, --U, --V;
		A_max = max(A_max, A);
		graph[U].emplace_back(V, B, A);
		graph[V].emplace_back(U, B, A);
	}
	const int Max = A_max * (N - 1);
	for(int i = 0; i < N; ++i) {
		int C, D;
		cin >> C >> D;
		graph[i].emplace_back(i, D, -C);
	}
	vector<vector<long long>>
		costs(N, vector<long long>(Max + 1, INT64_MAX));
	// T: (cost, coins, node)
	using T = tuple<long long, int, int>;
	boost::heap::fibonacci_heap<T, boost::heap::compare<greater<>>> que;
	// priority_queue<T, vector<T>, greater<>> que;
	que.emplace(0, S, 0);
	while(!que.empty()) {
		auto [cost_sum, coins, node] = que.top();
		que.pop();
		for(const auto& [to, cost, pay] : graph[node]) {
			if(coins >= pay && cost_sum + cost < costs[to][min(Max, coins - pay)]) {
				costs[to][min(Max, coins - pay)] = cost_sum + cost;
				que.emplace(cost_sum + cost, min(Max, coins - pay), to);
			}
		}
	}
	for(int i = 1; i < N; ++i)
		cout << *min_element(begin(costs[i]), end(costs[i])) << '\n';
}


Measured memory_bytes: 10244
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main(){

  int a[4];
  int c = 0;
  string str;

  cin >> str;
  for(int i = 0; i < 4; i++){
    a[i] = (int)(str[i] - '0');
  }
  
  for(int j = 1; j < 4; j++){
    if(a[j] - a[j-1] == 0){
      cout << "Bad" << endl;
      break;
    }else{
      c++;
    }
  }
  if(c == 3){
    cout << "Good" << endl;
  }

}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
void ABC60(void);
void ABC61(void);
void ABC62(void);
void ABC63(void);
void ABC64(void);
void ABC65(void);
void ABC66(void);
void ABC67(void);
void ABC68(void);
void ABC69(void);

int main(void){
    ABC65();
}

void ABC65(void){
    int a,b,x;
    cin>>a>>b>>x;
    if(x<=b){cout<<"delicious";}
    else if(x<=b+a){cout<<"safe";}
    else{cout<<"dangerous";}
}

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

using namespace std;

int main() {
	long long int d;
	while (cin >> d) {
		if (d == 0) {
			break;
		}
		int n;
		cin >> n;
		vector<long long int> mise(n);
		mise[0] = 0;
		int m;
		cin >> m;
		for (int i = 1; i < n; i++) {
			cin >> mise[i];
		}
		sort(mise.begin(), mise.end());
		int MAX = mise[n-1];
		long long int counter = 0;
		long long int a;
		for (int i = 0; i < m; i++) {
			cin >> a;
			if (a > MAX) {
				long long int MIN = a - MAX;
				MIN = min(MIN, d-a);
				counter += MIN;
			} else if (a != 0){
				long long int lb = -1;
				long long int ub = n;
				while (ub-lb > 1) {
					long long int mid = (lb+ub) / 2;
					if (mise[mid] >= a) {
						ub = mid;
					} else {
						lb = mid;
					}
				}
				long long int MIN = mise[ub]-a;
				MIN = min(MIN, a-mise[ub-1]);
				counter += MIN;
			}
		}
		cout << counter << endl;
	}
	return 0;
}

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

using namespace std;
int mat[25][25];
int dp[(1 << 21) + 5];
int solve(int msk, int n)
{
    if(msk == (1 << n) - 1)
        return 1;
    
    if(dp[msk] != -1)
        return dp[msk];
    int a = __builtin_popcount(msk);
    int j, ans = 0;
    for(j=0;j<n;j++)
    {
        if(((msk >> j)&1) == 0 && mat[a][j] == 1)
        {
            //cout << i << " " << j << '\n';
           ans = (ans + solve(msk|(1 << j), n))%(1000000007); 
        }
    }
    return (dp[msk] = ans);
}
int main() {
    int n;
    cin >> n;
    int i, j;
    for(i=0;i<n;i++)
        for(j=0;j<n;j++)
            cin >> mat[i][j];
    memset(dp, -1, sizeof(dp));
    cout << solve(0, n) << '\n';
}

Measured memory_bytes: 11792
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(long long i=(long long)(a);i<(long long)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
//重み付きグラフの場合
//隣接リストを格納する構造体
struct listc{
	int to;
	int cost;
};
vector<bool> Visited(100000, false);   //頂点が訪問済みか否かを格納
vector<bool> color(100000, true);   //頂点の色
vector<vector<listc>> LC(100000);
//深さ優先探索(現在位置をiとする)
void DFS(int i)
{
	Visited[i]=true;

	for(int j=0; j<(int)LC[i].size(); j++){
		if(Visited[LC[i][j].to]) continue;
		if(LC[i][j].cost%2==0){
			color[LC[i][j].to]=color[i];
		} else{
			color[LC[i][j].to]=!color[i];
		}
		DFS(LC[i][j].to);
	}
}

//頂点数n, 枝数mのグラフの入力(重み付き)
void Graph_Input_cost(int n, int m)
{
	for(int i=0; i<m; i++){
		int from, to, cost;
		cin>>from>>to>>cost;
		from--; to--;
		listc e;
		e.to=to; e.cost=cost;
		LC[from].push_back(e);
		//無向グラフの場合以下も追加
		e.to=from; e.cost=cost;
		LC[to].push_back(e);
	}
}
int main(void)
{
	int n;

	cin>>n;

	Graph_Input_cost(n, n-1);

	DFS(0);

	rep(i, n){
		cout<<color[i]<<endl;
	}
}


Measured memory_bytes: 8064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <map>
#include <math.h>
using namespace std;

int main() {
    long long N, K;
    cin >> N >> K;

	map<long long, long long> mp;

    for(long long i=0;i<N;i++){
        long long a, b;
        cin >> a >> b;
        mp[a] += b;
    }
    
    long long res = 0;
    for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
        res += itr->second;
        if(res >= K){
            cout << itr->first << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 4224
def main():
    n,k = map(int, input().split())
    town = list(map(int, input().split()))
    town = [i-1 for i in town]
    visited = [-1] * n
    current_town = 0
    current_order = 0
    memo = []
    while visited[current_town] == -1:
        visited[current_town] = current_order
        memo.append(current_town)
        current_town = town[current_town]
        current_order += 1
    loop_start = visited[current_town]
    if k < len(memo):
        print(memo[k]+1)
    else:
        loop_length = len(memo) - loop_start
        k =  (k - loop_start) % loop_length
        print(memo[k+loop_start]+1)
if __name__ == '__main__':
    main()

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

typedef long long ll;
// typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;

int main() {
  int64_t N, A, B;
  cin >> N >> A >> B;

  int64_t ans;
  if(A % 2 == B % 2) {
    ans = (B-A)/2;
  } else {
    if(N-B <= A-1) {
      ans = (N-B + 1) + (B-A-1)/2;
    } else {
      ans = (A-1 + 1) + (B-A-1)/2;
    }
  }

  cout << ans << endl;

}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	for {
		var n int
		fmt.Scan(&n)
		if n == 0 {
			break
		}
		score := make([]float64, n)
		for i := 0; i < n; i++ {
			fmt.Scan(&score[i])
		}

		var m float64
		for _, v := range score {
			m += v
		}
		var a float64
		m /= float64(n)

		for _, v := range score {
			a += (v - m) * (v - m)
		}
		a /= float64(n)
		a = math.Sqrt(a)

		fmt.Println(a)
	}
}



Measured memory_bytes: 1268
N, Y = map(int, input().split())

for x in range(N+1):
    for y in range(N+1-x):
        z = N-x-y
        if (10000*x + 5000*y + 1000*z) == Y:
            print(x, y, z)
            exit()
print(-1, -1, -1)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int>   II;
typedef vector< II >      VII;
typedef vector<int>     VI;
typedef vector< VI > 	VVI;
typedef long long int 	LL;
typedef vector<LL> 		VL;
typedef unsigned long long int ULL;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define LET(x,a) __typeof(a) x(a)

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
//Works for forward as well as backward iteration

#define gu getchar
#define pu putchar
#define si(n) cin>>n
#define dout(n) cout<<n<<"\n"
//# define M_PI           3.14159265358979323846264338327950288

#define DRT() int t; si(t); while(t--)

#define PlUSWRAP(index,n) index = (index+1)%n		//index++; if(index>=n) index=0
#define MINUSWRAP(index,n) index = (index + n -1)%n 	//index--; if(index<0) index=n-1
#define ROUNDOFFINT(d) d = (int)((double)d + 0.5)	//Round off d to nearest integer

#define FLUSHN while(gu()!='\n')
#define FLUSHS while(gu()!=' ')

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

// set_name.find_by_order(k) It returns to an iterator to the kth element (counting from zero) in the set in O(logn) time
// set_name.order_of_key(k) It returns to the number of items that are strictly smaller than our item k in O(logn) time.

int main() {
	#ifndef ONLINE_JUDGE
    freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
	#endif
	srand(chrono::steady_clock::now().time_since_epoch().count());
	off;
	LL n,m;
	cin>>n>>m;
	LL ans = 1;
	if(n == 1){
		cout<<m;
		return 0;
	}
	for(LL i=2;i*i<=m;i++){
		if((m % i) == 0){
			if(i >= n)
				ans = max(ans, m/i);
			if(m/i >= n)
				ans = max(ans, i);
		}
	}
	cout<<ans;
  	return 0;
}

Measured memory_bytes: 3556
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e5 + 10;
char str[N];
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin >> str + 1;
	LL n;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		if (str[i] != '1') putchar(str[i]), puts(""), exit(0);
	}
	puts("1");
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[]args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if(a < b && b < c)System.out.println("Yes");
		else System.out.println("No");
		 }
	 } 

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

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

//繰り返し自乗法による累乗計算
//a**n
ll pow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = pow(a, n/2);
    return res * res;
  }
  return a * pow(a, n-1);
}
//繰り返し自乗法によるmod累乗計算
//a**n (mod)
ll modpow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = modpow(a, n/2);
    return res * res % mod;
  }
  return a * modpow(a, n-1) % mod;
}
//組み合わせ
//nCa
ll com(ll n, ll a){
  ll x = 1, y = 1;
  rep(i,a){
    x *= n-i;
    y *= i+1;
  }
  ll res = x / y;
  return res;
}
//組み合わせ(mod)
//nCa (mod)
ll modcom(ll n, ll a){
  ll x = 1, y = 1;
  rep(i, a){
    x = x * (n-i) % mod;
    y = y * (i+1) % mod;
  }
  ll ans = x * modpow(y, mod-2) % mod;
  return ans;
}
//gcd 最大公約数
ll gcd(ll x, ll y){
  if(x % y == 0) return y;
  return gcd(y, x%y);
}
//lcm 最小公倍数
ll lcm(ll x, ll y){
  return x * y / gcd(x, y);
}
//ngcd n個の最大公約数
ll ngcd(vector<ll> a){
  ll res;
  res = a[0];
  for(ll i = 1; i < a.size() && res != 1; i++) {
    res = gcd(a[i], res);
  }
  return res;
}
//nlcm n個の最小公倍数
ll nlcm(vector<ll> a) {
  ll res;
  res = a[0];
  for (ll i = 1; i < a.size(); i++) {
    res = lcm(res, a[i]);
  }
  return res;
}
// 素数判定
bool isprime(ll x){
  ll i;
  if(x < 2) return false;
  else if(x == 2) return true;
  if(x % 2 == 0) return false;
  for(i = 3; i*i <= x; i += 2){
    if(x % i == 0) return false;
  }
  return true;
}
// 桁和
ll digsum(ll x){
  ll res = 0;
  while(x > 0){
    res += x % 10;
    x /= 10;
  }
  return res;
}


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






Measured memory_bytes: 256
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <map>
#include <functional>
#include <set>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
#define MIN(a, b) (((a) < (b)) ? (a) : (b))

using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pint;
const ll inf = (1LL << 60);
const ll mod = 1000000007;
ll max(ll a, ll b) {
	if (a < b)
		return b;
	else
		return a;

}
ll min(ll a, ll b) {
	if (a < b)
		return a;
	else
		return b;

}



char grid[2000][2000];
ll sumL[2000][2000], sumR[2000][2000], sumU[2000][2000], sumD[2000][2000];
int main() {
	
	ll H, W;

	cin >> H >> W;
	
	rep(i, H) {
		rep(j, W) {
			cin >> grid[i][j];

		}
	}
	
	
	rep(i, H) {
		ll sindex = -1;

		rep(j, W) {
			if (grid[i][j] == '#')
				sindex = j;
			else
				sumL[i][j] = sindex;
		}

		sindex = W;
		rep(j, W) {
			if (grid[i][W - 1 - j] == '#')
				sindex = W - 1 - j;
			else
				sumR[i][W - 1 - j] = sindex;

		}


	}

	rep(j, W) {

		ll sindex = -1;
		rep(i, H) {
			if (grid[i][j] == '#')
				sindex = i;
			else
				sumD[i][j] = sindex;
		}

		sindex = H;
		rep(i, H) {
			if (grid[H - 1 - i][j] == '#')
				sindex = H - 1 - i;
			else
				sumU[H - 1 - i][j] = sindex;

		}
	}

	ll ans = 0;
	rep(i, H) {

		rep(j, W) {

			if (grid[i][j] != '#') {

				ans = max(ans, (j - sumL[i][j]) + (sumR[i][j] - j - 1) + (i - sumD[i][j] - 1) + (sumU[i][j] - i - 1));
			}

		}
	}


	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 129152
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define dame {cout<< "0" <<"\n"; return;}
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
#define PI (acos(-1))
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll N; cin>>N;
    vector<ll> T(N),A(N);

    rep(i,N) cin>>T[i];
    rep(i,N) cin>>A[i];

    rep(i,N-1) if(T[i]>T[i+1]) dame; 
    rep(i,N-1) if(A[i]<A[i+1]) dame; 

    vector<ll> Tmax(N);
    vector<ll> Tmin(N,1);
    vector<ll> Amax(N);
    vector<ll> Amin(N,1);
    ll ma=-1;
    rep(i,N){
        Tmax[i]=T[i];
        if(maxi(ma,T[i])) Tmin[i]=T[i];
    }
    ma=-1;
    repr(i,N-1,0){
        Amax[i]=A[i];
        if(maxi(ma,A[i])) Amin[i]=A[i];
    }
    ll ans=1;
    rep(i,N){
        ll mama=min(Tmax[i],Amax[i]);
        ll mimi=max(Tmin[i],Amin[i]);
        //cout<< i << " "<< mama <<" "<<  mimi<<"\n";
        if(mama<mimi) dame;
        ans*=(mama-mimi+1);
        ans%=MOD;
    }
    cout<< ans <<"\n";

    /*

    vector<ll> saidai(N);
    vector<ll> saisho(N);
    rep(i,N) saisho[i]=1;
    ll ma=-1;
    rep(i,N){
        if(i!=0 and ma>T[i]) dame;
        if(maxi(ma,T[i])) saisho[i]=ma;
        saidai[i]=ma;
    }
    ma=-1;
    repr(i,N-1,0){
        if(i!=N-1 and A[i]<ma) dame;
        if(maxi(ma,A[i])){
            if(saidai[i]<ma) dame;
            saisho[i]=ma;
        }
        mini(saidai[i],ma);
    }
    ll ans=1;
    rep(i,N){
        ans*=saidai[i]-saisho[i]+1;
        ans%=MOD;
    }
    cout<< ans <<"\n";
    */
}
//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


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


int main()
{
    /*
    string s;
    cin>>s;
    if(s=="ABC")
    {
        cout<<"ARC"<<endl;
    }
    else
    {
        cout<<"ABC"<<endl;
    }
    */
   /*
    int n,k;
    cin>>n>>k;
    map <int,int> mp;
    for(int i=1;i<=k;i++)
    {
        int d;
        cin>>d;
        for(int j=1;j<=d;j++)
        {
            int a;
            cin>>a;
            mp[a]++;
        }
    }
    int count=0;
    for(int i=1;i<=n;i++)
    {
        if(mp[i]==0)
        {
            count++;
        }
    }

    cout<<count<<endl;
    */
    /*
    int n,m;
    cin>>n>>m;
    vector <pair<bool,ll>> h(n+1);  //良いか悪いか、標高
    for(int i=1;i<=n;i++)
    {
        int height;
        cin>>height;
        h[i].first=true;
        h[i].second=height;
    }

    for(int i=0;i<m;i++)
    {
        int a,b;
        cin>>a>>b;
        if(h[a].second<=h[b].second)
        {
            h[a].first = false;
        }
        if(h[a].second>=h[b].second)
        {
            h[b].first=false;
        }
    }

    int count=0;

    for(int i=1;i<=n;i++)
    {
        if(h[i].first)
        {
            count++;
        }
    }

    cout<<count<<endl;
    */

    ll A, B, X;
	cin >> X;
	for (ll i = 1;i < 1000;i++) {
		for (ll j = -1000;j < 1000;j++) {
			if (i * i * i * i * i - j * j * j * j * j == X) {
				cout << i << " " << j << endl;
				return 0;
			}
		}
	}
    
    return 0;
}

Measured memory_bytes: 3608
#include<iostream>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	for(int i=1;i<10001;i++){
		int a1=(i*8)/100,a2=i/10;
		if(a1==a&&a2==b)return cout<<i<<endl,0;
	}
	cout<<"-1"<<endl;
	return 0;
}

Measured memory_bytes: 256