akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int X[] = new int[M];
        for(int i = 0; i < M; i++) {
            X[i] = sc.nextInt();
        }
        Arrays.sort(X);

        List<Integer> len = new ArrayList<>();
        for(int i = 0; i < M - 1; i++) {
            len.add(Math.abs(X[i + 1] - X[i]));
        }
        int sub = M - N;
        if(sub <= 0) {
            System.out.println("0");
            return;
        }
        int lm[] = maxi(len, N - 1);
        int t = max(X);
        int f = min(X);
        int gsd = 0;
        for(int r = 0;r < lm.length; r++) {
            gsd += lm[r];
        }
        System.out.println(t - f -gsd);

    }

    private static int[] maxi(List<Integer> a, int n) {
        int j[] = new int[n];
        Collections.sort(a);
        Collections.reverse(a);
        for(int k = 0; k < n; k++) {
            j[k] = a.get(k);
        }
        return j;
    }

    private static int max(int[] a) {
        int maxi = 0;
        for(int i = 0; i < a.length; i++) {
            if(a[maxi] < a[i]) {
                maxi = i;
            }
        }
        return a[maxi];
    }

    private static int min(int[] a) {
        int maxi = 0;
        for(int i = 0; i < a.length; i++) {
            if(a[maxi] > a[i]) {
                maxi = i;
            }
        }
        return a[maxi];
    }


}

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

class Program
{
    //static void Main_o(string[] args)
    //{
    //    // 整数の入力
    //    int a = int.Parse(Console.ReadLine());
    //    // スペース区切りの整数の入力
    //    while (a-- > 0)
    //    {
    //        Console.WriteLine("a");
    //    }
    //    string[] input = Console.ReadLine().Split(' ');
    //    int b = int.Parse(input[0]);
    //    int c = int.Parse(input[1]);
    //    // 文字列の入力
    //    string s = Console.ReadLine();
    //    //出力
    //    Console.WriteLine((a + b + c) + " " + s);

    //}

    //static void Main(string[] args)
    //{
    //    // 整数の入力
    //    string[] input = Console.ReadLine().Split(' ');
    //    int b = int.Parse(input[0]);
    //    int c = int.Parse(input[1]);
    //    int a = int.Parse(input[2]);
    //    //出力
    //    Console.WriteLine( (b+c < a ? "No" : "yes" ) );
    //    Console.ReadLine();
    //}

    static void Main(string[] args)
    {
        // 整数の入力
        int n = int.Parse(Console.ReadLine());
        int[] xtoy_r = new int[2*n];
        int[] ytox_b = new int[2 * n];

        int i = 2*n;
        while(i-- > 0)
        {
            xtoy_r[i] = int.MaxValue;
            ytox_b[i] = int.MinValue;
        }

        i = n;
        while (i-- > 0)
        {
            string[] input = Console.ReadLine().Split(' ');
            //b[int.Parse(input[0]), int.Parse(input[1])] = true;
            xtoy_r[int.Parse(input[0])] = int.Parse(input[1]);
        }
        i = n;
        while (i-- > 0)
        {
            string[] input = Console.ReadLine().Split(' ');
            //b[int.Parse(input[0]), int.Parse(input[1])] = true;
            ytox_b[int.Parse(input[1])] = int.Parse(input[0]);
        }

        i = 0;
        int cnt = 0;
        
        while (i < 2*n)
        {
            if (ytox_b[i] > 0)
            {
                int x = ytox_b[i];
                while (x-- > 0)
                {
                    if (xtoy_r[x] < i)
                    {
                        cnt++;
                        xtoy_r[x] = int.MaxValue;
                        break;
                    }
                }
            }
            i++;
        }
        
        Console.WriteLine ( cnt );
    }
}

Measured memory_bytes: 11092
#![allow(non_snake_case,unused_imports)]
use std::io::Read;
use std::cmp::max;
use std::cmp::min;
use std::str::FromStr;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::BinaryHeap;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut buf_it = buf.split_whitespace();

    let N = buf_it.next().unwrap().parse::<usize>().unwrap();

    let A = (0..N).map(|_| 
                (0..N-1).map(|_|
                    buf_it.next().unwrap().parse::<usize>().unwrap()
                ).collect::<Vec<_>>()
    ).collect::<Vec<_>>();

    let M = N*N;
    let mut Ef = (0..M).map(|_| HashSet::new()).collect::<Vec<_>>();
    let mut Eb = (0..M).map(|_| HashSet::new()).collect::<Vec<_>>();

    for i in 0..N{
        for j in 0..N-2{
            let f = index(i,A[i][j]-1,N);
            let t = index(i,A[i][j+1]-1,N);
            Ef[f].insert(t);
            Eb[t].insert(f);
        }
    }

    let mut q = (0..M).filter(|&i| Eb[i].len()==0).collect::<Vec<_>>();
    let mut ret = Vec::new();
    while q.len()>0{
        ret.push(q.clone());
        let mut qq = vec![];
        while let Some(i) = q.pop(){
            for &j in &Ef[i]{
                Eb[j].remove(&i);
                if Eb[j].len()==0{
                    qq.push(j);
                }
            }
        }
        q = qq;
    }

    let mut ans = ret.len() as isize;
    if ans == 0 { ans = -1}
    if Eb.iter().map(|r| r.len()).sum::<usize>()!=0{
        ans = -1;
    }

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

fn index(i:usize,j:usize,N:usize)->usize{
    if i>j {
        i*N+j
    } else {
        j*N+i
    }
}

Measured memory_bytes: 639224
#include<stdio.h>
#include<math.h>
int main() {
	double r,m,e;
	scanf("%lf",&r);
	if(r > 0 && r < 10000) {
		m = pow(r,2.0) * M_PI;
		e = 2 * r * M_PI;
	}
	printf("%f %f\n",m,e);	
	return 0;
}

Measured memory_bytes: 1812
#include <bits/stdc++.h>
using namespace std;
using namespace std;
 
#define ll long long
#define f(i,a,b) for(ll i=a;i<b;i++)
#define endl '\n'
#define spc " "
#define pb push_back
#define mp make_pair
#define mod 1000000007

vector<vector<ll> >vii;

int main() 

{
    ios::sync_with_stdio(0);
    cin.tie(0);
    //freopen("in.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ll x,y,z;
    cin>>x>>y>>z;
    cout<<z<<spc<<x<<spc<<y<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define int long long
typedef vector<int> VI;
typedef vector<VI> VVI;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n,k; 
    cin >> n >>k;
    VI frog(n,0);
    rep(i,n) cin >> frog[i];
    VI dp(n,INT_MAX);
    dp[0] = 0;
    for(int i = 1; i < n; i++){
        for(int j = 1; j <= k; j++){
            if(i - j < 0) break;
            dp[i] = min(dp[i-j] + abs(frog[i] - frog[i-j]),dp[i]);
        }
    }
    cout << dp[n-1] << endl;
    
    return 0;
}

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

using namespace std;

using ll = long long;
constexpr int mo = 1e9+7;
constexpr int inf = 1<<30;
constexpr ll infl = 1ll<<60;
constexpr ll mo2 = 998244353;
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    string s;
    cin>>s;
    if(s[2] == s[3] and s[4] == s[5])cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  
  int ans = 0;
  vector<int> t(n);
  rep(i,n) cin >> t[i];
  
  int m;
  cin >> m;
  vector<pair<int,int>> px(m);
  rep(i,m) {
    cin >> px[i].first >> px[i].second;
    px[i].first--;
  }
  
  for (auto g : px) {
    int k = t[g.first];
    t[g.first] = g.second;
    
    int ans = 0;
    rep(i,n) ans += t[i];
    cout << ans << endl;
    
    t[g.first] = k;
  }
}

Measured memory_bytes: 256
<?php
  
fscanf(STDIN, "%d", $qua);
for ($i = 1; $i <= $qua; $i++){
  fscanf(STDIN, "%d", $numbers[]);
}
$large_order = $numbers;
rsort($large_order);
if ($large_order[0] === $large_order[1]) {
  for ($i = 0; $i < $qua; $i++) {
    echo $large_order[0]."\n";
  }
} else {
  for ($i = 0; $i < $qua; $i++) {
    if ($numbers[$i] === $large_order[0]) {
      echo $large_order[1];
    } else {
      echo $large_order[0];
    }
    echo "\n";
  }
}

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

#define rep(i, m, n) for(int(i) = (int)(m); i < (int)(n); ++i)
#define rep2(i, m, n) for(int(i) = (int)(n)-1; i >= (int)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
using tp = tuple<ll, ll, ll>;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
//constexpr long long MOD = (ll)1e9 + 7;
constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;

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

//グラフ関連
struct Edge {
    ll to, cap, rev;
    Edge(ll _to, ll _cap, ll _rev) {
        to = _to;
        cap = _cap;
        rev = _rev;
    }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph &G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
    G[from].push_back(Edge(to, cap, (ll)G[to].size()));
    if(revFlag)
        G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}
void solve() {
    ll n;
    cin >> n;
    vec<ll> a(n);
    REP(i, n) {
        cin >> a[i];
    }

    bitset<4040404> dp;
    dp.set(0);
    REP(i, n) {
        dp = dp | (dp << a[i]);
    }
    vec<int> ans;
    REP(i, 4040404) {
        if(dp[i])
            ans.push_back(i);
    }
    cout << ans[ans.size() / 2] << en;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /*
    ll t;
    cin >> t;
    while(t--)*/
    solve();

    return 0;
}


Measured memory_bytes: 13128
#include <iostream>

using namespace std;
typedef long long ll;

int n;
ll t[110];

ll gcd(ll a, ll b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}

void solve() {
  ll ans = 1;
  for (int i=0;i<n;i++) {
    ans = ans / gcd(ans, t[i]) * t[i];
  }
  cout << ans << endl;
}

int main() {
  cin >> n;
  for (int i=0;i<n;i++) {
    cin >> t[i];
  }
  solve();
}


Measured memory_bytes: 256
def srch(i, l, Lng, Dst):
    if Lng[i] != -1 and Lng[i] < l:
        return
    Lng[i] = l
    if Dst[i] is not None and len(Dst[i]) > 0:
        for c in Dst[i]:
            srch(c,l+1, Lng, Dst)

def main():
    num = int(input())
    Dst = [None for i in range(num + 1)]
    Lng = [-1] * (num + 1)
    
    for n in range(1, num+1):
        a = list(map(int,input().split()))
        u = a[0]
        if a[1] > 0:
            Dst[u] = a[2:]

    srch(1, 0, Lng, Dst)

    for n in range(1, num+1):
        l = Lng[n]
        if l > num:
            l = -1
        print("{} {}".format(n,l))

if __name__ == '__main__':
    main()

Measured memory_bytes: 7828
N = int(input())
ans = len(list(str(N)))
for i in range(1,int(N**(1/2)//1)+1):
    if N%i==0:
        a = i
        b = N//i
        ans = min(ans, max(len(list(str(a))), len(list(str(b)))))
print(ans)

Measured memory_bytes: 9452
import sys, io, os, re
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from pprint import pprint
from math import sin, cos, pi, radians, sqrt, floor, ceil
from copy import copy, deepcopy
from collections import deque
from fractions import gcd
from functools import reduce
from itertools import groupby
from heapq import heapify, heappush, heappop

# sys.setrecursionlimit(5000)

n1 = lambda: int(sys.stdin.readline().strip())
nn = lambda: list(map(int, sys.stdin.readline().strip().split()))
f1 = lambda: float(sys.stdin.readline().strip())
fn = lambda: list(map(float, sys.stdin.readline().strip().split()))
s1 = lambda: sys.stdin.readline().strip()
sn = lambda: list(sys.stdin.readline().strip().split())
nl = lambda n: [n1() for _ in range(n)]
fl = lambda n: [f1() for _ in range(n)]
sl = lambda n: [s1() for _ in range(n)]
nm = lambda n: [nn() for _ in range(n)]
fm = lambda n: [fn() for _ in range(n)]
sm = lambda n: [sn() for _ in range(n)]

def array1(n, d=0): return [d] * n
def array2(n, m, d=0): return [[d] * m for x in range(n)]
def array3(n, m, l, d=0): return [[[d] * l for y in xrange(m)] for x in xrange(n)]
def linc(A, d=1): return map(lambda x: x + d, A)
def ldec(A, d=1): return map(lambda x: x - d, A)

popcount = lambda x: bin(x).count("1")
bitflip = lambda x, n: x ^ (1 << n)
bitflip2 = lambda x, n: x ^ (1 << (len(bin(x))-2 - (n+1)))
bits = lambda x, n = 0: bin(x)[2:].zfill(n)

N = n1()
X = list(map(int, list(s1())))

rt = [0, 0]
t1 = 1
t2 = 1
p = X.count(1)

for i in range(N-1, -1, -1):    
    if X[i] == 1:
        if p > 1: rt[0] = (rt[0] + t1) % (p - 1)
        rt[1] = (rt[1] + t2) % (p + 1)
    if p > 1: t1 = t1 * 2 % (p - 1)
    t2 = t2 * 2 % (p + 1)

for i in range(N):
    if X[i] == 1 and p == 1:
        print(0)
        continue

    if X[i] == 0:
        t = (rt[1] + pow(2, N-i-1, p+1)) % (p + 1)
    else:
        t = (rt[0] - pow(2, N-i-1, p-1)) % (p - 1)

    ans = 1
    while t > 0:
        t %= popcount(t)
        ans += 1
    
    print(ans)

Measured memory_bytes: 100312
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

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

    vector<char> t(n, '-');
    cout << 0 << endl;
    string s;
    cin >> s;
    if (s == "Vacant") return 0;
    t[0] = s[0];
    cout << n-1 << endl;
    cin >> s;
    if (s == "Vacant") return 0;
    t[n-1] = s[0];

    int l = 0;
    int r = n-1;

    int cnt = 0;
    while(true) {
        cnt++;
        int m = (l+r)/2;
        debug(m);
        cout << m << endl;
        cin >> s;
        if (s == "Vacant") return 0;
        t[m] = s[0];
        if ((t[l] == t[m] && l%2==m%2) || (t[l] != t[m] && l%2!=m%2)) {
            l = m;
        } else {
            r = m;
        }
        if (cnt>=20) return 1;
    }

}

Measured memory_bytes: 980
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""


A =  int(sys.stdin.readline())
B =  int(sys.stdin.readline())
C =  int(sys.stdin.readline())
D =  int(sys.stdin.readline())

print(min(A, B) + min(C, D))

Measured memory_bytes: 63980
#include<iostream>
#include<numeric>

using namespace std;

int solve1(int k)
{
    int ans = 0;
    for (int a = 1; a <= k; a++)
    {
        for (int b = 1; b <= k; b++)
        {
            int d = std::gcd(a, b);
            for (int c = 1; c <= k; c++)
            {
                ans += std::gcd(d, c);
            }
        }
    }
    return ans;
}

int main(void)
{
    int k;
    cin >> k;
    cout << solve1(k) << endl;
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n); for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
typedef pair<int, int> P;
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijo(ll x){
  ll z=1;
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i <=n;i++){
    num*=yakusu[i];
  }
  return num;
}


//cout<<""<<endl;
int main(){
  string S;int K;cin>>S>>K;
  map<string ,int> mp;
  for(int k=1; k<= 5;k++){
    for(int i=0;i+k-1<S.size();i++){
       mp[S.substr(i,k)]++;
    }
  }
  int r=1;
  for(auto x:mp){
    if(r==K)cout<<x.first<<endl;
    r++;
  }
}


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

int main()
{
    int ans = 0;
    string s;
    cin >> s;
    rep(i, s.size() / 2)
    {
        if (s[i] != s[s.size() - 1 - i])
            ans++;
    }
    cout << ans << endl;
    return 0;
}

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

int is_prime(int m)
{
	for(int i=3;i<=sqrt(m);i=i+2)
	{
		if(m%i==0)return 0;
	}
	return 1;
}

int prime[9999]={2};
int num[5000];
int res[100000];
int main()
{
	num[0]=3;num[1]=5;num[2]=13;
	int j=1;
	for(int i=3;i<100000;i=i+2)
	{
		if(is_prime(i)==1)
		{
			prime[j]=i;j++;
		}	
	}//sushubiao
	
	int cnt=3;
	for(int i=6;i<=j;i++)
	{
		int s=(prime[i]+1)/2;
		if(s%2!=0&&is_prime(s)==1)
		{
			num[cnt]=prime[i];cnt++;
		}	
	}
	//for(int i=0;i<cnt;i++)
	//cout<<num[i]<<" ";
	
	int ss=0;int ans=0;
	for(int i=0;i<100000-1;i++)
	{
		if(i+1==num[ss])
		{
			ans++;
			if(ss!=cnt)
			ss++;
		}
		res[i]=ans;
		//cout<<res[i]<<" ";
	}
	
	
	
	int q,l,r;
	scanf("%d",&q);
	
	for(int i=0;i<q;i++)
	{
		scanf("%d%d",&l,&r);
		if(l==1)
		{
			printf("%d\n",res[r-1]);
			continue;
		}
			
		printf("%d\n",res[r-1]-res[l-1-1]);
	}
	/**/
	return 0;
 } 


 

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

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

	vector<int> a(n);
	int mx1=0, mx2=0, i1, i2;
	for(int i =0; i<n; i++){
		cin >> a[i];
		if(a[i]>mx1){
			mx2 = mx1;
			mx1 = a[i];
			i2 = i1;
			i1 = i;
		}

		else if(a[i]>mx2 && a[i]<=mx1){
			mx2 = a[i];
			i2 = i;
		}
	}

	for(int i=0; i<n; i++){
		if(i==i1){
			cout << mx2 << endl;
		}

		else{
			cout << mx1 << endl;
		}
	}
}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;
using itn = int;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a); i > (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define itn int
#define double ld
#define pb push_back
#define mp make_pair
#define pii pair<intl,intl>
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl lcm(intl a,intl b){
    return a / gcd(a, b) * b;
}
intl digit10(intl a){
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl a,b,c,d;
    cin >> a >> b >> c >> d;
    cout << (a - c) * (b - d) << endl;
    return 0;
}

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

using namespace std;

main() {
#ifdef HOME
    freopen("input.txt", "r", stdin);
#endif // HOME
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int a;
    cin >> a;
    cout << 3 * a * a;
    return 0;
}


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

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

int isprime[50100];

void sieve(int n){
  int i,j;
  isprime[0] = isprime[1] = 0;
  for(i = 2; i*i < n; i++) if(isprime[i]){
    for(j = 2*i; j <= n; j += i) isprime[j] = 0;
  }
}

int main(){
  int i,j,k,n;
  int res = 0;

  memset(isprime,1,sizeof(isprime));
  sieve(50100);

  while(scanf("%d",&n) != EOF){
    for(i = n-1; i; i--) if(isprime[i]){
      printf("%d ",i);
      break;
    }
    REP(i,n+1,50100) if(isprime[i]){
      printf("%d\n", i);
      break;
    }
  }

  return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <string>
using namespace std;
const int maxn = 2e5+10;
int save[maxn];
int main(){
    int n, k;
    scanf("%d%d", &k, &n);
    int res = 1e7;
    for(int i=1; i<=n; i++){
        scanf("%d", &save[i]);
        if(i>1) res = min(res, k-(save[i]-save[i-1]));
    }
    res = min(res, save[n]-save[1]);
    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 1024
solve :: [(Int,Int)] -> IO ()
solve [] = return ()
solve ((0,0):_) = return ()
solve ((n,x):r) = do
    print . length $
        [(i,j,k) | i <- [1..n], j <- [i+1..x-i],
                    let k = x-i-j, j < k && k <= n]
    solve r

main = getContents >>=
        solve . map ( (\[x,y] -> (x,y)) . map read . words) . lines

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

int main(){
  int N;
  cin >> N;
  
  vector<int>V(N);
  rep(i,N)cin >> V[i];
  
  sort(V.begin(),V.end()); //昇順にソートすると、最後に一番価値が高いのが残る
  double ans = V[0];
  rep(i,N){
    ans = (ans + V[i]) / 2;
  }
  cout << setprecision(5) << ans <<endl;

  
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;n>i;++i)
using namespace std;
using ll=int64_t;
using vi=vector<int>;
using VI=vector<ll>;
using vis=vector<string>;
using vvi=vector<vi>;
int main(){
    int H,W,h,w;
    cin>>H>>W>>h>>w;
    cout<<H*W-W*h-H*w+h*w<<endl;
}

Measured memory_bytes: 3624
// AOJ 2197

#include <iostream>
using namespace std;

int n, ret;

void func(int sum, int prev){
	// cout << prev << " ";
	if (n < sum) return;
	if (n == sum) ret++;
	func(sum + prev + 1, prev + 1);
}

int main(void)
{
	while (cin >> n, n){
		ret = 0;
		for (int i = 1; i < (n / 2) + 1; i++){
			func(i, i);
			// puts("");
		}
		cout << ret << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#include <set>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 1000000007;
long long INF = 1000000000000000; //10^15
typedef long long ll;
typedef unsigned long long ull;
pair<ll, ll> ps[1 << 20];

int main(void) {

  int n;
  ll k, a[100010];
  cin >> n >> k;
  rep(i, n) cin >> a[i];

  ll sum = 0, amax = k;
  rep(i, n) sum += a[i], amax = max(amax, a[i]);

  int N = 0;
  while (amax > (1LL << N)) N++;
 

  ll v[50] = {}, w[50] = {};
  rep(i, N) {
    w[i] = 1LL << i;
    rep(j, n) {
      if (!((a[j] >> i) & 1LL)) v[i]++;
    }
    v[i] = (2LL * v[i] - (ll)n) * w[i];
  }

  int N2 = N / 2LL;
  
  for (int i = 0; i < 1 << N2; i++) {
    ll sw = 0, sv = 0;
    for (int j = 0; j < N2; j++) {
      if (i >> j & 1) {
	sw += w[j];
	sv += v[j];
      }
    }
    ps[i] = make_pair(sw, sv);
  }
  sort(ps, ps + (1 << N2));
  int m = 1;
  for (int i = 1; i < 1 << N2; i++) {
    if (ps[m - 1].second < ps[i].second) {
      ps[m++] = ps[i];
    }
  }

  ll res = 0;
  for (int i = 0; i < 1 << (N - N2); i++) {
    ll sw = 0, sv = 0;
    for (int j = 0; j < (N - N2); j++) {
      if (i >> j & 1) {
	sw += w[N2 + j];
	sv += v[N2 + j];
      }
    }
    if (sw <= k) {
      ll tv = (lower_bound(ps, ps + m, make_pair(k - sw, LLONG_MAX)) - 1)->second;
      res = max(res, sv + tv);
    }
  }

  cout << sum + res << endl;

  return 0;

}

Measured memory_bytes: 17408
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char c;
  cin >> c;
  if(c =='a') cout << "vowel" <<endl;
  else if(c =='i') cout << "vowel" <<endl;
  else if(c =='u') cout << "vowel" <<endl;
  else if(c =='e') cout << "vowel" <<endl;
  else if(c =='o') cout << "vowel" <<endl;
  else cout << "consonant" << endl;
 }


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

int main()
{
    ll a, b;
    cin >> a >> b;
    ll ans = 0;
    if (a == b)
    {
        cout << a << endl;
        return 0;
    }
    if ((a ^ (a + 1)) != 1)
        ans = a, a++;
    ll p = (b - a) % 4;
    if (p == 0)
        ans = ans ^ b;
    else if (p == 1)
        ans = ans ^ b ^ (b - 1);
    else if (p == 2)
        ans = ans ^ b ^ (b - 1) ^ (b - 2);
    else
        ans = ans ^ b ^ (b - 1) ^ (b - 2) ^ (b - 3);
    cout << ans << endl;
}


Measured memory_bytes: 256
//بسم الله الرحمن الرحيم
///   ***   ---   |||		 In the name of ALLAH		|||   ---   ***   ///
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define el << endl
#define PI 3.141592653589793238
#define _test_ int t; cin >> t; while(t--)
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define file() freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout)
ll gcd ( ll  a, ll b ) { return __gcd ( a, b ); }
ll lcm ( ll a, ll b ) { return a * ( b / gcd ( a, b ) ); }
int dx[]={0,0,+1,-1,+1,-1,-1,+1};
int dy[]={+1,-1,0,0,+1,-1,+1,-1};
///*......................*//* LET'S BEGIN (-_^) *//*............................///
const int mx= 1e6+123;

void _case_()
{
    int n,m,sum=0,scr=0;
    vector<int>pen;
    cin >> n >> m;
    map<int,int>mp;
    while (m--)
    {
        int i;string s;
        cin >> i >> s;
        if(s=="AC") mp[i]++;
        if(s=="WA" and !mp[i]) pen.push_back(i) ;
    }
    for(auto i:mp)
        if(i.second) scr++;
    for(auto i:pen)
    {
        if(mp[i]) sum++;
    }
    cout << scr << ' ' << sum << endl;
}



int main()
{
    optimize();
    //_test_
      _case_();
}

///////////*  N A Y E M  *///////////

Measured memory_bytes: 8144
#include<iostream>
#include<cstdio>
#include<iomanip>

using namespace std;

int main(){
    cout<<std::setprecision(20);
    double x;
    string u;
    int N;
    double ans = 0;
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> x >> u;
        if(u == "JPY"){
            ans += x;
        }else{
            ans += x*380000.0;
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pf push_front

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)


const long long MOD = 1000000007;
const int MAX_C = 3000;
long long Com[MAX_C][MAX_C];

void calc_com() {
    memset(Com, 0, sizeof(Com));
    Com[0][0] = 1;
    for (int i = 1; i < MAX_C; ++i) {
        Com[i][0] = 1;
        for (int j = 1; j < MAX_C; ++j) {
            Com[i][j] = (Com[i-1][j-1] + Com[i-1][j]) % MOD;
        }
    }
}

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

 calc_com();
 
 for (int i = 1; i < k+1 ;i++){
   ll ans ;
   ans = ( Com[n-k+1][i] ) * Com[k-1][i-1] % 1000000007;
   
   cout << ans << endl;
   
 }
 
 
 
  
    return 0;
}


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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()
#define PI 3.141592653589
double getRadian(double x, double y, double x2, double y2) {
    double radian = atan2(y2 - y,x2 - x);

    return radian;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    double a,b,x;
    double ans;
    cin >> a >> b >> x;
    double start=0.0,end=90.0;
    double result;
    double ang;
    while(end-start>1e-7){ //ぎりぎりまで入ってたとする
        ang = (end+start) / 2.0;
        if(x<=a*a*b / 2){
            double r = (PI * ang) / 180.0;
            result = a * b * b/ tan(r) / 2;
        }else{
            double r = PI * (90.0-ang) /180.0;
            result = (b - a/(tan(r)*2)) * a * a;
        }
        if(result > x) start = ang;
        else if(result < x) end = ang;
        else break;
    }


    cout << setprecision(9) << ang << endl;
}

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

// #include <atcoder/all>

// #LIB#

using namespace std;
// using namespace atcoder;
using ll = long long;
#define double long double
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repr(i, a, b) for (auto i = (a); i < (b); ++i)
#define itr(x, c) for (auto&& x : (c))
#define updatemax(t, v) ((t) = std::max((t), (v)))
#define updatemin(t, v) ((t) = std::min((t), (v)))
#ifdef ONLINE_JUDGE
#define endl _endl
const char _endl = (cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout.precision(16), '\n');
#endif

const string Yes = "Yes";
const string No = "No";
int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  vector<ll> b(n);
  rep(i, n) cin >> b[n - 1 - i];
  ll c = -1;
  rep(i, n) {
    if (a[i] == b[i]) {
      c = a[i];
      break;
    }
  }
  if (c >= 0) {
    ll acl = lower_bound(a.begin(), a.end(), c) - a.begin();
    ll acr = upper_bound(a.begin(), a.end(), c) - a.begin();
    ll bcl = b.rend() - upper_bound(b.rbegin(), b.rend(), c);
    ll bcr = b.rend() - lower_bound(b.rbegin(), b.rend(), c);
    ll il = max(acl, bcl), ir = min(acr, bcr);
    ll ul = min(acl, bcl), ur = max(acr, bcr);
    repr(i, il, ir) {
      if (ul > 0) {
        swap(b[i], b[ul - 1]);
        --ul;
      } else if (ur < n) {
        swap(b[i], b[ur]);
        ++ur;
      } else {
        cout << No << endl;
        return 0;
      }
    }
  }
  cout << Yes << endl;
  itr(x, b) cout << x << ' ';
  cout << endl;
}


Measured memory_bytes: 6364
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll n,m;
ll a[55],b[55],d[55][55];
ll ans;
int main(void){
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>a[i]>>b[i];
    }
    for(int i=0;i<m;i++){
        for(int j=0;j<n;j++){
            for(int k=0;k<n;k++){
                d[j][k]=1000000000000000;
                if(j==k){
                    d[j][k]=0;
                }
            }
        }
        for(int j=0;j<m;j++){
            if(j!=i){
                d[a[j]-1][b[j]-1]=1;
                d[b[j]-1][a[j]-1]=1;
            }
        }
        for(int l=0;l<n;l++){
            for(int j=0;j<n;j++){
                for(int k=0;k<n;k++){
                    d[j][k]=min(d[j][k],d[j][l]+d[l][k]);
                }
            }
        }
        bool x=false;
        for(int j=0;j<n;j++){
            for(int k=0;k<n;k++){
                if(d[j][k]>=1000000000000000){
                    x=true;
                }
            }
        }
        if(x){
            ans++;
        }
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

int main(){
    ll N;
    cin >> N;
    vector<ll> a(N);
    rep(i, 0, N) cin >> a[i];

    ll ans = 1e18;
    rep(x, -100, 101){
        ll tmp = 0;
        rep(i, 0, N){
            tmp += (a[i] - x) * (a[i] - x);
        }
        ans = min(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//#define eps 1e-8
//#define eq(x,y) (fabs((x)-(y)) < eps)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int>pii;
const ll mod = 998244353;
long double PI = acosl(-1);
const ll infl = 3e18+10;
const int inf = 1e9+10;
const int nmax = 2e5+5;
const int MAXLG = log2(nmax)+1;
//mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
//typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ost;

vector<int>g[nmax];
bool vis[nmax];
vector<int>serial;

void dfs(int u){
    if(vis[u]) return;
    vis[u] = true;
    serial.push_back(u);
    dfs(g[u][0]);
}

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

    int n;
    cin>>n;
    vector<int>v(n);
    vector<int>dif(n);
    for(int &x : v) cin>>x;
    for(int i=1; i<n; i++) dif[i] = v[i] - v[i-1];
    int m;
    ll k;
    cin>>m>>k;
    vector<int>permu(n);
    for(int i=1; i<n; i++) permu[i] = i;
    for(int i=1; i<=m; i++){
        int pos;
        cin>>pos;
        swap(permu[pos], permu[pos-1]);
    }
    for(int i=1; i<n; i++){
        g[ permu[i] ].push_back(i);
    }
    vector<int>koigese(n);
    for(int i=1; i<n; i++){
        if(!vis[i]){
            dfs(i);
            int sz = serial.size();
            for(int j=0; j<sz; j++){
                int u = serial[j];
                koigese[u] = serial[ (k+j)%sz ];
            }
            serial.clear();
        }
    }
    vector<int>dif2(n);
    for(int i=1; i<n; i++) dif2[ koigese[i] ] = dif[i];

    vector<ll>ans = {v[0]};
    for(int i=1; i<n; i++) ans.push_back(ans.back() + dif2[i]);

    for(auto z : ans)
        cout<<z<<"\n";

}
/*
*/


Measured memory_bytes: 15604
#include <iostream>
#include <cmath>
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <cstdio>
#include <new>
#include <vector>
#include <cstdlib>
#include <string>
#include <set>
#include <tuple>
#include<map>

using namespace std;
int main() {
	vector<int> alice{ 2,3,4,5,6,7,8,9,10,11,12,13,1 };
	vector<int> bob{ 2,3,4,5,6,7,8,9,10,11,12,13,1 };

	int a, b;
	cin >> a >> b;

	int alice_p = 0, bob_p = 0;

	for (int i = 0; i < alice.size(); ++i) {
		if (a == alice.at(i)) {
			alice_p = i;
			//cout << "Alice_P = " << i << endl;
			break;
		}
	}

	for (int i = 0; i < alice.size(); ++i) {
		if (b == alice.at(i)) {
			bob_p = i;
			//cout << "Bob_P = " << i << endl;

			break;
		}
	}

	if (alice_p > bob_p) cout << "Alice" << endl;
	else if (alice_p < bob_p) cout << "Bob" << endl;
	else cout << "Draw" << endl;

}

Measured memory_bytes: 3628
/***********************************************************
	When you are inspired by passion 
	and you want to live for the current moment

	When your every thought and action
	has the power to become the story of your future

	When difficulties stand to demolish your Glory
	Just remember that Life is a 'Golden adverse Story'

	Withstand it to acheive your passion and dreams
	more amazingly more easily.

	Why then? When writing the story of your Life
	You want to Let someone else hold your pen

					huzaifa242©

***********************************************************/
#include <bits/stdc++.h>
using namespace std;
#define int int32_t
#define MAX 100005
#define x first 
#define y second

int seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline int rnd(int l=0,int r=INT_MAX)
{return uniform_int_distribution<int>(l,r)(rng);}

template <typename T,typename G>
ostream& operator << (ostream& out, const pair<T,G> &a) 
{return out<<"( "<<a.x<<", "<<a.y<<")";}

template <typename T>
ostream& operator << (ostream& out, const vector<T> &a) 
{out<<"[ ";for(const auto &i:a)out<<i<<", ";return out<<"]"<<endl;}

template <typename T>
ostream& operator << (ostream& out, const set<T> &a) 
{out<<"{ ";for(const auto &i:a)out<<i<<", ";return out<<"}"<<endl;}

template <typename T,typename G>
ostream& operator << (ostream& out, const map<T,G> &a) 
{out<<"< ";for(const auto &i:a)out<<i<<", ";return out<<">"<<endl;}

template<typename T, size_t N>
typename enable_if<!is_same<typename remove_cv<T>::type, char>::value,
ostream&>::type operator<<(ostream& out, T(&a)[N])
{out<<"[ ";for(size_t i=0;i<N;++i)out<<a[i]<<", ";out <<"]"<<endl;return out;}

void debug_out(){cerr<<endl;} 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{cerr<<(H)<<" ";debug_out(T...);}
 
#ifdef LOCAL
#define debug(...) cerr<<"#"<<#__VA_ARGS__<<":\n",debug_out(__VA_ARGS__)
#else
#define debug(...) 24
#endif

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	string s,t,p;
	cin>>s>>t;
	t.pop_back();
	if(s==t)
		cout<<"Yes\n";
	else
		cout<<"No\n";
	return 0;
}


Measured memory_bytes: 3660
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<map>
#include<algorithm>
#include<set>
#include <stdexcept>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int dx[]={1,0,-1,0,1,-1,-1,1};
const int dy[]={0,1,0,-1,1,1,-1,-1};
int ceil(int a,int b){
    return (a+b-1)/b;
}
int main(void){
    int a,b,c,x;
    cin>>a>>b>>c>>x;
    int ans=0;
    for(int i=0;i<=a;i++){
        for(int j=0;j<=b;j++){
            for(int k=0;k<=c;k++){
                int sum=500*i+100*j+50*k;
                if(sum==x) ans++;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <cmath>   
#include<cctype>
#include<string>
#include<set>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <utility> 

#define rep(i,m,n) for(int i = m;i < n;++i)
using namespace std;
using ll = long long;
using R = double;
const ll inf = 1LL << 50;
const ll MOD = 1e9 + 7;

ll N, M;
vector<ll>dev;
void devisor(ll n) {
	for (ll i = 1; i*i <= n; i++) {
		if (n%i == 0) {
			if (i == n / i) {
				dev.push_back(i);
			}
			else {
				dev.push_back(i);
				dev.push_back(n / i);
			}
		}
	}
}

int main() {
	cin >> N >> M;
	devisor(M);
	sort(dev.begin(), dev.end());

	if (N == 1) {
		cout << M << endl;
	}
	else {
		int c = 0;
		while (N <= M / dev[c]) {
			c++;
		}
		cout << dev[c - 1] << endl;
	}


	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
/* clang-format off */
#define MOD 1000000007
#define INF 1000000000
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
#define __DEBUG__
#ifdef __DEBUG__
#define CH_P(a) cout <<"check_point("<<#a<<")" << "\n";
#define DEBUG(x) cout<<#x<<":"<<x<<"\n"
#define DEBUGS(v) cout << #v << ":";for(auto x:v){cout<<x<<" ";}cout<<"\n"
#endif
#ifndef __DEBUG__
#define CH_P(a) 
#define DEBUG(x) 
#define DEBUGS(v) 
#endif
/* clang-format on */

int main() {
  double n, d;
  cin >> n >> d;
  cout << ceil(n/(2*d+1)) << endl;
  return 0;
}


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

int main()
{
	char S[10000 + 5];
	int sleng = 0;
	int N;

	cin >> N;
	cin >> S;

	for (int i = 0; S[i] != '\0'; i++)sleng++;
	for (int i = 0; i <= sleng; i++)
	{
		if (S[i] >= 65 && S[i] <= 90) {
			S[i] += N;
			if (S[i] >= 91) {
				S[i] -= 26;
			}
			cout << S[i];
		}
	}

	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
#define rep(i,j,n) for(int i=(j);i<=((int)n);++i)
#define rev(i,n,j) for(int i=(n);i>=((int)j);--i)
typedef long long int ll;
#define int long long int
const ll INFL=0x3f3f3f3f3f3f3f3fLL;
const int INF=0x3f3f3f3f;
const int mod=1000000007;
#define endl "\n"
#define mem(a,val) memset(a,val,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define present(container, element) (container.find(element) != container.end())
#define pb push_back
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define readmat(a, n, m) int a[n + 5][m + 5] = {}; rep(i, 1, n) {rep(j, 1, m) cin >> a[i][j];}
#define printmat(a, n, m) rep (i, 1, n) {rep (j, 1, m) cout << a[i][j] << " "; cout << endl;} cout << endl;
#define printarr(a, n) rep(i, 1, n) cout << a[i] << " "; cout << endl;
typedef std::map< int,int> mii;
typedef std::vector< int > vi;
typedef std::vector< vi > vvi;
typedef std::pair< int,int > ii;
using namespace std;
#define cerr cout
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);}
const int N = 1e6+5, M = N;
vector <int>g[N];

void solve()
{
	string s,t;
	cin>>s>>t;
	int a=0;
	for(int i = 0; i <s.length(); ++i) 
	{
		if (s[i]!=t[i])
			a++;
	}
	cout<<a<<endl;

}



signed main()
{
  FAST;
#ifdef LOCAL
    freopen("C:\\Users\\hp\\Documents\\input.txt", "r", stdin);
    freopen("C:\\Users\\hp\\Documents\\output.txt", "w", stdout);
    std::chrono::time_point<std::chrono::high_resolution_clock> start, end;
    start = std::chrono::high_resolution_clock::now();
#endif

solve();

#ifdef LOCAL
    end = std::chrono::high_resolution_clock::now();
    ll elapsed_time = std::chrono::duration_cast<std::chrono::milliseconds>(end-start).count();
    cout<<endl;
    cout << "\nElapsed Time: " << elapsed_time << "ms\n";
#endif

return 0;

}

// vector string set map first second continue break return upper_bound lower_bound length void sort
// stack queue pop size erase empty insert
// #Hala BBCF



Measured memory_bytes: 27208
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n);
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

int main()
{
    int a, b, c;
    cin>>a>>b>>c;
    cout<<a * b / 2<<endl;

    return 0;
}


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

int main(){
    int k, s;
    cin >> k >> s;
    
    int ans = 0;
    rep(x, k+1){
        rep(y, k+1){
            int z = s-x-y;
            if(z>=0 && z <= k) ans++;
        }
    }
    
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
*A, = map(int, input().split())

dp = [[-1]*(K + 1) for _ in range(N + 1)]
for j in range(K + 1):
    dp[0][j] = 0

for i in range(N):
    for j in range(K + 1):
        if j >= 1:
            dp[i + 1][j] = max(dp[i][j], dp[i][j - 1] + A[i])
        else:
            dp[i + 1][j] = dp[i][j]
            
print(dp[N][K])

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

string s;
long k;
int i;

int main(){
	cin >> s >> k;
	for (i = 0; i < s.size(); ++i){
		if (s[i] != '1') break;
	}
	if (i >= k) cout << '1';
	else cout << s[i];
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int k, s;
    cin >> k >> s;

    int count = 0;
    for (int x = 0; x <= k; x++) {
        for (int y = 0; y <= k; y++) {
            int z = s - (x + y);
            if (z >= 0 && z <= k)
                count++;
        }
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
k, n = map(int,input().split())
a = list(map(int,input().split()))
a.append(a[0])
ans = 10**7+1

for i in range(n):
    up = (a[i]-a[i-1]) % k
    down = (a[i+1] - a[i]) % k
    ans = min(ans, k-up, k-down)

print(ans)    


Measured memory_bytes: 26100
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
const int inf=0x7fffffff;
const int mod=1e9+7;
const int eps=1e-6;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define int long long
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl '\n'
signed main()
{
    IOS;
    int n,a,b;
    cin>>n>>a>>b;
    int res=n/(a+b)*a;
    n%=(a+b);
    res+=(n>=a)?a:n;
    cout<<res<<endl;
}


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

using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	int k;
	cin >> k;
	vector<int> answer(k);
	for (int i = 0; i<k; i++) cin >> answer[i];
	for (int i = 1; i<n; i++) {
		vector<int> kari = answer;
		answer.clear();
		cin >> k;
		for (int j = 0; j<k; j++) {
			int l;
			cin >> l;
			for (int s = 0; s<kari.size(); s++) {
				if (l == kari[s]) {
					answer.push_back(l);
					kari.erase(kari.begin() + s);
					break;
				}
			}
		}
	}

	cout << answer.size() << endl;
	return 0;
}

Measured memory_bytes: 256
//...and kamehameha
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define nl '\n'
typedef long long ll;
//////////////////////////////////////////////////////////////////////

const int N = 2e5+5;
int n,m;
vector<int> g[N];
bool v[N];

int main(){
  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  
  cin>>n>>m;
  for(int u,v,i=1;i<=m;i++){
    cin>>u>>v;g[u].emplace_back(v);g[v].emplace_back(u);
  }

  fill(v+1,v+1+n,0);
  v[1]=1;
  for(auto&w:g[1])
    v[w] = 1;
  for(auto&w:g[1])
    for(auto&x:g[w])
      if(!v[x]){
	if(x==n){
	  cout<<"POSSIBLE"<<nl;
	  return 0;
	}
      }
  cout<<"IMPOSSIBLE"<<nl;
  return 0;
}


Measured memory_bytes: 12144
n = int(input())  
li = list(map(int, input().split()))
li.append(0)
li.insert(0,0)
li_cost = [abs(li[i]-li[i+1]) for i in range(n+1)]
cost_sum = sum(li_cost)

for i in range(n):
    if li_cost[i] == 0:
        print(cost_sum)
    else:
        print(cost_sum - li_cost[i] - li_cost[i+1] + abs(li[i] - li[i+2]))

Measured memory_bytes: 14044