akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int long long

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

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(v) (v).begin(), (v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

struct comb {
    vvi v_set;

    void recursive_comb(int s, int rest, vi v) {
        if (rest == 0) {
            v_set.emplace_back(v);
        } else {
            if (s < 0) return;
            recursive_comb(s - 1, rest, v);
            v[rest - 1] = s;
            recursive_comb(s - 1, rest - 1, v);
        }
    }

    // nCkの組み合わせに対して処理を実行する
    void foreach_comb(int n, int k) {
        vi v(k);
        recursive_comb(n - 1, k, v);
    }

    vvi c(int n, int k) {
        v_set.clear();
        foreach_comb(n, k);
        return this->v_set;
    }
};

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

    int n, k;
    cin >> n >> k;

    vi a(n);
    REP(i, n) cin >> a[i];
    
    vvi v = comb().c(n-1, n-k);
    ll ans = -1;
    for (vi vec : v) {
        vector<bool> use(n, true);
        for (int n : vec) use[n+1] = false;
        int tmp = 0;
        ll pre;
        REP(i, n) {
            if (i == 0) pre = a[i];
            else {
                if (use[i]) {
                    int dif = max(pre - a[i] + 1, 0LL);
                    tmp += dif;
                    if (dif == 0) pre = a[i];
                    else pre++;
                }else {
                    pre = max(pre, a[i]);
                }
            }
        }

        if (ans == -1) ans = tmp;
        ans = min(ans, tmp);

    }

    cout << ans << endl;

    return 0;
}


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

int main(void){
    deque<char> S;
    int q, t, f, l;
    char c;
    bool dir = true;
    while((c = cin.get()) != '\n'){
        S.push_back(c);
    }
    cin >> q;

    for(int i = 0; i < q; ++i){
        cin >> t;
        if(t == 1) dir = !dir;
        else if(t == 2){
            cin >> f >> c;
            if(((f == 1) && (dir)) || ((f == 2) && (!dir))) S.push_front(c);
            else if(((f == 2) && (dir)) || ((f == 1) && (!dir))) S.push_back(c);
        }
    }
    if(!dir) reverse(S.begin(), S.end());
    l = S.size();
    for(int i = 0; i < l; i++){
        cout << S[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 896
input()
A=tuple(map(int,input().split()))
B=tuple(map(int,input().split()))

def solve(A,B):
    if sum(A)<sum(B):
        return -1
    ans=0
    s=0
    L=[]
    for a,b in zip(A,B):
        d=a-b
        if d<0:
            ans+=1
            s-=d
        else:
            L.append(d)
    if ans==0:
        return 0
    L.sort()
    t=0
    while t<s:
        t+=L.pop()
        ans+=1
    return ans

print(solve(A,B))

Measured memory_bytes: 18884
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

public class Main {
    static int cnt;

    static void insertionSort(int[] A, int n, int g) {
        for (int i = g; i < n; i++) {
            int v = A[i];
            int j = i - g;
            while (j >= 0 && A[j] > v) {
                A[j + g] = A[j];
                j -= g;
                cnt++;
            }
            A[j + g] = v;
        }
    }

    static void shellSort(int[] A, int n) {
        // Make G array
        List<Integer> G = new ArrayList<>();
        int h = 1;
        while (h <= n) {
            G.add(h);
            h = 3 * h + 1;
        }

        Collections.reverse(G);

        System.out.println(G.size());
        System.out.println(G.stream().map(String::valueOf).collect(Collectors.joining(" ")));

        G.forEach(g -> insertionSort(A, n, g));
    }

    public static void main(String[] args) {
        try (BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {
            cnt = 0;
            int n = Integer.parseInt(in.readLine());
            int[] A = new int[n];
            for (int i = 0; i < n; i++) {
                A[i] = Integer.parseInt(in.readLine());
            }

            shellSort(A, n);

            System.out.println(cnt);
            for (int i = 0; i < n; i++) {
                System.out.println(A[i]);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}


Measured memory_bytes: 109396
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

namespace mod {

	ll MOD = 1000000007;

	//x+y
	ll add(ll x, ll y) {
		return (x + y) % MOD;
	}

	//x-y
	ll sub(ll x, ll y) {
		return (x + MOD - (y % MOD)) % MOD;
	}

	//x*y
	ll mul(ll x, ll y) {
		return ((x % MOD) * (y % MOD)) % MOD;
	}

	//x^y
	ll power(ll x, ll y) {
		if (y == 0) {
			return 1;
		}
		else if (y == 1) {
			return x % MOD;
		}
		else if (y % 2 == 0) {
			ll pow = power(x, y / 2);
			return (pow * pow) % MOD;
		}
		else {
			ll pow = power(x, y / 2);
			return (((pow * pow) % MOD) * x) % MOD;
		}
	}

	//x/y
	ll div(ll x, ll y) {
		return mul(x, power(y, MOD - 2));
	}

	//階乗x~y xからyまでかける
	ll fact(ll x, ll y) {
		if (x < y) {
			return 0;
		}
		else if (x == y) {
			return x;
		}
		else {
			return mul(x, fact(x - 1, y));
		}
	}

	//組み合わせ nCr
	ll conbi(ll n, ll r) {
		if (r == 0) return 1;
		return div(fact(n, n - r + 1), fact(r, 1));
	}

	//順列 nPr
	ll perm(ll n, ll r) {
		return fact(n, n - r + 1);
	}

	//重複組合せ nHr
	ll homo(ll n, ll r) {
		return conbi((n + r - 1), r);
	}
}

ll N,K;
string S;
vector<ll> vec;

void solve() {
	cin >> N >> K;

	ll blue = K;
	ll red = N - K;

	for (ll i = 1; i <= K; i++) {

		if (i - 1 > red) {
			cout << 0 << endl;
			continue;
		}

		ll count = mod::conbi(blue - 1, i - 1);

		ll atp = mod::conbi(red + 1, i);

		cout << (count*atp) % mod::MOD << endl;

	}
}

int main() {
	solve();
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
//libraries
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//namespace
using namespace std;
using namespace __gnu_pbds;

//typedef
typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long,long> pll;

//define
#define inp(X) cin>>X;
#define inp_long(X) long long X; cin>>X;
#define inp_arr(A,N) long long A[N]; for(int i=0;i<N;i++) {cin>>A[i];}
#define sz(A) A.size()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define endl '\n'
#define vect(A) vector<long long> A;
#define inp_vect(A,N); for(int i=0;i<N;i++){long long q; cin>>q; A.push_back(q);}
#define forin(i,a,b) for(long long i=a;i<=b;i++)
#define forde(i,a,b) for(long long i=a;i>=b;i--)
#define fio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);

ll power(ll x,ll y)
{
    if (y == 0)
        return 1;
    ll p = power(x, y/2) % MOD;
    p = (p * p) % MOD;

    return (y%2 == 0)? p : (x * p) % MOD;
}
ll modInverse(ll a)
{
   return power(a,MOD-2);
}
int main()
{
	fio;
	ll n;
	inp(n);
	cout<<n*(n-1)/2<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define forn for(int i=0;i<n;i++)
int maxf(int a,int b,int c)
{
    int x=max(a,b);
    return max(x,c);
}
int main()
{
   int n;
   cin>>n;
   int arr[n][3];
   int dp[n][3];
   for(int i=0;i<n;i++) cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
   dp[0][0]=arr[0][0];
   dp[0][1]=arr[0][1];
   dp[0][2]=arr[0][2];
   for(int i=1;i<n;i++)
   {
       dp[i][0]=maxf(dp[i-1][0],dp[i-1][1]+arr[i][0],dp[i-1][2]+arr[i][0]);
       dp[i][1]=maxf(dp[i-1][1],dp[i-1][0]+arr[i][1],dp[i-1][2]+arr[i][1]);
       dp[i][2]=maxf(dp[i-1][2],dp[i-1][0]+arr[i][2],dp[i-1][1]+arr[i][2]);
   }
   cout<<maxf(dp[n-1][0],dp[n-1][1],dp[n-1][2]);
   return 0;
   
}

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

const int N = 301, P = 1e9 + 7;

int f[N][N][N], n, m, l[N][3], r[N][3], a, b, c, d, fa[N][N], fb[N][N], fc[N][N], ans, t[3];

void up (int &x, int y) { x += y; if (x >= P) x -= P; }

int main () {
	scanf("%d%d", &n, &m);
	f[0][0][0] = 1; fa[0][0] = fb[0][0] = fc[0][0] = 1;
	for (d = 1; d <= m; ++d) {
		scanf("%d%d%d", &a, &b, &c); --c;
		if (!l[b][c] || l[b][c] > a) l[b][c] = a;
		if (!r[b][c] || r[b][c] < a) r[b][c] = a;
	}
	for (a = 0; a <= n; ++a) {
		for (b = 0; b <= n; ++b) {
			for (c = 0; c <= n; ++c) {
				t[0] = a; t[1] = b; t[2] = c;
				sort(t, t + 3);
				d = t[2];
				if (a == 0 && b == 0 && c == 0) continue ;
				if (a && b && a == b) continue ;
				if (b && c && b == c) continue ;
				if (c && a && c == a) continue ;
				if (l[d][2] && r[d][2] > t[0]) continue ;
				if (l[d][1] && (r[d][1] > t[1] || l[d][1] <= t[0])) continue ;
				if (l[d][0] && l[d][0] <= t[1]) continue ;
				if (d == b) f[a][b][c] = max(a, c) + 1 == b ? fb[a][c] : f[a][b - 1][c];
				else if (d == a) f[a][b][c] = max(b, c) + 1 == a ? fa[b][c] : f[a - 1][b][c];
				else f[a][b][c] = max(a, b) + 1 == c ? fc[a][b] : f[a][b][c - 1];
				up(fb[a][c], f[a][b][c]);
				up(fa[b][c], f[a][b][c]);
				up(fc[a][b], f[a][b][c]);
				if (d == n) up(ans, f[a][b][c]);
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}
/*
7 2
3 5 2
1 5 2
*/

Measured memory_bytes: 107776
#https://atcoder.jp/contests/dp/tasks/dp_c
#2019-01-13
N = int(input())
abc = [list(map(int, input().split())) for i in range(N)]

A = [0]
B = [0]
C = [0]
for i in range(N):
    a = abc[i][0] + max(B[-1], C[-1])
    b = abc[i][1] + max(A[-1], C[-1])
    c = abc[i][2] + max(A[-1], B[-1])
    A += [a]
    B += [b]
    C += [c]
print(max(A[-1], B[-1], C[-1]))

Measured memory_bytes: 42556
#include <functional>
#include <vector>
#include <iostream>
using namespace std;

class Trie {
    struct Node {
        bool exists = false;
        int l = -1, r = -1;
    };
    vector<Node> nodes;
public:
    Trie () { nodes.push_back(Node()); }
    void add(string &s) {
        int i = 0;
        for (char c : s) {
            if (c == '0') {
                if (nodes[i].l >= 0) i = nodes[i].l;
                else {
                    const int i1 = nodes.size();
                    nodes[i].l = i1;
                    i = i1;
                    nodes.push_back(Node());
                }
            } else {
                if (nodes[i].r >= 0) i = nodes[i].r;
                else {
                    const int i1 = nodes.size();
                    nodes[i].r = i1;
                    i = i1;
                    nodes.push_back(Node());
                }
            }
        }
        nodes[i].exists = true;
    }
    long long solve(long long L) {
        long long ret = 0;
        function <void(int, long long)> dfs = [&](int i, long long h) {
            if (nodes[i].exists) return;
            if (nodes[i].l == -1) ret ^= h&-h;
            else dfs(nodes[i].l, h-1);
            if (nodes[i].r == -1) ret ^= h&-h;
            else dfs(nodes[i].r, h-1);
        };
        dfs(0, L);
        return ret;
    }
    void dump() {
        for (int i = 0; i < nodes.size(); i++) {
            Node nd = nodes[i];
            cerr << i << " " << (nd.exists ? "T" : "F") << " " << nd.l << " " << nd.r << endl;
        }
    }
};

int main() {
    int n;
    long long l; cin >> n >> l;
    Trie t;
    for (int i = 0; i < n; i++) {
        string s; cin >> s;
        t.add(s);
    }
    long long g = t.solve(l);
    cout << (g == 0 ? "Bob\n" : "Alice\n");
}


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

int main() {
	int ans;
	string str;
	do {
		getline(cin,str);
		ans=0;
		if (str=="0") break;
		for(unsigned int i=0;i<str.length();++i) {
			ans+=str[i]-'0';
		}
		cout << ans << endl;
	} while(1);
	return 0;
}

Measured memory_bytes: 3160
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
namespace mp = boost::multiprecision;

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

	cout << 3 * n * n;

	return 0;
}

Measured memory_bytes: 888
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7; //924844033 1000000000 + 9;
constexpr long long INF = numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<double, double> Dll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourth; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, t, s, p, q, last, first, cnt, sum, ans, dp[200000][3], a[200000][3], b[200000];
string str, ss;
bool f;
char c[800][800];
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
struct Edge { LL to, cost; };
struct edge { LL from, to, cost; };
vector<Edge>vec[20000];
vector<edge>ed;
vector<LL>v[23];
map<string, LL>ma;
set<LL>st;
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

int main() {
	cin >> n;
	rep(i, n) {
		rep(j, 3)
			cin >> a[i][j];
	}
	rep(i, n) {
		rep(j, 3) {
			dp[i + 1][(j + 1) % 3] = max(dp[i + 1][(j + 1) % 3], dp[i][j] + a[i][(j + 1) % 3]);
			dp[i + 1][(j + 2) % 3] = max(dp[i + 1][(j + 2) % 3], dp[i][j] + a[i][(j + 2) % 3]);
		}
	}
	cout << max({ dp[n][0],dp[n][1],dp[n][2] }) << endl;
	return 0;
}


Measured memory_bytes: 8960
n = gets.to_i
a = gets.split.map &:to_i

h = Hash.new(0)

a.each{|t| h[t] += 1}

ans = 0

b = h.sort
b.each{|(k,v)| 
  if k<=v then
    ans += v-k
  else
    ans += v
  end
}

p ans

Measured memory_bytes: 20876
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define prin(num) cout << num << endl
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 1000005
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PA;
typedef priority_queue<ll> PQ;
typedef map<ll, ll> Map;

int main(void) {
    ll N;
    cin >> N;
    double T, A;
    cin >> T >> A;
    double h[1001];
    ll i;
    ll ans=1;
    double min=INF;
    
    
    for(i=0; i<N; i++) {
        cin >> h[i];
    }
    
    for(i=0; i<N; i++) {
        if(abs(T-h[i]*0.006-A)<min) {
            ans=i;
            min=abs(T-h[i]*0.006-A);
        }
    }
    
    prin(ans+1);
    
    

}

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

// Define
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using int128 = __int128;
using cint = cpp_int;
const ll MOD = 1e9 + 7;
const ll INF = LONG_MAX;
const ull MAX = ULONG_MAX;
#define endl '\n'
#define space ' '
#define def inline auto
#define func inline constexpr ll
#define run __attribute__((constructor)) def _
#define all(v) begin(v), end(v)

// Debug
#define debug(...)                                                             \
    {                                                                          \
        cerr << __LINE__ << ": " << #__VA_ARGS__ << " = ";                     \
        for (auto &&X : {__VA_ARGS__}) cerr << "[" << X << "] ";               \
        cerr << endl;                                                          \
    }

// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i <= _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i >= _##i; --i)
#define each(i, a) for (auto &&i : a)
#define rep(i, n) inc(i, 0, n - 1)

// Stream
#define input(a) scanf("%lld", &(a))
#define output(a) printf("%lld\n", (a))
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)

// Speed
run() { fasten, fout(10); }
#pragma GCC optimize("-O3")
#pragma GCC target("avx")

// Math
func gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
func lcm(ll a, ll b) { return a * b / gcd(a, b); }

signed main() {
    ll N;
    cin >> N;
    vector<ll> X, Y, H;
    rep(i, N) {
        ll A, B, C;
        cin >> A >> B >> C;
        X.push_back(A), Y.push_back(B), H.push_back(C);
    }
    rep(CX, 101) rep(CY, 101) {
        ll H1;
        bool check = 1;
        rep(i, N) {
            if (H[i]) {
                H1 = H[i] + abs(X[i] - CX) + abs(Y[i] - CY);
                break;
            }
        }
        rep(i, N) {
            if (max(H1 - abs(X[i] - CX) - abs(Y[i] - CY), 0LL) != H[i]) {
                check = 0;
            }
        }
        if (check) {
            cout << CX << space << CY << space << H1 << endl;
            return 0;
        }
    }
}

// for compilation: g++ -O3 -o _ _.cpp -std=c++17


Measured memory_bytes: 256
import sys
S="".join(reversed(input()))
i=0
while i<len(S):
    if i+4<len(S) and (S[i:i+5]=="maerd" or S[i:i+5]=="esare"):
        i+=5
    elif i+5<len(S) and (S[i:i+6]=="resare"):
        i+=6
    elif i+6<len(S) and (S[i:i+7]=="remaerd"):
        i+=7
    else:
        print("NO")
        sys.exit()
print("YES")

Measured memory_bytes: 3956
import sys

table = [0]*26
letters = 'abcdefghijklmnopqrstuvwxyz'

input_str = sys.stdin.read()

for i in range(len(input_str)):
    for j in range(len(letters)):
        if input_str[i] == letters[j] or input_str[i] == letters[j].upper():
            table[j] += 1

for i in range(len(letters)):
    print('{} : {}'.format(letters[i],table[i]))


Measured memory_bytes: 5564
A,B = map(int,input().split())

#a,bの最大公約数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#a,bの最小公倍数
def lcm(a, b):
    return a * b // gcd (a, b)

print(lcm(A,B))

Measured memory_bytes: 2940
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

N, M = map(int, input().split())

l = make_divisors(M)
l.sort()
for i in range(len(l)):
    if l[i] >= N:
        a = l[i]
        break

ans = M // a
print(ans)

Measured memory_bytes: 3188
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
n = I()
li = [I() for _ in range(n)]
li.sort(reverse=True)
before = ans =  0
for i in range(n):
    if before != li[i]:
        ans += 1
        before = li[i]
print(ans)

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

int main(){
  long long N,K,Q;
  cin >> N >> K >> Q;
  long long count[N],A;
  
  for(long long i=1;i<N+1;i++){
    count[i] = K-Q;
  }
  for(long long i=0;i<Q;i++){
    cin >> A;
    count[A]++;
  }
  for(long long i=1;i<N+1;i++){
    if(count[i]>0){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }
  
  return 0;
}


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

#define MAX_B 5
#define MAX_F 4
#define MAX_R 11

int main() {
    int n;             // ????????¶??°
    int b, f, r, v;    // b(?£?) : 1 ~ 4,  f(???) : 1 ~ 3, r(??¨?±?) : 1 ~ 10, v(?????°)

    int count[MAX_B][MAX_F][MAX_R];

    // ?????????
    for (int i = 0; i < MAX_B; i++)
        for (int j = 0; j < MAX_F; j++)
            for (int k = 0; k < MAX_R; k++) count[i][j][k] = 0;

    // ??\???, ??????
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> b >> f >> r >> v;
        count[b][f][r] += v;
    }

    // ??????
    for (int i = 1; i < MAX_B; i++) {
        if (i > 1) cout << "####################" << endl;
        for (int j = 1; j < MAX_F; j++) {
            for (int k = 1; k < MAX_R; k++) {
                cout << " " << count[i][j][k];
            }
            cout << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 3072
s = int(input())
b = s
a=[]
t = True
i = 0
while t:
    if b in a:
        print(i+1)
        exit()
    else:
        a.append(b)
        if b%2 == 0:
            b = b//2
        else:
            b = 3*b + 1
        i += 1

Measured memory_bytes: 38384
n, m = map(int,input().split())
s = input()
t = input()

def gcd(x, y):
    while x != 0 and y != 0:
        x, y = min(x,y), max(x,y)
        y %= x
    return x

def aa():
    a = gcd(n, m)
    ss = n // a
    tt = m // a
    si = 0
    ti = 0
    for i in range(a):
        if s[si] != t[ti]:
            return -1
        si += ss
        ti += tt
    return n * m // a
print(aa())

Measured memory_bytes: 39536
#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(){
    int n,a;
    cin>>n>>a;
    if(n%500<=a)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<functional>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>
// 追加１
#include <fstream>



using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()


int main()
{
	int X, Y, Z;
	cin >> X >> Y >> Z;

	cout << Z << " " << X << " " << Y;

	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cmath>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <numeric>

using namespace std;

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

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

const int MAX_N = 200010;
ll fact[MAX_N], finv[MAX_N], inv[MAX_N];

void init_combination(ll p) {
    fact[0] = fact[1] = finv[0] = finv[1] = inv[1] = 1;
    for (int i = 2; i < MAX_N; ++i) {
        inv[i] = inv[p % i] * (p - p / i) % p;
        fact[i] = fact[i - 1] * i % p;
        finv[i] = finv[i - 1] * inv[i] % p;
    }
}

ll comb(int n, int k, ll p) {
    if (n < k || n < 0 || k < 0) return 0;
    return fact[n] * (finv[k] * finv[n - k] % p) % p;
}

vector<int> func(ll n) {
    vector<int> ret;
    for (ll i = 2; i * i <= n; ++i) {
        int cnt = 0;
        while (n % i == 0) {
            ++cnt;
            n /= i;
        }
        ret.emplace_back(cnt);
    }
    if (n != 1) ret.emplace_back(1);
    return ret;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n, m;
    cin >> n >> m;
    auto v = func(m);
    ll p = (ll) 1e9 + 7;
    init_combination(p);
    ll ans = 1;
    for (auto &i : v) {
        (ans *= comb(i + n - 1, i, p)) %= p;
    }
    cout << ans << endl;
}

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

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

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

Measured memory_bytes: 256
N, L = map(int, input().split())

# 0を範囲に含む
if L <= 0 and (L + N - 1) >= 0:
    print((2 * L + N - 1) * N // 2)
    exit()

# 全部自然数
if L > 0:
    print((2 * L + N) * (N - 1) // 2)
    exit()

# 全部負の数
print((2 * L + N - 2) * (N - 1) // 2)


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

n = int(input())
SP = [[x for x in input().split()] for _ in range(n)]
ans_list = defaultdict(list)
for i, sp in enumerate(SP):
    ans_list[sp[1]] = i

li = sorted(SP, key=lambda x: -int(x[1]))
li = sorted(li, key=lambda x: x[0])
#print(li)
#print(ans_list)
for x in li:
    print(ans_list[x[1]]+1)



Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=100010;
struct tfriend{
	ll idx;
	vector<ll> fr;
	ll siz;
} t[N];
vector<ll> bf;
ll m,n,k,x,y,id[N],con[N],vis[N];
ll haxi(ll x,ll y){
	return x*N+y;
}
void unhaxi(ll h,ll &x,ll &y){
	x=h/N;y=h%N;
}
ll find(ll x){
	while(x!=id[x]){
		id[x]=id[id[x]];
		x=id[x];
	}
	return x;
}
void dfs(ll x){
	vis[x]=1;
	ll tmp=find(x);
	//printf("x=%lld,tmp=%lld\n",x,tmp);
	for(ll i=0;i<t[x].fr.size();++i){
		ll xson=t[x].fr[i];
		if(vis[xson]) continue;
		//printf("x=%lld,xson=%lld\n",x,xson);
		t[tmp].siz++;
		id[xson]=tmp;
		dfs(xson);
	}
}
int main()
{
	scanf("%lld%lld%lld",&n,&m,&k);
	for(ll i=1;i<=m;++i){
		scanf("%lld%lld",&x,&y);
		if(x>y) swap(x,y);
		t[x].fr.push_back(y);
		t[y].fr.push_back(x);
		bf.push_back(haxi(x,y));
	}
	for(ll i=1;i<=k;++i){
		scanf("%lld%lld",&x,&y);
		if(x>y) swap(x,y);
		bf.push_back(haxi(x,y));
	}
	for(ll i=1;i<=n;++i){
	    id[i]=i;
	    t[i].siz=1;
	}
	for(ll i=1;i<=n;++i){
		dfs(i);
	}
	for(ll i=1;i<=n;++i){
		//printf("i=%lld,id[i]=%lld\n",i,id[i]);
	}
	for(ll i=0;i<m+k;++i){
		unhaxi(bf[i],x,y);
		if(id[x]==id[y]){
			++con[x];
			++con[y];
		}
	}
	for(int i=1;i<=n;++i){
		printf("%lld ",t[id[i]].siz-1-con[i]);
	}
}

Measured memory_bytes: 13296
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <map>
#include <vector>
using namespace std;

int main(int argc, char const *argv[]) {
  int N;
  cin>>N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  map<int, int> a_all;
  for (int i = 0; i < N; i++) {
    a_all[a[i]]++;
    a_all[a[i] + 1]++;
    a_all[a[i] - 1]++;
  }
  int ans=0;
  for (auto itr = a_all.begin(); itr != a_all.end(); ++itr) {
    if(ans<itr->second){
      ans=itr->second;
    }
  }
  cout<<ans<<endl;

  return 0;
}

Measured memory_bytes: 5120
s = input()
t = input()
ans = []
for i in range(len(s)-len(t) + 1):
  s_i = s[i:i+len(t)]
  count_diff = 0
  for t_j, s_j in zip(t, s_i):
    if t_j != s_j:
      count_diff += 1
  ans.append(count_diff)
print(min(ans))

Measured memory_bytes: 9072
#include <bits/stdc++.h>
#include <chrono>
#include <math.h>
using namespace std;
using ll = long long;
using ld = long double;
using namespace std::chrono; 
#define fo(i,z,n) for(int i = z;i<n;i++)
#define Fo(i,z,n) for(ll i = z;i<n;i++)
#define INT_BITS 32
#define mod 1000000007
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> > 
#define pb push_back
#define f first
// #define s second
#define int long long
#define float long double
#define all(c) (c).begin(), (c).end()
#define endl '\n'

const int m = 1e7+5;
vi v(m);
void sieve(int n){
	fo(i,0,n+1)v[i] = 1;
	for(int i = 2; i <= n; i+= 2)v[i]++;
	for(int i =3; i <= n;i++){
		for(int j = i; j <= n;j += i){
			v[j]++;
			// cout << v[j] << ' ';
		}
		// cout << endl;
	}
}

int32_t main()
{
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     cout.tie(0);
   	
    // int t;
     // cin >> t;

//      while(t--){

// }
     int n;
     cin >> n;
     sieve(n);
     int res = 0;
     for(int i = 1;i <= n; i++){
     	res += i*v[i];
     	// cout << v[i] << endl;
     }

cout << res << endl;


return 0;
}





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

int main(){
  int N;
  cin >> N;
  vector<int> D(N,0);
  for(int i=0;i<N;i++){
    cin >> D[i];
  }
  sort(D.begin(),D.end());
  int count=0;
  for(int i=0;i<N;i++){
    if(i==N-1){
      count ++;
      break;
    }
    if(D[i]!=D[i+1]){
      count ++;
    }
  }
  cout << count << endl;
}

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

int max(int a, int b){
	return a >= b ? a : b;
}

int min(int a, int b){
	return a <= b ? a : b;
}

int main(){
	int A, B, C;
	scanf("%d%d%d", &A, &B, &C);
	printf("%d\n", max(max(A, B), C) - min(min(A, B), C));
	return 0;
}

Measured memory_bytes: 128
import math
import itertools

n=int(input())
f=math.factorial(n)
p=[]
for _ in range(n):
  x,y=map(int,input().split())
  p.append([x,y])
  
def distance(x,y):
  return(((x[0]-y[0])**2+(x[1]-y[1])**2)**.5 )

ans=0
for path in list(itertools.permutations(range(n))):
  arr=[p[i] for i in path]
  ans+=sum([distance(x,y)/f for x,y in zip(arr[:-1],arr[1:])])
print(ans)

Measured memory_bytes: 47336
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(v) v.begin(), v.end()
using namespace std;

struct nd{
    vector< int > ady;
}G[100010];

int n,m,cont,u,v,ans[100010];
bool use[100010];

queue< pii > cl;
pii a;

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> n >> m;
    for(int i=0; i<m; i++) cin >> u >> v , G[u].ady.pb( v ) , G[v].ady.pb( u );

    cl.push( { 1 , 1 } );
    use[ 1 ] = true;
    while( !cl.empty() ){
        a = cl.front();
        cl.pop();
        cont++;
        ans[ a.fi ] = a.se;
        for( auto sig:G[ a.fi ].ady ){
            if( use[ sig ] ) continue;
            use[ sig ] = true;
            cl.push( { sig , a.fi } );
        }
    }

    if( cont < n ){
        cout << "No";
        return 0;
    }
    cout << "Yes\n";
    for(int i=2; i<=n; i++) cout << ans[ i ] << "\n";

    return 0;
}


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

using namespace std;

typedef long long ll;


int main() {
    ll N;
    ll i, j;
    ll mod;
    ll sum, sumu, sumv;
    char LRDU[2][2] = {{'L', 'D'}, {'U', 'R'}};
    int m[2] = {32, 31};

    cin >> N;
    vector<ll> X(N), Y(N);
    for (i = 0; i < N; i++) {
        cin >> X[i] >> Y[i];
    }

    mod = abs((X[0] + Y[0]) % 2);
    for (i = 1; i < N; i++) {
        if (mod != abs((X[i] + Y[i]) % 2)) {
            cout << -1 << endl;
            return 0;
        }
    }
    
    vector<ll> d(m[mod]);
    vector<ll> U(m[mod]), V(m[mod]);
    if (mod == 1) {
        sum = 1;
        for (i = 0; i < m[mod]; i++) {
            d[i] = sum;
            sum = sum << 1;
        }
    }
    else {
        sum = 1;
        d[0] = 1;
        for (i = 1; i < m[mod]; i++) {
            d[i] = sum;
            sum = sum << 1;
        }
    }



    cout << m[mod] << endl;
    for (i = 0; i < m[mod]; i++) {
        cout << d[i] << " ";
    }
    cout << endl;
    for (i = 0; i < N; i++) {
        if (mod == 1) {
            sumu = (X[i] + Y[i] + ((ll)2 << 30) - 1) / 2;
            sumv = (X[i] - Y[i] + ((ll)2 << 30) - 1) / 2;
            for (j = 0; j < m[mod]; j++) {
                U[j] = sumu % 2;
                V[j] = sumv % 2;
                sumu = sumu >> 1;
                sumv = sumv >> 1;
            }
        }
        else {
            sumu = (X[i] + Y[i] + ((ll)2 << 30)) / 2;
            sumv = (X[i] - Y[i] + ((ll)2 << 30)) / 2;
            U[0] = 0;
            V[0] = 0;
            for (j = 1; j < m[mod]; j++) {
                U[j] = sumu % 2;
                V[j] = sumv % 2;
                sumu = sumu >> 1;
                sumv = sumv >> 1;
            }
        }
        
        for (j = 0; j < m[mod]; j++) {
            cout << LRDU[U[j]][V[j]];
        }
        cout << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

ll n;
bool used[101010];
bool color[101010];
vector<vector<pair<ll, ll>>> vv(101010); // 遷移先, 重さ
void bfs(ll node, bool col){
    used[node]=true;
    color[node]=col;

    for(int j=0; j<vv[node].size(); j++){
        if(used[vv[node][j].first]) continue;

        if(vv[node][j].second%2 == 0){
            bfs(vv[node][j].first, col);
        }
        else{
            bfs(vv[node][j].first, !col);
        }
    }

    return;
}
int main() {
    cin>>n;
    REP(i, 0, n-1){
        ll u, v, w;
        cin>>u>>v>>w;
        u--;
        v--;
        vv[u].emplace_back(v, w);
        vv[v].emplace_back(u, w);
    }

    bfs(0, false);

    REP(i, 0, n){
        cout<<color[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 9728
#include <stdio.h>

int main(){
    int m, f, r;
	while(1){
		scanf("%d %d %d", &m, &f, &r);
		if(m == -1 && f == -1 && r == -1 )break;
        if(m == -1 || f == -1){
            printf("F\n");
        }
		else if(m+f>=80){
            printf("A\n");
        }
		else if (m+f>=65){
			printf("B\n");
		}
		else if (m+f>=50){
			printf("C\n");
		}else if(m+f>=30){
            if(r>=50){
                printf("C\n");
            }else{
                printf("D\n");
            }
		}
		else{
			printf("F\n");
		}
	}
	return(0);
}

Measured memory_bytes: 584
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

cnt = [0] * len(b)
a = sorted(a)
c = sorted(c)

for i in range(len(b)):
    target = b[i]

    # decide a cnt
    l = 0
    r = len(a) - 1
    if a[l] >= target:
        cnt[i] += 0
    elif a[r] < target: 
        cnt[i] += len(a)
    else:
        while r - l > 1:
            mid = (l + r) // 2
            if a[mid] >= target:
                r = mid
            else:
                l = mid
        cnt[i] += l + 1

    # decide c cnt
    l = 0
    r = len(c) - 1
    if c[l] > target:
        cnt[i] *= len(c)
    elif c[r] <= target: 
        cnt[i] *= 0
    else:
        while r - l > 1:
            mid = (l + r) // 2
            if c[mid] > target:
                r = mid
            else:
                l = mid
        cnt[i] *= len(c) - (l + 1)
print(sum(cnt))









Measured memory_bytes: 22720
# include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ll n,x,t;
    cin>>n>>x>>t;
    ll c=0;
    c=n/x;
    n=n%x;
    
    ll tt=(c*t);
    if(n!=0 && n<x)
    tt+=t;
    cout<<tt;
}

Measured memory_bytes: 3672
#include<stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

int main(void)
{
  int n,i,sum=1;
  char s[200001][11];
  
  scanf("%d",&n);
  
   for(i=0; i<n; i++)
       scanf("%s",&s[i]);

  qsort(s,n,11,strcmp);

  for(i=1;i<n;i++){
      if(strcmp(s[i],s[i-1])!=0) 
        sum++;    
  }
   
  printf("%d",sum);
  
  return 0;
}


Measured memory_bytes: 5736
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

struct edge {
    int to, cost;
    edge(int to, int cost): to(to), cost(cost) {}
};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
constexpr int INF = 10000000;

template<class T> inline T sqr(T x) {return x*x;}

template <typename T = pair<int, int>>
void Dijkstra(int s, vector<vector<edge>> g, VI &d) {
    int numv = d.size();
    priority_queue<T, vector<T>, greater<T>> q;
    for (int i = 0; i < numv; ++i) d[i] = INF;
    d[s] = 0;
    q.emplace(0,s);

    while (!q.empty()) {
        T p = q.top(); q.pop();
        int v = p.second; // vertex
        if (d[v] < p.first) continue;
        for (int i = 0; i < g[v].size(); ++i) {
            edge e = g[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                q.emplace(d[e.to], e.to);
            }
        }
    }
}

void solve() {
    int n;
    cin >> n;
    vector<vector<edge>> es(n);
    VI d1(n), d2(n);
    int a,b;
    REP(i,0,n-1) {
        cin >> a >> b;
        es[a-1].pb(b-1,1);
        es[b-1].pb(a-1,1);
    }
    Dijkstra(0,es,d1);
    Dijkstra(n-1,es,d2);
    int cnt[2] = {};
    //REP(i,0,n) cerr << d1[i] << " " << d2[i] << endl;
    REP(i,0,n) cnt[d1[i] <= d2[i] ? 0 : 1]++;
    if (cnt[0] > cnt[1]) cout << "Fennec" << endl;
    else cout << "Snuke" << endl;
}

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

Measured memory_bytes: 12976
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(n); i++)
#define REPR(i,n) for(int i=n; i>=0; i--)
#define FOR(i,m,n) for(int i=m; i<(n); i++)
#define ALL(v) v.begin(),v.end()
#define INF 2e9
using namespace std;
typedef long long ll;
 
int euqrid(int a, int b){
    
    while (a%b != 0) {
        int c = a%b;
        a = b;
        b = c;
    }
    return b;
    
}


int main()
{
    
    int N,X;
    cin >> N >> X;
    vector<int> x(N);
    REP(i, N) cin >> x[i];
    REP(i, N) x[i] = abs(x[i]-X);
    int ans = x[0];
    for (int i = 1; i < N; i++) {
        ans = euqrid(ans, x[i]);
    }
    cout << ans << endl;
    
    
    return 0;
}


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

int main(){
  int n,i,j,v,k;
  cin>>n;
  int a[n];
  for (i=0;i<n;i++)cin>>a[i];
  for (k=0;k<n;k++){
    if (k)cout<<' ';
    cout<<a[k];
  }
  cout<<endl;
  for (i=1;i<n;i++){
    v=a[i];
    for (j=i-1;j>=0&&a[j]>v;j--)a[j+1]=a[j];
    a[j+1]=v;
    for (k=0;k<n;k++){
      if (k)cout<<' ';
      cout<<a[k];
    }
    cout<<endl;
  }
}



Measured memory_bytes: 3068
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
from itertools import accumulate #list(accumulate(A))

N, K = mi()
P = li()
C = li()
ans = -float('inf')

for i in range(N):
    ind = i
    his = []
    while True:
        ind = P[ind] - 1
        his.append(C[ind])
        if ind == i:
            his = list(accumulate(his))
            #print(his)
            L = len(his)
            if K > L:
                if his[-1] > 0:
                    if not K%L:
                        ans = max(ans, his[-1] * (K//L), max(his) + his[-1] * max(K//L-1, 0))
                    else:
                        ans = max(ans, max(his[:K%L]) + his[-1] * (K//L), his[-1] * (K//L), max(his) + his[-1] * max(K//L-1, 0))
                else:
                    ans = max(ans, max(his))
            else:
                ans = max(ans, max(his[:K]))
            break

print(ans)

Measured memory_bytes: 107704
s = input()
n = len(s)
for i in range(2**n):

  total = 0
  ans = s[0]
  val = int(s[0])
  for j in range(1, n):
    if (i >> j) & 1:
      ans = ans + "+" + s[j]
      val = val + int(s[j])
    else:
      ans = ans + "-" + s[j]
      val = val - int(s[j])
  
  if val == 7:
    print(ans + "=7")
    exit()

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

int main(){
	int a,b,c,ans = 0;
	int i;
	cin >> a >> b >> c;

	for(i = a; i <= b; i++){
		if(c % i == 0){
			ans = ans + 1;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a,b,i,k=0,m=0;
	cin >> a;
	long long arr[a];
	for(i=0;i<a;i++)
	{
		cin >> arr[i];
	}
	for(i=0;i<a;i++)
	{
	if(arr[i+1]<=arr[i])
	{
    k++;
	}
	else
	{
		m=max(m,k);
		k=0;
	}
	
	}
	m=max(m,k);
	cout << m;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007
#define endl "\n"
 
int32_t main()
{
	fast;
	int s;
	string b;
	cin>>s>>b;
	// int x=stoi(s);
	if(s>=3200)
		cout<<b;
	else
		cout<<"red";
	return 0;
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()

def main():
    n=int(input())
    t,a=map(int,input().split())
    hh=list(enumerate(map(int,input().split())))
    print(min(hh, key=lambda x:abs(t-a-x[1]*0.006))[0]+1)

main()

Measured memory_bytes: 3188
import java.util.*;

public class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Integer> cards = new ArrayList<>();
        int alliceSum = 0;
        int bobSum = 0;
        for (int i = 0; i < n; i++) {
            cards.add(sc.nextInt());
        }
        Collections.sort(cards, Comparator.reverseOrder());

        int current = 2;
        while (cards.size() > 0) {
            if (current % 2 == 0) {
                alliceSum += cards.get(0);
            } else {
                bobSum += cards.get(0);
            }
            cards.remove(0);
            current++;
        }

        System.out.println(alliceSum - bobSum);

    }
}

Measured memory_bytes: 22996
#include <stdio.h>

int main(){
	int x, y, z, i;
	scanf("%d %d %d", &x, &y, &z);
	for (i = 0;x <= y; x++){
		if (z % x == 0){
			i++;
		}
	}
	printf("%d\n", i);
	return(0);
}

Measured memory_bytes: 596
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner r =new Scanner(System.in);
		int w = r.nextInt();
		int h = r.nextInt();
		int x = r.nextInt();
		int y = r.nextInt();
		int z = r.nextInt();
		if(z <= x && x <= (w -z) && z <= y && y <= (h - z)){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}

}

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

int main(){
	int  n,k;
	cin>>n>>k;
	vector<int>okasi(n,0);
	rep(i,k){
		int d;
		cin>>d;
		rep(i,d){
			int a;
			cin>>a;
			okasi[a-1]++;
		}
	}
	int count =0;
	rep(i,n){
		if(okasi[i]==0)count++;
      //cout<<okasi[i]<<endl;
	}
	cout<<count<<endl;
	return 0;
}

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

using namespace std;
int n;
double d,a,b;
int main()
{
    cin>>n>>d;
    int dem=0;
    while (n--)
    {
        cin>>a>>b;
        if (sqrt(pow(a,2)+pow(b,2))<=d ) dem++;
    }
    cout<<dem;
}


Measured memory_bytes: 3748
package main

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

func main() {
	N, M := ReadInt(), ReadInt()
	s := make([][]int, M)
	for i := 0; i < M; i++ {
		k := ReadInt()
		s[i] = ReadInts(k)
		for j := 0; j < k; j++ {
			s[i][j]--
		}
	}
	p := ReadInts(M)
	ans := 0
	for S := 0; S < 1<<N; S++ {
		ok := true
		for i := 0; i < M; i++ {
			c := 0
			for _, j := range s[i] {
				if S>>j&1 == 1 {
					c++
				}
			}
			if c%2 != p[i] {
				ok = false
				break
			}
		}
		if ok {
			ans++
		}
	}
	fmt.Println(ans)
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 1848
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
typedef pair<int,int> P;
typedef vector<int> ivec;

const int MOD=1000000007;
int INF=100100100100100;

signed main(){
  int a;cin>>a;
  cout<<a+a*a+a*a*a<<endl;
  return 0;
}

Measured memory_bytes: 3588
using System;
using System.Collections.Generic;
using System.Linq;

namespace AojStudy
{
    public class Program
    {
        /// <summary>
        /// プログラムのエントリポイント
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            int index = 1;
            while(true)
            {
                string input = Console.ReadLine();
                if (input == "0")
                    break;

                Console.WriteLine($"Case {index++}: {input}");
            }
        }
    }
}


Measured memory_bytes: 17844
using System;

namespace ABC168_A
{
    class Program
    {
        static void Main(string[] args)
        {
            int i = int.Parse(Console.ReadLine());
            i = i % 10;

            if(i == 3)
            {
                Console.WriteLine("bon"); 
            }else if(i==0 || i ==1 || i ==6 || i == 8)
            {
                Console.WriteLine("pon");
            }
            else
            {
                Console.WriteLine("hon");
            }
        }
    }
}


Measured memory_bytes: 27480
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::f64::consts::*;

#[allow(unused)]
const INF: usize = std::usize::MAX / 4;
#[allow(unused)]
const M: usize = 1000000007;

fn main() {
    input! {
        mut s: Chars,
    }
    s.sort();
    if s[0] == s[1] && s[2] == s[3] && s[0] != s[2] {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2156