akhauriyash/Code-Regression huggingface dataset:
N = int(input())
a = list(map(int, input().split()))

x2 = 0
for i in range(N):
    if i%2:
        x2 -= a[i]
    else:
        x2 += a[i]
ans = [0 for i in range(N)]
ans[0] = x2/2
for i in range(N-1):
    ans[i+1] = a[i]-ans[i]
for i in range(N):
    ans[i] *= 2

for i in ans:
    print(int(i),end="")
    print(" ",end="")
print()
    

Measured memory_bytes: 14028
#include<bits/stdc++.h>
using namespace std;
using lint = long int;
#define pb push_back


lint X, K, D;
lint k, x;

int main(){
    cin >> X >> K >> D;

    lint k = abs(X) / D;
    if(k > K) x = abs(X) - D * K;
    else {
        x = abs(X) - D * k;
        k = K - k;  //残り回数
        if(k & 1) x = D - x;
    }

    cout << x << endl;
    return 0;
}


Measured memory_bytes: 3628
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
using namespace std;
typedef long long ll;

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

const long long INF = 1LL << 60;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

int main(void){
    ll a, b;

    cin >> a >> b;

    bool ok = false;
    for(int i = 0; i <= 1000000000; i++){
        if(abs(a - i) == abs(b - i)){
            cout << i << endl;
            ok = true;
            break;
        }
    }

    if(!ok){
        cout << "IMPOSSIBLE" << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void){
  int A, B;
  cin >> A >> B;

  if(A>B){
    if(A-B>=2){
      cout << A * 2 - 1 << endl;
    }else{
      cout << A + B << endl;
    }
  }else{
    if(B-A>=2){
      cout << B * 2 - 1 << endl;
    }else{
      cout << A + B << endl;
    }
  }
}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef map<ll,ll>::iterator itll;
typedef long double ld;
typedef map<ll,ll> mapll;

#define con continue
#define pb push_back
#define fi first
#define se second
#define fr front()
#define INF 1000000000000000000
#define all(vl) vl.begin(),vl.end()
#define m_p make_pair 
#define sz(a) sizeof(a)
#define forn(mp,it) for(it = mp.begin();it!=mp.end();it++)
#define FOR(i,a,n) for(ll i=a;i<n;i++) 
#define FORE(i,a,n) FOR(i,a,n+1)
#define Endl endl
#define eNdl endl
#define enDl endl
#define endL endl

int main()
{
	ll l,r,d;
	cin>>l>>r>>d;
	ll ans = 0;
	FOR(i,l,r+1)
	{
		ans+=(i%d == 0);
	}
	cout<<ans<<Endl;
	return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
   ll x,k;
   cin >> x >> k;
   x%=k;
   //cout << x << endl;
    if(x<=(k/2)){
     // cout << "OK!" << endl;
         cout << x << endl;
    }
    else{
        x=k-x;
        cout << x << endl;
    }
}

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



int N, K;
int R, S, P;
string T;

int main(){
	
	cin >> N >> K;
	cin >> R >> S >> P;
	cin >> T;
	
	int score = 0;
	for ( int i = 0; i < T.size(); i++ ){
		char c = T[i];
		if ( K <= i && T[i] == T[i-K] ){
			score += 0;
			T[i] = 'x';
		}
		else if ( c == 'r' )
			score += P;
		else if ( c == 's' )
			score += R;
		else if ( c == 'p' )
			score += S;
	}
	
	cout << score << endl;
	
	return 0;
}



Measured memory_bytes: 512
import math

def main():
    num, hp = map(int, input().split())
    data = [list(map(int, input().split())) for i in range(num)]
    data_a = [data[i][0] for i in range(num)]
    data_b = [data[i][1] for i in range(num)]
    data_a.sort(reverse=True)
    data_b.sort(reverse=True)
    count = 0
    huru = data_a[0]
    nageru_ind = 0
    while hp > 0:
        if nageru_ind == num:
            count += math.ceil(hp / huru)
            break
        elif huru > data_b[nageru_ind]:
            count += math.ceil(hp / huru)
            break
        else:
            hp -= data_b[nageru_ind]
            nageru_ind += 1
        count += 1


    print(count)


if __name__ == '__main__':
    main()

Measured memory_bytes: 68888
#include<cstdio>
#include<vector>
using namespace std;
int root,index,n,m,ans;
int num[55],low[55];
vector<int> ve[55];
void dfs(int cur,int father)
{
    index++;
    num[cur]=index;
    low[cur]=index;
    for(int i=0;i<ve[cur].size();i++){
        int qq=ve[cur][i];
        if(num[qq]==0){
            dfs(qq,cur);
            low[cur]=min(low[qq],low[cur]);
            if(low[qq]>num[cur]){
                ans++;
            }
        }
        else if(qq!=father){
            low[cur]=min(low[cur],num[qq]);
        }
    }
}
int main()
{
    while(scanf("%d%d",&n,&m)!=EOF){
        for(int i=0;i<=n;i++) ve[i].clear();
        for(int i=0;i<m;i++){
            int a,b;
            scanf("%d%d",&a,&b);
            ve[a].push_back(b);
            ve[b].push_back(a);
        }
        root=1;
        ans=index=0;
        dfs(1,root);
        printf("%d\n",ans);
    }
    return 0;
}


Measured memory_bytes: 256
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A3 = list(map(int, input().split()))
N = int(input())

B = []
for _ in range(N):
  B.append(int(input()))

import numpy as np
A = np.array([A1, A2, A3])

bingo = np.zeros((3, 3), dtype=bool)
for b in B:
  bingo += (A == b)

if bingo.all(axis=0).any() or \
   bingo.all(axis=1).any() or \
   np.diag(bingo).all() or \
   np.diag(np.fliplr(bingo)).all():
  print('Yes')
else:
  print('No')

Measured memory_bytes: 12924
/*Author - Shubham Gupta (@shubham107)*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<ll> vl;      typedef vector<int> vi;
typedef vector<vl> vvl;     typedef vector<vi> vvi;
typedef pair<ll, ll> pll;   typedef pair<int, int> pii;
#define forn(i,n) for(int i=0;i<n;i++)
#define rforn(i,n) for(int i=n-1;i>=0;i--)
#define forne(i,n) for(int i=1;i<=n;i++)
#define forse(i,s,e) for(int i=s;i<e;i++)
#define rforse(i,s,e) for(int i=e-1;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define MOD 1000000007
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define INF ll(1e18)
#ifdef SHUBHAM107
#include "../trace.h"
#else
#define trace(args...)
#endif
void solve() {
    int a;
    cin >> a;
    cout << (a + a * a + a * a * a);
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifdef SHUBHAM107
    freopen("inp.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("err.txt", "w", stderr);
#endif
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#include <boost/multiprecision/cpp_int.hpp> 
using boost::multiprecision::cpp_int; 
 
#define ff              first
#define ss              second
// #define ll 				long long int
#define dd             double
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define modp            998244353
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
#define FIO           	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl 			'\n'
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
// void aks()
// {
// #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// #endif
// }


void solve()
{
	int n; cin >> n;
	cpp_int a[n];cpp_int res = 1;
	for(int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	sort(a, a+n);
	for(int i = 0; i < n; i++)
	{
		cin >> a[i];
		res = res*a[i];
		if(res > 1000000000000000000)
		{
			cout << -1 << endl;
			return;
		}
	}
	cout << res << endl;

}
 
int32_t main()
{
	FIO
    //aks();
    //w(t)
    {
    	solve();
    }
    return 0;
}
	

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

int main(){

    int n,m;
    int ans=0;

    cin>>n;
    vector<string> s(n);
    for(int i=0;i<n;i++) cin>>s.at(i);

    cin>>m;
    vector<string> t(m);
    for(int i=0;i<m;i++) cin>>t.at(i);

    vector<int> cnt(n);

    for(int i=0;i<n;i++){
        
        for(int j=0;j<n;j++){

            if(s.at(i)==s.at(j)) cnt.at(i)++;

        }

    }

    for(int i=0;i<n;i++){

        for(int j=0;j<m;j++){

            if(s.at(i)==t.at(j)) cnt.at(i)--;

        }

    }

    for(int i=0;i<n;i++){

        ans=max(ans,cnt.at(i));

    }

    cout<<ans<<endl;










    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
 
using namespace std;
#define PB push_back
#define MP make_pair
#define REP(i,n) for(int i=0;i<(n);i++)
#define ll long long
int main()
{
    int n;
    cin>>n;
    cout<<n*n*n<<endl;
}

Measured memory_bytes: 256
from sys import stdin,stdout
import math
from collections import deque,defaultdict
from math import ceil,floor,inf,sqrt,factorial,gcd,log2
from copy import deepcopy
ii1=lambda:int(stdin.readline().strip())
is1=lambda:stdin.readline().strip()
iia=lambda:list(map(int,stdin.readline().strip().split()))
isa=lambda:stdin.readline().strip().split()
mod=1000000007
# ani,total = iia()
# if ani==1:
#     print('No')
# elif total % 2==0:
#     if 2<=(4*ani-total)<=(2*ani-2):
#         print('Yes')
#     else:
#         print('No')
# else:
#     print('No')
x,n=iia()
if n==0:
    print(x)
elif x<=0:
    print(x)
else:
    arr=iia()
    arr.sort()
    dp = [-1,0]
    res=inf
    for i in range(1,101):
        if i not in arr:
            dp.append(i)
    dp.append(101)
    dp.append(102)
    for j in dp:
        if abs(j-x)<res:
            ans = j
            res=abs(j-x)
    print(ans)


Measured memory_bytes: 9576
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=a;i<b;i++)
#define each(it,v) for(auto it : v)
#define mod 1000000007
#define all(v) (v).begin(),(v).end()
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vv vector<vector<int>>
using namespace std;

int n;

main()
{
    cin>>n;
    if(n%2==1)
    {
        cout<<"No"<<endl;
        return 0;
    }

    string s;
    cin>>s;

    if(s.substr(0,n/2)==s.substr(n/2,n/2))
    {
        cout<<"Yes"<<endl;
    }else
    {
        cout<<"No"<<endl;
    }

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    ll A[n + 1], B[n + 1];
    for(int i = 0; i < n; i++) cin >> A[i], B[i] = A[i];
    sort(A, A + n);
    for(int i = 0; i < n; i++)
    {
        if(B[i] <= A[n / 2 - 1]) cout << A[n / 2] << endl;
        else cout << A[n / 2 - 1] << endl;
    }
    return 0;
}



Measured memory_bytes: 5376
#include <iostream>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,b) FOR(i,0,b)
#define INF 1e9

struct problem{
  int d;
  int v;
};

void solve(int N, int M){
  int max_d_prob[M],max_sum_v = 0;
  fill(max_d_prob,max_d_prob+M,0);
  struct problem prob[N];

  REP(i,N){
    cin>>prob[i].d>>prob[i].v;
    max_d_prob[prob[i].d-1] = max(max_d_prob[prob[i].d-1],prob[i].v);
  }

  REP(i,M) max_sum_v += max_d_prob[i]; //cout<<max_d_prob[i]<<" ";

  cout<<max_sum_v<<endl;
}

int main(){
  int N,M;

  while(1){
    cin>>N>>M;
    if(N == 0 && M == 0) break;
    solve(N,M);
  }

  return 0;
}


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

/* short names and const
using ll = long long;
using vll = vector<long long>;
using df = vector<vector<long long>>;
df data(n, vector<long long>(m));
const int MOD = 1e9 + 7;
const long long INF = 1e18;
*/

/* Boost!
#include <boost/algorithm/string/classification.hpp> // is_any_of
#include <boost/algorithm/string/split.hpp>
using boost::algorithm::split; // split(result, s, boost::is_any_of(","));
#include <boost/algorithm/string/join.hpp>
using boost::algorithm::join; // string s = join(arr, "");
#include <boost/algorithm/string/replace.hpp>
using boost::algorithm::replace_all; // replace_all(s, "AtCoder", "A");
#include <boost/range/algorithm.hpp> // boost::sort(arr)
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;
*/

/* print(arr)
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << " ";
  }
  cout << endl;
}
*/

/* fast cin and precise cout
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  getline(cin, s);
  cout << fixed << setprecision(15);
*/

/* sum function
int sum(vector<int> &arr) {
  int res = accumulate(arr.begin(), arr.end(), 0);
  return res;
}
*/

int main() {
  string s;
  cin >> s;
  cout << (s <= "2019/04/30" ? "Heisei": "TBD") << endl;
}


Measured memory_bytes: 256
s = gets.chomp
n = s.length
as = Array.new(n+1, 0)

n.times do |i|
  as[i + 1] = as[i] + 1 if s[i] == "<"
end

(n - 1).downto(0) do |i|
  as[i] = as[i + 1] + 1 if as[i] <= as[i + 1] && s[i] == ">"
end

puts as.inject(:+)


Measured memory_bytes: 6788
S=int(input())

A=int(S/100)
B=int(S%100)

if 1<=A and A<=12:
    if 1<=B and B<=12:
        print('AMBIGUOUS')
    else :
        print('MMYY')
else :
    if 1<=B and B<=12:
        print('YYMM')
    elif B>=13:
        print('NA')
    elif B==0:
        print('NA')

Measured memory_bytes: 3060
#include <stdio.h>
#include <string>
#include <iostream>
#include <cmath>
using namespace std;
int main() {
  string a, b;  cin>>a>>b;
  int v; sscanf((a+b).c_str(), "%d", &v);
  int c = (int)sqrt(v);
  puts(c*c == v	? "Yes"	: "No");
  return 0;
}


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

#define int long long
#define double long double

const int INF = 9223372036854775807;

struct line{
    int a, b;
};

vector< line > convexHull;

double intersect(line a, line b){
    if(a.a == b.a) return -INF;
    return ((double)(b.b-a.b)/(double)(a.a-b.a));
}

int query(int x){
    int l = 0;
    int r = convexHull.size()-1;

    if(convexHull.empty()) return INF;

    while(l < r){
        int mid = (l+r)/2;

        int tmp = convexHull[mid].b+convexHull[mid].a*x;
        int tmp1 = convexHull[mid+1].b+convexHull[mid+1].a*x;

        if(tmp < tmp1){
            r = mid;
        }else{
            l = mid+1;
        }

    }

    return convexHull[l].b+convexHull[l].a*x;
}

void add(int a, int b){
    line c;
    c.a = a;
    c.b = b;

    while(convexHull.size() >= 2 && intersect(convexHull[convexHull.size()-2], c) <= intersect(convexHull[convexHull.size()-2], convexHull.back())){
        if(intersect(convexHull[convexHull.size()-2], c) == -INF) convexHull.erase(convexHull.end()-2);
        else convexHull.pop_back();
    }

    convexHull.push_back(c);
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, c;
    cin >> n >> c;
    vector<int> v(n);
    for(int i = 0; i < n; i++){
        cin >> v[i];
    }

    int ans = 0;

    add(-2*v[0],v[0]*v[0]);

    for(int i = 1; i < n; i++){

        ans = c+v[i]*v[i]+query(v[i]);

        add(-2*v[i], ans+v[i]*v[i]);

    }

    cout << ans << endl;

}


Measured memory_bytes: 7792
#include<bits/stdc++.h>
#include <cstring>
using namespace std;
long long a,b,c,n,ans,d[3][1100000];
// string s,s1,s2,s3;
// vector<int> v[100000],v1;
// deque<int> dq;
// map<int,int> mp,mp1,mp2;
// bool o[100000];                                                               
// stack<long long> st;
// char h;
// long double ld;
int main(){
    cin>>a>>b;
    if(2*b<a){
        cout<<a-2*b;
    } else cout<<0;
}


Measured memory_bytes: 256
while True:
    a,op,b=input().split()
    a=int(a)
    b=int(b)

    if op=="?":
        break
    if op=="+":
        print(a+b)
    if op=="-":
        print(a-b)
    if op=="*":
        print(a*b)
    if op=="/":
        print(a//b)



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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int maxn = 210000;
const int mod = 998244353;
ll power(ll a, ll b)
{
    ll ans = 1 % mod;
    while (b > 0)
    {
        if (b & 1)
        {
            ans = ans * a % mod;
        }
        a = a * a % mod;
        b >>= 1;
    }
    return ans;
}
ll fact[maxn], inv[maxn];
ll C(ll n, ll k)
{
    return ((((fact[n] * inv[k]) % mod) * inv[n - k]) % mod);
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    int n, m, k;
    cin >> n >> m >> k;
    fact[0] = inv[0] = 1;
    for (int i = 1; i <= n; ++i)
    {
        fact[i] = (fact[i - 1] * i) % mod;
        inv[i] = power(fact[i], mod - 2);
    }
    ll ans = 0;
    for (int i = 0; i <= k; i++)
    {
        ll cnt = 1LL * m * C(n - 1, i) % mod * power(m - 1, n - 1 - i) % mod;
        ans = (ans + cnt) % mod;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 6732
import scala.io.StdIn

case class Expr(l:Int, op: String, r:Int)

object Main {
  def calc(str:String):Option[Int] = {
    if(str.trim.isEmpty == false){
      val inputs = str.split(" ")
      Expr(inputs(0).toInt, inputs(1), inputs(2).toInt) match {
        case Expr(l, "+", r) => Some(l + r)
        case Expr(l, "-", r) => Some(l - r)
        case Expr(l, "*", r) => Some(l * r)
        case Expr(l, "/", r) => Some(l / r)
        case _ => None
      }
    }else{
      None
    }
  }

  def main(args: Array[String]): Unit = {
    Iterator.continually(StdIn.readLine()).takeWhile(_ != null).foreach{
      line =>
        calc(line).foreach(println _)
    }
  }
}

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


int main() {

    string s;
    
    cin >> s;

    auto isTrue = [&](int index) {
        switch(s[index]) {
            case 'A':
            case 'C':
            case 'G':
            case 'T':
                return true;
            defalut :
                return false;
        }
        return false;
    };


    int ans = 0;
    for(int i = 0; i < s.size(); ++i) {
        int count = 0;
        for(int j = i; j < s.size(); ++j) {
            
            if(isTrue(j)) {
                count++;
            }
            else {
                break;
            }

        }
        ans = max(count, ans);

    }

    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder_3
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] n = new int[6];
            for (int i = 0; i < 6; i++)
            {
                n[i] = int.Parse(Console.ReadLine());
            }
            int g;
            string hantei = "Yay!";
            for (int j = 0; j <= 3; j++)
            {
                for (int k = j + 1; k <= 4; k++)
                {
                    g = n[k] - n[j];
                    if (g > n[5])
                    {
                        hantei = ":(";
                    }
                }
                if (hantei == ":(") break;
            }
            Console.WriteLine(hantei);
        }
    }
}


Measured memory_bytes: 11092
#include<iostream>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
  int N,K;
  cin >> N >> K;
  string S;
  cin >> S;
  if(S[K-1] == 'A') S[K-1] = 'a';
    else if (S[K-1] == 'B') S[K-1] = 'b';
    else if (S[K-1] == 'C') S[K-1] = 'c';
    
cout << S << endl;
  

}




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

int main() {
  int N, D, X, a, s;
  cin >> N;
  cin >> D >> X;
  s = 0;
  for (int i=0;i<N;i++){
    cin >> a;
    for (int j=1;j < D+1;j=j+a)s++;
  }   
  cout << s+X << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define INF 0x7FFFFFFF
#define mod 1000000007
typedef long long ll;
////////////////////////////////////////////////////////////

template<class X> void is_prime( X n  , X m){
	if( n == 1 )
		cout << m << endl;
	else if( m % n == 0 ){
		cout << m / n << endl;
	}
	else{
		ll M = 0;
		int i = 2;	
		//ll lim = sqrt(m)+1;
		while( i * n <= m /*&& i < lim*/ ){
			if( m % i == 0){
				M = i;
			}
			i++;
		}
		if( M )
			cout << M << endl;
		else{
			if( m % 2 ){
				cout << 1 << endl;
			}
			else{
				if( m / n >= 2 ) 
					cout << 2 << endl;
				else
					cout << 1 << endl;
			}
		}
	}
}

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

	is_prime( n , m );
	

	


	ret 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+10;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=100010;
const ll mod=1e9+7;

int main(){
  int n,m; cin >> n;
  vector<int> a(n+1,0),b(n+1,0);
  for(int i=1; i<=n; i++){ cin >> a[i]; }
  for(int i=n; i>0; i--){
    if(i>n/2){ b[i]=a[i]; continue; }
    for(int cnt=i*2; cnt<=n; cnt+=i){ b[i] += b[cnt]; }
    b[i] = (b[i]+a[i])%2;
  }
  int ans=accumulate(b.begin(), b.end(), 0);
  cout << ans << endl; 
  rep(i,n+1){ if(b[i]){ cout << i << endl; } }
  return 0;
}


Measured memory_bytes: 2432
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define reps(i,x) for(ll i=1;i<=(ll)(x);i++)
#define rrep(i,x) for(ll i=((ll)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(ll)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
using namespace std;
ll p[10];
int main() {
    ll n;
    cin >> n;
    rep(i, n)
        cin >> p[i];
    sort(p, p+n);
    ll ans = 0;
    rep(i, n -1)
        ans += p[i];
    cout << ans + p[n-1]/2 << endl;
}



Measured memory_bytes: 256
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;

// 解説AC...
namespace AtCoder {
    class Practice {
        static void Main() => CustomMain();

        static void Solve() {
            var n = ReadInt();
            var a = ReadIntArray();

            var ans = 0;
            for (int i = 1; i < n; i++) {
                if (a[i - 1] == a[i]) {
                    a[i] = 10001;
                    ans++;
                }
            }

            WriteAnswer(ans);
        }

        static void CustomMain() {
#if DEBUG
            // ファイルからテストケースを読み込む
            global::Common.ChangeStdIn();
            // 時間計測
            var stopwatch = new Stopwatch();
            stopwatch.Start();
#endif
            // 出力高速化
            var streamWriter = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
            Console.SetOut(streamWriter);
            // 回答
            Solve();
#if DEBUG
            stopwatch.Stop();
            Console.WriteLine(stopwatch.Elapsed);
#endif
            Console.Out.Flush();
        }

        static string ReadString() => Console.ReadLine().Trim();
        static int ReadInt() => int.Parse(ReadString());
        static long ReadLong() => long.Parse(ReadString());
        static float ReadFloat() => float.Parse(ReadString());
        static double ReadDouble => double.Parse(ReadString());

        static string[] ReadStringArray() => ReadString().Split(' ');
        static int[] ReadIntArray() => Array.ConvertAll(ReadString().Split(' '), int.Parse);
        static long[] ReadLongArray() => Array.ConvertAll(ReadString().Split(' '), long.Parse);
        static float[] ReadFloatArray() => Array.ConvertAll(ReadString().Split(' '), float.Parse);
        static double[] ReadDoubleArray() => Array.ConvertAll(ReadString().Split(' '), double.Parse);

        static T TypeConversion<T>(string s) {
            if (typeof(T) == typeof(int)) {
                return (T) Convert.ChangeType(int.Parse(s), typeof(T));
            } else if (typeof(T) == typeof(long)) {
                return (T) Convert.ChangeType(long.Parse(s), typeof(T));
            } else if (typeof(T) == typeof(double)) {
                return (T) Convert.ChangeType(double.Parse(s), typeof(T));
            } else {
                return (T) Convert.ChangeType(s, typeof(T));
            }
        }

        static void ReadMulti<T, U>(out T a, out U b) {
            var str = ReadStringArray();
            a = TypeConversion<T>(str[0]);
            b = TypeConversion<U>(str[1]);
        }

        static void ReadMulti<T, U, V>(out T a, out U b, out V c) {
            var str = ReadStringArray();
            a = TypeConversion<T>(str[0]);
            b = TypeConversion<U>(str[1]);
            c = TypeConversion<V>(str[2]);
        }

        static void WriteAnswer(object ans) => Console.WriteLine(ans);

        static bool IsOdd(long num) {
            return (num & 1) == 1;
        }

        static bool IsEven(long num) {
            return (num & 1) == 0;
        }

        static long GCD(long a, long b) {
            return b != 0 ? GCD(b, a % b) : a;
        }
    }
}

Measured memory_bytes: 13140
import java.lang.reflect.Array;
import java.util.*;
import java.io.*;

public class Main {
    static boolean check(int a,int b,int mid){
        if(a <= mid && b <= mid || a > mid && b > mid)return true;
        return false;
    }
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int array[] = new int[2 * n + 1];
        StringTokenizer st = new StringTokenizer(br.readLine());
        for (int i = 1; i < 2 * n; i++)
            array[i] = Integer.parseInt(st.nextToken());
        array[0] = array[2 * n] = -1;
        int infinity = (int) 1E9 + 5;
        int low = 1;
        int high = 2 * n;
        TreeSet<Integer> zero;
        TreeSet<Integer> ones;
        while (low < high) {
            int mid = (low + high) / 2;
            int temp = -1;
            zero = new TreeSet<>();
            ones = new TreeSet<>();
            ones.add(infinity);
            ones.add(-infinity);
            zero.add(infinity);
            zero.add(-infinity);
            for (int i = 1; i < 2 * n; i++) {
                if (check(array[i],array[i - 1],mid) && i != 1) {
                    //System.out.println(array[i] + " " + mid + " " + i);
                    if (array[i] > mid) ones.add(i);
                    else zero.add(i);
                }
                if (check(array[i],array[i + 1],mid) && i != 2*n - 1) {
                    //System.out.println(array[i] + " " + mid + " " + i);
                    if (array[i] > mid) ones.add(i);
                    else zero.add(i);
                }
            }
            if (zero.size() == 2 && ones.size() == 2) {
                if ((n - 1) % 2 == 0) temp = (array[n] > mid) ? 1 : 0;
                else temp = (array[n] > mid) ? 0 : 1;
            } else {
                int beforezero = zero.floor(n);
                int afterzero = zero.ceiling(n);
                int beforeone = ones.floor(n);
                int afterone = ones.ceiling(n);
                int beforemax = Math.max(beforeone, beforezero);
                int aftermin = Math.min(afterone, afterzero);
                int min = Math.min(aftermin - n, n - beforemax);
                //System.out.println("1 " + aftermin + " " + beforemax + " " + min + " " + beforezero + " " + afterzero + " " + beforeone + " " + afterone);
                if (min == aftermin - n) {
                    if (afterone < afterzero) temp = 1;
                    else temp = 0;
                }
                if (min == n - beforemax) {
                    if (beforeone < beforezero) temp = 0;
                    else temp = 1;
                }
            }
            //System.out.println(mid + " " + low + " " + high + " " + zero + " " + ones + " " + temp);
            if (temp == 1) low = mid + 1;
            else high = mid;
        }
        System.out.println(low);
    }
}

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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    ll A,B,K;
    Scll3(A,B,K);

    printf ("%lld %lld\n", max(0ll,A-K), max(0ll,B-max(K-A,0ll)) );

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
using vd= vector<double>;
using vc= vector<char>;
#define REP(i,x,n) for(int i=x; i<n; i++)
#define rep(i,n) REP(i,0,n)
#define all(x) x.begin(), x.end()

int main(){
  int n;
  ll ans=0;
  cin >> n;

  REP(i,0,n){
    ans+= i;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define f first
#define s second
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
/*bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
} */
int main()
{
     ll n;
     cin>>n;
     cout<<(n)*(n-1)/2<<endl;

}


Measured memory_bytes: 3612
#include <iostream>

using namespace std;

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

    int a;
    int target = 1, count = 0;
    for (int i = 0; i < N; i++) {
        cin >> a;
        if (a == target) target++;
        else count++;
    }
    if (target == 1) count = -1;

    cout << count << endl;
}

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

using ll = long long;
using P = pair<int, int>;
using PP = pair<int, P>;
#define rep1(i,n) for (int i=1; i<=n; i++)
#define rep0(i,n) for (int i=0; i<n; i++)
#define chmin(a,b) if ((a)>(b)) { a=(b); }
#define chmax(a,b) if ((a)<(b)) { a=(b); }
#ifdef _DEBUG
string _format(string args) { string r = "", t; istringstream s(args); while (getline(s, t, ',')) r += t+":%d "; return r + "\n"; }
#define debug(...) printf(_format(#__VA_ARGS__).c_str(), __VA_ARGS__);
#else
#define debug(...) 
#endif

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

//[mint]
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
  mint p(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[n-k];
  }
};

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

    // ( mPn ) ^ 2 : すべての組み合わせ
    // - sigma k=1 to n : k個の要素が一致する場合の数 : Mからk個選び、それをNの中にk個並べる、残りm-kからn-k個選んで並べる
    combination c(m);

    mint ans = c(m,n)*c.fact[n];
    ans *= ans;
    rep1(k,n) {
        mint combi = c(m,k) * c.p(n,k) * c.p(m-k,n-k) * c.p(m-k,n-k);
        if (k&1) ans-=combi; else ans+=combi;
    }

    cout << ans << endl;
}


Measured memory_bytes: 11100
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
typedef pair<int, int> P;
string G[51];
int H, W;
int d[51][51];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int bfs() {
    queue<P> que;

    rep(i, H) rep(j, W) d[i][j] = INF;
    que.push(P(0, 0));
    d[0][0] = 0;

    while(que.size()) {
        P p = que.front(); que.pop();
        if (p.first == H - 1 && p.second == W - 1) break;
        rep(i, 4) {
            int xx = p.first + dx[i], yy = p.second + dy[i];
            if (xx < 0 || xx >= H || yy < 0 || yy >= W || G[xx][yy] == '#' || d[xx][yy] != INF) continue;
            que.push(P(xx, yy));
            d[xx][yy] = d[p.first][p.second] + 1;
        }
    }
    return d[H - 1][W - 1];
}

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> H >> W;
    rep(i, H) cin >> G[i];
    int d = bfs();
    if (d == INF) {
        cout << -1 << endl;
        return 0;
    }
    int ans = H * W - d - 1;
    rep(i, H) rep(j, W) if (G[i][j] == '#') ans--;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
# include <bits/stdc++.h>
# define sz(x) (int)((x).size())
# define f first 
# define s second
# define pb push_back
# define ub upper_bound
# define lb lower_bound
# define all(x) x.begin(), x.end()
# define pqueue priority_queue
# define Speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
# define rep(i,n) for(int i=0;i<n;++i)
# define forn(i,n) for(int i=1;i<=n;++i)

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

# define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
# define debug cerr<<"ERROR"<<endl
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

template<class T> void umin(T &a,T b){a=min(a,b);}
template<class T> void umax(T &a,T b){a=max(a,b);}

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

const int dx[]={1,0,-1,0,-1,-1,1,1};
const int dy[]={0,1,0,-1,-1,1,-1,1}; 
const int inf=1e9,mod=1e9+7,N=2e5+5;

void solve(){
	int n;
	cin>>n;
	int x[n],y[n];
	for(int i=0;i<n;++i){
		cin>>x[i]>>y[i];
	}
	int cnt=0,ans=0;
	for(int i=0;i<n;++i){
		if(x[i]==y[i]){
			cnt++;
			umax(ans,cnt);
		}
		else cnt=0;
	}
	cout<<(ans>2?"Yes":"No");
}

int main(){
 	Speed();
	int T=1; 
	//cin>>T;	
	while(T--)solve();
}

Measured memory_bytes: 3640
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

int correct(int N) {
    int ans = 0;
    for(int i = 2; i <= N; i++) {
        int num = N;
        if (num % i == 0) {
            while(num % i == 0) num /= i;
            if (num % i == 1) {
                ans++;
                //cout << i << endl;
            }
        }
        else if (num % i == 1) {
            ans++;
            //cout << i << endl;
        }
    }
    return ans;
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int ans = 2;
    if (N == 2) ans--;
    for(int i = 2; i * i <= N; i++) {
        int num = N;
        if (num % i == 0) {
            while(num % i == 0) num /= i;
            if (num % i == 1) {
                ans++;
                //cout << i << endl;
            }
        }
        else if (num % i == 1) {
            if((N - 1) / i == i) ans++;
            else ans += 2;
        }
        //cout << "*" << i << " " << ans << endl;
        
        //if ((N - 1) % i == 0) ans++;
    }
    cout << ans << endl;


    return 0;
}


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

int n;
int d[101];
bool a[101][101];
const int INF = (1<<21);

void bfs(int s)
{
    queue<int> q;
    q.push(s);
    for(int i=0; i<n; i++) d[i] = INF;
    d[s] = 0;
    
    int u;
    while(!q.empty())
    {
        int u = q.front();
        q.pop();
        for(int v=0; v<n; v++)
        {
            if(a[u][v] && d[v] == INF)
            {
                d[v] = d[u] + 1;
                q.push(v);
            }
        }
    }
}


int main() {
    ios::sync_with_stdio(false);
    cin >> n;
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<n; j++)
        {
            a[i][j] = false;
        }
    }

    for(int i=0; i<n; i++)
    {
        int u, k;
        cin >> u >> k;
        for(int j=0; j<k; j++)
        {
            int v;
            cin >> v;
            a[u-1][v-1] = true;
        }
    }
    
    bfs(0);

    for(int i=0; i<n; i++)
    {
        cout << i+1 << " " << ((d[i] == INF) ? (-1) : d[i]) << endl;
    }
    return 0;
}

Measured memory_bytes: 3172
#include<stdio.h>
#define INFTY 1000000001
#define N 500000
 
void merge(int *, int ,int ,int);
void mergeSort(int *, int, int);
 
int n,count=0;
 
int main(){
  int A[N],i;
  scanf("%d",&n);
  for(i=0 ; i<n ; i++){
    /*if(A[i]<=INFTY && A[i]>=0) */
scanf("%d",&A[i]);
  }
  mergeSort(A,0,n);
   
  for(i=0 ; i<n ; i++){
    if(i<n-1)
      printf("%d ",A[i]);
    else
      printf("%d\n",A[i]);
  }
  printf("%d\n",count);
  return 0;
}
 
void merge(int *A,int left, int mid, int right){
  int n1 = mid - left;
  int n2 = right - mid;
  int L[n1];
  int R[n2];
  int i,j,k;
  for (i = 0 ; i< n1 ; i++){
    L[i] = A[left + i];
  }
  for (i = 0 ; i<n2 ; i++){
    R[i] = A[mid + i];
  }
  L[n1] = INFTY;
  R[n2] = INFTY;
  i = 0;
  j = 0;
  for(k=left; k < right ; k++){
    if (L[i] <= R[j]){
      A[k] = L[i];
      i=i+1;
    }
    else{
      A[k] = R[j];
      j=j+1;
    }
    count++;
  }
}
 
void mergeSort(int *A, int left, int right){
  int mid;
  if (left+1 < right){
    mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}


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

#define ll long long

ll L[100];

void init()
{
    L[0]=2;
    L[1]=1;
    for(int i=2;i<=90;i++)
        L[i]=L[i-1]+L[i-2];
}

int main()
{
    init();
    int n;
    cin>>n;
    cout<<L[n];
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <numeric>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

using namespace std;

int main(void){
  int n,m;
  cin >> n>>m;
  if (m%n ==0) {cout << m/n;return 0;}
  if (m/n == 1) {cout << 1; return 0;}
  int k = m/n;
  int l = m%n;
  int a = 1;
  while (true) {
    if ((n*a+l)%(k-a)==0)break;
    a++;
  }
  cout << k-a;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;
    Func cin2;
    void calc()
    {
        cin = new Scanner();
        cin2 = new Func();
        int N=cin.nextInt();
        double[] a=cin.ArrayDouble(N,0);
        double ans=0;
        for(int i=0;i<N;i++)ans+=(1/a[i]);
        ans=(1/ans);
        Console.WriteLine(ans);
        
    }
}



class Scanner
{
    string[] s;
    int i;

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

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

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

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

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

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


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Answer
{
    public void Int2DArrayAns(int[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
    public void Char2DArrayAns(char[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
}

class Func
{
    public long GCDLong(long a, long b)
    {
        while(a!=0)
        {
          long t=a;
          a=b%a;
          b= t;
        }
      
        return b;        
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001


int main(){
//    隣接リスト入力
//    verify用 judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_12_C&lang=jp
    int V; cin >> V;
    struct edge {
        int to, cost;
    };
    vector<vector<edge>> T(V);
    priority_queue<PII, vector<PII>, greater<PII>> Q;
    vector<int> d(V, INF);

    for(int i=0; i<V; i++){
        int from; cin >> from;
        int k; cin >> k;
        T[i].resize(k);
        for(int j=0; j<k; j++)
            cin>> T[i][j].to >> T[i][j].cost;
    }

    Q.push(PII(0, 0));


//  辺が与えられた場合
//  verify用 judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_A&lang=jp
//    int V, E, S; cin >> V >> E >> S;
//    struct edge {
//        int to, cost;
//    };
//    vector<vector<edge>> T(V);
//    priority_queue<PII, vector<PII>, greater<PII>> Q;
//    vector<int> d(V, INF);
//
//    for(int i=0; i<E; i++){
//        int from, to, cost; cin >> from >> to >> cost;
//        edge e;
//        e.to = to;
//        e.cost = cost;
//        T[from].push_back(e);
//    }
//    Q.push(PII(0, S));

    while(!Q.empty()){
        
        PII p = Q.top();
        int from = p.second;
        int cost = p.first;
        Q.pop();
        
        if(cost > d[from]) continue;
        d[from] = cost;
        for(int i=0; i<T[from].size(); i++){
            edge e = T[from][i];
            if(d[e.to] > d[from] + e.cost){
                Q.push(PII(d[from] + e.cost, e.to));
            }
        }
    }

    for(int i=0; i<V; i++){
        cout << i << " ";
        if(d[i]==INF){
            cout << "INF" << endl;
        }else{
             cout << d[i] << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 10880