akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
//var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
namespace AtCoderSolve
{
    class Solve
    {
        const int mod = 1000000007;
        static void Main(string[] args)
        {
            //var watch = new Stopwatch();
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);


            var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int D = input[0];
            int G = input[1];
            int[] p = new int[D];
            int[] c = new int[D];

            for(var i = 0; i < D; i++)
            {
                var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
                p[i] = a[0];
                c[i] = a[1];
            }
            //watch.Start();

            long ans = 10000000000;
            for(var bit = 0; bit < (1 << D); bit++)
            {
                long psum = 0;
                long nsum = 0;
                List<int> B = new List<int>();
                List<int> rest = new List<int>();
                for(var i = 0; i < D; i++)
                {
                    if ((bit & (1 << i)) != 0)
                    {
                        B.Add(i);
                    }
                    else
                    {
                        rest.Add(i);
                    }
                }
                if (rest.Count() > 0) { rest.Reverse(); }


                for(var i = 0; i < B.Count(); i++)
                {
                    psum += 100 * (B[i] + 1) * p[B[i]] + c[B[i]];
                    nsum += p[B[i]];
                }

                if (psum >= G)
                {
                    ans = Math.Min(ans, nsum);
                }
                else
                {
                    for(var i = 0; i < rest.Count(); i++)
                    {
                        if (p[rest[i]] == 1) { continue; }
                        
                        for(var j = 0; j < p[rest[i]]; j++)
                        {
                           nsum++;
                           psum += 100 * (rest[i] + 1);
                           if (psum >= G)
                           {
                              ans = Math.Min(ans, nsum);
                              i = rest.Count() - 1;
                              break;
                           }
                        }
                        
                    }
                }

            }

            Console.WriteLine(ans);



            Console.Out.Flush();
            /*watch.Stop();

            Console.WriteLine($"time:{watch.ElapsedMilliseconds} ms"); //Debug Only.
            Console.Out.Flush();*/
        }
    }
    


    public class Calculation
    {
        
    }

    public class Graph
    {

    }
}
    

Measured memory_bytes: 13396
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		String t = "";
		boolean[] c = new boolean[3];
		for (int i = 0; i < 3; i++)
			c[i] = false;
		c[0] = true;
		while ((t = bf.readLine()) != null) {
			char[] ca = t.toCharArray();
			if (ca.length != 3)
				break;
			int p0 = (int) ca[0] - 'A';
			int p1 = (int) ca[2] - 'A';
			c[p0] ^= c[p1];
			c[p1] ^= c[p0];
			c[p0] ^= c[p1];
		}
		for (int i = 0; i < 3; i++)
			if (c[i]) {
				System.out.println((char) ('A' + i));
				break;
			}
	}
}

Measured memory_bytes: 9416
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long double w,h,x,y;
  cin >> w >> h >> x >> y;
  long double area = w*h/2;
  cout << fixed << setprecision(6) << area << " ";
  if(x==w/2 && y==h/2) cout << 1 << endl;
  else cout << 0 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL MOD = 1000000007;
#define lcm(x, y) ((x) * (y) / __gcd((x), (y)))
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define debug(x) cout << #x << " : " << x << endl
#define part cout << "----------------------------------\n";
#define fastinput                     \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
LL cal(LL n)
{
    return (n*(n+1))/2;
}

int main()
{
    fastinput;
    LL n,i,j,k,t,temp;
    cin>>n;
    map<LL,LL> freq;
    for(i=2;i*i<=n;i++)
    {
        if(n%i==0)
        {
            while(n%i==0)
            {
                freq[i]++;
                n/=i;
            }
        }
    }

    if(n!=1)
    {
        freq[n]++;
    }

    LL ans=0;

    for(auto x:freq)
    {
        LL f=x.second;
       // debug(x.first);
        //debug(x.second);
        LL lb=0,ub=50;
        LL pos=-1,mid=-1;
        while(lb<=ub)
        {
            mid=(lb+ub)/2;
            if(cal(mid)>f)
            {
                pos=mid;
                ub=mid-1;
            }
            else
            {
                lb=mid+1;
            }            
        }

        pos--;
        //debug(pos);
       // part;
        ans+=pos;

    }
   // debug(ans);
   cout<<ans<<endl;

    return 0;
}



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

string connect(string a, string b){
  for (int i = 0; i < a.length(); i++) {
    if(a.substr(i) == b.substr(0, a.length() - i))
      return b.substr(a.length() - i);
  }
  return b;
}

bool minCost(string a, string b){
  if(a.length() != b.length())return a.length() < b.length();
  return a < b;
}
             


string solve(vector<string> s, vector<vector<string> > tail){
  int n = s.size();
  vector<vector<string> > dp(1 << n, vector<string>(n, string(101, 'z')));
  for (int i = 0; i < n; i++) {
    dp[(1 << i)][i] = s[i];
  }
  for (int i = 0; i < (1 << n); i++) {
    for (int j = 0; j < n; j++) {
      if((i & (1 << j)) == 0)continue;
      int m = j;
      for (int k = 0; k < n; k++) {
        if((i & (1 << k)) == 0 || j == k)continue;
        //std::cout << i << " " << j << " " << k << std::endl;
        //std::cout << tail[k][j] << std::endl;
        if(minCost(dp[i ^ (1 << j)][k] + tail[k][j],
                   dp[i ^ (1 << j)][m] + tail[m][j]))
          m = k;
      }
      if(minCost(dp[i ^ (1 << j)][m] + tail[m][j], dp[i][j]))
        dp[i][j] = dp[i ^ (1 << j)][m] + tail[m][j];
        
    }
  }
  string res = string(101, 'z');
  for (int i = 0; i < n; i++) {
    if(minCost(dp[(1 << n) - 1][i], res))
      res = dp[ (1 << n) - 1][i];
  }
  // for (int i = 0; i < (1 << n); i++) {
  //   for (int j = 0; j < n; j++) {
  //     std::cout << "i:" << i << " j:" << j << " " << dp[i][j] << std::endl;
  //   }
  //   std::cout << std::endl;

  //}
  return res;
}
int main(int argc, char *argv[]){
  int n;
  while(cin >> n, n){
    vector<string> s(n), use;
    for (int i = 0; i < n; i++) {
      cin >> s[i];
    }
    sort(s.begin(), s.end());
    s.erase(unique(s.begin(), s.end()), s.end());
    vector<int> del(s.size(), 0);
    for (int i = 0; i < s.size(); i++) {
      for (int j = 0; j < s.size(); j++) {
        if(i == j)continue;
        if(s[i].find(s[j]) != string::npos) del[j] = 1;
      }
    }
    for (int i = 0; i < del.size(); i++) {
      if(del[i] == 0)use.push_back(s[i]);
    }
    n = use.size();
    vector<vector<string> > tail(n, vector<string>(n));
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        tail[i][j] = connect(use[i], use[j]);
      }
    }
    // for (int i = 0; i < n; i++) {
    //   for (int j = 0; j < n; j++) {
    //     std::cout << tail[i][j] << std::endl;
    //   }
    //   std::cout << std::endl;
    // }
    std::cout << solve(use, tail) << std::endl;
  }
  return 0;
}

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

using namespace std;

int main() {
  int X, N; cin >> X >> N;
  vector<int> P(N);
  for (int i = 0; i < N; i++) cin >> P[i];
  
  for (int i = 0; i < N+100; i++) {
    int target1 = X - i;
    bool unmatch1 = true;
    for (int j = 0; j < N; j++) {
      if (target1 == P[j]) {
        unmatch1 = false;
        break;
      }
    }
    if (unmatch1) {
      cout << target1 << endl;
      break;
    }
    int target2 = X + i;
    bool unmatch2 = true;
    for (int j = 0; j < N; j++) {
      if (target2 == P[j]) {
        unmatch2 = false;
        break;
      }
    }
    if (unmatch2) {
      cout << target2 << endl;
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
using vi  = vector<int>;
using ii  = pair<int,int>;
using vii = vector<ii>;
using ll  = long long;

typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update> ordered_set;

#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) int((x).size())
#define REP(i, a, b) for (auto (i) = (a); (i) <= (b); (i)++)
#define PER(i, a, b) for (auto (i) = (a); (i) >= (b); (i)--)
#define ITR(i, x) for (auto (i) = (x).begin(); (i) != (x).end(); (i)++)

string to_string(string s) { return '\"' + s + '\"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B> string to_string(pair<A,B> p)
{ return "(" + to_string(p.F) + ", " + to_string(p.S) + ")"; }
template <typename T> string to_string(T v) {
	int f = 0; string res = "{";
	for (const auto &x: v)
		res += (f++ ? ", " : "") + to_string(x);
	return res + "}";
}
void debug_out() { cerr << "]\n"; }
template <typename T, typename... V>
void debug_out(T a, V... v)
{ cerr << to_string(a); if (sizeof...(v)) cerr << ", "; debug_out(v...); }

#ifdef LOCAL // add -DLOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = [", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif // debug(var1, var2, ...);

const int N = 1e5;
ii edges[N+5];
ll ans[N+5];

vi p;
vi rnk;
vector<ll> sizes;
ll curr;

int find(int i)
{ return (p[i] == i ? i : p[i] = find(p[i])); }

ll getSize(int i)
{ return sizes[find(i)]; }

void unite(int i, int j)
{
	i = find(i); j = find(j);
	if (i == j)  return;
	curr -= getSize(i) * getSize(j);
	if (rnk[i] < rnk[j])
	{
		p[i] = j;
		sizes[j] += sizes[i];
	}
	else
	{
		p[j] = i;
		sizes[i] += sizes[j];
		if (rnk[i] == rnk[j])
			rnk[i]++;
	}
}

signed main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	ll n, m;
	cin >> n >> m;
	REP(i, 0, m-1)
	{
		int x, y;
		cin >> x >> y;
		x--, y--;
		edges[i] = {x, y};
	}

	p.assign(n, 0);
	iota(ALL(p), 0);
	rnk.assign(n, 1);
	sizes.assign(n, 1LL);
	curr = n*(n-1)/2;

	PER(i, m-1, 0)
	{
		ans[i] = curr;
		unite(edges[i].F, edges[i].S);
	}
	REP(i, 0, m-1)
		cout << ans[i] << '\n';
	return 0;
}

Measured memory_bytes: 6324
import numpy as np
na = np.array

def ii():
    return int(input())


def lii():
    return list(map(int, input().split(' ')))


def lvi(N):
    l = []
    for _ in range(N):
        l.append(ii())
    return l


def lv(N):
    l = []
    for _ in range(N):
        l.append(input())
    return l


def yn(b):
    if b:
        print('Yes')
    else:
        print('No')


def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1


def ok(S, i, j):
    try:
        if S[i+1][j] == '#':
            return True
    except:
        pass
    try:
        if S[i-1][j] == '#':
            return True
    except:
        pass
    try:
        if S[i][j+1] == '#':
            return True
    except:
        pass
    try:
        if S[i][j-1] == '#':
            return True
    except:
        pass

    return False


def C():

    H, W = lii()
    S = []
    for _ in range(H):
        S.append(input())

    for i, l in enumerate(S):
        for j in range(len(l)):
            if S[i][j] == '#':
                if not ok(S, i, j):
                    return False

    return True


if __name__ == '__main__':
    yn(C())

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

#define rep(i, n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i, s, n) for(long long i=(s);i<(long long)(n);i++)
#define repi(i, n) for(int i=0;i<(int)(n);i++)
#define rep2i(i, s, n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define chmax(s, t) s=max(s,t);
#define chmin(s, t) s=min(s,t); 

#define deg2rad(deg) (((deg)/360)*2*M_PI)
#define rad2deg(rad) (((rad)/2/M_PI)*360)

using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

const ll INF = (1LL<<60);
const int INFi = (1<<29);

/*素数判定*/
bool is_prime(ll n){
    if(n==1) return false;
    for(ll i=2;i*i<=n;i++){
        if(n%i==0) return false;
    }
    return true;
}

/*約数列挙*/
vll enum_divisors(ll n){
    vll l;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            l.push_back(i);
            if(n/i != i) l.push_back(n/i);
        }
    }
   sort(all(l));
   return l;
}

/*素因数分解*/
vector<P> prime_factorize(ll n){
    vector<P> l;
    for(ll i=2;i*i<=n;i++){
        if(n%i!=0) continue;
        ll e = 0;
        while(n%i==0){
            e++;
            n /= i;
        }
        l.push_back({i, e});
    }
    if(n!=1) l.push_back({n, 1});
    return l;
}

/*最小公倍数*/
ll lcm(ll a, ll b){
    return a*b/__gcd(a,b);
}

/*最大公約数*/
ll gcd(ll a, ll b){
    return __gcd(a,b);
}

/*組み合わせ(Combination)*/
const ll CMAX = 1010000;
const ll CMOD = 1e9+7;
ll fac[CMAX], finv[CMAX], inv[CMAX];
// テーブルを作る前処理
void combinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (ll i = 2; i < CMAX; i++) {
		fac[i] = fac[i - 1] * i % CMOD;
		inv[i] = CMOD - inv[CMOD%i] * (CMOD / i) % CMOD;
		finv[i] = finv[i - 1] * inv[i] % CMOD;
	}
}
// 二項係数計算
ll comb(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % CMOD) % CMOD;
}

/*階乗*/
ll factorial(ll n){
    const ll FMOD = 1e9+7;
    ll ret = n;
    for(ll i=n-1;i>0;i--){
        ret*=i;
        ret%=FMOD;
    }
    return (ret?ret:1);
}


int main(){

    ll n, x, t; cin >> n >> x >> t;

    cout << ((n/x)+!!(n%x))*t << endl;

    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
using namespace std;
int main(){
  int n,m,t,i;
  cin >> n >> m;
int mat1[n][m],mat2[m],mat_a[n]={},a[n];
  for(i=0;i<n;i++){
    for(t=0;t<m;t++){
      cin >> mat1[i][t];
    }
  }
  for (i=0;i<m;i++){
    cin >> mat2[i];
  }
  for(t=0;t<n;t++){
    for(i=0;i<m;i++){
      a[i]=mat1[t][i]*mat2[i];
      mat_a[t]+=a[i];
    }
    cout << mat_a[t] << endl;
  }
return 0;
}



Measured memory_bytes: 3132
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
        new Main().run();
    }
	public void run(){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int n = scan.nextInt();
			if(n == 0){
				break;
			}
			int[] a = new int[n];
			for(int i = 0;i < n;i++){
				a[i] = scan.nextInt();
			}
			int ter = scan.nextInt();
			int count = 0;
			int min = 0;
			int max = n-1;
			while(true){
				if(a[(min+max)/2] == ter){
					count++;
					break;
				}
				if(min > max){
					break;
				}
				if(a[(min+max)/2] < ter){
					count++;
					min = (min+max)/2+1;
				}else{
					count++;
					max = (min+max)/2-1;
				}
			}
			System.out.println(count);
		}
	}
}

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

ll max(ll a, ll b){ 
	if(a >= b) return a;
	else if(a < b) return b;
}
ll min(ll a, ll b){ 
	if(a <= b) return a;
	else if(a > b) return b;
}
ll gcd(ll a, ll b){
	if(b == 0) return a;
	return gcd(b, a%b);
}
ll fact(ll n){
	ll res = 1;
	rep(i, n){
		res *= i + 1;
		res =  res%((ll)(1e9 + 7));
	}
	return res;
}
ll digit(const ll n){
	ll res = 0;
	ll i = 1;
	while(n % i != n){
		res += 1;
		i *= 10;
	}
	return res;
}

int main(){
	string s; cin >> s;
	int k; cin >> k;
	vector<string>substrings;
	int length = 1;
	while(length <= k){
		for(int i = 0; i < s.size() - length + 1; i++){
			string temp = {};
			for(int j = i; j < i + length; j++){
				temp += s[j];	
			}
			substrings.push_back(temp);
		}
		length += 1;
	}

	sort(substrings.begin(), substrings.end());
	substrings.push_back("-1");
	vector<string>ansstrings;
	for(int i = 0; i < substrings.size()-1; i++){
		if(substrings[i] != substrings[i+1] )ansstrings.push_back(substrings[i]);
	}
	/*
	rep(i, substrings.size())cout << substrings[i] << " ";
	cout << endl;
	rep(i, ansstrings.size())cout << ansstrings[i] << " ";
	cout << endl;	
	*/
	cout << ansstrings[k-1] << endl;
}


Measured memory_bytes: 1916
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

using namespace std;

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

	int N;
	cin >> N;

	cout << "ABC" << N;

	return 0;
}


Measured memory_bytes: 3640
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cstring>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()
#define foreach(it,c) for(typeof(c.begin()) it=c.begin();it!=c.end();++it)

const int H = 12, M = 60, S = 60;
int t[] = {0, 0, 1, 1, 2 , 2};
int c[] = {1, 2, 0, 2, 0, 1};
int b[] = {2, 1, 2, 0, 1, 0};


int main()
{
    int n;
    while(cin >> n && n)
    {
        int w[H * M * S + 10] = {};
        int h, m, s, ct, tt, bt, time, a[3];
        REP(n)
        {
            cin >> a[0] >> a[1] >> a[2];

            rep(rot, 60)rep(j, 6)
            {
                ct = (a[c[j]] + rot) % 60;
                tt = (a[t[j]] + rot) % 60;
                bt = (a[b[j]] + rot) % 60;
                if((tt % 5) == (ct / 12))
                {
                    h = tt / 5;
                    m = ct;
                    s = bt;
                    time = h *  M * S + m * S + s;
                    w[time] |= (1 << i);
                }
            }
        }
       // cout << w[0] << " " << w[10] << endl;
        int d = H * M * S, ans1 = 0, ans2 = H * M * S;
        int watch[M] = {}, wnum = 0, rs = 0, ls = 0;
        REP(n)if((w[0]>>i)&1) watch[i]++;
        while(rs < H * M * S)
        {
            wnum = 0;
            REP(n)if(watch[i]> 0) wnum++;
           // cout << watch << endl;
            if(wnum != n)
            {
                rs++;
                REP(n)if((w[rs]>>i)&1) watch[i]++;
            }
            else
            {
             //   cout << watch << endl;
                if(ans2 - ans1 > rs - ls){ ans2 = rs; ans1 = ls;}
                rep(j, n)if((w[ls]>>j) & 1) watch[j]--;
                ls++;
            }
        }
        //cout << ans1 << " " << ans2 << endl;
        printf("%02d:%02d:%02d %02d:%02d:%02d\n", ans1/(M*S), (ans1/S)%M, ans1%S,
                ans2/(M*S), (ans2/S)%M, ans2%S);
        
    }

    return 0;
}

Measured memory_bytes: 1332
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる





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

  vector<int> a(z);
  vector<int> b(z);
  vector<int> c(z);
  vector<int> d(z);
  rep(i,z){
    cin>>a[i]>>b[i]>>c[i]>>d[i];
    a[i]--;
    b[i]--;
  }

  vector<int> p(m+n-1);
  rep(i,m-1){
    p[i]=1;
  }

  ll ans=0;

  //——————————————next_permutaion(np)——————————————
  sort(all(p));
  
  do{
    vector<int> q(n);
    int cnt=0;
    int now=0;
    rep(i,m+n-1){
      if(p[i]==1) cnt++;
      else {
        q[now]=cnt;
        now++;
        if(now==n) break;
      }
    }
    
    ll sum=0;
    rep(j,z){
      if(q[b[j]]-q[a[j]]==c[j]) {
        sum+=d[j];
      }
    }

    chmax(ans,sum);

  }while(np(all(p)));

  //——————————————————————————————————————————

  cout << ans << endl;
}

Measured memory_bytes: 3588
// C - 4-adjacent
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

bool solve(int N, vi &A){
	int c2 = 0, c4 = 0;
	rp(i, 0, N){
		if(A[i]%4 == 0) c4++;
		else if(A[i]%2 == 0) c2++;
	}
	return N/2 <= c4 + c2/2;
}

int main(){
	int N; cin>>N;
	vi A(N); rp(i, 0, N) cin>>A[i];
	puts(solve(N, A)? "Yes":"No");
}

Measured memory_bytes: 640
fun main(args: Array<String>) {
    val (A, B) = listOfInt()
    println(if (A <= B + B) 0 else A - (B + B))
}
fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun listOfString() = next().split(" ")
fun listOfInt(delta: Int = 0) = listOfString().map { Integer.parseInt(it) + delta }

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

int bagNum(vector<int> A, int a, int k, int n){
    int i = 0;
    for(int j = 0; j < k; j++){
        int total = 0;
        while(total < a){
            total += A[i];
            if (total > a){
                break;
            } else {
                i++;
                if (i == n){
                    return n;
                }
            }
        }
    }
    return i;
}

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

    vector<int> w(n);
    rep(i,n){
        cin >> w[i];
    }

    int left = 0;
    int right = 1000000000;

    int mid;
    while(left < right){
        mid = (left + right) / 2;
        int midnum = bagNum(w, mid, k, n);
        if(midnum == n){
            right = mid;
        } else {
            left = mid + 1;
        }
    }

    cout << left << endl;

}


Measured memory_bytes: 3664
import Control.Monad
import Data.Array
import Data.Bits
import Data.List

main = do
    [n, k] <- fmap read <$> words <$> getLine
    a      <- fmap read <$> words <$> getLine
    putStrLn $ show $ solve n k a

solve :: Integer -> Integer -> [Integer] -> Integer
solve n k a = memo ! (50, False)
  where
    doit (-1, _)  = sum(a)
    doit (b, ok) | ok || k .&. msb /= 0 = max (memo ! (b - 1, ok) + diff) (memo ! (b - 1, True))
                 | otherwise            =      memo ! (b - 1, ok)
      where
        msb  = 1 `shift` b
        diff = sum $ [if ai .&. msb /= 0 then -msb else msb | ai <- a]
    memo = listArray ((-1, False), (50, True)) [doit (b, ok) | b <- [-1..50], ok <- [False, True]]


Measured memory_bytes: 68988
N,K = list( map(int,input().split()) )
ans = 0
for i in range(K,N+2) :  
    S_min = i*(i-1)/2      
    S_max = (2*N-i+1)*i/2
    ans += S_max - S_min + 1
ans %= 7+10**9 
print(int(ans))

Measured memory_bytes: 9136
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define dup(x,y) (((x)+(y)-1) / (y)) //整数型のまま切り上げ演算する
#define PI 3.14159265359
typedef long long LL;
template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> inline T gcd(T x, T y) { if (y == 0) { return x; } else if (x == 0) { return y; }return gcd(y, x % y); }
template<class T> inline T lcm(T x, T y) { return (x * y) / gcd(x, y); }
template<class T> inline vector<T> convert_to_binary_number(T x) { vector<T> binary_num; while (x != 1) { binary_num.push_back(x % 2); x /= 2; } binary_num.push_back(1); return binary_num; }
template<class T> inline void print_vector(vector<T> vec) { for (int i = 0; i < vec.size(); i++) { cout << vec[i] << " "; } cout << endl;}
const LL MOD = 1e9 + 7;
const LL INF = 1LL << 60;

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

    int insert_place = 1;
    int count = 0;
    while(insert_place < B){
        insert_place = insert_place - 1 + A;
        count++;
    }
    cout << count << endl;
    return 0;
}


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

int main(void){
  int n;
  int d;
  scanf("%d", &n);
  scanf("%d", &d);
  int a[n][d];
  int i;
  int j;
  int k;
  int count = 0;
  for(i=0;i<n;i++){
    for(j=0;j<d;j++){
      scanf("%d", &a[i][j]);
    }
  }
  int sum = 0;
  for(i=0;i<n-1;i++){
    for(k=i+1;k<n;k++){
      for(j=0;j<d;j++){
        sum += pow(abs(a[i][j]-a[k][j]), 2.0);
      }      
      //printf("\n%d", sum);
      //printf("\n%lf", sqrt(sum));
      if((int)sqrt(sum)*(int)sqrt(sum) == sum){
        count++;
      }
      sum = 0;
    }
  }
  printf("%d", count);
}

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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

class Prints {
private:
    class __Prints {
    public:
        __Prints(const char* sep, const char* term) : sep(sep), term(term) {}
        template <class... Args>
        void operator()(Args&&... args) const { print(std::forward<Args>(args)...); }

    private:
        const char *sep, *term;
        void print() const { std::cout << term; }
        void print_rest() const { std::cout << term; }
        template <class T, class... Tail>
        void print(T&& head, Tail&&... tail) const { std::cout << head, print_rest(std::forward<Tail>(tail)...); }
        template <class T, class... Tail>
        void print_rest(T&& head, Tail&&... tail) const { std::cout << sep << head, print_rest(std::forward<Tail>(tail)...); }
    };

public:
    Prints() {}
    __Prints operator()(const char* sep = " ", const char* term = "\n") const { return __Prints(sep, term); }
    template <class T>
    void print_vec(const std::vector<T>& vec, const char* sep = " ", const char* term = "\n") const {
        const size_t sz = vec.size();
        for (size_t i = 0; i < sz; i++) std::cout << vec[i] << (i == sz - 1 ? term : sep);
    }
};

Prints prints;

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    ll X;
    cin >> X;
    prints()(8 - (X / 200 - 2));
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    cout << setprecision(18) << fixed;
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 3688
import numpy as np
from collections import deque

xs, ys, xt, yt = map(int, raw_input().split())
N = int(raw_input())
X = [xs]
Y = [ys]
R = [0]
for _ in range(N):
    x, y, r = map(int, raw_input().split())
    X.append(x)
    Y.append(y)
    R.append(r)
X.append(xt)
Y.append(yt)
R.append(0)

X_np = np.array(X)
Y_np = np.array(Y)
R_np = np.array(R)

dist = np.zeros((N+2, N+2))
for i in range(N+2):
    dist[i, :] = np.maximum(np.sqrt((X_np - X_np[i])**2 + (Y_np - Y_np[i])**2) - (R_np + R_np[i]), 0)

cost = 4000000000.0 * np.ones(N+2)
cost[0] = 0
# with minnimum cost
q = 0
unfixed_list = range(N+2)
unfixed_list.remove(q)


while len(unfixed_list) > 0:
    new_cost = cost[q] + dist[q, :]
    cost = np.minimum(cost, new_cost)
    q = unfixed_list[cost[unfixed_list].argmin()]
    unfixed_list.remove(q)
    

print cost[N+1]

Measured memory_bytes: 18476
class SegmentTree:
    n=0
    node=[]

    def __init__(self, sz):
        self.n=1
        while self.n<sz: self.n *= 2
        self.node = [INF] * (2*self.n-1)


    def update(self, x, val):
        x += self.n-1 
        self.node[x] = val
        while x>0:
            x = int((x-1)/2)
            self.node[x] = min(self.node[2*x+1], self.node[2*x+2])

    def getmin(self, a, b, k=0, l=0, r=-1):
        if r<0: r = self.n
        if a<=l and r<=b: return self.node[k]
        if r<=a or  b<=l: return INF
        
        vl = self.getmin(a, b, 2*k+1, l, int((l+r)/2))
        vr = self.getmin(a, b, 2*k+2, int((l+r)/2), r)
        return min(vl, vr)


INF = 2**31-1
sz, q = map(int, input().split())
rmq = SegmentTree(sz)
for _ in range(q):
    c, x, y = map(int, input().split())
    if c: print(rmq.getmin(x, y+1))
    else: rmq.update(x, y)



Measured memory_bytes: 8696
#include<stdio.h>
#include<stdlib.h>
 
struct node{
    struct node *right;
    struct node *left;
    struct node *parent;
    int key;
};
 
typedef struct node * Node;
#define NIL NULL
 
Node root;
 
Node treeMinimum (Node x ){
 
}
 
Node treeSearch (Node u, int k ){
 
}
 
Node treeSuccessor (Node x ){
 
}
 
void treeDelete (Node z ){
    Node y; // node to be deleted
    Node x; // child of y
}
 
void insert (int k ){
    Node y = NIL;
    Node x = root;
    Node z;
 
    z = malloc (sizeof (struct node ) );
    z->key = k;
    z->left = NIL;
    z->right = NIL;
 
    if (x == NIL ){
        root = z;
    }else{
        do{
            if (x->key < k ){
                y = x->right;
            }else{
                y = x->left;
            } // end if
 
            if (y != NIL ){
                y->parent = x;
            }else{
                if (x->key < k )
                    x->right = z;
                else
                    x->left = z;
            } // end if
            x = y;
        }while (x != NIL ); // end while
    } // end if
}
 
void inorder (Node u ){
    if (u == NIL ) return;
    inorder (u->left );
    printf (" %d", u->key );
    inorder (u->right );
}
 
void preorder (Node u ){
    if (u == NIL ) return;
    printf (" %d", u->key );
    preorder (u->left );
    preorder (u->right );
}
 
int main()
{
    int n, i, x;
    char com[20];
 
    root = NIL;
    scanf ("%d", &n );
    for (i = 0; i < n; i++ ){
        scanf ("%s", com );
        if (com[0] == 'i' ){    // case insert
            scanf ("%d", &x );
            insert (x );
        }else
        if (com[0] == 'p' ){ // case print
            inorder (root );
            printf ("\n" );
            preorder (root );
            printf ("\n" );
        } // end if
    }   // end for
 
    return 0;
}


Measured memory_bytes: 25184
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <iomanip>
#include <stdio.h>
#include <algorithm>
#include <queue>
#include <string.h>
#define endl '\n'
#define pb push_back
#define mp make_pair
#define int long long
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
int n,k;
int a[200010];
signed main(){
	cin>>n>>k;
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	int L=-Inf,R=Inf;
	while(L+1<R){
		int MID=(L+R)>>1,cnt=0;
		for(int i=0;i<n;i++){
			int l=i,r=n;
			while(l+1<r){
				int mid=(l+r)>>1;
				if(a[i]*a[mid]<=MID)(a[i]<0)?r=mid:l=mid;
				else (a[i]<0)?l=mid:r=mid;
			}
			cnt+=(a[i]<0)?n-r:l-i;
		}
		if(cnt<k)L=MID;
		else R=MID;
	}
	cout<<R<<endl;
	return 0;
}


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

constexpr int inf = 1e9;
vector<int> w(300);
int dp[1000][1000];

int rec(int l,int r){
    //既に計算済み？
    if(dp[l][r] != -1) return dp[l][r];

    //これ以上取り除けない？
    if(abs(l - r) <= 1) return 0;

    int res = 0;
    //パターン1.
    if(abs(w[l] - w[r - 1]) <= 1 && rec(l + 1,r - 1) == r - l - 2)
    {
        //[l , r)がはじき出せるので
        res = r - l;
    }

    //パターン２.区間を分ける
    for(int mid = l + 1;mid <= r - 1;mid++)
    {
        res = max(res , rec(l,mid) + rec(mid,r));
    }
    return dp[l][r] = res;
};

int main(){
    int num;

    while(cin >> num, num != 0){
        memset(dp, -1,sizeof(dp));
        for(int i = 0; i < num; i++){
            cin >> w[i];
        }
        cout << rec(0, num) << endl;
    }

    return 0;
}




Measured memory_bytes: 7020
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1000000007;

int main(){
  int n, k;
  cin >> n >> k;
  vector<vector<int>> vec(n,vector<int>(0));
  vector<int> d(n,-1);
  for(int i=0; i<n-1; ++i){
    int a, b;
    cin >> a >> b;
    --a, --b;
    vec[a].push_back(b);
    vec[b].push_back(a);
  }
  
  queue<int> que;
  que.push(0);
  d[0] = k;
  while(!que.empty()){
    int x = que.front();
    que.pop();
    int cnt = k-2;
    if(x == 0) ++cnt;
    for(int a: vec[x]){
      if(d[a] != -1) continue;
      if(cnt == 0){
        cout << 0 << endl;
        return 0;
      }
      d[a] = cnt;
      --cnt;
      que.push(a);
    }
  }
  ll ans = 1;
  for(int i=0; i<n; ++i){
    ans *= d[i];
    ans %= MOD;
  }
  cout << ans << endl;
}

Measured memory_bytes: 10036
(* O(√p) *)
let n, p = Scanf.scanf " %d %d" @@ fun a b -> a, b
let factorize_primes n =
  let rec f acc c d m =
    if d > m || d * d > n then
      List.rev @@ if c > 0 then (d, c) :: acc else if m > 1 then (m, 1) :: acc else acc
    else
      if m mod d = 0 then f acc (c + 1) d @@ m / d
      else f (if c > 0 then (d, c) :: acc else acc) 0 (d + 1) m in
  f [] 0 2 n
let rec pow b n =
  if n <= 0 then 1
  else let p = pow b (n / 2) in p * p * if n mod 2 = 0 then 1 else b
let ps = factorize_primes p
let _ = List.fold_left (fun acc (b, c) -> acc * pow b (c / n)) 1 ps |> Printf.printf "%d\n"

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

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var card = new int[3, 3];
            for (int i = 0; i < 3; i++)
            {
                var r = Console.ReadLine().Split(' ');
                for (int j = 0; j < r.Length; j++)
                {
                    card[i, j] = r[j].ToInt();
                }
            }
            var N = Console.ReadLine().ToInt();
            for (int i = 0; i < N; i++)
            {
                var b = Console.ReadLine().ToInt();
                for (int j = 0; j < 3; j++)
                {
                    for (int k = 0; k < 3; k++)
                    {
                        if (card[j, k] == b)
                        {
                            card[j, k] = 0;
                            break;
                        }
                    }
                }
            }
            var ans = "No";
            for (int i = 0; i < 3; i++)
            {
                if (card[i, 0] + card[i, 1] + card[i, 2] == 0) ans = "Yes";
            }
            for (int i = 0; i < 3; i++)
            {
                if (card[0, i] + card[1, i] + card[2, i] == 0) ans = "Yes";
            }
            if (card[0, 0] + card[1, 1] + card[2, 2] == 0) ans = "Yes";
            if (card[0, 2] + card[1, 1] + card[2, 0] == 0) ans = "Yes";
            Console.WriteLine(ans);
        }
    }

    public static class Extentions
    {
        public static int ToInt(this object obj)
        {
            return int.Parse(obj.ToString());
        }

        public static decimal ToDecimal(this object obj)
        {
            return decimal.Parse(obj.ToString());
        }
    }
}


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

int main()
{
	int N;
	string S;
	cin >> N;
	cin >> S;
	int ans = 0;
	for (int i = 1; i < N; i++)
	{
		int same = 0;
		bool X[26] = {}, Y[26] = {};
		for (int j = 0; j < i; j++)
		{
			X[S[j] - 'a'] = true;
		}
		for (int j = i; j < N; j++)
		{
			Y[S[j] - 'a'] = true;
		}
		for (int i = 0; i < 26; i++)
		{
			if (X[i] && Y[i])
				same++;
		}
		ans = max(ans, same);
	}
	cout << ans << endl;
    return 0;
}

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

long int euclid_alg(const long int a, const long int b) {
	return a > b ? a % b : b % a;
}

int main(void) {
	long int a,b;
	std::vector<long int> num;
	while(std::cin >> a >> b){
		num.push_back(a);
		num.push_back(b);
	}

	for(int i = 0; i < (int)num.size(); i+=2){
		long int pro = num[i] * num[i+1];
		while(num[i] != 0 && num[i+1] != 0){
		if(num[i] > num[i+1]){
				num[i] = euclid_alg(num[i],num[i+1]);
			}else{
				num[i+1] = euclid_alg(num[i],num[i+1]);
			}
		}

		if(num[i] == 0){
			num[i] = num[i+1];
			num[i+1] = 0;
		}
		num[i+1] = pro / num[i];
	}

	for(int j = 0; j < (int)num.size(); j+=2){
		std::cout << num[j] << " " << num[j+1] << std::endl; 
	}

	return 0;
}

Measured memory_bytes: 1216
// AOJ 3100 Strange Plants
// 2019.9.23 bal4u

#include <stdio.h>

//// 入出力関係
#if 1
#define gc() getchar_unlocked()
#define pc(x) putchar_unlocked(x)
#else
#define gc() getchar()
#define pc(x) putchar(x)
#endif

int in() {  // 整数の入力
	int n = 0, c = gc();
	if (c == '-') {	c = gc();
		do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
		return -n;
	}
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

void ins(char *s) { // 文字列の入力　スペース以下の文字で入力終了
	do *s = gc();
	while (*s++ > ' ');
	*(s-1) = 0;
}

void out(int n) { // 非負整数の表示（出力）
	int i; char b[30];

	if (!n) pc('0');
	else {
		i = 0; while (n) b[i++] = n % 10 + '0', n /= 10;
		while (i--) pc(b[i]);
	}
	pc('\n');
}

int main()
{
	int i, X, A, B, N;
	char S[10];

	X = in(), A = in(), B = in(), N = in();
	while (N--) {
		ins(S);
		if (*S == 'n') X += A;
		else if (*S == 't') X += B;
		else X = 0;
		if (X < 0) X = 0;
	}
	out(X);
	return 0;
}



Measured memory_bytes: 2100
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int c2i(char c) {
    return c - '0';
}

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

    string S;
    cin >> S;

    queue<int> q;

    int ans = 0;
    int i = 0;
    for(; i < S.size(); ++i) {
        int cur = c2i(S[i]);

        if (!q.empty() && q.front() ^ cur) {
            q.pop();
            ans += 2;
        } else {
            q.push(cur);
        }
    }

    cout << ans << endl;

}

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

int N;
int main(int argc, char const *argv[]) {
  cin >> N;
  vector<int> a(N);
  for (size_t i = 0; i < a.size(); i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  int ans = *(a.end() - 1) - *a.begin();

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
#define N 200100
#define mem(a,b) memset(a,b,sizeof(a))
typedef long long ll;
using namespace std;
int a[N];
int w[N];
int cmp(int x,int y){
    return x>y;
}
int main(){
  int n,k;
  int ans=0;
  int t;
  cin>>n>>k;
  for (int i=1;i<=n;i++){
    cin>>a[i];
    w[a[i]]++;
  }
  int num=0;

  for (int i=1;i<=N;i++)
    if (w[i]!=0)
      ans++;
  sort(w+1,w+1+N,cmp);
  if (ans>k){
     t=ans-k;
    for (int i=k+1;i<=ans;i++)
        num+=w[i];
        cout << num << endl;
  }
  else
    cout << "0" << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;
using ll = long long;

int main() {
	int n, k, x[100000];
	scanf("%d %d", &n, &k);
	for (int i = 0; i < n; i++)
		scanf("%d", x + i);

	vector<ll> minus, plus;
	plus.push_back(0);
	for (int i = 0; i < n; i++)
		if (0 <= x[i])
			plus.push_back(x[i]);
	minus.push_back(0);
	for (int i = n - 1; 0 <= i; i--)
		if (x[i] < 0)
			minus.push_back(-x[i]);

	ll cost = 1ll << 62;
	for (int i = 0; i < plus.size(); i++) {
		if ((k - i) < minus.size()) {
			cost = min(cost, min(plus[i] * 2 + minus[k - i], plus[i] + minus[k - i] * 2));
		}
	}
	printf("%d\n", cost);
}

Measured memory_bytes: 2040
<?php

$lr = explode(' ', trim(fgets(STDIN)));
$l = $lr[0];
$r = $lr[1];

$min = $r*$r;
for($i=$l; $i<min($l+2019,$r); $i++){
   for($j=$l+1; $j<=min($l+2019,$r); $j++){
    	$m = ($i*$j)%2019;
     if ($m < $min) $min = $m;
   } 
}

echo $min;


?>

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

using namespace std;

using ll = long long;

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

    int n;
    cin >> n;

    int a, ans = 1e9;
    for (int i = 0; i < n; ++i) {
        cin >> a;
        int cnt = 0;
        while (a % 2 == 0 && 0 < a) { a /= 2; ++cnt; }
        ans = min(ans, cnt);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
//include,namespace
 #include<bits/stdc++.h>
 #include<iostream> 
 #include <queue>
 #include <vector>
 #include <string>
 using namespace std;
//REPmacro
 #define all(x) (x).begin(),(x).end()             //ソート
 #define FOR(i,x,n)for(int i=(x);i<(n);i++)
 #define FOR_R(i,x,n) for(int i=(n-1);i>=(x);i--)
 #define REP(i, n) FOR(i, 0, n)
 #define REP_R(i, n) FOR_R(i, 0, n)
//long long(define)
 using ll = long long;
 typedef long long ll;
 typedef long long int64;
 typedef long long lint;
 typedef long long lli;

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};
////////////////いろいろあるよ//////////////////////////////////
int main(){
  char a,b,c;
  cin >> a >> b >> c;
  if(a=='7'||b=='7'||c=='7')cout << "Yes" << endl;
  else cout << "No" << endl;
  

}


Measured memory_bytes: 3596
h = gets.to_i
w = gets.to_i
n = gets.to_i
sum = 0
i = 0

#hとnを比較して大きい数をかける小さい数>m掛けてnより多ければよし

if h > w then
  #print("h は w より大きい")
  while sum < n do
    sum += h
    i += 1
  end
  p i

else
  while sum < n do
    sum += w
    i += 1
  end
  p i
end



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

int main()
{
 
  int a, b, c, d;
  cin >> a >> b >> c >> d;

  if((a + d - 1) / d >= (c + b - 1) / b){
    cout << "Yes" << "\n"; 
  }
  else
  {
    cout << "No" << "\n";
  } 

}

Measured memory_bytes: 3620
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val k, s = sc.nextInt()
  var ans = 0
  for {
    x <- 0 to k
    y <- 0 to k
    if 0 <= s - (x + y) && s - (x + y) <= k
  } {
    ans += 1
  }
  println(ans)
}


Measured memory_bytes: 57192
#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  map<string,int> M;
  for(int i=0;i<N;i++){
  string s;
    cin>>s;
    if(!M.count(s))
      M[s]=1;
    else
      M.at(s)+=1;
  }int Max=0;
  
  for(auto p:M){
   auto k=p.first;
     auto v=p.second;
    if(Max<=v)
      Max=v;
    
  }for(auto p:M){
  auto k=p.first;
    auto v=p.second;
    if(v==Max)
      cout<<k<<endl;
  
  }
  
   return 0;
}

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

int main(void){
    int n,ans;
    cin>>n;
    set<string>st;
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        st.insert(s);
    }
    cout<<st.size()<<endl;
    }


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

int main() {
    int A, B;
    cin >> A >> B;
    bool flag = true;

    rep2(i, 1, 10000/8){
        int a = i * 8 / 100;
        int b = i * 10 / 100;
        if (a == A && b == B){
            cout << i << endl;
            flag = false;
            break;
        }
    }

    if(flag){
        cout << -1 << endl;
    }

    /* miss
    int ans1min, ans1max, ans2min, ans2max;

    double a = A * 100 / 8.0;
    if (a - (int)a == 0){
        ans1min = (int)a;
    } else {
        ans1min = (int)a++;
    }
    
    ans1max = (A + 1) * 100 / 8;

    ans2min = B * 10;
    ans2max = (B + 1) * 10 - 1;

    if (ans1max < ans2min || ans2max < ans1min){
        cout << -1 << endl;
    } else {
        cout << max(ans1min, ans2min) << endl;
    }
    */

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;
using vi = vector<int>;

#define in(v) v; cin >> v;
void ins() {}
template<class T,class... Rest>void ins(T& v,Rest&... rest){cin>>v;ins(rest...);}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rrep(i,n) for(long long i=(n);i>=0;--i)
#define all(f,c,...) (([&](decltype((c)) cccc) { return (f)(begin(cccc), end(cccc), ## __VA_ARGS__); })(c))

// ========== debug ==========
template<class T>ostream& operator<<(ostream& os,const vector<T>& vec){os<<"{";for(size_t i=0;i<vec.size();++i)os<<(i?", ":"")<<vec[i];os<<"}";return os;}
ostream& operator<<(ostream& os,const vector<char>&v){for(size_t i=0;i<v.size();++i)os<<v[i];return os;}
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>& rhs){os<<"("<<rhs.first<<", "<<rhs.second<<")";return os;}

#ifdef LOCAL
void debug() {cerr << "\n";}
template<class First> void debug(const First& first) {cerr<<first<<"\n";}
template<class First, class... Rest> void debug(const First& first, const Rest&... rest) {cerr<<first<<",";debug(rest...);}
void debug2() {cerr << "\n";}
template<class First> void debug2(const First& first) {cerr<<first<<" ";}
template<class First, class... Rest> void debug2(const First& first, const Rest&... rest) {cerr<<first<<" ";debug2(rest...);}
#else
#define debug(...) 42
#define debug2(...) 42
#endif
// ===========================

int main() {
  ll A, V, B, W, T;
  ins(A, V, B, W, T);
  ll d = abs(A-B);
  if (W > V) {
    cout << "NO\n";
    return 0;
  }
  if (d <= T * (V - W))
    cout << "YES\n";
  else
    cout << "NO\n";

  return 0;
}


Measured memory_bytes: 3636
import sys
input = sys.stdin.readline

MOD = 10**9+7
fact = []
memo = {}

def pow(a):
    b = MOD-2
    res = 1
    while b:
        if b & 1: res = res * a % MOD
        a = a**2 % MOD
        b >>= 1
    return res

def comb(n, r):
    global fact, memo
    if r < 0 or r > n: return 0
    if r in memo: a = memo[r]
    else: a = memo[r] = pow(fact[r])

    if n-r in memo: b = memo[n-r]
    else: b = memo[n-r] = pow(fact[n-r])
    
    return (fact[n] * a) % MOD * b % MOD 

def main():
    global fact, memo
    N, K = map(int, input().split())
    A = sorted(list(map(int, input().split())))

    fact = [1] * (N+1)
    
    for i in range(2, N+1): fact[i] = fact[i-1] * i % MOD    
    ans = 0

    for i in range(2):
        for j in range(N):
            n = comb(j, K-1)
            if i == 1: n = -n
            ans += n * A[j]
        if i == 0: A.reverse()
    print(ans%MOD) 

if __name__ == '__main__':
    main()

Measured memory_bytes: 19900