akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <algorithm>
using namespace std;

const int N = 1e5+10;

int T[N][3];
int DP[N][3];
int n;

int licz(int i, int j){
  int res = 0;
  for(int k=0; k<3; k++){
    if(k == j)continue;
    res = max(res, DP[i-1][k] + T[i][j]);
  }
  return res;
}

int main(){
  scanf("%d",&n);
  for(int i=1; i<=n; i++){
    for(int j=0; j<3; j++)scanf("%d",&T[i][j]);
  }
  for(int j=0; j<3; j++)DP[1][j] = T[1][j];
  for(int i=2; i<=n; i++){
    for(int j=0; j<3; j++){
      DP[i][j] = licz(i,j);
    }
  }
  int res = 0;
  for(int j=0; j<3; j++){
    res = max(res, DP[n][j]);
  }
  printf("%d\n",res);

  return 0;
}


Measured memory_bytes: 2560
program sample
	integer ::A,B,C
    
    read(*,*) A,B   
    C=A+B
    
    if (mod(A,3)==0 .or. mod(B,3)==0 .or. mod(C,3)==0) then
    	write(*,*) 'Possible'
    else
    	write(*,*) 'Impossible'
    end if
    stop
end program sample



Measured memory_bytes: 2636
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
#define INF 10000000000000000
#define rep(i,n) for(int i=0;i<n;i++)
signed main(){
	string s;
	cin>>s;
	int cnt=0;
	rep(i,s.size())if(s[i]=='x')cnt++;
	if(cnt>=8)puts("NO");
	else puts("YES");
	return 0;
}


Measured memory_bytes: 256
from collections import deque
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
B = [0]*M
dic = {}
for i in range(M):
    c,b = list(map(int,input().split()))
    B[i] = b
    if dic.get(b):dic[b] += c
    else:dic[b] = c
# print(dic)
A = deque(sorted(A))
B = deque(sorted(list(set(B)),reverse=True))
C = []

while A:
    b = B[0]
    if A[0]<b:
        A.popleft()
        C.append(b)
        dic[b] -= 1
        if dic[b]==0:
            B.popleft()
            if not B:break
    else:break
# print(dic[C[0]])
print(sum(A)+sum(C))

Measured memory_bytes: 124164
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		sc.close();
		
		long ans = 0;
		for(int a = 1;a <= N;++a) {
			int b = K-a;
			if(b <= 0)
				b += (-b / K + 1)*K;
			if((b + b) % K != 0)continue;
			if(b > N)continue;
			
			ans += (long)((N - b)/K + 1) * (long)((N - b)/K + 1);
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 22996
package main

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

const pi = math.Pi

var mod int = pow(10, 9) + 7
var Umod uint64 = 1000000007
var ans, cnt, sum int = 0, 0, 0

func main() {
	reader.Split(bufio.ScanWords)
	N, _ := strconv.Atoi(read())
	K, _ := strconv.Atoi(read())

	for b := 1; b <= N; b++ {
		ans += (N/b)*max(0, b-K) + max(0, N%b-K+1)
	}
	if K == 0 {
		ans -= N
	}
	fmt.Println(ans)
}

/*  ----------------------------------------  */

var reader = bufio.NewScanner(os.Stdin)

func read() string {
	reader.Scan()
	return reader.Text()
}

func lcm(x, y int) int {
	return (x / gcd(x, y)) * y
}

func gcd(x, y int) int {
	if x%y == 0 {
		return y
	} else {
		r := x % y
		return gcd(y, r)
	}
}

var fac [1000000]int
var finv [1000000]int
var inv [1000000]int

func combination_init() {
	fac[0], fac[1] = 1, 1
	finv[0], finv[1] = 1, 1
	inv[1] = 1

	// invは a^(-1) mod p
	// pをaで割ることを考える

	// p/a*(a) + p%a = p
	// p/a*(a) + p%a = 0          (mod p)
	// -p%a = p/a*(a)             (mod p)
	// -p%a *a^(-1)= p/a          (mod p)
	// a^(-1)= p/a * (-p%a)^(-1)  (mod p)
	// a^(-1) =

	for i := 2; i < 1000000; i++ {
		fac[i] = fac[i-1] * i % mod
		inv[i] = mod - inv[mod%i]*(mod/i)%mod
		finv[i] = finv[i-1] * inv[i] % mod
	}
}

func combination(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[y] * finv[x-y] % mod) % mod
	//return fac[x] / (fac[y] * fac[x-y])
}

func permutation(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[x-y] % mod) % mod
	//return fac[x] / fac[x-y]
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }
func ceil(x int) int   { return int(math.Ceil(float64(x))) }

type SortBy []int

func (a SortBy) Len() int           { return len(a) }
func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool { return a[i] < a[j] }

type PriorityQueue []int

func (h PriorityQueue) Len() int            { return len(h) }
func (h PriorityQueue) Less(i, j int) bool  { return h[i] > h[j] }
func (h PriorityQueue) Swap(i, j int)       { h[i], h[j] = h[j], h[i] }
func (h *PriorityQueue) Push(x interface{}) { *h = append(*h, x.(int)) }
func (h *PriorityQueue) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  int n;
  cin>>n;
  vector<int> p(n);
  rep(i,n)cin>>p[i];
  sort(p.begin(),p.end());
  reverse(p.begin(),p.end());
  cout << p[0]/2+accumulate(p.begin()+1,p.end(),0)<<endl;
  return 0;
}


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

int main() {
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> v(n, 0);
    rep(i, q) {
        int a;
        cin >> a;
        v[a-1]++;
    }
    for(auto &x : v) {
        cout << ((q - x) < k ? "Yes" : "No") << endl;
    }
}

Measured memory_bytes: 3720
N = gets.to_i
h = gets.split.map(&:to_i)

i = 0
ans = 0
while h.max > 0
  N.times do |i|
    if h[i] > 0
      h[i] -= 1
      # 最後の要素が水やり可能ならiを0に戻してans+=1
      if i == N-1
        ans += 1
      # 右隣が0なら水やり1回終了なのでans+=1
      elsif h[i+1] == 0
        ans += 1
      end
    end
  end
  # puts "#{h}"
end
puts ans

Measured memory_bytes: 1788
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <functional>
#include <map>
#include <set>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long
#define INF 10e9

using namespace std;
using P = pair<int, int>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

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

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

using Graph = vector<vector<int>>;
int N, Q;

vector<bool> seen;
vector<int> score;
vector<int> points;

void dfs(Graph &g, int v, int tmp_score) {
  seen[v] = true;
  score[v] = tmp_score + points[v];

  for (auto next_v : g[v]) {
    if (seen[next_v]) continue;

    dfs(g, next_v, tmp_score + points[v]);
  }
}

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

  Graph g(300000);

  rep(i, N-1) {
    int a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  points.assign(300000, 0);
  Rep(i, Q) {
    int p, q;
    cin >> p >> q;
    points[p] += q; 
  }

  seen.assign(300000, false);
  score.assign(300000, 0);

  dfs(g, 1, 0);

  rep(i, N-1) {
    cout << score[i] << " ";
  }
  cout << score[N] << "\n";
}

Measured memory_bytes: 30592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll N = 55, mod = 1e9 + 7;

#define temptts template <class T, class... Ts>
temptts int add(T f) { return f; } temptts int add(T f, Ts... ts) { return (f + add(ts...)) % mod; }
temptts int sub(T f) { return f; } temptts int sub(T f, Ts... ts) { return (f - sub(ts...) + 1ll * mod * mod) % mod; }
temptts int mul(T f) { return f; } temptts int mul(T f, Ts... ts) { return (1ll * f * mul(ts...)) % mod; }

int n;
char s[N], t[N];
int dp[N][3], f[N][3][3];

int32_t main() { cin.tie(0)->sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> s[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> t[i];
  }
  for (int i = 1; i <= n; i++) {
    if (s[i] == t[i]) {
      if (i == 1) {
        dp[i][0] = dp[i][1] = dp[i][2] = 1;
        continue;
      }
      dp[i][0] = add(dp[i - 1][1], dp[i - 1][2], f[i - 1][1][2], f[i - 1][2][1]);
      dp[i][1] = add(dp[i - 1][0], dp[i - 1][2], f[i - 1][0][2], f[i - 1][2][0]);
      dp[i][2] = add(dp[i - 1][0], dp[i - 1][1], f[i - 1][0][1], f[i - 1][1][0]);
    } else if (s[i] == s[i - 1]) {
      int c = i;
      if (i == 2) {
        for (int i = 0; i < 3; i++) {
          for (int j = 0; j < 3; j++) {
            if (i == j) continue;
            f[c][i][j] = 1;
          }
        }
        continue;
      }
      for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
          if (i == j) continue;
          int k = i ^ j ^ 0 ^ 1 ^ 2;
          f[c][i][j] = dp[c - 2][k];
          for (int u = 0; u < 3; u++) {
            for (int v = 0; v < 3; v++) {
              if (u == v) continue;
              if (u != i && v != j) {
                f[c][i][j] = add(f[c][i][j], f[c - 2][u][v]);
              }
            }
          }
        }
      }
    }
  }
  int ans = 0;
  if (s[n] == t[n]) for (int i = 0; i < 3; i++) {
    ans = add(ans, dp[n][i]);
  } else {
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        if (i == j) continue;
        ans = add(ans, f[n][i][j]);
      }
    }
  }
  cout << ans;
}

Measured memory_bytes: 3624
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 10**9
for i in range(M):
    x, y, c = map(int, input().split())
    ans = min(ans, a[x-1]+b[y-1]-c)
ans = min(ans, min(a)+min(b))
print(ans)


Measured memory_bytes: 66924
#include <iostream>
using namespace std;
int main()
{
    int n,num[100000]={0},count=0,i,ans=0;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>num[i];
    }
    for(i=0;i<n-1;i++){
        if(num[i]>=num[i+1]){
            count++;
            if(ans<count)
                ans=count;
        }
        else{
                if(ans<count)
                ans=count;
            count=0;
        }
    }
    cout<< ans<<endl;

    return 0;
}

Measured memory_bytes: 640
/// IN THE NAME OF GUITAR
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long int ll;
typedef pair<ll, ll> pll;

#define sz(x)                       (ll) x.size()
#define all(x)                      (x).begin(),(x).end()
#define F                           first
#define S                           second
#define lc                          id << 1
#define rc                          lc | 1

ll Pow(ll a, ll b, ll md, ll ans = 1) {
    for (; b; b >>= 1, a = a * a % md)
        if (b & 1)
            ans = ans * a % md;
    return ans % md;
}
 
const ll MAXN = 2e3 + 20;
const ll INF  = 1e18;
const ll MOD  = 1e9 + 7;
ll L[MAXN], R[MAXN], A[MAXN][MAXN], ps[MAXN][MAXN], n, m, ans;
stack<ll> st;

int main() {
	scanf("%lld%lld", &n, &m);
	for (ll i = 1; i <= n; i++) {
		string s;
		cin >> s;
		for (ll j = 1; j <= m; j++) {
			A[i][j] = (s[j - 1] == '#');
		}
	}
	for (ll i = 1; i < n; i++) {
		for (ll j = 1; j < m; j++) {
			ll cnt = A[i][j] + A[i + 1][j] + A[i][j + 1] + A[i + 1][j + 1];
			if (cnt & 1) ps[i][j] = 0;
			else ps[i][j] = ps[i - 1][j] + 1;
		}
	}
	ans = max(n, m);
	for (ll i = 1; i < n; i++) {
		while (sz(st)) st.pop();
		st.push(0);
		for (ll j = 1; j < m; j++) {
			while (sz(st) && ps[i][j] <= ps[i][st.top()]) st.pop(); 
			if (sz(st))
				L[j] = st.top();
			st.push(j);
		}
		while (sz(st)) st.pop();
		st.push(m);
		for (ll j = m - 1; j >= 1; j--) {
			while (sz(st) && ps[i][j] <= ps[i][st.top()]) st.pop();
			if (sz(st)) R[j] = st.top();
			st.push(j);
		}
		for (ll j = 1; j < m; j++) {
			ans = max(ans, (ps[i][j] + 1) * (R[j] - L[j]));
		}
	}
	printf("%lld\n", ans);
    return 0;
}
 

Measured memory_bytes: 66944
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <stdlib.h>

using namespace std;

//int main(int argc, char *argv[]){
int main(){

	int xi=0;
	int snuke=0;

	for(int i=1; i<6; i++)
	{
		//xi = atoi(argv[i]);
		cin >> xi;

		if(xi==i){
			continue;
		}else{
			snuke=i;
		}
	}

	cout << snuke << endl;

}

Measured memory_bytes: 3556
#include<bits/stdc++.h>
using namespace std;
const int N=2e6+5;
bitset<N>V;
int main()
{
    int n,s=0;
    scanf("%d",&n);
    V[0]=1;
    for(int i=0,x; i<n; i++)scanf("%d",&x),s+=x,V|=V<<x;
    for(int i=s/2;;i--)
    if(V[i])
    {
        printf("%d\n",s-i);
        return 0;
    }
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define MOD 1000000007
#define INF 1 << 30

using namespace std;
typedef long long ll;
typedef pair<int, int> pp;

int main(void) {
	int num, i, a, b;
	cin >> a >> b;
	if (a * 500 >= b)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    const ll MOD = 1e9+7;
    ll n;
    cin >> n;
    vector<vector<ll>> a(21,vector<ll>(21));
    for(i = 0;i < n;++i){
        rep(j,n){
            cin >> a.at(i).at(j);
        }
    }
    vector<vector<ll>> dp(22,vector<ll>(1ll << 21, 0));
    dp.at(0).at(0) = 1;
    for(i = 0;i < n;++i){
        for(int bit = 0;bit < (1ll << n);++bit){
            if(dp.at(i).at(bit) == 0) continue;
            for(j = 0;j < n;++j){
                if(a.at(i).at(j) && (bit & (1 << j)) == 0){
                    dp.at(i+1).at(bit | (1 << j)) += dp.at(i).at(bit)%MOD;
                    dp.at(i+1).at(bit | (1 << j)) %= MOD;
                }
            }
        }
    }
    cout << dp.at(n).at((1 << n)-1) << endl;
    return 0;
}

Measured memory_bytes: 377216
#include <stdio.h>
#include<iostream>
using namespace std;
int main()
{
	int a, b, i, j;
	while (1) {
		cin >> a >> b;
		if (a == 0 && b == 0) { break; }
		else {
			for (j = 1;j <= a;j++) {
				{ for (i = 1;i <= b;i++) {
					if (i % 2 == j % 2) {
						printf("#");
					}
					else { printf("."); }
					
				}printf("\n");

				}
			}
		}
			printf("\n");
		
	}
		return 0;
	
}


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

int main () {
    int i, m1,m2,m3,h[10];
    for(i=0;i<10;i++)
        cin >> h[i];
    for(i=0;i<10;i++) {
        if(h[i]>=m1) {m3=m2;m2=m1;m1=h[i];}
        else if(h[i]<m1&&h[i]>=m2) {m3=m2;m2=h[i];}
        else if(h[i]<m2&&h[i]>=m3) {m3=h[i];}
    }
    cout << m1 << endl;
    cout << m2 << endl;
    cout << m3 << endl;
}

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

int N, M;
int A[100];

int main() {
	int i;
	
	cin >> N >> M;
	for (i = 0; i < N; i++) cin >> A[i];
	
	int sumA = 0;
	for (i = 0; i < N; i++) sumA += A[i];
	
	int cnt = 0;
	for (i = 0; i < N; i++) {
		if (A[i] * 4 * M >= sumA) cnt++;
	}
	if (cnt >= M) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
N, P = [int(x) for x in input().split()]

import types, math, operator
import numpy as np
from math import sqrt
from collections import Counter
from itertools import product
from functools import reduce
class PrimeUtils:
    @staticmethod
    def _has_numpy():
        g = globals()
        m = g.get('np')
        if m is not None and isinstance(m, types.ModuleType):
            return  m.__name__ == 'numpy'
        return False
    @staticmethod
    def _primes_sieve_pp(n):
        sieve = [True] * (n + 1)
        for i in range(2, int(sqrt(n)) + 1):
            if sieve[i]:
                for j in range(i * i, n + 1, i):
                    sieve[j] = False
        return [i for i, x in enumerate(sieve[2:], 2) if x]
    @staticmethod
    def _primes_sieve_np(n):
        sieve = np.ones(n + 1, np.bool)
        sieve[0] = sieve[1] = False
        for i, v in enumerate(sieve[2:int(sqrt(n)) + 1], 2):
            if v: sieve[i*i::i] = False
        return np.nonzero(sieve)[0]
    @staticmethod
    def _primes_sieve_np_fast(n):
        n += 1
        sieve = np.ones(n//3 + (n%6 == 2), dtype=np.bool)
        check_upper = int(sqrt(n)) // 3
        for i, v in enumerate(sieve[1:check_upper + 1], 1):
            if v:
                k = (3*i + 1) | 1
                sieve[k* k           //3::2*k] = False
                sieve[k*(k-2*(i&1)+4)//3::2*k] = False
        sieve[0] = False
        return np.r_[2,3,((3*np.nonzero(sieve)[0] + 1)|1)]
    @classmethod
    def primes_sieve(cls, n):
        if cls._has_numpy():
            return cls._primes_sieve_np_fast(n)
        else:
            return cls._primes_sieve_pp(n)
    # Prime Factor Decomposition
    @classmethod
    def pfd(cls, n):
        primes = cls.primes_sieve(math.floor(n ** (1/N)))

        factors = []
        cur = n
        for p in primes:
            while True:
                div, rem = divmod(cur, p)
                if rem == 0:
                    factors.append(p)
                    cur = div
                else:
                    break
        # assert(cur == 1)
        return factors
    # List up aliquots
    @classmethod
    def aliquots(cls, n):
        pf = cls.pfd(n)
        pfc = Counter(pf)
        ppv = [[pow(p, i) for i in range(n+1)] for p,n in pfc.items()]
        if not ppv:
            return (1,)
        else:
            return map(lambda x: reduce(operator.imul, x), product(*ppv))

from collections import Counter
import functools, operator, itertools
if N == 1:
    print(P)
else:
    c = Counter(PrimeUtils.pfd(P))
    print(functools.reduce(operator.imul, itertools.chain([1], map(lambda x: x[0] ** (x[1]//N), filter(lambda x: x[1] >= N, c.items())))))

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

int n, A, B, C, l[10], ans;

void omgJaeyoung(int a, int b, int c, int idx, int cnt){
	if(idx == n){
		if(a == 0 || b == 0 || c == 0)	return;
		ans = min(ans, abs(A-a)+abs(B-b)+abs(C-c)+10*(cnt-3));
		return;
	}
	omgJaeyoung(a+l[idx], b, c, idx+1, cnt+1);
	omgJaeyoung(a, b+l[idx], c, idx+1, cnt+1);
	omgJaeyoung(a, b, c+l[idx], idx+1, cnt+1);
	omgJaeyoung(a, b, c, idx+1, cnt);
}

int main() {
	cin>>n>>A>>B>>C;
	for(int i = 0;i<n;i++)	cin>>l[i];
	ans = 987654321;
	omgJaeyoung(0, 0, 0, 0, 0);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define fs first
#define sc second
#define task "test"
using namespace std;
const ll N = 5e3 + 9;
const ll inf = 1e9 + 7;
typedef pair<ll,ll> LL;

ll a,b,k,t;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    if (fopen(task".inp", "r")){
        freopen(task".inp", "r", stdin);
        freopen(task".out", "w", stdout);
    }
    cin>>k>>a>>b;
    for (ll i = a;i <= b;i++){
        if (i%k == 0){
            cout<<"OK"; return 0;
        }
    }
    cout<<"NG";
}



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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
  ll n, m;
  cin >> n >> m;

  ll ans = 1;
  for(ll i = 1; i * i <= m; ++i)
  {
    if (m % i == 0)
    {
      if (i * n <= m) ans = max(ans, i);
      if (m / i * n <= m) ans = max(ans, m / i);
    }
  }
  cout << ans;
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,x) for(int i=0;i<x;i++)
#define put(ans)    cout << ans << endl;
#define reverse(s) reverse(s.begin(),s.end())

int main(){
    int n,a,b,sum(1),f(1);
    cin >> n >> a >> b;
    string s;   cin >> s;


    rep(i,n){
        if(s[i]!='c'){
            if(sum<=(a+b)){
                if(s[i]=='a'){
                    cout << "Yes" << endl;
                    sum++;
                }else if(f<=b){
                    cout << "Yes" << endl;
                    sum++;
                    f++;
                }else{
                    cout << "No" << endl;
                }
            }else{
                cout << "No" << endl;
            }
        }else{
            cout << "No" << endl;
        }
    }
 
    return 0;
}

Measured memory_bytes: 896
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <functional>
#include <vector>
#include <queue>
#include <string>

#define REP(i,n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = (s); i < (n); i++)
#define ALLOF(c) c.begin(), c.end()
#define RANGEOF(c,i,n) c.begin() + (i), c.begin() + (i) + (n)
#define EPS 1e-9
#define INF 1000000000
using namespace std;

template <class T> T read() { T t; cin >> t; return t; }
template <class T> vector<T> read(int n) { vector<T> v; REP(i,n) { v.push_back(read<T>()); } return v; }
template <class T> vector<vector<T>> read(int n, int m)
{
	vector<vector<T>> v;
	REP(i,n) { v.push_back(read<T>(m)); }
	return v;
}

template <class T> void write(const T &t) { cout << t << endl; }
template <class T> void write(const T &t, const T &t2) { cout << t << ' ' << t2 << endl; }
template <class T> void write(const vector<T> &v)
{
	ostringstream ss; 
	for (auto x : v) ss << x << ' ';
	auto s = ss.str();
	cout << s.substr(0, s.length() - 1) << endl;
}

struct _Reader { template <class T> _Reader operator ,(T &rhs) { cin >> rhs; return *this; } };
#define READ(t,...) t __VA_ARGS__; _Reader(), __VA_ARGS__

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

/// template end ///

void solve()
{
	READ(int, datasets);
	const string tbl[] = { ".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz" };
	REP(dataset, datasets)
	{
		READ(string, input);
		string ret;
		for (auto it = input.begin(); it != input.end(); it++)
		{
			int c = *it - '0';
			if (c != 0)
			{
				const string &t = tbl[c - 1];
				auto f = find(it + 1, input.end(), '0');
				ret.push_back(t[(f - it - 1) % t.length()]);
				it = f;
			}
		}
		write(ret);
	}
}

Measured memory_bytes: 1216
#include <iostream>
// #include <algorithm>
// #include <set>
// #include <map>
using namespace std;

int main()
{
  // 整数の入力
  // int N;
  // cin >> N;
  // N分、入力を取る
  int N;
  cin >> N;
  int h[101];
  for (int i = 0; i < N; i++)
    cin >> h[i];

  int count = 1;
  int max = h[0];
  for (int i = 1; i < N; i++)
  {
    if (max <= h[i])
    {
      count++;
      max = h[i];
    }
  }
  cout << count;
  // スペース区切りの整数の入力
  // int b, c;
  // cin >> b >> c;
  // 文字列の入力
  // string s;
  // cin >> s;
  // 出力
  // cout << (a + b + c) << " " << s << endl;
  return 0;
}

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

namespace ABC155B
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var As = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();

            Console.WriteLine(As.Where(x => x % 2 == 0).All(x => x % 3 == 0 || x % 5 == 0)
                ? "APPROVED"
                : "DENIED");
        }
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define R register
#define ll long long
#define mp make_pair
#define pii pair<int, int>
using namespace std;
const int N = 50;

int n, m, tab[N][N], dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0}, dis[N][N];
char s[N];
queue<pii> que;

template <class T>
inline void read(T &x) {
    x = 0;
    char ch = getchar(), w = 0;
    while (!isdigit(ch)) w = ch == '-', ch = getchar();
    while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
    x = w ? -x : x;
    return;
}

inline int bfs(int sty, int stx) {
    memset(dis, -1, sizeof (dis));
    dis[sty][stx] = 0, que.push(mp(sty, stx));
    int ret = 0;
    while (que.size()) {
        int nowy = que.front().first, nowx = que.front().second;
        que.pop();
        for (R int i = 0; i <= 3; ++i)
            if (tab[nowy + dy[i]][nowx + dx[i]] && dis[nowy + dy[i]][nowx + dx[i]] == -1)
                dis[nowy + dy[i]][nowx + dx[i]] = dis[nowy][nowx] + 1, que.push(mp(nowy + dy[i], nowx + dx[i]));
        ret = max(ret, dis[nowy][nowx]);
    }
    return ret;
}

int main() {
    int ans = 0;
    read(n), read(m);
    for (R int i = 1; i <= n; ++i) {
        scanf("%s", s + 1);
        for (R int j = 1; j <= m; ++j)
            tab[i][j] = s[j] == '.';
    }
    for (R int i = 1; i <= n; ++i)
        for (R int j = 1; j <= m; ++j)
            if (tab[i][j]) ans = max(ans, bfs(i, j));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static Scanner;

class Program
{
    static void Main() => new Program().Solve();

    public void Solve()
    {
        int n = Read<int>();
        int k = Read<int>();
        Console.WriteLine((int)Math.Ceiling((double)(n - 1) / (k - 1)));
    }
}

static class Scanner
{
    static Queue<string> que = new Queue<string>();

    public static T Read<T>()
    {
        if (!que.Any())
        {
            foreach (var s in Console.ReadLine().Split()) que.Enqueue(s);
        }
        return (T)Convert.ChangeType(que.Dequeue(), typeof(T));
    }

    public static IEnumerable<T> Read<T>(long n)
    {
        for (long i = 0; i < n; i++) yield return Read<T>();
    }
}

Measured memory_bytes: 28380
N = int(input())
A = list(map(int,input().split()))

def selectSort(A, N):
 sw = 0
 for i in range(N):
  minj = i
  for j in range(i, N):
   if A[j] < A[minj]:
    minj = j
  if A[i] != A[minj]:
   A[i], A[minj] = A[minj], A[i]
   sw += 1
 return str(sw)

sw = selectSort(A, N)
print(" ".join(map(str, A)))
print(sw)

Measured memory_bytes: 7712
#include <bits/stdc++.h>
using namespace std;
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast;
 
long long mod = 1000000007;
 
long long div(long long a, long long b, long long c){
    return b / c - (a - 1) / c;
}
 
void print_binary(long long a) {
    for (int i = 31; i >= 0; i--) {
        cout << (a >> i & 1);
    }
    cout << endl;
}
 
int main() {
    long long n, a = 0, max = 0;
    cin >> n >> a;
    if (a == n){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# 整数の入力

def main():
    s = input()
    t = input()

    count = 0

    for i, ch in enumerate(list(t)):
        if ch != s[i]:
            count = count + 1
    
    print(count)


if __name__ == '__main__':
    main()

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

const int MAX_N = 112345;
ll A[MAX_N];
ll S[MAX_N];
ll V[MAX_N];

int main2() {
  CLR(A, 0);
  CLR(S, 0);

  int N = nextInt();
  REP(i, N + 1) A[i] = nextInt();

  S[N] = A[N];
  for (int i = N - 1; i >= 0; i--) S[i] = A[i] + S[i+1];


  if (N == 0) {
    if (A[0] == 1) cout << 1 << endl; else cout << -1 << endl;
    return 0;
  }

  if (A[0] != 0) {
    cout << -1 << endl;
    return 0;
  }

  V[0] = 1;
  for (int i = 1; i <= N; i++) {
    V[i] = min(V[i-1]*2 - A[i], S[i+1]);
  }
  // pv(A, A+N+1);
  // pv(V, V+N+1);

  ll ans = 0;
  REP(i, N+1) {
    ans += A[i] + V[i];
    if (V[i] < 0) {
      ans = -1;
      break;
    }
    if (i+1 <= N && V[i] * 2 < V[i+1] + A[i+1]) {
      ans = -1;
      break;
    }
  }
  cout << ans << endl;

  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

Measured memory_bytes: 6204
#include<stdio.h>

main(){
  int H,W;
  int i,j;
  for(;;){
    scanf("%d %d",&H,&W);
    if(H==0 && W==0) {
      break;
    }else{
      for(i=0;i<H;i++){
        for(j=0;j<W;j++){
          if(i!=0 && i!=H-1 && j!=0 && j!=W-1){
            printf(".");
          }else{
          printf("#");
        }
      }
      printf("\n");
    }
    printf("\n");
  }
}
}



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

const int MAXBIT = 60;
const long long MOD = 1E9+7;

long long f[MAXBIT+2][2][2];

long long n;

long long dp(int i, int mod, bool ok){
	long long& ret = f[i][mod][ok];
	if(ret != -1) return ret;
	if(i == MAXBIT) return ret = (mod == 0 && ok == 0);
	int bitn = (n>>i)&1;
	ret = 0;
	for(int a = 0; a < 2; ++a)
		for(int b = 0; b <=a ; ++b){
			int curbit = (a+b+mod)%2;
			int nmod = (a+b+mod)/2;
			bool nok = ok;
			if(curbit > bitn) nok = 1;
			if(curbit < bitn) nok = 0;
			ret += dp(i+1, nmod, nok);
			ret %= MOD;
 		}
 	return ret;
}

int main() {
	cin >> n;
	memset(f, -1, sizeof f);
	cout << dp(0,0, 0);
	return 0;
}

Measured memory_bytes: 256
input_lines = gets.chop.split.map(&:to_i)
input_lines2 = gets.chop.split.map(&:to_i)

count = input_lines2[0]
n = input_lines[0]

for i in 1...(n - 1)
    if input_lines2[(i - 1)] > input_lines2[i]
        count = count + input_lines2[i]
    else
        count = count + input_lines2[(i - 1)]
    end
end
count = count + input_lines2[(n-2)]
puts count

Measured memory_bytes: 1788
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<deque>
#include<ctime>

using namespace std;
typedef pair<int, int> P;
typedef long long ll;
const int mod = 1000000007;
/*
class UnionFind{//UnionFind木
 private:
    vector<int> Parent;
 public:
    UnionFind(int N){
        vector<int> Parent(N,-1);
    }

    int root(int A){
        if(Parent[A]<0) return A;
        return Parent[A]=root(Parent[A]);
    }

    int size(int A){
        return -Parent[root(A)];
    }

    bool connect(int A,int B){
        A=root(A);
        B=root(B);
        if(A==B) return false;
        if(size(A)<size(B)) swap(A,B);
        Parent[A]-=Parent[B];
        Parent[B]=A;
    }
};
*/
ll mpow(ll x, ll n){ //x^n(mod division) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % mod;
        x = x*x % mod;
        n = n >> 1;
    }
    return ans;
}


class Fuctorical{
private:
    vector<ll> fac;
public:
    
    Fuctorical(ll N){
        fac.push_back(1);
        for(int i=0;i<N;i++) fac.push_back(fac[i]*(i+1)%mod);
    }

    ll fact(ll a){return fac[a];}
    ll ifact(ll a){return mpow(fac[a],mod-2);}

    ll cmb(ll a,ll b){
        if(a==0&&b==0) return 1;
        if(a<b||a<0) return 0;
        ll tmp =ifact(a-b)*ifact(b)%mod;
        return tmp*fac[a]%mod;
    }

    
};

int gcd(int x,int y){return y ? gcd(y,x%y) : x;};//xとyの最大公約数

int main(){
    int N,A,B,C;
    cin>>N>>A>>B>>C;
    Fuctorical get(2*N);
 
    long long ans = 0;
    long long dab = mpow(A + B,mod-2);
    for(auto i = N; i < 2 * N; ++i)
    {
        ans += get.cmb(i - 1, N - 1)
            * (mpow(A, N) * mpow(B, i - N) % mod + mpow(A, i - N) * mpow(B, N) % mod) % mod
            * i % mod 
            * 100 % mod
            * mpow(dab, i) % mod
            * mpow(100 - C, mod - 2) % mod;
        ans %= mod;
    }
 
    cout << ans << endl;
}


Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(c) c.begin(), c.end()
#define inf 1000000000
#define ninf -1000000000
#define for0(n) for(int i=0;i<n;i++)
#define fori(a,n) for(int i=a;i<n;i++)
#define rev(n,d) for(int i=n;i>=d;i--)
#define mem(ar,x) memset(ar,x,sizeof ar)
inline long long  max2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  max3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  min2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  min3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector< pair<int,int> > vii;
typedef long long ll;
 
#define  modu 1000000007


int main() {
    
    {
        fast
        int n,i,a,b,x;cin>>n>>a>>b;
        vi v;
        int p1=0,p2=0,p3=0;
        for0(n)
        {
            cin>>x;
            if(x<=a)
                p1++;
            else if(x>b)
                p3++;
            else
                p2++;
                
        }
        cout<<min3(p1,p2,p3);
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  ll n;
  R n;
  string s[2];
  rep(i,2) R s[i];
  ll dp[n+1][2];
  mem(dp);
  int i=0;
  if(s[0][i]==s[1][i]) {
    dp[1][0]=3;
    i++;
  } else {
    dp[2][1]=6;
    i+=2;
  }
  for(;i<n;i++) {
    if(s[0][i]==s[1][i]) {
      dp[i+1][0]+=dp[i][0]*2;
      dp[i+1][0]+=dp[i][1];
      dp[i+1][0]%=MAX;
    } else {
      dp[i+2][1]+=dp[i][0]*2;
      dp[i+2][1]+=dp[i][1]*3;
      dp[i+2][0]%=MAX;
      i++;
    }
  }
  pr((dp[n][0]+dp[n][1])%MAX);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
typedef unsigned long long ul;
ll v[1 << 17];
bool used[5000][5000];
int main() {
	int n; cin >> n;
	rep(i, n) {
		cin >> v[i];
	}
	sort(v, v + n);
	int out = 1;
	rep(i, n) {
		Rep(j, i + 1, n) {
			if (used[i][j])continue;
			vector<int> s;
			int dif = v[j] - v[i];
			s.push_back(i); s.push_back(j);
			int now = v[j] + dif;
			while (true) {
				int id = lower_bound(v, v + n, now) - v;
				if (id < n&&v[id] == now) {
					s.push_back(id); now += dif;
				}
				else break;
			}
			out = max(out, (int)s.size());
			rep(k, s.size()-1) {
				used[s[k]][s[k + 1]] = true;
			}
		}
	}
	cout << out << endl;
	return 0;
}



Measured memory_bytes: 27180
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
const int MOD=1e9+7;


int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<int> ed(n+1);
    rep(i,n) {
        if (s[i]=='E') ed[i+1]=ed[i]+1;
        else ed[i+1]=ed[i];
    }
    int ans=n;
    rep(i,n) {
        int tans=i-(ed[i]-ed[0])+ed[n]-ed[i+1];
        ans=min(ans,tans);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1796
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline int read()
{
	int out=0,fh=1;
	char jp=getchar();
	while ((jp>'9'||jp<'0')&&jp!='-')
		jp=getchar();
	if (jp=='-')
		fh=-1,jp=getchar();
	while (jp>='0'&&jp<='9')
		out=out*10+jp-'0',jp=getchar();
	return out*fh;
}
int main()
{
	int a=read()-1,b=read()-1;
	cout<<(b+a-1)/a;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
#define vll vector<ll>
constexpr ll INF = 1e9 + 7;
constexpr ll MOD = 1e9 + 7;

template<typename T>
void vecin(vector<T>& v, int n = 0){
    if (n == 0)
        n = v.size();
    for (int i = 0; i < n; ++i)
    {
        cin >> v[i];
    }
}
template <typename T>
void vecout(vector<T> &v, int n = 0)
{
    if (n == 0)
        n = v.size();
    for (int i = 0; i < n-1; ++i)
    {
        cout << v[i] << " ";
    }
    cout << v[n - 1] << endl;
}
void print(string s){
    cout << s << endl;
}

int main()
{
    ciosup;
    int a, b;
    cin >> a >> b;
    int ans = 0;
    b--;
    a--;
    if (b % a == 0)
    {
        ans = b / a;
    }else{
        ans = b / a + 1;
    }
    cout << ans << endl;
}

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

int main()
{
    set <int> S;
    ll int q,x,n;
    cin>>q;
    while(q--)
    {
        cin>>n;
        if(n==0)
        {
            cin>>x;
            S.insert(x);
            cout<<S.size()<<endl;
        }
        else if(n==1)
        {
            cin>>x;
            if(S.count(x))
                cout<<"1"<<endl;
            else
                cout<<"0"<<endl;
        }
        else
        {
            cin>>x;
            S.erase(x);
        }

    }
}



Measured memory_bytes: 12384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner input = new Scanner(System.in);
		String S = input.nextLine();
		String T = input.nextLine();
		String[] SList = S.split("");

		String tmpS = "";
		boolean flag = false;
		for (int i = 0; i < SList.length; i++) {
			// 文字を末尾を除外して連結
			for (int j = 0; j < SList.length - 1; j++) {
				tmpS += SList[j];
			}
			// 末尾を先頭に移動
			tmpS = SList[SList.length - 1] + tmpS;

			if (tmpS.equals(T)) {
				System.out.println("Yes");
				flag = true;
				break;
			} else {
				// 一致しなかった場合、配列に入れ替えたデータを設定
				SList = tmpS.split("");
				tmpS = "";
			}
		}
		if (!flag) {
			System.out.println("No");
		}
		input.close();
	}
}


Measured memory_bytes: 29524
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        String n = sc.next();

        String result = "No";
        if (n.charAt(0) == n.charAt(2)) result = "Yes";

        System.out.println(result);
    }
}


Measured memory_bytes: 23636
package main

import "fmt"

func main() {
	var h, w int
	for {
		fmt.Scan(&h, &w)
		if h == 0 && w == 0 {
			break
		}
		for i := 0; i < h; i++ {
			for j := 0; j < w; j++ {
				fmt.Print("#")
			}
			fmt.Print("\n")
		}
		fmt.Print("\n")
	}
}


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

int k,st,h[100010];
int memo[100010];

int go(int ind)
{
    if(ind == st) return 0;
    if(memo[ind]!=-1) return memo[ind];

    int ret = INT_MAX;

   // ret = abs(h[ind]-h[ind+1]) + go(ind+1);

    for(int i = 1;i<=k;i++)  {
            if(ind+i>st) break;
            ret = min(ret,abs(h[ind]-h[ind+i]) + go(ind+i));
    }
    return memo[ind] = ret;
}

int main()
{
    cin>>st>>k;
    for(int i = 1;i<=st;i++) cin>>h[i];
    memset(memo,-1,sizeof memo);

    cout<<go(1)<<endl;
}

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

int P,Q,A,N;

int accum(int p, int q, int depth, int max, int prd) {
  if( p == 0 )
    return 1;

  int res = 0;
  for(int i = max; prd*i <= A; i++) {
    if ((N-depth)*q < p*i) break;
    if (p*i < q) continue;
    res += accum( p*i-q, q*i, depth+1, i, prd*i );
  }
  return res;
}

int main() {
  while(true) {
    cin>>P>>Q>>A>>N;
    if(!P) break;
    cout<<accum( P, Q, 0, 1, 1 )<<endl; 
  }
}

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

class Program
{
    static void Main(string[] args)
    {
        new Program().Calc();
    }

    Scanner cin;

    public Program() { }

    void Calc()
    {
        cin = new Scanner();

        //Console.WriteLine( Math.Log(8) / Math.Log(2));
        //Console.WriteLine( Math.Log(8));



        int n = cin.nextInt();
        int k = cin.nextInt();

        // 最初にK以上になる確率
        double ratio = 1 - (double)(k - 1) / n;

        if (ratio < 0) { ratio = 0; }

        double remain = 1 - ratio;

        int log = (int)Math.Ceiling(Math.Log(k /*- 1*/) / Math.Log(2));

        //double ans = ratio + Math.Pow(0.5, log);

        int[] logs = new int[log + 1];

        int count = Math.Min(n, k - 1);

        double coef = (1 / (double)count) * remain;
        double pow = 1;

        for (int i = 1; i <= log; ++i)
        {
            pow *= 0.5;
            logs[i] = (int)Math.Ceiling(k * pow);

            if (logs[i] <= count)
            {
                int tmp = count - logs[i] + 1;
                ratio += tmp * pow * coef;
                count -= tmp;
            }
        }

        Console.WriteLine(ratio);
    }
}

class Scanner
{
    string[] s;
    int i;

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

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

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

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

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

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

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


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


Measured memory_bytes: 11092
/*#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
 #pragma GCC target("avx", "avx2")*/
#include<bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;
using ull = unsigned long long;

#define int long long
// #define double ld
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

void accell() {
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
}
const int N = 300;
int dp[N][10][4][2];

signed main() {
    accell();
    string s;
    cin >> s;
    int tk;
    cin >> tk;
    for (int i = 0; i < (s[0] - '0'); ++i) {
        dp[0][i][i != 0][0] = 1;
    }
    int n = s.size();
    dp[0][s[0] - '0'][(s[0] - '0') != 0][1] += 1;
    for (int i = 1; i < n; ++i) {
        int c = (s[i] - '0');
        for (int j = 0; j < 10; ++j) {
            for (int k = 0; k < 10; ++k) {
                for (int p = 0; p <= 3; ++p) {
                    if (p + (j != 0) <= tk) {
                        dp[i][j][p +(j != 0)][0] += dp[i - 1][k][p][0];
                    }
                }
            }
        }
        for (int j = 0; j < c; ++j) {
            for (int p = 0; p <= 3; ++p) {
                if (p + (j != 0) <= tk)
                    dp[i][j][p + (j != 0)][0] += dp[i - 1][(s[i - 1] - '0')][p][1];
            }
        }
        for (int p = 0; p <= 3; ++p) {
            if (p + (c != 0) <= tk) {
                // cout << dp[i - 1][(int)(s[i - 1] - '0')][p][1] << ' ' << p + (c != 0) << "   ";
                dp[i][c][p + (c != 0)][1] += dp[i - 1][(int)(s[i - 1] - '0')][p][1];
            }
        }
       /* for (int j = 0; j <= 3; ++j) {
            cout << dp[i][c][j][1] << ' ';
        }*/
       //  cout << endl;
    }
    int ans = 0;
    for (int i = 0; i < 10; ++i) {
        for (int j = 0; j < 2; ++j) {
            ans += dp[n - 1][i][tk][j];
            // cout << dp[n - 1][i][tk][j] << endl;
            // cout << endl;
        }
    }
    cout << ans;
    return 0;
}


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

int main(void){
  int x1, x2, x3, x4, x5;
  cin >> x1 >> x2 >> x3 >> x4 >> x5;
 
  if(x1 == 0) cout << 1;
  if(x2 == 0) cout << 2;
  if(x3 == 0) cout << 3;
  if(x4 == 0) cout << 4;
  if(x5 == 0) cout << 5;
  
  return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=a;i<b;i++)
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    REP(i, 0, n) cin >> a[i];
    sort(a.begin(), a.end());
    cout << a[a.size() - 1] - a[0] << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <bitset>
#include <stack>
#include <queue>
#include <ctype.h>
#include <list>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
#define MOD 1000000007
#define more(a,b) (((a)>(b))?(a):(b))
#define less(a,b) (((a)<(b))?(a):(b))
template<class T> inline bool chmax(T & a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T & a, T b) { if (a > b) { a = b; return 1; } return 0; }

using namespace std;

int main(void)
{
	string S, T; cin >> S >> T;
	map<char, char> table_S, table_T;
	bool flag = true;
	rep(i, 0, S.size()) {
		if (table_S.find(S[i]) != table_S.end()) {
			if (table_S[S[i]] != T[i]) {
				flag = false;
				break;
			}
		}
		else table_S[S[i]] = T[i];

		if (table_T.find(T[i]) != table_T.end()) {
			if (table_T[T[i]] != S[i]) {
				flag = false;
				break;
			}
		}
		else table_T[T[i]] = S[i];
	}
	cout << (flag ? "Yes" : "No") << endl;

	return 0;
}

Measured memory_bytes: 776