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

#define rep(i,n) for(int i = 0;i < n;++i)
#define rep2(i,n,m) for(int i = n;i < m;++i)
#define all(v) v.begin(),v.end()

using namespace std;
using ll = long long;
const int INF = 1001001001;

uintmax_t combination(unsigned int n, unsigned int r) {
  if ( r * 2 > n ) r = n - r;
  uintmax_t dividend = 1;
  uintmax_t divisor  = 1;
  for ( unsigned int i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
  return dividend / divisor;
}

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

    ll n;
    cin >> n;
    vector<ll> v(n);
    vector<ll> ans(n);
    vector<ll> b(n);
    rep(i,n){
        ll a;
        cin >> a;
        ans.at(i) = a-1;
        v.at(a-1)++;
    }
    rep(i,n){
        ll c = v.at(i);
        if(c == 0 || c == 1) b.at(i) = 0;
        else b.at(i) = combination(c,2);
    }
    ll sum = 0;
    rep(i,n){
        sum += b.at(i);
    }
    rep(i,n){
        ll c = v.at(ans.at(i))-1;
        ll d = 0;
        if(c == 0 || c == 1) d = 0;
        else d = combination(c,2);
        ll v = b.at(ans.at(i)) - d;
        d = sum - v;
        cout << d << endl;
    }
    
    return 0;
}

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s,t;
    cin >> s >> t;
    int p=s.size()-t.size();
    bool judge;
    for(int i = p;i >= 0;i --){
        judge = true;
        for(int j = 0;j < t.size();j ++){
         if(t[j]!=s[i+j]&&s[i+j]!='?') judge = false;
        }
        if(judge) {p=i;break;}
    }
    if(!judge) cout << "UNRESTORABLE" << endl;
    else{
        for(int i = p;i < t.size()+p;i ++){
            if(s[i]=='?') s[i] = t[i-p];
        }
        for(int i = 0;i < s.size();i ++){
            if(s[i]=='?') s[i] = 'a';
        }
        cout << s << endl;
    }
    return 0;
}


Measured memory_bytes: 256
from sys import stdin
from itertools import combinations
from math import factorial
import numpy as np
import math

a,b = [int(x) for x in stdin.readline().rstrip().split()]
s = stdin.readline().rstrip()

if s[a] != "-":
    print("No")
elif "-" in s[:a] or "-" in s[a+1:]:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 12444
use std::io;

fn main() {
    let mut line = String::new();
    io::stdin().read_line(&mut line).expect("");
    let vec : Vec<&str> = line.split_whitespace().collect();

    let n1 : i32 = vec[0].parse().unwrap_or(0);
    let n2 : i32 = vec[1].parse().unwrap_or(0);

    let multi = n1 * n2;

    println!("{}", multi);
}



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

public class Main {
    public static void main(String[] args) {
        FastReader s = new FastReader();
        long a = s.nextLong();
        long v = s.nextLong();
        long b= s.nextLong();
        long w= s.nextLong();
        long t= s.nextLong();
        long d = Math.abs(a-b);

        if(w>=v)
            System.out.println("NO");
        else {
            if (Math.abs(v - w) * t >= d)
                System.out.println("YES");
            else
                System.out.println("NO");
        }

    }

    private static boolean isPrime(int n) {
        if (n == 2)
            return true;
        else if ((n % 2 == 0 && n > 2) || n < 2)
            return false;
        else {
            for (int i = 3; i <= (int) Math.sqrt(n); i += 2) {
                if (n % i == 0)
                    return false;
            }
            return true;
        }


    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

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

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

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

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

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

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

}

Measured memory_bytes: 25392
#include <stdio.h>

//?????¢??¢?´¢
int search(int A[],int n,int key){
	int i = 0;
	A[n] = key; //?????§n-1?????§ n?????????
	while( A[i] != key ) i++;
	return i != n;//???????????£?????´??????????????\?????????????????????
}

int main(){
	int i,n,A[10000+1],q,key,sum = 0;
	
	scanf("%d",&n);
	for(i=0; i < n; i++) scanf("%d", &A[i]);
	
	scanf("%d",&q);
	for(i = 0; i < q; i++){
		scanf("%d", &key);
		if( search(A, n, key) ) sum++;
	}
	printf("%d\n", sum);
	
	return 0;
}

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

using graph = std::vector<vector<int>>;

using ll = long long;
constexpr ll MOD = 1e9+7;

void add_edge(graph& g, int from, int to) {
    g[from].push_back(to);
}

int scc(graph& g, std::vector<int>& cmp) {
    int V = g.size();
    std::vector<vector<int>> rg(V);
    std::vector<bool> used(V, false);
    std::vector<int> vs;
    cmp.resize(V);
    for(int i=0; i<V; ++i) {
        for(auto to : g[i]) {
            rg[to].push_back(i);
        }
    }
    std::function<void(int)> dfs = [&g, &vs, &used, &dfs](int v) {
        used[v] = true;
        for(auto i : g[v]) {
            if(!used[i]) {
                dfs(i);
            }
        }
        vs.push_back(v);
    };
    std::function<void(int, int)> rdfs = [&rg, &cmp, &used, &rdfs](int v, int k) {
        used[v] = true;
        cmp[v] = k;
        for(int i : rg[v]) {
            if(!used[i]) {
                rdfs(i, k);
            }
        }
    };
    for(int v=0; v<V; ++v) {
        if(!used[v]) {
            dfs(v);
        }
    }
    std::fill(used.begin(), used.end(), false);
    int k = 0;
    for(int i=vs.size()-1; i>=0; --i) {
        if(!used[vs[i]]) {
            rdfs(vs[i], k++);
        }
    }
    return k;
}

vector<vector<int>> build_graph(graph const& g, vector<int> const& cmp, int K) {
    int V = g.size();
    std::vector<std::set<int>> s(K);
    std::vector<std::vector<int>> res(K);
    for(int i=0; i<V; ++i) {
        for(auto to : g[i]) {
            s[cmp[i]].insert(cmp[to]);
        }
    }
    for(int i=0; i<K; ++i) {
        for(auto j : s[i]) {
            if(i != j) {
                res[i].push_back(j);
            }
        }
    }
    return res;
}


ll solve(int v, graph& g) {
    if(g[v].size() == 0) {
        return 2;
    }
    ll res = 1;
    for(auto to : g[v]) {
        res = (res*solve(to, g)) % MOD;
    }
    res += 1;
    return res;
}

int main() {
    int N, M;
    cin >> N >> M;
    graph g(N);
    for(int i=0; i<M; ++i) {
        int s, d;
        cin >> s >> d;
        s--; d--;
        add_edge(g, s, d);
    }
    vector<int> cmp;
    int K = scc(g, cmp);
    g = build_graph(g, cmp, K);
    graph rg(K);
    for(int i=0; i<g.size(); ++i) {
        for(int j=0; j<g[i].size(); ++j) {
            rg[g[i][j]].push_back(i);
        }
    }
    ll res = 1;
    for(int i=0; i<K; ++i) {
        if(g[i].size() == 0) {
            res = (res*solve(i, rg)) % MOD;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 3296
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

struct PBDS
{
	tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> t;
	int timer;
	
	PBDS(){timer = 0;}
	void insert(int x)
	{
		t.insert(mp(x, timer));
		timer++;
	}
	
	int lower(int x)
	{
		return t.order_of_key(ii(x, -1));
	}
	
	void del(int x) //make sure x exists
	{
		ii tmp = (*t.find_by_order(lower(x)));
		t.erase(tmp);
	}
	
	int higher(int x)
	{
		int tmp = lower(x+1);
		return (int(t.size()) - tmp);
	}
};

int ans[111111];
int L[111111];
vi d[111111];
vi add[111111];
vi rem[111111];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	for(int i = 2; i <= 100000; i++)
	{
		for(int j = i; j <= 100000; j+=i)
		{
			d[j].pb(i);
		}
	}
	int n, m; cin>>n>>m;
	for(int i = 0; i < n; i++)
	{
		int l, r; cin>>l>>r;
		L[1]++;
		L[r-l+2]--;
		add[l].pb(r-l+1); //at least r-l+2 to count
		rem[r+1].pb(r-l+1);
	}
	PBDS t;
	for(int i = 1; i <= m; i++)
	{
		for(int j = 0; j < add[i].size(); j++) t.insert(add[i][j]);
		for(int j = 0; j < rem[i].size(); j++) t.del(rem[i][j]);
		for(int j = 0; j < d[i].size(); j++)
		{
			int D = d[i][j];
			int cnt = t.lower(D);
			ans[D]+=cnt;
		}
	}
	for(int i = 1; i <= m; i++)
	{
		L[i]+=L[i-1];
		ans[i]+=L[i];
	}
	for(int i = 0; i < m; i++)
	{
		cout<<ans[i+1]<<'\n';
	}
}


Measured memory_bytes: 38656
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
  
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
 
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
	return r;
}
ll fact[N], invFact[N];

ll nCr(int n, int r){
	return fact[n] * invFact[r] % mod * invFact[n - r] % mod;
}
void solve()
{	
	int n, k;
	cin >> k >> n;
	if(k * 500 >= n) cout << "Yes";
	else cout << "No";
}


 
 
int main()
{
    Red;
  	// int T; cin >> T; while(T--)
    solve();
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 50
int dp[MAX];

int fibonacci(int n)
{
	if (n == 0 || n == 1) return 1;
	if (dp[n] != -1)return dp[n];
	return dp[n] = fibonacci(n - 1) + fibonacci(n - 2);
}

int main()
{
	for (int i = 0; i < MAX; i++)
	{
		dp[i] = -1;
	}

	int n;
	scanf("%d", &n);

	printf("%d\n", fibonacci(n));
}


Measured memory_bytes: 2756
from queue import Queue
import numpy as np

H,W = map(int,input().split())

B = []
for i in range(H):
    B_sub = []
    for j in input():
        if j == "#":B_sub.append(5)
        else: B_sub.append(-1)
    B.append(B_sub)
    
qy,qx = Queue(),Queue()
qy.put(0)
qx.put(0)

isok = True
while(isok):
    if qy.empty() and qx.empty(): break
    else:
        y,x = qy.get(),qx.get()
        if y==0 and x==0: B[y][x] = 0

        if y<H-1 and B[y+1][x]==5:
            B[y+1][x] = 0
            qy.put(y+1)
            qx.put(x)
            if 5 in B[y]: isok = False
        elif x<W-1 and B[y][x+1]==5:
            B[y][x+1] = 0
            qy.put(y)
            qx.put(x+1)
            if 5 in np.array(B).T[x]: isok = False
            
            
if isok:
    print("Possible")
else:
    print("Impossible")

Measured memory_bytes: 13928
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
ll pow(ll a,ll b)
{
    ll ans=1;
    while(b!=0)
    {
        if(b%2==1)
        {
            ans=((ans%mod)*(a%mod))%mod;
        }
        a=((a%mod)*(a%mod))%mod;
        b=b/2;
    }
    return ans%mod;
}
int main()
{
    ll n,k;
    cin>>n>>k;
    ll count[k+1];
    memset(count,0,sizeof(count));
    count[k]=1;
   
    ll ans=k;
    for(int i=k-1;i>=1;i--)
    {
        ll rem=(ll)k/i;
        count[i]=pow(rem,n);
        for(int j=i+i;j<=k;j+=i)
        {
            count[i]=count[i]-count[j]+mod;
            if(count[i]>=mod)
            count[i]=count[i]-mod;
        }
        ans=(ans%mod+(count[i]*i)%mod)%mod;
        
        
    }
    cout<<ans%mod<<endl;
}

Measured memory_bytes: 4400
#include <bits/stdc++.h>
#include <map> // pair
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<int>a(N);
  for(int i=0;i<N;i++){
    cin>>a.at(i);
  }
  string ans ="YES";
  sort(a.begin(),a.end());
  for(int i=1;i<N;i++){
    if(a.at(i-1)==a.at(i)){
      ans = "NO";
      break;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    int l, r, d, ans = 0;
    cin >> l >> r >> d;
    for(int i = l; i < r + 1; ++i){
        if(i % d == 0) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

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

    int n;
    cin >> n;
    int a[n], dp[n];
    for(int i=0; i<n; ++i) cin >> a[i];
    dp[0] = 0;
    dp[1] = abs(a[1]-a[0]);
    for(int i=2; i<n; ++i){
        dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]), dp[i-2]+abs(a[i]-a[i-2]));
    }
    cout << dp[n-1];

    return 0;
} 

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

using namespace std;

using int64 = long long;

struct Edge {
  int from, to;
};

// Verified: ABC131F
vector<vector<int>> ConnectedComponents(const vector<vector<Edge>>& graph) {
  int n = graph.size();
  vector<vector<int>> components;
  vector<int> visited(n);

  function<void(int)> dfs = [&](int v) {
    if (visited[v]) return;
    visited[v] = true;
    components[components.size() - 1].push_back(v);
    for (auto e : graph[v]) {
      if (visited[e.to]) continue;
      dfs(e.to);
    }
  };

  for (int s = 0; s < n; s++) {
    if (visited[s]) continue;
    components.push_back(vector<int>());
    dfs(s);
  }
  return components;
}

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

  int n, m;
  cin >> n >> m;

  vector<vector<Edge>> graph(n);
  for (int i = 0; i < m; i++) {
    int x, y, z;
    cin >> x >> y >> z;
    x--;
    y--;
    graph[x].push_back(Edge({x, y}));
    graph[y].push_back(Edge({y, x}));
  }
  auto connected_components = ConnectedComponents(graph);
  cout << connected_components.size() << endl;
}


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

#define LLINF (1LL<<60)
typedef long long ll;

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)

template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<typename T> inline T divrup(T a, T b) { if (a % b) return a/b+1; else return a/b;}

#define dbg_v1(i,V) do{cout<<"-v1----\n";rep(i,V.size())cout<<" "<<i<<"\t:"<<V[i]<<endl;cout<<endl;}while(0)
#define dbg_v2(i,k,V) do{cout<<"-v2----\n";rep(i,V.size()){rep(k,V[0].size())cout<<" "<<V[i][k];cout<<endl;}}while(0)

//C++14 (GCC 5.4.1)
int main() {
    int A,B,C,X,Y;
    cin >>A>>B>>C>>X>>Y;    
    //-----------------------------------
    int AB=min(X,Y);
    int Adake=X-AB;
    int Bdake=Y-AB;

    ll ans=0;
    ans+=min(A+B,2*C)*AB;
    ans+=min(A,2*C)*Adake;
    ans+=min(B,2*C)*Bdake;

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

Measured memory_bytes: 256
def CountingSort(arrA,arrB,k)
  arrC=Array.new()
  0.upto(k) do |i|
    arrC[i]=0
  end
  1.upto(@n) do |j|
    arrC[arrA[j]]+=1
  end
  1.upto(k) do |i|
    arrC[i]=arrC[i]+arrC[i-1]
  end
  @n.downto(1) do |j|
    arrB[arrC[arrA[j]]]=arrA[j]
    arrC[arrA[j]]-=1
  end
end
@n=gets.to_i
arr=gets.split.map(&:to_i)
arr.unshift(0)
res=Array.new()
CountingSort(arr,res,10001)
res.shift
puts res.join(' ')

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

int main() {
	long long X;
	cin >> X;
	long long okane = 100;
	long long count = 0;
	while (okane<X) {
		okane = okane *1.01;
		count++;
	}
	cout << count << endl;
}

Measured memory_bytes: 3564
#include <iostream>
#include <iomanip>
using namespace std;
int main(){
	while(1){
	int n; cin >> n ;
	if(!n) break;
	int num[10][10];
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++) cin >> num[i][j];
	for(int i=0;i<n;i++){
		int sum=0;
		for(int j=0;j<n;j++){
			sum+=num[i][j];
			// if(j) cout << ' ' ;
			cout.width(5);
			cout << num[i][j] ;
		};
		cout.width(5);
	cout << sum << '\n' ;
	};
	int* sum=new int[n]; int nsum=0;
	for(int i=0;i<n;i++){
		sum[i]=0;
		// if(i) cout << ' ' ;
		for(int j=0;j<n;j++) sum[i]+=num[j][i];
		cout.width(5);
		cout << sum[i] ;
		nsum+=sum[i];
	};
	cout.width(5);
	cout << nsum << '\n' ;
	};
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#define int long long
using pii=std::pair<int,int>;
using namespace std;

int a, b, c, k;
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> a >> b >> c >> k;
    for(int i = 0; i <= k; i++)
        for(int j = 0; i + j <= k; j++)
            for(int l = 0; i + j + l <= k; l++)
            {
                int newa = a << i, newb = b << j, newc = c << l;
                if(newb > newa && newc > newb)
                {
                    cout << "Yes\n";
                    return 0;
                }
            }
    cout << "No\n";
    return 0;
}

Measured memory_bytes: 3648
N, K = map(int, input().split())
S = list(input())
s = S[K-1]
if s == 'A':
    S[K-1] = 'a'
elif s == 'B':
    S[K-1] = 'b'
else:
    S[K-1] = 'c'
print(*S, sep='')

Measured memory_bytes: 3060
import java.util.*;

public class Main {

    static final int MOD=1000000007;


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long a = sc.nextLong();
        long b = sc.nextLong();
        long sum = a+b;
        long ans = 0;
        long temp = n/sum;
        ans += temp*a;
        n-=temp*sum;
        ans+=Math.min(n,a);
        System.out.println(ans);



    }
}




Measured memory_bytes: 23380
n, k = map(int, input().split())
a_list = []
b_list = []
for i in range(n):
    a, b = map(int, input().split())
    a_list.append(a)
    b_list.append(b)

dic = {}
for i in range(n):
    a = a_list[i]
    b = b_list[i]
    if a in dic.keys():
        tmp = dic[a]
        dic[a] = tmp + b
    else:
        dic[a] = b
count = 0
sorted_dic = sorted(dic.items())
for a, b in sorted_dic:
    count += b
    if count >= k:
        print(a)
        exit()

Measured memory_bytes: 19260
n = int(input())
a = [int(_) for _ in input().split()]

sum_a = sum(a)

ai_sum = 0
for i in range(0, n-1):
    ai_sum += a[i]
    if i == 0:
        min_gap = abs(ai_sum * 2 - sum_a)
    if abs(ai_sum * 2 - sum_a) <= min_gap:
        min_gap = abs(ai_sum * 2 - sum_a)

print(min_gap)

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define IN freopen("C.in","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define DBG printf("Hi\n")
#define i64 long long int
#define ui64 unsigned long long int
#define eps (1e-10)
#define xx first
#define yy second
#define ln 17
#define off 2

#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL)

using namespace __gnu_pbds;
using namespace std ;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef pair<int,int> pii;

#define log 20
#define mod 998244353LL
#define maxn 200005
#define INF 1000000000

char s[55] ;

int main()
{
    i64 a , v , b , w , t ;

    scanf("%lld %lld %lld %lld %lld",&a,&v,&b,&w,&t) ;

    if( abs(b-a) <= t*(v-w) ) printf("YES\n") ;
    else printf("NO\n") ;

    return 0 ;
}


Measured memory_bytes: 3664
import math  # noqa
import bisect  # noqa
import queue  # noqa


if __name__ == '__main__':
    H, W = map(int, input().split())
    N = int(input())
    A = list(map(int, input().split()))

    que = queue.Queue()
    for i, a in enumerate(A):
        que.put((a, i + 1))

    field = [[0 for _ in range(W)] for _ in range(H)]
    num, color = que.get()
    for i in range(0, H):
        if i % 2 == 0:
            j_range = range(0, W)
        else:
            j_range = range(W - 1, -1, -1)
        for j in j_range:
            if num == 0:
                num, color = que.get()
            field[i][j] = color
            num -= 1

    for row in field:
        print(*row)


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

using namespace std;

#define llong long long int
#define ldouble long double
#define rep(i, n) for (int i = 0; i < n; ++i) 
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define stl_repr(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

constexpr static int MOD = 1000000000 + 7;
constexpr static int inf = INT_MAX / 2;
constexpr static llong INF = 1LL << 31;
constexpr static int dx[] = {1, 0, -1, 0};
constexpr static int dy[] = {0, 1, 0, -1};

template<typename T> struct UF {
    vector<int> par;
    vector<T> sz;

    UF(int n) {
        par.resize(n);
        sz.resize(n);
        for (int i = 0; i < n; ++i) {
            par[i] = i;
            sz[i] = 1;
        }
    }

    int find_root(int x) {
        return par[x] == x ? x : par[x] = find_root(par[x]);
    }

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

    void unite(int x, int y) {
        x = find_root(x);
        y = find_root(y);
        if (x == y) return;
        
        if (sz[x] < sz[y]) swap(x, y);
        sz[x] += sz[y];
        par[y] = x;
    }

    T size_of_tree(int x) {
        return sz[find_root(x)];
    }
};

int main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, k;
    cin >> n >> k;
    UF<int> uf(n);
    rep(i, k) {
        int x, y, z;
        cin >> x >> y >> z;
        --x, --y;
        uf.unite(x, y);
    }

    int ans = 0;
    vector<bool> check(n, false);
    rep(i, n) {
        if (! check[uf.find_root(i)]) ++ans, check[uf.find_root(i)] = true;
    }

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

Measured memory_bytes: 1024
// Quick Sort
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 100000
#define INFTY 1000000000

typedef struct{
  char suit;
  int value;
}card;

void QuickSort(card*, int, int);
int Partition(card*, int, int);
void merge(card*, int, int, int);
void mergeSort(card*, int, int);

int main(){
  int i, n;
  card A[MAX], B[MAX];

  scanf("%d", &n);
  for(i=0; i < n; i++){
    scanf("%s %d", &A[i].suit, &A[i].value);
    B[i] = A[i];
  }
  
  QuickSort(A, 0, n-1); // クイックソートを実行
  mergeSort(B, 0, n); // 安定かどうかの確認のため安定なソートであるマージソートを使う

  for(i=0; i < n; i++){
    if(A[i].suit != B[i].suit){
      printf("Not stable\n");
      break;
    }
  }
  if(i == n)printf("Stable\n");
  
  for(i=0; i < n; i++){
    printf("%c %d\n", A[i].suit, A[i].value);  
  }
  
  return 0;
}

void QuickSort(card *A, int p, int r){
  int q;
  if(p < r){
    q = Partition(A, p, r);
    QuickSort(A, p, q-1);
    QuickSort(A, q+1, r);
  }
}

int Partition(card *A, int p, int r){
  int i, j;
  card swap;

  // 配列の要素0からiまでは基準A[r]より小さい値、
  // 要素i+1からr-1までは基準A[r]より大きい値を格納していく
  i = p-1;
  for(j=p; j < r; j++){ // 基準A[r]の手前の要素までループ
    if(A[j].value <= A[r].value){
      i++;
      swap=A[i];  A[i]=A[j];  A[j]=swap; // A[i]とA[j]を交換
    }
  }
  swap=A[i+1];  A[i+1]=A[r];  A[r]=swap; // 最後にA[i+1]A[r]を交換
  return i+1; // パーティションの基準となる要素を返す
}

void merge(card *A, int left, int mid, int right){
  int i, j, k, n1, n2;
  card L[MAX], R[MAX];
  n1 = mid - left;
  n2 = right - mid;
  for(i=0; i < n1; i++){
    L[i] = A[left + i];
  }
  for(i=0; i < n2; i++){
    R[i] = A[mid + i];
  }
  L[n1].value = INFTY; // 番兵を設置
  R[n2].value = INFTY; // 番兵を設置
  i = 0;
  j = 0;
  for(k=left; k < right; k++){
    if(L[i].value <= R[j].value){
      A[k] = L[i];
      i++;
    }
    else{
      A[k] = R[j];
      j++;
    }
  }
}

void mergeSort(card *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: 4008
#include <bits/stdc++.h>

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int main() {
  int n, a, b;
  cin >> n >> a >> b;
  cout << ((b - a) % 2 == 0 ? "Alice" : "Borys") << endl;
}


Measured memory_bytes: 256
s = input()
a = ""
b = ""
if len(s) % 2 == 1:
  s = s[:len(s)-1]
  a = s[:len(s)//2]
  b = s[len(s)//2:]
  if a == b:
    print(len(s))
    exit()

while len(s) > 0:
  s = s[:len(s)-2]
  a = s[:len(s)//2]
  b = s[len(s)//2:]
  if a == b:
    print(len(s))
    break

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


int main(){
    int r;
    cin >> r;
    
    cout << r*r << endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int[] num = new int[5];
    int t = 0;//入れ替え用
    int sum = 0;
    for(int i=0; i <= 4; i++){
    num[i] = sc.nextInt();
    if(i!=0){
        if((num[i]%10)!=0){
         if((num[i-1]%10) < (num[i]%10)){
            t = num[i-1];
            num[i-1] = num[i];
            num[i] = t;
         }
        }else if((num[i]%10 == 0)){
            if((num[i-1]%10) > (num[i]%10)){
            t = num[i-1];
            num[i-1] = num[i];
            num[i] = t;
         }
        }
    }
  }

    for(int i=0; i <= 3; i++){
        if((num[i] % 10) == 0){
        sum += num[i];
        //System.out.println(num[i]);
    }else if((num[i] % 10) != 0){
        sum = sum + num[i] + (10 - num[i]%10);
        //System.out.println(num[i]);
    }
    }
        sum = sum + num[4];
        System.out.println(sum);
  }
}

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

#define ff first
#define ss second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define boost ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define check(x) cout << #x << " : " << (x) << endl
#define inf LLONG_MAX
#define all(v) v.begin(),v.end() 
#define allr(v) v.rbegin(),v.rend() 
//#define endl '\n'  
#define mod 998244353
typedef  long long ll; 
typedef  unsigned long long ull; 
//using u64 = uint64_t; 
//using u128 = __uint128_t;
typedef vector< ll > edge; 
typedef pair< ll , bool > mypair;
typedef priority_queue <ll> max_heap;
typedef priority_queue <ll, vector<ll>, greater<ll> > min_heap;
const ll N=1e5+20;

int main()
{
	boost;
	std::vector<double> po(32);
	po[0]=1;
	for(ll i=1;i<32;i++) po[i]=po[i-1]*2;
	double ans=0;
	ll n,k;
	cin>>n>>k;
	for(ll i=1;i<=n;i++)
	{
		ans+=((double)1/(*lower_bound(all(po),(double)k/(double)i)));
	}
	ans/=n;
	cout<<fixed <<setprecision(15)<<ans<<endl;	


	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL

int main() {
	int n; cin >> n;
	string s; cin >> s;
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		string t; cin >> t;
		for (int i = 0; i < t.size(); i++) { //テ・ツ按敕」ツつ?」ツ?ョテヲツ鳴?・ツュツ?
			if (s[0] != t[i])continue;
			//cout << i << " " << endl;
			for (int j = 1; i + 1 + (s.size() - 1)*j <= t.size(); j++) { //テゥツ鳴禿ゥツ堋?
				for (int k = 1; k < s.size(); k++) { //2テヲツ鳴?・ツュツ療ァツ崢ョテ、ツサツ・テゥツ卍?
					//cout << " " << i + j*k;
					if (s[k] != t[i + j*k])break;
					if (k == s.size() - 1) {
						cnt++;
						i = t.size();
						j = i + 1 + (s.size() - 1)*j + 1;//テ」ツδォテ」ツδシテ」ツδ曜テ」ツつ津ヲツ環愿」ツ?妥」ツつ?
						break;
					}
				}
				//cout << endl;
			}
			//cout << endl;
		}
	}
	cout << cnt << endl;
	return 0;
}

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

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

long long MOD = 1000000000 + 7;

int main(){
  int N,M;
  cin >> N >> M;
  vector<vector<ll>> v(8, vector<ll>(N));

  for(int i= 0; i < N; i++){
    ll x,y,z;
    cin >> x >> y >> z;
    v.at(0).at(i) = x + y + z;
    v.at(1).at(i) = x - y + z;
    v.at(2).at(i) = x + y - z;
    v.at(3).at(i) = x - y - z;
    v.at(4).at(i) = -x + y + z;
    v.at(5).at(i) = -x - y + z;
    v.at(6).at(i) = -x + y - z;
    v.at(7).at(i) = -x - y - z;
  }
  ll max_val = 0;
  for(int i =0 ; i < 8; i++){
    sort(v.at(i).rbegin(), v.at(i).rend());
    ll tmp = 0;
    for(int j = 0; j < M; j++){
      tmp += v.at(i).at(j);
    }
    max_val = max(tmp, max_val);
  }
  cout << max_val << endl;
}


Measured memory_bytes: 256
n,k=map(int,input().split())
l=[0]*n
for i in range(k):
    d=int(input())
    A=map(int,input().split())
    for a in A:
        l[a-1]+=1
count=0
for i in range(n):
    if l[i]==0:
        count+=1
print(count)

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

int main()
{

    map<string, int> days{
        {"SUN", 7},
        {"MON", 6},
        {"TUE", 5},
        {"WED", 4},
        {"THU", 3},
        {"FRI", 2},
        {"SAT", 1}
        };
    string S;
    cin>>S;

    cout << days[S] << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 924844033
typedef long long ll;
ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
int pow(int x,int y){
	int ret=1;
	while(y){
		if(y&1)ret=1ll*ret*x%mod;
		x=1ll*x*x%mod;y>>=1;
	}
	return ret;
}
int fact[200010],ifact[200010];
int C(int n,int m){if(n<m)return 0;return 1ll*fact[n]*ifact[m]%mod*ifact[n-m]%mod;}
int fir[200010],dis[400010],nxt[400010],id;
void link(int a,int b){nxt[++id]=fir[a],fir[a]=id,dis[id]=b;}
int siz[200010];
void dfs(int x){
	siz[x]=1;
	for(int i=fir[x];i;i=nxt[i]){
		if(siz[dis[i]])continue;
		dfs(dis[i]);
		siz[x]+=siz[dis[i]];
	}
}
int A[524341],B[524341],rev[524341],N,lg;
const int G=19260817,iG=pow(G,mod-2);
void ntt(int*A,int N,int t){
	for(int i=0;i<N;++i)if(i<rev[i])std::swap(A[i],A[rev[i]]);
	for(int o=1;o<N;o<<=1){
		int W=pow(t?G:iG,(mod-1)/(o<<1));
		for(int*p=A;p!=A+N;p+=o<<1)
			for(int i=0,w=1;i<o;++i,w=1ll*w*W%mod){
				int t=1ll*p[i+o]*w%mod;
				p[i+o]=(p[i]-t+mod)%mod;
				p[i]=(p[i]+t)%mod;
			}
	}
	if(!t){
		int iN=pow(N,mod-2);
		for(int i=0;i<N;++i)A[i]=1ll*A[i]*iN%mod;
	}
}
int main(){
#ifdef XZZSB
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	int n=gi(),a,b;
	fact[0]=1;for(int i=1;i<=n;++i)fact[i]=1ll*fact[i-1]*i%mod;
	ifact[n]=pow(fact[n],mod-2);for(int i=n;i;--i)ifact[i-1]=1ll*ifact[i]*i%mod;
	for(int i=1;i<n;++i)a=gi(),b=gi(),link(a,b),link(b,a);
	dfs(1);
	for(int i=2;i<=n;++i)++A[n-siz[i]],++A[siz[i]];
	for(int i=1;i<=n;++i)A[i]=1ll*A[i]*fact[n-i]%mod;
	for(int i=0;i<=n;++i)B[i]=ifact[i];
	N=1;while(N<n*2+3)N<<=1,++lg;
	for(int i=0;i<N;++i)rev[i]=(rev[i>>1]>>1)|((i&1)<<lg-1);
	ntt(A,N,1),ntt(B,N,1);
	for(int i=0;i<N;++i)A[i]=1ll*A[i]*B[i]%mod;
	ntt(A,N,0);
	for(int i=1;i<=n;++i)printf("%d\n",(1ll*n*C(n,i)-1ll*ifact[i]*A[n-i]%mod+mod)%mod);
	return 0;
}


Measured memory_bytes: 19840
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>
#include <functional>
#include <cassert>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define ASSERT(cond,mes) assert(cond && mes)

using namespace std;
using ll = long long;

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
    REP(i, (int)v.size())os << v[i] << endl;
    return os;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << fixed << setprecision(20);

    int A, B;
    cin >> A >> B;

    if (abs(A - B) % 2 == 0) {
        cout << max(A, B) - abs(A - B) / 2 << endl;
    }
    else {
        cout << "IMPOSSIBLE" << endl;
    }
    return 0;
}

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

int main(){
  string s;
  cin >> s;
  int a=0;
  int b=0;
  int c=0;
  for(int i=0;i<3;i++){
    if(s[i] == 'a')
      a++;
    if(s[i] == 'b')
      b++;
    if(s[i] == 'c')
      c++;
  }
  if( a==1 && b==1 && c==1){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < (n); i++)
// 素因数分解
vector<pair<long long, long long>> prime_factorize(long long n)
{
  vector<pair<long long, long long>> res;
  for (long long p = 2; p * p <= n; ++p)
  {
    if (n % p != 0)
      continue;
    int num = 0;
    while (n % p == 0)
    {
      ++num;
      n /= p;
    }
    res.push_back(make_pair(p, num));
  }
  if (n != 1)
    res.push_back(make_pair(n, 1));
  return res;
}
int main()
{
  ll n;
  cin >> n;
  auto pf = prime_factorize(n);
  ll ans = 0;
  for (auto i : pf)
  {
    ll e = i.second;
    ll j = 1;
    ll k = 0;
    while (e >= j)
    {
      e -= j++;
      k++;
    }
    ans += k;
  }
  cout << ans << endl;
  return 0;
}

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

int main(){
    while(1){
    int n; cin >> n;
    if(n == 0) break;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    //for(int i = 0; i < n; i++) cout << a[i] << " ";
    int ans = a[1] - a[0];
    for(int i = 1; i < n-1; i++) ans = min(ans, a[i + 1] - a[i]);
    cout << ans << endl;
    }
    return 0;
    
}

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

const ll MAXN = 200001;

ll N, ans=0, tmp=0;
vector<ll> A(MAXN, 0);
map<ll, ll> M;
signed main(){
    cin >> N;
    M[0]++;
    for(int i=1;i<=N;i++) {
        ll a;
        cin >> a;
        A[i] = A[i-1]+a;
        M[A[i]]++;
    }
    for(map<ll, ll>::iterator itr=M.begin();itr!=M.end();itr++) {
        pair<ll, ll> p = *itr;
        if(p.second>1) ans += p.second*(p.second-1)/2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 14336
#include <stdio.h>

int main(void)
{
    int h, w, n, max, ans;

    scanf("%d", &h);
    scanf("%d", &w);
    scanf("%d", &n);

    max = h>w? h: w;
    ans = n/max;
    if( ans*max==n )
        printf("%d", ans);
    else
        printf("%d", ans+1);

    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<set>
#include<map>
using namespace std;
using ulong = unsigned long;
using ll = long long;
const int M = 1e9 + 7;
#pragma unused(M)

int main(){
	string s;
	cin >> s;
	int n = s.size();
	int p = 0, g = 0;
	for(char c : s){
		if(c == 'p'){
			p++;
		}else{
			g++;
		}
	}
	int mp = n / 2, mg = n - mp;
	// int dp = mp - p, dg = g - dg;
	cout << mp - p << endl;
	// cout << (n % 2 == 0 ? 0 : -1) - p_g << endl;
	return 0;
}



Measured memory_bytes: 512
N = int(input())
S = []
for i in range(N):
    s = input()
    S.append(s)

ans = []
chars = "abcdefghijklmnopqrstuvwxyz"
for c in chars:
    cnt = 999
    for i in range(N):
        cnt = min(cnt, S[i].count(c))
    for i in range(cnt):
        ans.append(c)

print("".join(ans))


Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main(int argc, const char *argv[]) {
  int x;
  cin >> x;

  if(x == 3 || x == 5 || x == 7){
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
using namespace std;
#define int long long


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

    int n,m; cin >> n >> m;
    int a = m / n;

    int ans;
    
    for(int i = a;;i --){
        if(m % i == 0){
            ans = i;
            break;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        //String str = sc.next();
        double A = sc.nextDouble();
        double B = sc.nextDouble();
        double rA = 0.08;
        double rB = 0.1;
        
        for(int i=12; i<1001; i++){
            if(Math.floor(i*rA) == A && Math.floor(i*rB) == B){
                System.out.println(i);
                return;
            }
        }
        System.out.println(-1);
    }
}

Measured memory_bytes: 37368
import itertools

N,M,R=map(int,input().split())
r=list(map(int,input().split()))
n=len(r)

graph=[[float("inf")]*N for _ in range(N)]
for i in range(M):
    A,B,C=map(int,input().split())
    A-=1
    B-=1
    graph[A][B]=C
    graph[B][A]=C

def dijkstra(start,cost):
    d=[float("inf")]*N
    used=[False]*N
    d[start]=0

    while True:
        v=-1
        for i in range(N):
            if (not used[i]) and (v==-1):
                v=i
            elif (not used[i]) and d[i]<d[v]:
                v=i
        if v==-1:
            break
        used[v]=True

        for j in range(N):
            d[j]=min(d[j],d[v]+cost[v][j])
    
    return d

d=[]
for i in range(N):
    d.append(dijkstra(i,graph))

ans=float("inf")
for city in itertools.permutations(r):
    tmp=0
    for i in range(n-1):
        tmp+=d[city[i]-1][city[i+1]-1]
    ans=min(ans,tmp)
print(ans)

Measured memory_bytes: 50904
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <numeric>




typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define _GLIBCXX_DEBAC
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/
//copy(v1.begin(), v1.end(), back_inserter(v2));
using namespace std;

ll gcd(ll a, ll b) {
	ll c;
	if (a < b) {
		c = a; a = b; b = c;
	}
	while (b != 0) {
		c = a % b; a = b; b = c;
	}
	return a;
}

ll lcm(ll a, ll b) {
	ll c;
	c = a * b / gcd(a, b);
	return c;
}

int sort_greater(int m,int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(),greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
		return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

int a_z()
{
	for (int i = 0; i <= ('Z' - 'A'); i++) {
		cout << (char)('A' + i);
	}
	return 0;
}

int selecttionsort(int a[], int n) {
	int t,sw = 0, minj;
	for (int i = 0; i < n - 1; i++) {
		minj = i;
		for (int j = 0; j < n - 1; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		t = a[i]; a[i] = a[minj]; a[minj] = t;
		if (i != minj) sw += 1;

	}
	return sw;
}

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

const ll mod = 1000000007;
struct mint {
	ll x;
	mint(ll x = 0):x(x%mod){}
	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 {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		res -= a;
	}
	mint operator*(const mint a)const {
		mint res(*this);
		return res *= a;
	}
};

map<string, int> memo;

using P=pair<int, int>;

struct Clock {
	int hour, minute, second;
	void set(int h, int m, int s) {
		hour = h; minute = m; second = s;
	}
	string to_str() {
		string h, m, s;
		h = to_string(hour);
		m= to_string(minute);
		s= to_string(second);
		if (h.size() < 2) h = "0" + h;
		if (m.size() < 2) m = "0" + m;
		if (s.size() < 2) s = "0" + s;
		return h + ":" + m + ":" + s;
	}
	void shift(int diff_second) {
		int h, m;
		h = diff_second / 3600;
		m = diff_second / 60;
		diff_second %= 60;
		second += diff_second;
		
	}
};


/*void dfs(int v, int p = -1) {
	for (int u : to[v]) {
		if (u == p) continue;
		ans[u] += ans[v];
		dfs(u, v);
	}
}*/
int main() {
	string s;
	cin >> s;
	ll ans = 0;
	rep(i, s.size()) {
		ll a = 0;
		for (ll j = i; j < s.size(); j++) {
			if (s[j] == 'A' || s[j] == 'C' || s[j] == 'G' || s[j] == 'T') {
				a++;
			}
			else break;
		}
		ans = max(ans, a);
	}
	cout << ans;
	return 0;
}










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

using namespace std;

int main() {

	int n, m, cnt=0, su = 0;
	vector<int> v;

	cin >> n >> m;
	v.resize(n);
	for (int i = 0;i < n;i++) {
		cin >> v[i];
		su += v[i];
	}

	for (int i = 0;i < v.size();i++) {
		if (4 * m*v[i] >= su) cnt++;
	}

	if(m<=cnt) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


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

char raw[MAX][15];
char *str[MAX];

int mstrcmp(char* a, char* b)
{
	return (strcmp(a, b) < 0);
}

int main(void)
{
	int N;
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> raw[i];
		sort(raw[i], raw[i] + 10);
		str[i] = raw[i];
	}
	sort(str, str + N, mstrcmp);
	long long ans = 0;
	int start = 0;
	while (start < N)
	{
		int end = start;
		while (end < N && !strcmp(str[start], str[end])) end++;
		ans += 1LL * (end - start - 1) * (end - start) / 2;
		start = end;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)n;i++)
#define REP1(j,n) for(int j=0;j<(int)n;j++)
#define REPD(i,n) for(int i=n;i>=0;i--)
#define REPD1(j,n) for(int j=n;j=>0;j--)
#define REPS(i,n) for(int i=1;i<=(int)n;i++)
#define REPS1(j,n) for(int j=1;j<=(int)n;j++)
#define rep(i,a,n) for(int i=a;i<(int)n;i++)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;

int main(void) {
	int a, b,c;
	cin >> a >> b>>c;
	if (a + b + 1 >= c) cout << b + c << endl;
	else cout << b + (a + b + 1) << endl;
	return 0;

}



Measured memory_bytes: 256
def rec(i, g, count, rem):
    global ans
    if i == 0:
        # 総得点がGを超えていなければ、remの中の最高配点の問題を解く
        if g < G:
            # 解く問題
            use = max(rem)
            c = min(pc[use-1][0], -(-(G-g) // (use*100)))
            count += c
            g += use*100 * c
            
            
        if g >= G:
            ans = min(ans, count)
            
    else:
        # 全部解かない
        rec(i-1, g, count, rem)
        # 全部解く
        rem[i] = 0
        rec(i-1, g+i*100*pc[i-1][0]+pc[i-1][1], count+pc[i-1][0], rem)
        rem[i] = i

# 入力
D, G = map(int, input().split())
pc = [[int(i) for i in input().split()] for j in range(D)]
# 解いてない問題リスト
rem = [i for i in range(D+1)]
ans = float("inf")

rec(D, 0, 0, rem)

print(ans)

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


int main()
{
    int n,k;
    std::cin >> n >> k; // n : 宝石の数 / k : 操作の数
    int max = -1000000000;
    std::deque<int> deq;
    for(int i = 0; i < n; i++){int t; std::cin >>t ; deq.push_back(t);}
    for(int a = 0; a <= std::min(n,k); a++){            //左端
        for(int b = 0; a + b <= std::min(n,k); b++){    //右端
            std::vector<int> cur;
            for(int i = 0; i < a; i++){cur.push_back(deq[i]);}
            for(int i = 0; i < b; i++){cur.push_back(deq[n - 1 - i]);}
            std::sort(cur.begin(),cur.end(),std::greater<int>());
            for(int i = 0; i < std::min(a + b, k - (a + b)); i++){
                if(cur.back() < 0)cur.pop_back();
            }
            max = std::max(std::accumulate(cur.begin(),cur.end(),0),max);
        }
    }
    std::cout << max << std::endl;
}

Measured memory_bytes: 256