akhauriyash/Code-Regression huggingface dataset:
#pragma GCC target ("avx2") 
#pragma GCC optimization ("O3") 
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define fast_az_fuk ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long 
#define int ll 
#define ull unsigned ll
#define ld long double 
#define pb push_back 
#define pf push_front
#define dll deque<ll> 
#define vll vector<ll> 
#define pll pair<ll,ll> 
#define mapll map<ll,ll>
#define endl "\n" 
#define all(v) v.begin(),v.end() 
#define ms(a,x) memset(a,x,sizeof(a))
using namespace std;
void swap(auto*,auto*);
const ll mod=998244353;
int32_t main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    fast_az_fuk
    ll n; cin>>n;
    ll k; cin>>k; vector<pll> v(k); for(ll i=0;i<k;i++) {
        ll l,r; cin>>l>>r; v[i]={l,r};
    }
    sort(all(v));
    ll dp[n+1]; dp[n]=1;
    vll preDP(n+2); preDP[n+1]=0; preDP[n]=dp[n];
    for(ll i=n-1;i>=1;i--){
        dp[i]=0;
        for(ll j=0;j<k;j++){
            if(v[j].first>n-i) break;
            dp[i]=(dp[i]+mod+preDP[i+v[j].first] - preDP[i+min(v[j].second,n-i)+1])%mod;
        }
        preDP[i]=(preDP[i+1]+dp[i])%mod;
    }
    cout<<dp[1];
    return 0;
}
void swap(auto &a,auto &b)
{
    auto temp=a; a=b; b=temp;
}

Measured memory_bytes: 6352
n=int(input())
s=input()
k=int(input())
a=s[k-1]
t=[]
for i in range(n):
    if(s[i] == a):
        t.append(s[i])
    else:
        t.append('*')
        continue
for j in range(n):
    print(t[j],end='')
print()

Measured memory_bytes: 3060
n,k = map(int,input().split())

h = [0 for _ in range(n)]
h = [int(s) for s in input().split()]

h.sort()
#print(h)
if(n-k <= 0):
  ans = 0
else:
  h_new = h[:n-k]
  #print(h_new)
  ans = sum(h_new)

print(ans)

Measured memory_bytes: 33292
N, K = map(int, input().split())
P= list(map(int, input().split()))
temp = 0
for i in range(K):
    temp+=P[i]
l = []
l.append(temp)
for i in range(N-K):
    l.append(l[i]+P[K+i]-P[i])
#print(l)
temp = max(l)
ans = (temp+K)/2
print(ans)

Measured memory_bytes: 32012
/*Bismillahir Rahmanir Rahim*///{
#include <bits/stdc++.h>
#include <ext/numeric>
using namespace std; using __gnu_cxx::power;
using ll = long long; using ull = unsigned long long; using ld = long double;
const ll llinf = (1ll<<61)-1;
const double eps = 1e-6, ldeps = 1e-9;
struct Dbg {
static constexpr auto &os = cout;   // replace by cerr in interactive.
template<class C> static auto dud(C *x)->decltype(os << *x, 0);
template<class C> static char dud(...);
template<class C> typename enable_if<sizeof dud<C>(0)!=1, Dbg&>::type operator<<(const C &x) { os << x; return *this; }
template<class C> Dbg &dump(C b, C e) {
    *this << "\n[";
    int cur = 0;
    for (C i = b; i!=e and cur<26; i++, cur++) *this << ", "+2*(i==b) << *i;
    return *this << ']';
}
template<class C> typename enable_if<sizeof dud<C>(0)==1, Dbg&>::type operator<<(const C &x) {
    return dump(begin(x), end(x));
}
template<class C, size_t X> typename enable_if<!is_same<C, const char>::value, Dbg&>::type operator <<(C (&x)[X]) {
    return dump(begin(x), end(x));
}
template<class B, class C> Dbg &operator <<(const pair<B, C> &x) {
    return *this << '{' << x.first << ", " << x.second << '}';
}
Dbg &operator<<(ostream&(*x)(std::ostream&)) { os << x; return *this; }
} dbg;
void err(istringstream *iss) { delete iss; }
template<class C, class... Args> void err(istringstream *iss, const C &val, const Args &... args) {
    string name; *iss >> name; if (name.back()==',') name.pop_back();
    dbg << name << " = " << val << "; ", err(iss, args...);
}
#define bug(args...) dbg << __LINE__ << ": ", err(new istringstream(#args), args), dbg << endl
#define cbug(a, args...) if (a) bug(args);
#define ASSERT(a, o, b, args...) if (!((a)o(b))) bug(a, b, ##args), assert((a)o(b));
#define sl(a) int(strlen(a))
#define sz(a) int(a.size())
int T, Q, cn;//}
const int inf = 1000000007, mxn = 2005;

int n;
pair<int, int> a[mxn];
ll memo[mxn][mxn];
bitset<mxn> vstd[mxn];
ll dp(int at, int l) {
    if (at == n+1) return 0;
    auto &ret = memo[at][l];
    if (vstd[at][l]) return ret;
    vstd[at][l] = 1;
    int r = n-(at-l);
    ret = max(abs(a[at].second-l)*ll(a[at].first)+dp(at+1, l+1), abs(a[at].second-r)*ll(a[at].first)+dp(at+1, l));
    return ret;
}

signed main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); cout.precision(11);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i].first, a[i].second = i;
    }
    sort(a+1, a+1+n, greater<pair<int, int>> ());
    cout << dp(1, 1) << '\n';
}

Measured memory_bytes: 26904
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 1LL << 60;

int main(){
    int N; cin >> N;
    ll ans = 0;
    for(ll i = 1; i <= N; i++){
        ans += (N / i)*(N / i + 1)*i / 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3536
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <string>
#include <math.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
bool o=true;
int n;
set<string>p;
string q;
int main(void){
    cin>>n>>q;
    p.insert(q);
    for(int i=1;i<n;i++){
        string w;
        cin>>w;
        if(q[q.size()-1]!=w[0])o=false;
        if(p.find(w)!=p.end())o=false;
        p.insert(w);
        q=w;
    }
    if(o)cout<<"Yes\n";
    else cout<<"No\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include<map>
#include<algorithm>
#include<set>
#define rep(i,n) for(int i = 0;i < n;i++)
#define req(i,n) for(int i = 1; i<=n;i++)
#define ALL(a) a.begin(),a.end()
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T & val) {
    std::fill((T*)array, (T*)(array + N), val);
}
typedef long long int ll;
int main() {
    ll n, now,ans = 1000; cin >> n;
    vector<ll> a(n),dp(100,1000);
    rep(i, n) cin >> a[i];
    req(i, n - 1) {
        if (a[i] > a[i-1]) ans += 1LL * (a[i] - a[i-1]) * (ans / a[i-1]);
    }cout << ans << endl;
}

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


int main() {
	int N, M;
	cin >> N >> M;
	vector<int> A(N), B(N);
	for (int i = 0; i < N; i++)
	{
		cin >> A[i] >> B[i];
	}

	//mapを使う方法
	map<int, long long> m;

	for (int i = 0; i < N; i++)
	{
		//A円のお店にはB個追加されたよ
		m[A[i]] += B[i];
	}

	long long ans = 0;
	for (auto shop : m) {
		long long buy = min((long long)M, shop.second);
		ans += buy * shop.first;
		M -= (int)buy;
	}

	cout << ans << endl;
}



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

int main(){
  ll n,m,s=0;
  cin>>n>>m;
  while(m--)
  {
    ll x;
    cin>>x;
    s+=x;
  }
  if(n>=s)
  {
    cout<<n-s<<'\n';
  }
  else{
    cout<<"-1\n";
  }
}

Measured memory_bytes: 3644
#include <bits//stdc++.h>
using namespace std;
#define int long long
signed main() {
    int A,N,Max=0;
    cin >> N;
    long long goukei=0;
    for(int i=0;i<N;i++){
        cin >> A;
        goukei+=max(Max-A,(int)0);
        Max=max(A,Max);
    }
    cout << goukei << endl;
    
}



Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<V>;
using VVV = vector<VV>;
using VL = vector<ll>;
using VVL = vector<VL>;
using VVVL = vector<VVL>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
// const ll MOD = 1e9 + 7;
const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
void add(ll& a, ll b) {
	a += b;
	if (a >= MOD) while (a >= MOD) a -= MOD;
}
int main() { // 意外と取れる行動が少ない
	int n, s;
	cin >> n >> s;
	V a(n);
	rep(i, n) {
		cin >> a[i];
	}
	/*
	1.そもそもTからピックしない→dp[i+1][j]+=dp[i][j]
	2.Tからピックするが、それを部分集合に加えない→dp[i+1][j]+=dp[i][j]
	3.Tからピックして、それを部分集合に加える→dp[i+1][j+a[i]]+=dp[i][j]
	*/
	VVL dp(n + 1, VL(s + 1, 0)); // i番目までで、1,2,3の行動を行ったときに総和がjとなるようなものの数
	dp[0][0] = 1;
	rep(i, n) {
		rep(j, s + 1) {
			add(dp[i + 1][j], 2 * dp[i][j]);
			if (j + a[i] <= s) {
				add(dp[i + 1][j + a[i]], dp[i][j]);
			}
		}
	}
	cout << dp[n][s] << endl;
	return 0;
}

Measured memory_bytes: 73748
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_B main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


int main_B() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;

    int ax = x2 - x1;
    int ay = y2 - y1;
    int x3 = x2 + (-ay);
    int y3 = y2 + ax;
    int x4 = x1 + (-ay);
    int y4 = y1 + ax;

    cout << x3 << ' ' << y3 << ' '
         << x4 << ' ' << y4 << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] a = new int[N];
    int ans = 0;
    
    for(int i=0;i<N;i++){
      a[i] = sc.nextInt();
    }
    
    for(int i=0;i<N-2;i++){
      if(a[i]>a[i+1] && a[i+1]>a[i+2]){
        ans++;
      }else if(a[i]<a[i+1] && a[i+1]<a[i+2]){
        ans++;
      }
    }
    
    System.out.println(ans);
  }
}

Measured memory_bytes: 22604
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include "bits/stdc++.h"
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

int main(){
    int N,cnt=0;
    cin>>N;
    int A[N];
    for(int i=0;i<N;i++) cin>>A[i];
    while(true){
        for(int j=0;j<N;j++){
            if(A[j]%2!=0){
            cout<<cnt<<endl;
            return 0;
            }
            else
                A[j]/=2;
        }
        cnt++;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void){
  char s[100000];
  scanf("%s",s);
  int j[100]={0};
  int n=strlen(s);
  for(int i=0;i<n;i++){
    int num=s[i]-'a';
    j[num]=1;
  }
  for(int i=0;i<26;i++){
    if(j[i]==0){
      printf("%c",i+'a');
      return 0;
    }
  }
  printf("None");
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> md(k, 0);
  rep2(i, 1, n+1){
    int add = i % k;
    md.at(add)++;
  }
  ll ans = 0;
  rep(i, k){
    ll add = md.at(i);
    int nx = (k - i) % k;
    if((nx + nx) % k != 0) continue;
    add *= (ll)md.at(nx) * md.at(nx);
    ans += add;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main{
     public static void main(String[] args){
     	
     	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            long n = Long.parseLong(br.readLine());
            
        	System.out.print(n + ":");
        	primeFact(n);
        	
        } catch (Exception e) {
            e.printStackTrace();
        }
     }
	
	static void primeFact (long n) {
		
		for (long sqrtRel = 2; sqrtRel*sqrtRel <= n;) {
			if (n%sqrtRel == 0) {
			System.out.print(" " + sqrtRel);
				n = n/sqrtRel;
			} else {
				sqrtRel++;
			}
		}
		
		System.out.println(" " + n);
	}
}

Measured memory_bytes: 24464
# coding: utf-8
# Your code here!

import sys
readline = sys.stdin.readline
read = sys.stdin.read

#n,*a = [int(i) for i in read().split()]
#a = [int(i) for i in readline().split()]
#n = int(input())

n = int(input())
#n,*a = [int(i) for i in read().split()]
from collections import Counter

d = Counter(read().split())

m = max(d.values())

a = sorted(d.items())

for s,si in a:
    if si == m:
        print(s)
        






Measured memory_bytes: 46832
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);
		int n = sc.nextInt();
		BigInteger[] a=new BigInteger[n];
		BigInteger maxAbs=BigInteger.ZERO;
		int argMaxAbs=0;
		for (int i=0;i<n;i++) {
			a[i]=BigInteger.valueOf(sc.nextInt());
			if(a[i].abs().compareTo(maxAbs) > 0) {
				maxAbs=a[i].abs();
				argMaxAbs=i;
			}
		}
		int count=0;
		int[] first=new int[2*n];
		int[] second=new int[2*n];
		if(a[argMaxAbs].compareTo(BigInteger.ZERO) > 0) {
			for (int i=0;i<n-1;i++) {
				for(int j=0;j<2;j++) {
					first[count]=argMaxAbs+1;
					second[count]=i+2;
					count++;
					a[i+1]=a[i+1].add(a[argMaxAbs]);
					
					if(a[i+1].abs().compareTo(maxAbs) > 0) {
						maxAbs=a[i+1].abs();
						argMaxAbs=i+1;
					}		

				}
				

			}
		}
		else if (a[argMaxAbs].compareTo(BigInteger.ZERO) < 0){
			for (int i=n-1;i>0;i--) {
				
		
				for(int j=0;j<2;j++) {
					first[count]=argMaxAbs+1;
					second[count]=i;
					count++;
					a[i-1]=a[i-1].add(a[argMaxAbs]);
					
					if(a[i-1].abs().compareTo(maxAbs) > 0) {
						maxAbs=a[i-1].abs();
						argMaxAbs=i-1;
					}	

				}

			}
		}
		System.out.println(count);
		for(int i=0;i<count;i++) {
			System.out.println(first[i]+" "+second[i]);
		}
		
	//	System.out.println(Arrays.toString(a));
		
	}

}


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

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

typedef vector<int> vi;
typedef map<int, int> mi;
typedef pair<int, int> pi;
typedef long long ll;

void solve() {
  int m1, d1, m2, d2;
  cin >> m1 >> d1 >> m2 >> d2;
  if (m1 != m2) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int n, i, j, num;
    char mark, markList[4] = { 'S','H','C','D' };
    bool card[4][13];
    for (i = 0; i < 4; i++) {
        for (j = 0; j < 13; j++) {
            card[i][j] = true;
        }
    }
    cin >> n;
    for (i = 0; i < n; i++) {
        cin >> mark >> num;
        switch (mark) {
        case 'S':
            card[0][num - 1] = false;
            break;
        case 'H':
            card[1][num - 1] = false;
            break;
        case 'C':
            card[2][num - 1] = false;
            break;
        case 'D':
            card[3][num - 1] = false;
            break;
        }
    }
    for (i = 0; i < 4; i++) {
        for (j = 0; j < 13; j++) {
            if (card[i][j]) {
                cout << markList[i] << ' ' << j + 1 << endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string n;
	cin>>n;
	long long int sum=0;
	for(int i=0;i<n.length();i++)
	{
		sum=sum+(n[i]-'0');
	}
	if(sum%9==0)
	{
		cout<<"Yes"<<"\n";
	}
	else
	{
		cout<<"No"<<"\n";
	}
}

Measured memory_bytes: 3696
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
ll dp[5555];
int main(void)
{
    int n;
    cin>>n;
    vector < pii > s(n);
    for (auto &it : s)
        cin>>it.fi>>it.se;
    sort(all(s),[&](pii x,pii y)
         {
            return (x.fi + x.se) < (y.fi + y.se);
         });
    for (int i = 1;i <= n;++i)
        dp[i] = 1e18;
    dp[0] = 0;
    for (auto it : s)
        for (int i = n;i;--i)
            if (dp[i - 1] <= it.fi)
                smin(dp[i],dp[i - 1] + it.se);
    int ans = 0;
    for (int i = 0;i <= n;++i)
        if (dp[i] < 1e18)
            ans = i;
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 384
// Sky's the limit :)
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int T = 1; 
    // cin >> T; 
    while (T--) {
        int n;
        cin >> n;

        int ans = 0;
        for(int i = 1; i <= n; i++) {
            int lo = i;
            int hi = i * (n / i);
            int cnt = hi / i - lo / i + 1;
            ans += (cnt * (lo + hi)) / 2;
        }

        cout << ans << '\n';
        
    }
    
    return 0;
}



Measured memory_bytes: 3632
#include <iostream>

using namespace std;

int main() {
    string str;
    cin >> str;
    bool flag=false;
    for(int i=0; i<str.size(); i++) {
        if(str[i]=='7') {
            flag=true;
            break;
        }
    }

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

    return 0;
    
}

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

#define fast ios_base::sync_with_stdio; cin.tie(0); cout.tie(0)
#define ll          long long
#define ull         unsigned long long
#define pb          push_back
#define pii         pair<int,int>
#define pll         pair<long,long>
#define vi          vector<int>
#define vll         vector<ll>
#define vii         vector<pii>
#define Mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)      (a).rbegin(),(a).rend()
#define ff           first
#define ss           second
#define sz(x)       (int)x.size()
//#define endl        '\n'
#define mod        1000000007
//#define mod        998244353
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define rem(i,a,b)  for(int i=a;i>b;i--)
#define mp(a,b)     make_pair(a,b)
#define INF         numeric_limits<ll>::max();
#define NINF        numeric_limits<ll>::min();
#define vvi(a,b,name)    vector<vector<int>> name(a,vector<int>(b,-1))
const long double pi=3.14159265359;

int main()
{fast;
 int t=1,n;
 //cin>>t;
 while(t--)
 {double r;
  cin>>r;
  cout<<2*pi*r;
//   printf()
 }
 return 0;
}


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

int main() {
    long long n, a, b;
    scanf("%Ld%Ld%Ld", &n, &a, &b);
    if (a % 2 == b % 2)
        printf("%Ld\n", abs(a - b) / 2);
    else {
        if (a > b)
            swap(a, b);
        long long a1 = 1;
        long long p1 = a;
        long long b1 = b - a;
        long long p2 = n - b + 1;
        long long b2 = n;
        long long a2 = a + p2;

        printf("%Ld\n", min(p1 + (b1 - a1) / 2, p2 + (b2 - a2) / 2));
    }
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define all(x) x.begin(),x.end()

int const N = 1e5+2;
int n;
string a , b ,c; 

int main(){
         cin >> n >> a >> b >> c;
         int an = 0 ;
         map<int,char> pos;
         for(int i=0;i<n;++i){ 
                map<char,int> fr;
                ++fr[a[i]];
                ++fr[b[i]];
                ++fr[c[i]];
                int mx = 0;
                for(int j='a';j<='z';++j){
                      if(fr[j] > mx)mx = fr[j],pos[i]=j;
                }
         }
         for(int i=0;i<n;++i){
               if(a[i] != pos[i]){++an;a[i]=pos[i];}
               if(b[i] != pos[i]){++an;b[i]=pos[i];}
               if(c[i] != pos[i]){++an;c[i]=pos[i];}
         }
         cout << an ;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int n,m,d[10],a,b,t;

  while (1){
    for (int i=0;i<10;i++)d[i]=0;
    t=0;
    cin >> n >> m;

    if (n==0&&m==0)break;
    for (int i=0;i<n;i++) {
      cin >> a >> b;
      d[b-1]+=a;
    }
    for (int i=9;i>=0;i--){
      if (m==0) break;
      if (d[i]<=m){
	m-=d[i];
	d[i]=0;
      }else if (d[i]>m){
	d[i]-=m;
	m=0;
      }
    }
    for (int i=0;i<10;i++){
      t+=d[i]*(i+1);
    }
    cout << t << endl;
  }

  return 0;
}

Measured memory_bytes: 3092
#include<iostream>
#include<cstring>
#include<cstring> 
#include<algorithm>
using namespace std;
int n,m,a[200005],ans=0,Ans;
int main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n*2;i++){
    	scanf("%d",&a[i]);
    }
    sort(a+1,a+2*n+1);
    int l=0,r=n;
    while(l<=r){
        int mid=(l+r)>>1;
        bool flag=true;
        int t=mid<<1;
        int ans=0;
        if(flag){
        	for(int i=t+1,j=2*n;i<j;i++,j--){
        		if(a[i]+a[j]<m){
                	flag=false;
					break;
           	 	}	
        	}
        }
        if(flag){
            Ans=mid;
            r=mid-1;
        }
		else{
			l=mid+1;
		} 
    }
    int t=Ans*2;
    for(int i=1;i<=Ans;i++){
    	ans=max(ans,a[i]+a[t-i+1]);
    } 
    for(int i=t+1,j=2*n;i<j;i++,j--){
    	ans=max(ans,a[i]+a[j]-m);
    } 
    printf("%d\n",ans);
    return 0;
} 

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


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

  ll n;
  cin >> n;
  string s;
  cin >> s;
  if(s[0]=='W'){
    cout << 0 << endl;
    return 0;
  }
  ll sum=0;
  ll hon=1;
  ll mod=1e9+7;
  sum=1;  
  rep1(i,2*n-1){
    //判定
    if(hon==0 && s[i]=='W'){
      cout << 0 << endl;
      return 0;
    }
    if(s[i]=='B'){
      if(hon%2==1){
	sum=(sum*hon)%mod;
	hon-=1;
      }
      else{
	hon+=1;
      }
    }
    else{
      if(hon%2==0){
	sum=(sum*hon)%mod;
	hon-=1;
      }
      else{
	hon+=1;
      }
    }
    if(i==2*n-1 && hon!=0){
      cout << 0 << endl;
      return 0;
    }
    //    cout << sum <<" " << hon << endl;
  }
  ll ans=1;
  rep1(i,n){
    ans = (ans*i)%mod;
  }
  ans = (ans * sum)%mod;
  cout << ans << endl;
  
  return 0;
    

}


Measured memory_bytes: 720
import java.util.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt(), m = in.nextInt();
        long[] a = new long[n];
        List<Pair> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            a[i] = in.nextLong();
        }
        for (int i = 0; i < m; i++) {
            list.add(new Pair(in.nextInt(), in.nextLong()));
        }
        Arrays.sort(a);
        Collections.sort(list, (p1, p2) -> p1.c - p2.c > 0 ? -1 : 1);

        int idx = 0;
        for (Pair p : list) {
            int count = 0;
            while (idx < n && count < p.b && idx + count < n && a[idx + count] < p.c) {
                a[idx + count] = p.c;
                count++;
            }
            idx += count;
        }
        System.err.println(Arrays.toString(a));
        long sum = 0;
        for (long val : a) {
            sum += val;
        }
        System.out.println(sum);
    }
}

class Pair {
    int b;
    long c;

    public Pair(int b, long c) {
        this.b = b;
        this.c = c;
    }
}

Measured memory_bytes: 96928
#include <bits/stdc++.h>
#include <vector>
#include <cmath>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define ENDL cout << endl;
using namespace std;
using ll = long long;
using ld = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using VI = vector<int>;
using VVI = vector<VI>;
using Vll = vector<ll>;
using VVll = vector<Vll>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
const int INF = 1e9;
const ll MOD = 1e9 + 7;

ll ans(auto n, auto x, auto &a, auto &p)
{
  if (n == 0)
  {
    if (x >= 1) return 1;
    else return 0;
  }
  if (1 <= x && x <= 1 + a[n-1]) return ans(n-1, x-1, a, p);
  if (x == 2 + a[n-1]) return p[n-1] + 1;
  if (2 + a[n-1] < x && x <= 2 + 2*a[n-1]) return p[n-1]+1+ans(n-1, x-2-a[n-1], a, p);
  if (x == 3 + 2*a[n-1]) return 2*p[n-1] + 1;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N, X;
  cin >> N >> X;
  Vll a(N+1), p(N+1);
  a[0] = 1; p[0] = 1;
  REP2(i, 1, N+1)
  {
    a[i] = 2*a[i-1] + 3;
    p[i] = 2*p[i-1] + 1;
  }
  cout << ans(N, X, a, p) << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int A, B, C, X;
    cin >> A >> B >> C >> X;

    int a, b, c;
    a = X/500;
    b = (X-a*500)/100;
    c = (X-a*500-b*100)/50;

    int i, j, k, count=0;
    for(i=a; i>=0; i--) {
        k = c;
        // if(b>B) {
        //     break;
        // }
        for(j=b; j>=0; j--) {
            if(k>C) {
                break;
            }
            if((i<=A)&&(j<=B)&&(k<=C)) {
                count += 1;
            }
            k += 2;
        }
        b += 5;
    }

    cout << count << endl;

    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<lint>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    int n;
    lint k;
    cin >> n >> k;
    vec a(n);
    rep(i, n) cin >> a[i];

    lint l = k;
    int cnt = -1;
    while (l > 0) {
        l >>= 1;
        cnt++;
    }

    lint res = 0;
    bool smaller = false;

    for (int i = 60; i >= 0; --i) {
        lint base = 1LL << i;
        if (i > cnt) {
            int cnt2 = 0;
            rep(j, n) {
                if ((a[j] >> i) & 1) cnt2++;
            }
            res += base * cnt2;
        }
        else {
            int nd = (k >> i) & 1;
            int cnt1 = 0;
            rep(j, n) {
                if ((a[j] >> i) & 1) cnt1++;
            }
            int cnt0 = n - cnt1;
            if (cnt1 >= cnt0) {
                if (nd) smaller = true;
                res += base * cnt1;
            }
            else {
                if (smaller) {
                    res += base * cnt0;
                }
                else {
                    if (nd) res += base * cnt0;
                    else res += base * cnt1;
                }
            }
        }
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 4028
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INF = 1000000007;
const int mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main(){
  string odd,even;
  cin >> odd >> even;
  for(int i=0; i<(int)even.size(); i++){
    cout << odd[i] << even[i];
  }
  if(odd.size() != even.size()){
    cout << odd[odd.size()-1];
  }
  cout << endl;
  return 0;
}


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

using namespace std;

int main() {
	int n, k;
	string s;

	cin >> n >> s >> k;

	char c = s[k-1];

	for (int i = 0; i < n; i++) {
		if (s[i] != c) {
			s[i] = '*';
		}
	}

	cout << s << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#include<cstring>
#include <vector>
typedef long long int ll;

string s, t;

int main()
{
  ios_base::sync_with_stdio(false); 
  cin.tie(NULL);
  cin >> s >> t;
  int n = s.size();
  int m = t.size();
  vector<vector<ll>> dp(n+1, vector<ll>(m+1, 0));
  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]);
    }
  }
  ll len = dp[n][m];
  vector<char> res(len, ' ');
  while (n > 0 && m > 0)
  {
    if (s[n-1] == t[m-1])
    {
      res[len-1] = s[n-1];
      len--;
      n--;
      m--;
    }
    else if (dp[n-1][m] > dp[n][m-1])
    {
      n--;
    }
    else
    {
      m--;
    }
  }
  for (auto c: res) cout << c;
  return 0;
}


Measured memory_bytes: 73336
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template<typename T> using rev_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<class S, class T> void map_init(map<S, T> &m, S k, T v){if(!m.count(k)) m[k] = v;}
void R_YESNO(bool p) { cout << (p ? "YES" : "NO") << endl; }
void R_YesNo(bool p) { cout << (p ? "Yes" : "No") << endl; }

int64_t divceil(int64_t a, int64_t b) {
    return a / b + (a > 0 && a % b ? 1 : 0);
}

int main() {
    i64 S;
    cin >> S;
    i64 N = 1e9;
    vector<i64> ans = { 
        0,
        0,
        N,
        1,
        N * divceil(S, N) - S,
        divceil(S, N),
    };
    string delim = "";
    for(auto &x : ans) {
        cout << delim << x;
        delim = " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
  char s[100002];
  scanf("%s",s);
  int len=strlen(s);
  int i,white=0,black=0;
  for(i=0;i<len;i++)
    if(s[i]=='0')
      white++;
    else
      black++;
  if(white<black)
    printf("%d\n",white*2);
  else
    printf("%d\n",black*2);
  return 0;
}


Measured memory_bytes: 256
import bisect

A, B, Q = map(int, input().split())

INF = 10 ** 18

s = [-INF] + [int(input()) for i in range(A)] + [INF]

t = [-INF] + [int(input()) for i in range(B)] + [INF]


for q in range(Q):
    x = int(input())
    b, d = bisect.bisect_right(s, x), bisect.bisect_right(t, x)
    res = INF
    for S in [s[b - 1], s[b]]:
        for T in [t[d - 1], t[d]]:
            d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)
            res = min(res, d1, d2)
    print(res)

Measured memory_bytes: 90048
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define ii pair<int,int>
#define MAX 1000000007
using namespace std;

int main(void){
	int tmp, max=0, ans=0;
	
	rep(i,5){
		cin>>tmp;
		if(tmp%10 == 0)ans+=tmp;
		else{
			ans+=(tmp/10+1)*10;
			if(max < 10-tmp%10)max=10-tmp%10;
		}
	}
	cout<<ans-max<<endl;
	return 0;
}


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

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecbool vector<bool>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)


int main()
{
  ll n, id=0, count=0;
  cin >> n;
  vecll a(n), c(n, 0);
  forll(i, 0, n)
	cin >> a[i];
  forll(i, 0, n){
	if(id == 1){
	  cout << count << endl;
	  return 0;
	}
	id = a[id] - 1;
	count++;
	if (c[id] != 0)
	  break;
	c[id]++;
  }
  cout << -1 << endl;
}


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

int main(){
	int N;
	cin >> N;
	vector<int> vec(N);//要素数Nのint型ベクトル作成
	for(int i = 0; i<N ; i++){cin >> vec[i];}//N回vecに値を渡す

	sort(vec.begin(), vec.end());//vecの始まりから終わりまでを昇順に並び替え
	//sortすることで、以下の文で常にiが一番大きくなる

	int ans = 0;

	for(int i = 0; i<N; i++){
		for(int j=0; j<i; j++){
			for(int k=0; k<j; k++){
				if(vec[k]!=vec[j] and vec[i] != vec[j] and vec[k]+vec[j]>vec[i]){//kとjが等しくなく、iとjが等しく無い(各値が違う)時に、kとjの和がiよりも大きい。これをi<Nまでやる
					ans++;}
			}
		}
	}
//i=0,1の時はkのfor文までたどり着かない
cout << ans << endl;
return 0;
}

Measured memory_bytes: 3560
n, m = map(int, input().split())
A = list(map(int, input().split()))
b = sum(A)/(4*m)
a = 0
#print(b)
for i in range(n):
  if A[i] >= b:
    a += 1

if a >= m:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 8972
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w;
  while(1){
    scanf("%d %d",&h,&w);
    if(h==0 && w==0) break;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	if(i==0 || j==0 || i+1==h || j+1==w) printf("#");
	else printf(".");
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define rep(i, n) for(ll i = 0;i < n;i++)
template<class T, class U> void cmax(T& a, U b) { if (a<b) a = b; }
template<class T, class U> void cmin(T& a, U b) { if (a>b) a = b; }

int n, x;
int pre(int i) {
  if (i == 0) return n-1;
  return i-1;
}

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

  cin >> n >> x;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

  const ll INF = 1LL << 50;
  vector<vector<int>> cnt(n, vector<int>(n, 0));
  vector<vector<ll>> cost(n, vector<ll>(n, INF));
  rep(i, n) cost[0][i] = a[i];

  rep(i, n-1) {
    rep(j, n) {
      if (cost[i][pre(j)] < cost[i+1][j] && cost[i][pre(j)] < cost[i][j]) {
        cost[i+1][j] = cost[i][pre(j)];
        cnt[i+1][j] = cnt[i][pre(j)] + 1;
      } else if (cost[i][j] < cost[i+1][j]) {
        cost[i+1][j] = cost[i][j];
      }
    }
  }

//  cerr << endl;
//  rep(i, n) {
//    rep(j, n) {
//      cerr << cost[i][j] << " ";
//    }
//    cerr << endl;
//  }
//  cerr << endl;
//  rep(i, n) {
//    rep(j, n) {
//      cerr << cnt[i][j] << " ";
//    }
//    cerr << endl;
//  }
//  cerr << endl;

  ll ans = INF;
  rep(i, n) {
    ll costsum = 0;
    rep(j, n) {
      costsum += cost[i][j];
    }
    
//    cerr << cntsum << endl << cntmax << endl << costsum << endl << endl;
    cmin(ans, costsum + i * x);
  }
  cout << ans << endl;
}


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

using namespace std;

int main()
{
    int h, n;
    cin >> h >> n;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        h-= x;
    }
    cout << (h <= 0 ? "Yes" : "No") << endl;
    return 0;
}


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

ll x, k, d;

int main() {
	cin >> x >> k >> d;
	x = abs(x);
	if ((double) k * d < x) {
		cout << x - k * d << endl;
	} else {
		ll t = x / d;
		x -= d * t;
		k -= t;
		if (k & 1)
			x = abs(x - d);
		cout << x << endl;

	}
}


Measured memory_bytes: 3620
//Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl '\n'
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
bool sortbysec(const pair<ll,ll>&a,const pair<ll,ll>&b)
{
    return (a.second<b.second);
}
int main()
{
  ios;
  int n;
  cin>>n;
  ll a[n];
  ll gcd=0,k=1,d=0,lcm=1;
  double ans=0;
  for(int i=0;i<n;i++)
  {
      cin>>a[i];
      ans+=1.0/(a[i]*1.0);

  }
  cout<<(1.0/ans*1.0)<<endl;




}
//Alhamdulillah











Measured memory_bytes: 3808
fun main(args:Array<String>) {
    val (d,n) = readLine()!!.split(" ").map { it.toInt() }
    val baseNum = Math.pow(100.toDouble(), d.toDouble()).toInt()
    val ans = (1..101).filter { it % 100 != 0 }[n-1]*baseNum
    println(ans)
}

Measured memory_bytes: 36376
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long lng;
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define ALL(a) (a).begin(), (a).end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) //ATTENTION: <a> must be sorted in advance

lng power(lng b, lng n) {lng sol=1; while(n>0) {if(n&1) {sol=sol*b;} n>>=1; b*= b;} return sol;} //calculate b^n

const int MOD = 1000000007; //10^9+7


/*********** variables ************/
int N;
/**********************************/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    cout << (N%2 ? 2*N : N) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define retunr return
#define pb push_back
#define mp make_pair
#define null NULL
#define sc(x) scanf("%d", &x)
#define sc64(x) scanf("%lld", &x)
#define pr(x) printf("%d", (x))
#define pr64(x) printf("%lld", (x))
#define sp putchar(' ')
#define ln putchar('\n')
#define rep(i,l,r) for (int i = l, lim = r;i <= lim; ++i)
#define repr(i,l,r) for (int i = r, lim = l;i >= lim; --i)
#define fi first
#define se second
#define SET(__set, val) memset(__set, val, sizeof __set)
#define fill(a,v,n) memset((a),(v),sizeof(a[0])*(n))
#define copy(a,b,n) memcpy((a),(b),sizeof(a[0])*(n))
#define ALL(x) (x.begin(),x.end())
#define prf(x) printf("%.20f", x)
#define for_each_edge(u) for(int i = point[u];i;i=G[i].n)
typedef unsigned int uint;
typedef double db;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define N 100010
#define M 1024
#define MOD 1000000007
void _add(int &a, int b){a = (a+b)%MOD;}
void _sub(int &a, int b){a = (a+MOD-b)%MOD;}
void _mul(int &a, int b){a = (ll)a*b%MOD;}
void _max(int &a, int b){a = max(a,b);}
void _min(int &a, int b){a = min(a,b);}
ll gcd(ll a, ll b){if(!b)return a;return gcd(b,a%b);}
ll pw(ll a, ll b){ll res(1);while(b){if(b&1)res=res*a%MOD;a=a*a%MOD;b>>=1;}return res;}
ll pwM(ll a, ll b, ll mod){ll res(1);while(b){if(b&1)res=res*a%mod;a=a*a%mod;b>>=1;}return res;}

const int infi = 2147483647;
const ll infl = 9223372036854775807ll;
const db PI = 3.14159265358979323846;

/*
struct E{
	int v, w, n;
}G[N];
int cnt, point[N];
void adde(int u, int v, int w = 0){
	G[++cnt]=(E){v,w,point[u]},point[u]=cnt;
	G[++cnt]=(E){u,w,point[v]},point[v]=cnt;
}
void Ginit(int n){
	cnt = 0;
	fill(point,0,n+1);
}
*/
/*
struct hh{
	int a, b;
	bool operator < (const hh &x) const{
		if(a==x.a)return b<x.b;
		return a<x.a;
	}
}a[N];
*/
int n, m, k,q;
vector<int> d;
int main(){
//	freopen("1", "r", stdin);
	sc(n),sc(m);
	rep(i,1,sqrt(m)){
		if(m%i==0){
			d.pb(i);
			if(i!=m/i)
				d.pb(m/i);
		}
	}
	int ans = 1;
	for(auto t:d){
		if(m/t >= n)ans = max(ans, t);
	}
	pr(ans),ln;
/*
	int Case;
	sc(Case);
	rep(ca, 1, Case){
	    printf("Case #%d: ", ca);
	}
*/
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
string a, b, c;
cin >> a >> b >> c;
((a[a.length()-1] == b[0]) && (b[b.length()-1] == c[0])) ? cout << "YES\n" : cout << "NO\n";
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main(int argc, char const *argv[]) {
  string ramen;
  cin >> ramen;
  int price = 700;
  for (int i = 0; i < 3; i++) {
    if (ramen[i] == 'o') price += 100;
  }
  cout << price << endl;
  return 0;
}


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

import static java.lang.Integer.parseInt;

/**
 * Cyclic Sugoroku
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;

		int N = parseInt(br.readLine());
		int[] a = new int[N];

		StringTokenizer st = new StringTokenizer(br.readLine());

		for (int i = 0; i < N; i++) {
			a[i] = parseInt(st.nextToken());
		}

		//
		int[] indeg = new int[N];
		boolean[] used = new boolean[N];

		for (int i = 0; i < N; i++) {
			indeg[(i + a[i]) % N]++;
		}


		for (int i = 0; i < N; i++) {
			int j = i;
			while (!used[j] && indeg[j] == 0) {
				used[j] = true;
				j = (j + a[j]) % N;
				indeg[j]--;
			}
		}

		System.out.println(Arrays.stream(indeg).filter(x -> x != 0).count());
	}
}

Measured memory_bytes: 49008
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1e9+7;

#define vec vector<int>
#define vecll vector<ll>
#define vpair vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>

#define rep(i,n)   for(int i=(int)0; i<(int)n; i++)
#define REP(i,m,n) for(int i=(int)m; i<(int)n; i++)
#define all(var)     (var).begin(), (var).end()
#define prt(var)     cout << var << endl
#define prtd(n, var)  cout << fixed << setprecision(n) << var << endl
#define prt2(var1, var2) cout << var1 << " " << var2 << endl

//----------------------------------------------------------------
class Graph{

public:
  vector<vector<int>> tree;
  vector<int> check; // For DFS
  vector<ll> dist;   // For BFS
  queue<int> q; // For BFS

  Graph(int n){
    tree.resize(n);
    init(n);
  }
  ~Graph(){}

  void addpath(int m){
    int a, b;
    rep(i,m){
      cin >> a >> b;
      a = (a-1)*3; b = (b-1)*3;
      tree[a].push_back(b+1);
      tree[a+1].push_back(b+2);
      tree[a+2].push_back(b);
    }
  }

  void init(int n){
    check.assign(n, false);
    dist.assign(n, -1);
  }
  void resetCheck(){
    rep(i,check.size()){
      check[i] = false;
    }
  }

  void dfs(int v){
    check[v] = true;

    for(auto next_v : tree[v]){
      if(check[next_v]) continue;
      dfs(next_v);
    }
  }

  void bfs(int v){
    dist[v] = 0;
    q.push(v);

    while(!q.empty()){
      int cur_v = q.front();
      q.pop();

      for(int next_v : tree[cur_v]){
        if(dist[next_v] != -1){
          continue;
        }

        dist[next_v] = dist[cur_v] + 1;
        q.push(next_v);
      }
    }
  }
};

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

  Graph g(3*n);
  g.addpath(m);

  int s, t;
  cin >> s >> t;
  s = (s-1)*3;
  t = (t-1)*3;

  //prt("path check");
  //rep(i,n){prt2("---from : ", i);rep(j,g.tree[i].size()){prt(g.tree[i][j]);}}

  //prt("Distance");
  //rep(i,n){prt2(i, g.dist[i]);}

  g.bfs(s);
  if(g.dist[t] == -1){prt(-1); return 0;}
  prt(g.dist[t]/3);
  //prt("check"); rep(i,n){prt2(i, g.dist[i]);}

}


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

int n,m;
int G[8][8];

int res(int cur,int dip,int a[8]){
    //cout<<cur<<endl;
    int sum=0;
    if(dip==n){
        return 1;
    }
    for(int i=0; i<8; i++){
        if(G[cur][i]&&!a[i]){
            int *used=new int[8];
            for(int i=0; i<8; i++){
                used[i]=a[i];
            }
            used[i]=1;
            //cout<<cur<<' '<<i<<endl;
            sum+=res(i,dip+1,used);
            delete[] used;
        }
    }
    return sum;
}

int main(){
    cin>>n>>m;
    int used[8];
    for(int i=0; i<8; i++){
        used[i]=0;
    }
    for(int i=0; i<m; i++){
        int a,b;
        cin>>a>>b;
        a--;b--;
        G[a][b]=1;
        G[b][a]=1;
    }
    used[0]=1;
    cout<<res(0,1,used)<<endl;
    return 0;
}



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

int main(void){
  int H, W;
  string str;
  vector<string> v;
  cin >> H >> W;
  for(int i=0;i<H;i++){
    cin >> str;
    v.push_back(str);
  }
  for(int i=0;i<W+2;i++) cout << "#";
  cout << endl;
  for(int i=0;i<H;i++){
    cout << "#" << v[i] << "#" << endl;
  }
  for(int i=0;i<W+2;i++) cout << "#";
  cout << endl;
  return 0;
}


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

int main(){
	string w;
	cin >> w;
	int c[26] = {0};
	rep(i,w.size()) c[w[i]-'a']++;
	rep(i,26) {
		if (c[i]%2 == 1) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;

	return 0;
}


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

int main() {
  string S,T;
  cin >> S >> T;
  if (S.size() + 1 != T.size()){
    cout << "No" << endl;
    return 0;
  }
  rep(i,S.size()){
    if(S.at(i) != T.at(i)){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

ll n,k;
ll a[100001];
ll s[41];
ll dp[41][2];
ll dfs(int cur,bool flag){
    if(cur<0) return 0;
    if(dp[cur][flag]!=-1) return dp[cur][flag];
    ll ret=0;
    if(flag||(k>>cur&1)){
        ret=dfs(cur-1,flag)+(1ll<<cur)*(n-s[cur]);
    }
    ret=max(ret,dfs(cur-1,flag|(k>>cur&1))+(1ll<<cur)*(s[cur]));
    return dp[cur][flag]=ret;
}
int main(){
    cin>>n>>k;
    rep(i,n){
        cin>>a[i];
        rep(j,40){
            if(a[i]>>j&1) ++s[j];
        }
    }
    memset(dp,-1,sizeof(dp));
    cout<<dfs(39,false)<<endl;
    return 0;
}

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

using ll = long long;

const int mod = 1000000007;
const int INF = 1000000000;
const double EPS = 1e-9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, R;
    cin >> N >> R;
    if (N >= 10) cout << R << endl;
    else cout << R + 100 * (10 - N) << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int n, c1, c2, c3, c4, c5;
int w[101000][2], cnt;
int main(){
	int i, a, t = 0, tp;
	scanf("%d", &n);
	for (i = 1; i <= n; i++){
		scanf("%d", &a);
		if (i != 1 && tp != a){
			cnt++;
			w[cnt][0] = tp;
			w[cnt][1] = t;
			t = 0;
		}
		tp = a;
		t++;
	}
	cnt++;
	w[cnt][0] = tp;
	w[cnt][1] = t;
	for (i = 2; i < cnt; i++){
		if (w[i - 1][0] < w[i][0]){
			if (w[i][0] < w[i + 1][0]){
				if (w[i][1] > 1)c3++;
			}
			else{
				if (w[i][1] > 1)c1++;
				else c4++;
			}
		}
		else{
			if (w[i][0] > w[i + 1][0]){
				if (w[i][1] > 1)c3++;
			}
			else{
				if (w[i][1] > 1)c2++;
				else c5++;
			}
		}
	}
	printf("%d %d %d %d %d\n", c1, c2, c3, c4, c5);
	return 0;
}


Measured memory_bytes: 1772