akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include <string>
#include <bitset>
#include <tuple>
#include <cmath>
#include <map>

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

using namespace std;

using ll = long long;
using ull = unsigned long long;

using Pll  = pair<ll, ll>;
using Pull = pair<ull, ull>;

#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple

#define F first
#define S second

#define rep( i, n ) for ( int i = 0; i < (int)( n ); ++i )
#define reps( i, n ) for ( int i = 1; i <= (int)( n ); ++i )
#define rrep( i, n ) for ( int i = (int)( ( n ) - 1 ); i >= 0; --i )
#define rreps( i, n ) for ( int i = (int)( ( n ) ); i > 0; --i )
#define arep( i, v ) for ( auto &&i : ( v ) )

template<typename T> T gcd( const T a, const T b ) { return ( b ? gcd( b, a % b ) : a ); }

#define ALL( c ) ( c ).begin(), ( c ).end()
#define RALL( c ) ( c ).rbegin(), ( c ).rend()
#define UNIQUE( c ) ( c ).erase( unique( ( c ).begin(), ( c ).end() ), ( c ).end() )

constexpr ll MOD = 1000000007LL;

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev

template<typename T = ll> class UnionFind {
public:
	UnionFind( T n ) { rep( i, n ) { par.resize( n ); siz.resize( n ); par[i] = i; siz[i] = 1; } }
	T find( T x ) { if ( x == par[x] ) return ( x ); else return( par[x] = find( par[x] ) ); }
	void unite( T x, T y ) { T xx = find( x ); T yy = find( y ); if ( xx == yy ) return;
		if ( siz[xx] <= siz[yy] ) swap( xx, yy ); par[yy] = xx; siz[xx] += siz[yy]; }
private:
	vector<T> par, siz;
};

template<typename T = ll> T power( T a, T b, T m = MOD ) {
	T res = 1;
	while ( b > 0 ) { if ( b & 1 ) res = res * a % m;
		a = a * a % m; b >>= 1; }
	return ( res );
}

/*
constexpr ll MAX = 500010;
ll fact[MAX];
ll inv[MAX];
ll inv_fact[MAX];

template<typename T> void initComb( T n, T m = MOD )
{
	fact[0] = fact[1] = inv_fact[0] = inv_fact[1] = 1;
	inv[1] = 1;
	for ( int i = 2; i < n; i++ ) {
		fact[i] = ( fact[i - 1] * i ) % m;
		inv[i] = m - inv[m % i] * ( m / i ) % m;
		inv_fact[i] = inv_fact[i - 1] * inv[i] % m;
	}
}

template<typename T> T comb( T n, T r, T m = MOD )
{
	if ( n < r ) return ( 0 );
	if ( n < 0 || r < 0 ) return ( 0 );
	return ( fact[n] * ( inv_fact[r] * inv_fact[n - r] % m ) % m );
}
*/

void replace( string &s, string t, string r ) {
	string::size_type p = 0;
	while ( ( p = s.find( t, p ) ) != string::npos ) {
		s.replace( p, t.length(), r );
		p += r.length();
	}
}


int main()
{
	string S;
	cin >> S;
	map<char, int> m;
	rep( i, S.size() )
	{
		m[S[i]]++;
	}

	arep( it, m )
	{
		if ( it.second != 1 )
		{
			cout << "No" << endl;
			return ( 0 );
		}
	}

	cout << "Yes" << endl;

	return ( 0 );
}


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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef vector<vl> mt;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<string> vs;
typedef vector<vs> table;


const ll e5 = 1 << 20;
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 50;

const string pros = "YES";
const string cons = "NO";

ll n;
vl p;
ll cnt;

int main(){
  cin >> n;
  p = vl(n);
  for(ll i = 0;i < n;i++) cin >> p[i];
  for(ll i = 0;i < n;i++){
    if(p[i] != i+1) cnt++;
  }
  if(cnt == 2 || cnt == 0) cout << pros << endl;
  else cout << cons << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
typedef pair<int,int>P;
typedef pair<P,int>PP;
vector<PP>v;

int main(){
	int L;
	cin>>L;
	if(L==2){
		cout<<2<<" "<<2<<endl;
		cout<<1<<" "<<2<<" "<<0<<endl;
		cout<<1<<" "<<2<<" "<<1<<endl;
		return 0;
	}
	L-=1;
	if(L%2==0){
		v.push_back(PP(P(1,20),L));
	}else{
		v.push_back(PP(P(1,19),L-1));
	}
	REP(i,19){
		v.push_back(PP(P(i+1,i+2),0));
	}
	
	int LL=L;
	int c=0;
	int a=1;
	LL/=2;
	while(LL!=0){
		v.push_back(PP(P(20-c-1,20-c),a));
		LL/=2;
		c++;
		a*=2;
	}
	/*
	int now=a;
	L-=a;
	int b=0;
	while(L!=0){
		bool check=false;
		L/=2;
		if(L%2==1){
			check=true;
		}
		if(check){
			v.push_back(PP(P(1,20-b-1),now+(L<<b)));
		}
		b++;
	}*/
	REP(i,c-1){
		int LLL=L>>(i+1);
		if(LLL%2==1){
			v.push_back(PP(P(1,20-i-1),((L>>(i+2))<<(i+2))));
		}
	}
	
	cout<<20<<" "<<v.size()<<endl;
	REP(i,v.size()){
		cout<<v[i].first.first<<" "<<v[i].first.second<<" "<<v[i].second<<endl;
	}
	
	return(0);
}

Measured memory_bytes: 256
let rec for_fold a b f v = if a >= b then v else for_fold (a+1) b f (f v a)
let rec pop v = function (y,_)::ys when y > v -> pop v ys | ys -> ys

let _ = Scanf.scanf "%d" @@ fun n ->
  let a = Array.init n (fun _ -> Scanf.scanf " %d" ((+) 0)) in
  let li = Array.make n (-1) in
  let _ : _ list = for_fold 0 n (fun stk i ->
    let x = a.(i) in
    let stk' = pop x stk in
    li.(i) <- (match stk' with [] -> -1 | (_,j)::_ -> j);
    (x, i)::stk') [] in

  let ri = Array.make n n in
  let _ : _ list = for_fold 0 n (fun stk i ->
    let i = n-1-i in
    let x = a.(i) in
    let stk' = pop x stk in
    ri.(i) <- (match stk' with [] -> n | (_,j)::_ -> j);
    (x, i)::stk') [] in

  for_fold 0 n (fun s i ->
    s + a.(i) * (i - li.(i)) * (ri.(i) - i)) 0
  |> Printf.printf "%d\n"


Measured memory_bytes: 17408
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<59;
const double pi=acos(-1);
const double eps=1e-7;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

string s;
vi a(3),b(3);

int main(){
	cin>>s;
	int S=s.size();
	for(int i=0;i<S;i++){
		a[s[i]-'a']++;
		b[s[i]-'a']=1;
	}
	sort(a.begin(),a.end());
	int t=b[0]+b[1]+b[2];
	bool B=0;
	if(t==1){
		if(S==1) B=1;
	}
	else if(t==2){
		if(a[2]==1) B=1;
	}
	else{
		if(a[2]-a[0]<2) B=1;
	}
	if(B) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}

Measured memory_bytes: 512
n,k,q = map(int,input().split())
L = [int(input()) for i in range(q)]
P = [k - q for i in range(n)]

     
for i in range(q):
      P[L[i] - 1] += 1

for i in range(n):      
      if P[i] > 0:
            print("Yes")
      else:
            print("No")

Measured memory_bytes: 56408
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
    ll X,Y,Z;
    cin >> X >> Y >>Z;
    cout <<(X-Z)/(Y+Z)<<endl;
    return 0;
}


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

int main() {
    int a, b;
    cin >> a >> b;
    if (a == b) cout << "Draw" << endl;
    else if (a == 1) cout << "Alice" << endl;
    else if (b == 1) cout << "Bob" << endl;
    else {
        if (a < b) cout << "Bob" << endl;
        else cout << "Alice" << endl;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    long W = sc.nextInt();
    long[] w = new long[N];
    int[] v = new int[N];
    int vsum = 0;
    for (int i = 0; i < N; i++) {
      w[i] = sc.nextInt();
      v[i] = sc.nextInt();
      vsum += v[i];
    }
    long[][] dp = new long[110][110000];
    for (int i = 0; i < 110; i++) {
      for (int j = 0; j < 110000; j++) {
        dp[i][j] = 11000000000000000L;
      }
    }

    dp[0][0] = 0;
    for (int i = 0; i < N; i++) {
      for (int j = 0; j <= vsum; j++) {
        dp[i + 1][j] = Math.min(dp[i + 1][j], dp[i][j]);
        dp[i + 1][j + v[i]] = Math.min(dp[i + 1][j + v[i]], dp[i][j] + w[i]);
      }
    }

    long ans = 0;
    for (int i = vsum; i >= 0; i--) {
      if (dp[N][i] <= W) {
        ans = i;
        break;
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 162900
# -*- coding: utf-8 -*-
"""
Created on Sun Jun  2 15:02:08 2019

@author: Yamazaki Kenichi
"""

N, A, B, C = map(int,input().split())
mod = 10**9+7

def cmb(n, r, mod):
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

g1 = [1, 1] # 元テーブル
g2 = [1, 1] # 逆元テーブル
inv = [0, 1] # 逆元テーブル計算用テーブル
for i in range(2, 2*10**5+1):
    g1.append((g1[-1] * i) % mod)
    inv.append((-inv[mod % i] * (mod//i)) % mod)
    g2.append((g2[-1] * inv[-1]) % mod)
#逆元求める
#def g(a,mod):
def g(a):
    b, u, v = mod, 1,0
    while b:
        t = a//b
        a -= t * b
        u -= t * v
        a,b,u,v = b,a,v,u
        u %= mod
    return u if u > 0 else u + mod

p1,p2 = A * g(A + B) % mod, B * g(A + B) % mod
p3 = (100 - C) * g(100) % mod

#p1,p2のべき乗のリスト
P1, P2 = [1], [1]
for i in range(N+1):
    P1.append(P1[-1] * p1 % mod)
    P2.append(P2[-1] * p2 % mod)

ans = 0
for i in range(N):
    ans += (N+i) * cmb(N+i-1, i, mod) * P1[N] * P2[i]
    ans += (N+i) * cmb(N+i-1, i, mod) * P1[i] * P2[N]
    ans %= mod
ans = ans * g(p3) % mod

print(ans)



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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef unsigned char ubyte;

const ld EPS = 1e-10;
const ld PI = acos(-1.0);
const int INF = (int)1e9 + 5;
const ll LINF = (ll)1e18 + 5;

template<class T> 
ll abs(const T & x) { return x < 0 ? -x : x; }

template<class T> 
ll round(const T & x) { return x < 0 ? x - 0.5 : x + 0.5; }

template<class T> 
bool chmin(T & x, const T & y) {
	if (y < x) {
		x = y;
		return true;
	}
	return false;
}

template<class T>
ostream & operator <<(ostream & os, const vector<T> & v) {
	os << "{";
	for (typename vector<T>::const_iterator it = v.begin(); it != v.end(); ++it) {
		os << *it;
		if ((it + 1) != v.end()) os << ", ";
	}
	os << "}";
	return os;
}

template<class P, class Q>
ostream & operator <<(ostream & os, const pair<P, Q> & p) {
	return os << "(" << p.first << ", " << p.second << ")";
}

template<class T> 
bool chmax(T & x, const T & y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

#define all(a) (a).begin(), (a).end()

const ll P = (ll)1e9 + 7;

ll powmod(ll x, ll n) {
	x %= P;
	ll res = 1;
	while (n) {
		if ((n & 1)) {
			res = (res * x) % P;
			n--;
		}
		else {
			x = (x * x) % P;
			n >>= 1;
		}
	}
	return res;
}

const int N = 400500;

ll fact[N], invFact[N];

void calc() {
	fact[0] = invFact[0] = 1;
	for (int i = 1; i < N; i++) {
		fact[i] = (fact[i - 1] * i) % P;
		invFact[i] = powmod(fact[i], P - 2);
	}
}

ll C(int n, int k) {
	if (k > n) return 0;
	return fact[n] * invFact[k] % P * invFact[n - k] % P;
}

ll ways(int x, int y, int xx, int yy) {
	if (x > xx || y > yy) return 0;
	return C(xx - x + yy - y, xx - x);
}

int main() {
	srand(time(0));
#ifdef LOCAL 
	freopen("input.txt", "r", stdin);
#else
#endif

	calc();

	int H, W, A, B;

	cin >> H >> W >> A >> B;

	int curx = H - A, cury = B + 1;

	ll res = 0;

	while (curx >= 1 && cury <= W) {
		res += ways(1, 1, curx, cury) * ways(curx, cury, H, W);
		res %= P;
		curx--;
		cury++;
	}

	cout << res << endl;
}

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

int main(){
  char S[4];
  int sum = 0;
  for(int i = 0;i < 4; i++){
    cin >> S[i];
    if(S[i] == '+' ) sum++;
    else sum--;
  }

  cout << sum << endl;


  return 0;
}

Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

alias AB = Tuple!(long, "a", long, "b");

AB[10^^5] ABS;

void main()
{
    auto N = readln.chomp.to!int;
    foreach (i; 0..N) {
        auto ab = readln.split.to!(long[]);
        ABS[i] = AB(ab[0], ab[1]);
    }
    sort!"(a.a + a.b) > (b.a + b.b)"(ABS[0..N]);
    

    int t;
    long sum_a, sum_b;
    auto abs = ABS[0..N];
    foreach (_; 0..N) {
        ++t;
        auto head = abs[0];
        abs = abs[1..$];
        if (t % 2 == 1) {
            sum_a += head.a;
        } else {
            sum_b += head.b;
        }
    }
    writeln(sum_a - sum_b);
}

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

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

int sub(long n) {
  int cnt = 0;
  for (long i = 2; i * i <= n; ++i) {
    bool ok = false;
    while (n % i == 0) {
      n /= i;
      ok = true;
    }
    
    if (ok) {
      ++cnt;
    }
  }
  
  if (n > 1) {
    ++cnt;
  }
  return cnt;
}

int main() {
  cin >> a >> b;
  long g = GCD(a, b);
  cout << sub(g) + 1 << endl;
}

Measured memory_bytes: 256
#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 fix_cout(){cout << fixed << setprecision(20) ;}

int main(){
	ll n,c ;
	cin >> n >> c ;
	vector<vector<pll>> tv(c,vector<pll>(0)) ;
	for(int i=0;i<n;i++){
		ll s,t,ch ;
		cin >> s >> t >> ch ;
		s-- ; t-- ; ch-- ;
		tv.at(ch).emplace_back(s,t) ;
	}
	for(int i=0;i<c;i++) tv.at(i).emplace_back(INF,INF) ;
	for(int i=0;i<c;i++) sort(all(tv.at(i))) ;
	vll time(100100,0) ;
	for(int i=0;i<c;i++){
		ll s = tv.at(i).at(0).first ;
		ll t = tv.at(i).at(0).second ;
		for(int j=1;j<tv.at(i).size();j++){
			if(tv.at(i).at(j).first!=t){
				time.at(s)++ ;
				time.at(t+1)-- ;
				s = tv.at(i).at(j).first ;
				t = tv.at(i).at(j).second ;
			}else{
				t = tv.at(i).at(j).second ;
			}
		}
	}
	for(int i=1;i<time.size();i++) time.at(i) += time.at(i-1) ;
	ll ans = 0 ;
	for(int i=0;i<time.size();i++) ans = max(ans,time.at(i)) ;
	cout << ans << endl ;
//	for(auto i:tv){
//		for(auto j:i){
//			cout << j.first << " " << j.second << " " ;
//		}
//		cout << endl ;
//	}
}


Measured memory_bytes: 3456
import java.io.*;
import java.util.*;
public class Main {
	
	public static void main(String[] args) {
	
		MyScanner sc = new MyScanner();
		
		//String s=sc.next();
		int a=sc.nextInt();
		//int b=sc.nextInt();
		//int c=sc.nextInt();
		//int l=s.length();
		int i=1;
		while(a!=1&&a!=4&&a!=2) {
			a= a%2==0?a/2:3*a+1;
			i++;
		}
		System.out.println(i+3);
	
		
	}	
	
	
	
//----------------------------------------------------------
	static int l_min(int[] a) {
		Arrays.sort(a);
		return a[0];
	}
	static int l_max(int[] a) {
		int l=a.length;
		Arrays.sort(a);
		return a[l-1];
	}
	public static PrintWriter out;

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

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

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

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

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

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

	}
	

}





Measured memory_bytes: 21332
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <map>
#include <cstdlib>
#include <cctype>
#include <ctype.h>
#include <math.h>
char toupper(char c);
char toupper(char c)
{
    return (c - 0x20);
}

using namespace std;
int main()
{
    int n;
    cin >> n;
    int j;
    j = n / 100;
    n = n - j * 100;
    if (j * 5 >= n)
    {
        cout << "1" << endl;
    }
    else
    {
        cout << "0" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
n = int(input())
from collections import Counter
c = Counter()
for _ in range(n):
    s = input()[0]
    c[s] += 1

ans = 0
ans += c["M"]*c["A"]*c["R"]
ans += c["M"]*c["A"]*c["C"]
ans += c["M"]*c["A"]*c["H"]
ans += c["M"]*c["R"]*c["C"]
ans += c["M"]*c["R"]*c["H"]
ans += c["M"]*c["C"]*c["H"]
ans += c["A"]*c["R"]*c["C"]
ans += c["A"]*c["R"]*c["H"]
ans += c["A"]*c["C"]*c["H"]
ans += c["R"]*c["C"]*c["H"]

print(ans)

Measured memory_bytes: 9476
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<string.h>
#include<cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ll long long
using namespace std;


int main()
{
    int n;
    cin >> n;
    switch (n % 10)
    {
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
        cout << "hon" << endl;
        break;

    case 0:
    case 1:
    case 6:
    case 8:
        cout << "pon" << endl;
        break;
    
    default:
        cout << "bon" << endl;
        break;
    }
}

Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

void chmax(int &a, int b) { a = max(a, b); }

int n, m;
vector<int> et[100000];
int inV[100000];
queue<int> que;
int dp[100001];

signed main() {
	int i;
	
	cin >> n >> m;
	rep(i, m) {
		int x, y;
		cin >> x >> y;
		x--; y--;
		et[x].push_back(y);
		inV[y]++;
	}
	
	rep(i, n) {
		if (inV[i] == 0) {
			dp[i] = 0;
			que.push(i);
		}
	}
	
	while (!que.empty()) {
		int v = que.front(); que.pop();
		rep(i, et[v].size()) {
			int nv = et[v][i];
			inV[nv]--;
			chmax(dp[nv], dp[v] + 1);
			if (inV[nv] == 0) que.push(nv);
		}
	}
	
	int ans = 0;
	rep(i, n) chmax(ans, dp[i]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6528
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto X = RD;
	auto m = new long[](N);
	foreach (i; 0..N)
	{
		m[i] = RD;
	}
	m.sort();
	X -= m.sum;

	writeln(N + X / m[0]);
	stdout.flush();
	debug readln();
}


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

XY = []
for i in range(n):
    a = int(input())
    xy = []
    for j in range(a):
        xy.append(list(map(int, input().split())))
    
    XY.append(xy)
    
def check(i, xiyj, HoU):
    # 矛盾したらFalse 正直者と仮定した証言より 正直&正直者と仮定されている / 不親切&不親切と仮定されている True
    if ((i >> xiyj) & 1) ^ HoU:
        return False

    return True
    
max_honest = 0
for i in range(2 ** len(XY)):
    count = 0
    is_contradiction = True
    for j in range(len(XY)):
        # 正直者と仮定したときだけ採用
        if not ((i >> j) & 1): continue
        for k in range(len(XY[j])):
            xiyj = XY[j][k][0] - 1
            HoU = XY[j][k][1]
            
            if not check(i, xiyj, HoU):
                is_contradiction = False
                break
                
        if not is_contradiction:
            break

    if is_contradiction:
        for j in range(len(XY)):
            if ((i >> j) & 1): count+=1 
                
        if count > max_honest:
            max_honest =count
            
print(max_honest)

Measured memory_bytes: 3064
N = int(input())
A = []
for i in range(N):
  A.append(int(input()))

first = max(A)
firstCnt = 0
firstIdx = 0
second = 0
secondIdx = 0

for i,a in enumerate(A):
  if a < first:
    if a > second:
      second = a
      secondIdx = i
  else:
    firstIdx = i
    firstCnt += 1

if firstCnt > 1:
  for i in range(N):
    print(first)
else:
  for i in range(N):
    if i == firstIdx:
      print(second)
    else:
      print(first)


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

int main()
{
    int n, x;
    cin>>n>>x;

    int arr[n], i, count=1, value=0;

    for(i=0; i<n; i++)
        cin>>arr[i];

    for(i=0; i<n; i++)
    {
        value = value + arr[i];
        if(value > x)
            break;
        count++;
    }

    cout<<count;
}


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

int main(){
    int A, B, H, M;
    static const double pi = 3.141592653589793;
    cout << fixed;
    cout << setprecision(10);
    cin >> A >> B >> H >> M;
    double h = (double) (H * 60 + M)  / 720 * 2 * pi;
    double m = (double) M / 60 * 2 * pi;
    double ans = sqrt(A*A + B*B - 2 * A * B * cos(h-m));
    cout << ans << endl;
}

Measured memory_bytes: 4152
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
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 maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);


int main(){
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    ll A,B,H,M; cin>>A>>B>>H>>M;
    double tmp=(double)(A*A+B*B-2*A*B*cos(M_PI*abs(30*H+0.5*M-6*M)/180));
    printf("%.15f",sqrt(tmp));
}



Measured memory_bytes: 4136
#include <stdio.h>
int KI[100][100];
int N;

void kansu(){
  int i,j,k,min,m,b;
  int A[100],bango[100];

  for(i=0; i< N;i++){
    bango[i]=0;
    A[i]=2000000;
  }
  bango[0]=1;
  A[0]=0;

  while(1){
    k=-1;
    min=2000000;
    for(i=0; i <N ;i++){
      if(A[i] < min && bango[i]!=2){
        k=i;
        min=A[i];
      }
    }
    if(k==-1){
      break;
    }
    bango[k]=2;
    for(b=0;b<N;b++){
      if(bango[b] !=2 && KI[k][b]!=2000000){
        if(A[k]+KI[k][b] < A[b]){
          bango[b]=1;
          
          A[b]=A[k]+KI[k][b];
        }
      }
    }
  }


  for(i=0;i < N;i++){
    m=(A[i]==2000000 ? -1:A[i]);
    printf("%d %d",i,m);
    printf("\n");
  }
}

int main(){
  int i,j,k,a,b,c,d;
  scanf("%d",&N);
  for(i=0;i <N;i++){
    for(j=0; j < N;j++){
      KI[i][j]=2000000;
    }
  }
  for(i=0;i < N;i++){
    scanf("%d %d",&a,&b);
    for(j=0; j < b;j++){
      scanf("%d %d",&c,&d);
      KI[a][c]=d;
    }
  }
  kansu();
  return 0;

}



Measured memory_bytes: 2112
"""
the condition is straightforward.
each element of A and B must multiply to the same value.
to minimise the total of B, simply make that value as small
as possible (since A is fixed).

lcm(2, 3, 4) = 12
therefore B is
12/2, 12/3, 12/4
and the sum of B is
12/2 + 12/3 + 12/4

lcd of a list is loop: lcd(partial, new_value)
lcd(a, b) = ab / gcd(a, b)
"""

from fractions import gcd


def lcm(list_ints):
    lcm_ongoing = 1
    for val in list_ints:
        lcm_ongoing = val*lcm_ongoing//gcd(val, lcm_ongoing)
    return lcm_ongoing


def flatten(N, A):
    # get lcm
    lcm_of_A = lcm(A)
    # get sum of lcm/values
    ans = sum(lcm_of_A//value for value in A)
    modulo_value = int(int(10e8)+7)
    return ans % modulo_value


if __name__ == "__main__":
    test1 = \
"""3
2 3 4"""
    test2 = \
"""5
12 12 12 12 12"""
    test3 = \
"""3
1000000 999999 999998"""
    test = test3
    # N = int(test.split("\n")[0])
    # A = list(map(int, test.split("\n")[1].split()))
    N = int(input())
    A = list(map(int, input().split()))
    print(flatten(N, A))

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

int main()
{
  // 入力受け取り
  long L,R;
  cin >> L >> R;
  
  long minL = L / 2019;
  long maxR = R / 2019;

  if ((maxR - minL) > 0) {
    cout << "0" << endl;
    return 0;
  }
  
  long res = 2018;
  for (long i = L; i <=R; i++) {
    for (long j = i+1; j <= R; j++){
      res = min(res, ( i%2019 * j%2019 ) % 2019);
    }
  }
  cout << res << endl;   
  return 0;
}


Measured memory_bytes: 256
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	m := getNextInt(scanner)
	nodes := make([]Node, n)

	for i := 0; i < n; i++ {
		nodes[i].list = make([]int, 0)
	}

	for i := 0; i < m; i++ {
		s := getNextInt(scanner)
		t := getNextInt(scanner)
		nodes[s].list = append(nodes[s].list, t)
		nodes[t].list = append(nodes[t].list, s)
	}

	c := 1
	for i := 0; i < n; i++ {
		if nodes[i].c == 0 {
			traverse(nodes, i, c)
			c++
		}
	}

	q := getNextInt(scanner)

	for i := 0; i < q; i++ {
		s := getNextInt(scanner)
		t := getNextInt(scanner)
		if nodes[s].c == nodes[t].c {
			fmt.Fprintln(writer, "yes")
			continue
		}
		fmt.Fprintln(writer, "no")
	}

	writer.Flush()
}

// Node ...
type Node struct {
	list []int
	c    int
}

func traverse(nodes []Node, r, c int) {
	nodes[r].c = c
	for _, i := range nodes[r].list {
		if nodes[i].c != 0 {
			continue
		}
		traverse(nodes, i, c)
	}
}



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

int main() {
  int N;
  cin >> N;
  vector<pair<string,int>> lis(N);
  vector<pair<string,int>> mot(N);
  
  for (int i=0; i<N; i++) {
    cin >> lis[i].first >> lis[i].second;
    lis[i].second *= -1;
    mot[i].first = lis[i].first;
    mot[i].second = lis[i].second;
  }
  sort(lis.begin(),lis.end());
  for (int i=0; i<N; i++) {
    for (int j=0; j<N; j++) {
      if (mot[j].first == lis[i].first && mot[j].second == lis[i].second) {
        cout << j+1 << endl;
        break;
      }
    }
  }
  
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int b=700;
  char a[3];
  scanf("%s",a);
  if(a[0]=='o')b+=100;
  if(a[1]=='o')b+=100;
  if(a[2]=='o')b+=100;
  printf("%d",b);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define endl '\n'
#define PI acos(-1)
typedef long long ll;
//	Table is the complete reverse of dp
//	Always think of the pattern (LCM, GCD)
//	Be careful of unsigned
//	double epsilon = FLT_EPSILON;
//	Think of a solution that gets TLE and optimize it
string s, t, ans;
int n, m, **dp;
int main()
{
    cin.tie(nullptr); cout.tie(nullptr); ios_base::sync_with_stdio(false);
    cin >> s >> t;
    n = s.size();
    m = t.size();
    dp = new int *[n + 1];
    for(int i = 0; i <= n; i++)
    {
    	dp[i] = new int[m + 1];
    	dp[i][0] = 0;
    }
    memset(dp[0], 0, (m + 1) * 4);
    for(int i = 1; i <= n; i++)
    	for(int j = 1; j <= m; j++)
    	{
    		if(s[i - 1] == t[j - 1])
    			dp[i][j] = 1 + dp[i - 1][j - 1];
    		else
    			dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
    	}
    {
    	int i = n, j = m;
    	while(i && j)
    	{
    		if(s[i - 1] == t[j - 1])
    		{
    			ans += s[i - 1];
    			i--;
    			j--;
    		}
    		else
    		{
    			if(dp[i - 1][j] >= dp[i][j - 1])
    				i--;
    			else
    				j--;
    		}
    	}
    	reverse(ans.begin(), ans.end());
    }
    cout << ans;
}

Measured memory_bytes: 35456
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] cost = new int[n+1][n+1];
        int[] rc = new int[n+1];
        
        // Miの行 = rc[i-1], 列 = rc[i]
        for (int i = 0; i < n; i++) {
            rc[i]   = sc.nextInt();
            rc[i+1] = sc.nextInt();
        }
        
        for (int l = 2; l <= n; l++) {
            for (int i = 1; i <= n - l + 1; i++) {
                int j = i + l - 1;
                cost[i][j] = (1 << 21);
                for (int k = i; k <= j - 1; k++) {
                    cost[i][j] = Math.min(cost[i][j], cost[i][k] + cost[k + 1][j] + rc[i-1] * rc[k] * rc[j]);
                }
            }
        }
        System.out.println(cost[1][n]);
    }
}



Measured memory_bytes: 26872
#include<iostream>
#include<algorithm>
using namespace std;
int p = 1000000007;
int log2_p_MAX = 32;
// 1/a (mod p) = a^(p-2) (mod p)
long felmer(long a)
{
  // a^(2^i) mod p
  long rem[log2_p_MAX];
  rem[0] = a%p;
  for(int i=1;i<log2_p_MAX;i++)
    rem[i] = (rem[i-1]*rem[i-1])%p;
  long res = 1;
  long expo = p-2;
  for(int i=0;i<log2_p_MAX;i++){
	if(expo%2==1){
      res *= rem[i];
      res = res%p;
    }
  	expo /= 2;
  }
  return res;
}
int main()
{
  int n,k,i,t;
  long res;
  cin >> n >> k;
  res=n-k+1;
  t=1;
  cout << res << endl;
  for(i=2;i<=k;i++){
    if(i>n-k+1)
      res=0;
    else{
      res=(res*(k-i+1)*(n-k+2-i))%p;
      res=(res*t)%p;
      t=felmer(i);
      res=(res*t)%p;
    }
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int main() {
  ll a,b,k;
  cin >> a >> b >> k;
  if(a>=k){
    a-=k;
    cout << a << " " << b << endl;
  }
  else {
    k-=a;
    a=0;
    b-=k;
    if(b<0)b=0;
    cout << a << " " << b << endl;
  }
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;

int main(){
  ll N, tmp;
  cin >> N;
  vector<ll> A;
  for (ll i=0; i<N; i++){
    cin >> tmp;
    A.push_back(tmp);
  }
  ll m = 1000;
  ll s = 0;
  for (int i=0; i<N; i++){
    if (i != N - 1){
      if (A[i] < A[i+1]) {
        m += A[i] * s;
        s = 0;
        s += m / A[i];
        m -= s * A[i];
      }
      else if (A[i] > A[i+1]) {
        m += A[i] * s;
        s = 0;
      }
    }
    else {
      m += A[i] * s;
      s = 0;
    }
  }
  cout << m << "\n";
  return 0;
}

Measured memory_bytes: 3624
n,m = [int(x) for x in input().split()]
a = []
for i in range(n):
    list = [int(x) for x in input().split()]
    a.append(list)
b = [[int(input())] for i in range(m)]

#内積もとめる
for i in range(n):
    sum = 0
    for j in range(m):
        aij = a[i][j]
        bj = b[j][0]
        sum += aij * bj
    print(sum)


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

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin >> s;
    int rock = 0, paper = 0, sum = 0;
   for(int i = 0; i < s.size() - 1; i += 2){
       if(s[i] == 'g' && s[i + 1] == 'g')
        sum++;
       if(s[i] == 'g' && s[i + 1] == 'p');
       if(s[i] == 'p' && s[i + 1] == 'p')
        sum--;
       if(s[i] == 'p' && s[i + 1] == 'g');
   if(s.size() % 2 != 0){
       s[s.size() - 1] == 'g' ? sum = sum : sum--;
   }
   }
   cout << sum << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
int main(){
  int n;
  cin>>n;
  vll a(n);
  rep(i,n){
    cin>>a[i];
  }
  int cu=1;
  rep(i,n){
    if(a[i]==cu){
      cu++;
    }
  }
  cu--;
  if(cu==0){
    cout<<-1<<endl;
  }
  else{
    cout<<n-cu<<endl;
  }
}

Measured memory_bytes: 1920
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

int main(int argc, char *argv[])
{
  int N, x, a[123456], b[123456];
  long long ans = 0;
  cin >> N >>  x;

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

  for (int i = 1; i <= N; i++) {
    if(a[i] > (x - a[i-1])) {
      int d = a[i] - (x - a[i-1]);
      ans += d;
      a[i] -= d;
    }
  }

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


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
// マクロ
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
// 型エイリアス
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (b < c || d < a) cout << 0 << endl;
  else if (a < c) cout << min(b,d) - c << endl;
  else cout << min(b, d) - a << endl;
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
# define ll long long int
# define pb push_back
# define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
# define endl "\n"
using namespace std;
bool areAnagram(string str1, string str2)
{
    // If two strings have different size
    if (str1.size() != str2.size()) {
        return false;
    }

    // To store the xor value
    ll value = 0;

    for (ll i = 0; i < str1.size(); i++) {
        value = value ^ (ll) str1[i];
        value = value ^ (ll) str2[i];
    }
    return value == 0;

}
int main()
{
   fast
	 ll n;
	 cin>>n;
	 vector <string> v;
	 vector <ll> store;
	 for(ll i=0;i<n;i++)
	 {
		 string s;
		 cin>>s;
		 sort(s.begin(),s.end());
		 v.pb(s);
	 }
	 sort(v.begin(),v.end());
	 ll count=1,ans=0;
	 for(ll i=0;i<(n-1);i++)
	 {
		 if(v[i]==v[i+1])
		 {
			 count++;
		 }
		 else
		 {
			 store.pb(count);
			 count=1;
		 }
	 }
	 if(count!=1)
	 {
		 store.pb(count);
	 }
	 for(ll i=0;i<store.size();i++)
	 {
		 ans+=(((store[i])*(store[i]-1))/2);
	 }
	 cout<<ans;
	 return 0;
}


Measured memory_bytes: 7284
# 解説を見て解き直し
N, K = [int(x) for x in input().split()]

ranges = [tuple(int(x) for x in input().split()) for _ in range(K)]
ranges.sort()
p = 998244353

dp = [0] * (N + 1)
dpsum = [0] * (N + 1)
dp[1] = 1
dpsum[1] = 1

for i in range(2, N + 1):
    for l, r in ranges:
        rj = i - l
        lj = max(1, i - r)  # 1以上
        if rj <= 0: continue

        dp[i] += dpsum[rj] - dpsum[lj - 1]
        dp[i] %= p
    dpsum[i] = dpsum[i - 1] + dp[i]
    dpsum[i] %= p

print(dp[N])

Measured memory_bytes: 24396
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>

using namespace std;

using lli = long long;

#ifdef DEBUG
#define debug(var) cout << (#var) << ": " << (var) << endl;
template<class T> void dump_array_impl(const T& a) {
  bool first = true;
  for (auto&& x : a) {
    if (!first) { cout << ", "; first = false; }
    cout << x;
  }
}
#define debug_array(a) cout<<(#a)<<": ";dump_array_impl(a);cout<<endl
#else
#define debug(var) ()
#define debug_array(a) ()
#endif


lli n, m;
int main() {
  cin >> n >> m;
  for (lli y = m/n; y>=1; --y) {
    if (m%y == 0) {
      cout << y << endl;
      return 0;
    }
  }
  return 0;
}


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

int main() {
	long long num,tak,ao,m=0;
	cin >> tak >> ao >> num;
	if (num >= tak + ao) {
		cout << 0 << " " << 0;
	}
	else {
		if (num <= tak)
			cout << tak - num <<" " <<ao;
		else
			cout << 0 << " " << ao - (num-tak);
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
const ll INF = 1LL << 60;
const ll MOD = (ll) 1e9 + 7;

struct Train {
    int c;
    int s;
    int f;
};

int main(){
    int n;
    cin >> n;
    vector<Train> v;
    for (int i = 0; i < n - 1; i++) {
        int c, s, f;
        cin >> c >> s >> f;
        v.push_back(Train{c, s, f});
    }

    for (int i = 0; i < n - 1; i++) {
        int t = v[i].s;
        for (int j = i; j < n - 1; j++) {
            t = max(t, v[j].s);
            t += v[j].c + (v[j].f - t % v[j].f) % v[j].f;
        }
        cout << t << "\n";
    }
    cout << 0 << "\n";
}

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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) //cerr << #x << " : " << x << '\n';
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265359;

const ll MOD = (ll) 1e9 + 7;
const ll MAXN = (ll) 3e5 + 10;
const ll INF = (ll) 2242545357980376863;
const ld EPS = (ld) 1e-8;
const ll LOG = (ll) 30;

vector<ll> G[MAXN];

ll d[MAXN], sub[MAXN], mx[MAXN], val[MAXN];

vector<pll> H[MAXN];
set<pll> st[MAXN]; 
ll r;
void DFS(ll u, ll p){
	sub[u] = val[u];
	d[u] = 0;
	mx[u] = 0;
	ll m = 0, s = 0, mm = 0;
	for(auto adj : G[u]){
		if(adj == p) continue;
		DFS(adj, u);
		sub[u] += sub[adj];
		d[u] += (d[adj] + sub[adj]);
		//H.pb({d[adj] + sub[adj], mx[adj]});
		s += (d[adj] + sub[adj]);
		if(m < d[adj] + sub[adj]){
			m = d[adj] + sub[adj];
			mm = mx[adj];
		}
		if(m == d[adj] + sub[adj]){
			m = d[adj] + sub[adj];
			mm = max(mm, mx[adj]);
		}
		m = max(d[adj] + sub[adj], m);
	}
	if(r == 2 and u == 2){
		debug(u);
		debug(mm);
		debug(s);
		debug(m);
		debug('\n');
	}
	if(m + m <= s) mx[u] = s - (s & 1);
	else {
		if(s-mm >= (m - mm) + (m - mm)) mx[u] += s - (s & 1);
		else {
			mx[u] = mm + ((s - m) * 2ll);
		}
	}
}

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n;
	cin >> n;
	str s;
	cin >> s;
	for(int i =1 ; i <= n; i++) val[i] = s[i - 1] - '0';
	ll u, v;
	for(int i = 1; i < n; i++){
		cin >> u >> v;
		G[u].pb(v);
		G[v].pb(u);
	}
	ll ans = INF;
	for(int i = 1; i <= n; i++){
		DFS(i, -1);
		r = i;
		//debug(d[i]); debug(mx[i]);
		
		if(mx[i] == d[i]) {
			debug(i);
			ans= min(ans, d[i]);
		}
	}
	cout << (ans == INF ? -1 : ans / 2);
	return 0;
}

/*

                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/


Measured memory_bytes: 38016
import java.util.Scanner;
public class Main {
	public static int gcd(int x, int y) {if (y==0) {return x;}return gcd(y,x%y);}
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		System.out.println(gcd(s.nextInt(),s.nextInt()));
	}
}

Measured memory_bytes: 26272
function Main (input) {
  input = input.split("\n");
  var N = parseInt(input[0], 10);
  var o1 = input[1].split(" ");
  var S = o1[0];
  var T = o1[1];

  var i = 0;
  var ans = "";
  while (N > i) {
    var o2 = String(S.slice(i, i+1)) + String(T.slice(i, i+1));
    ans = ans + o2;
    i++
  }
  console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define itn int
typedef long long ll;
typedef pair<int,int> p;


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

  for (int i = 0; i < 100; i++)
  {
    int tmp = pow(2, i);
    if(tmp <= 1000000000)
    sam.push_back(tmp);
  }
  int res = 0;
  for(int i : v)
  {
    while(i % 2 == 0)
    {
      res++;
      i /= 2;
    }
  }

  cout << res << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD = 1e9+7;
const int larg = 1e5;

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

int main() {
	int N,A;
	cin >> N >> A;
	if(A >= N%500) cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    int n;
    cin >> n;

    int ans = 0;
    int maxi = -1;
    rep(i, n){
        int a, b;
        cin >> a >> b;
        if(maxi < a){
            maxi = a;
            ans = a + b;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.io.File;
import java.util.HashSet;
import java.util.Scanner;


public class Main {

		  public static void main(String[] args) throws Exception{
			  
		  try {
		        Scanner input = new Scanner(System.in);

		        while (input.hasNext()) {
		         String reverse;
		         String string = input.nextLine();
		         reverse = new StringBuilder(string).reverse().toString();
		         System.out.println(reverse);
		        }    
		         	        
		        input.close();

		        } catch (Exception ex) {
		            ex.printStackTrace();
		        }
		    }
		}

Measured memory_bytes: 26104
/*Priyansh Agarwal*/
#include<bits/stdc++.h>
#include<algorithm>
#include<unordered_map>
#include<vector>
#include<unordered_set>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define MOD 1000000007
#define MOD1 998244353
#define nline "\n"
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define debug(x) cout << #x << " " << x <<endl;
typedef long long ll;
typedef unsigned long long ull;
typedef priority_queue<int, vector<int>, function<bool(int, int)>> pq_func;
/*---------------------------------------------------------------------------------------------------------------------------*/
int gcd(int a, int b) {if (b > a) {return gcd(b, a);} if (b == 0) {return a;} return gcd(b, a % b);}
ll expo(ll a, ll b, ll mod) {ll res = 1; while (b > 0) {if (b & 1)res = (res * a) % mod; a = (a * a) % mod; b = b >> 1;} return res;}
vector<int> sieve(int n) {int*arr = new int[n + 1](); vector<int> vect; for (int i = 2; i <= n; i++)if (arr[i] == 0) {vect.push_back(i); for (int j = 2 * i; j <= n; j += i)arr[j] = 1;} return vect;}
void extendgcd(ll a, ll b, ll*v) {if (b == 0) {v[0] = 1; v[1] = 0; v[2] = a; return ;} extendgcd(b, a % b, v); ll x = v[1]; v[1] = v[0] - v[1] * (a / b); v[0] = x; return;} //pass an arry of size 3
ll mminv(ll a, ll b) {ll arr[3]; extendgcd(a, b, arr); return arr[0];} //for non prime b
ll mminvprime(ll a, ll b) {return expo(a, b - 2, b);}
bool revsort(ll a, ll b) {return a > b;}
void swap(int &x, int &y) {int temp = x; x = y; y = temp;}
void google(int t) {cout << "Case #" << t << ": ";}
/*--------------------------------------------------------------------------------------------------------------------------*/
int main()
{
	fastio();
#ifndef ONLINE_JUDGE
	freopen("Input.txt", "r", stdin);
	freopen("Output.txt", "w", stdout);
	freopen("Error.txt", "w", stderr);
#endif
	ll x;
	cin >> x;
	int count = 0;
	ll val = 100;
	while (val < x)
	{
		val += val / 100;
		count++;
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 3644