akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1e9+7;
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long LL;
typedef vector<int> VI;
typedef vector<string> VS;

int main(){
    int n, q, cnt = 0;
    cin >> n;
    VI S(n);
    REP(i, n){
        cin >> S[i];
    }
    cin >> q;
    VI T(n);
    REP(i, q){
        cin >> T[i];
        if (binary_search(ALL(S), T[i])){
            cnt++;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 3516
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		
		String s [] = S.split("/");
		
		
		if (s[0].equals("2019")!=true)
			System.out.println("Heisei");
		
		else {
			if (s[1].equals("01") || s[1].equals("02") || s[1].equals("03") || s[1].equals("04"))
				System.out.println("Heisei");
			else
				System.out.println("TBD");
		}
		sc.close();

	}

}


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

using namespace std;
typedef long long ll;

int main(){
  ll N, K, tmp;
  cin >> N >> K;
  vector<ll> A;
  for (ll i=0; i<N; i++){
    cin >> tmp;
    A.push_back(tmp);
  }
  for (ll i=K; i<N; i++){
    cout << ((A[i-K] < A[i]) ? "Yes" : "No") << "\n";
  }
  return 0;
}

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

int main()
{
	int H=0,W=0;
	while(1)
	{
		cin>>H>>W;
		if (H==0 && W==0) break;
		for(int i=0;i<H;i++)
		{
			for(int j=0;j<W;j++)
			{
				if(i%2 == 0 && j%2 == 0) cout<<"#";
				if(i%2 == 0 && j%2 != 0) cout<<".";
				if(i%2 != 0 && j%2 == 0) cout<<".";
				if(i%2 != 0 && j%2 != 0) cout<<"#";
			}
			cout<<endl;
		}
		cout<<endl;
	}
	return 0;
}



Measured memory_bytes: 3068
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define MAXMIN(a,b,c) std::max(a,min(b,c))
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}

	return d;
}

lli graph[30][30] = {};


lli  answer = 0;

void bfs(int x, int y) {
	bool visit[30][30] = {};

	queue<tlll> q;
	q.push(tlll(y, x, 0));

	while (!q.empty()) {

		auto t = q.front();
		q.pop();

		if (graph[std::get<0>(t)][std::get<1>(t)] == 1 && visit[std::get<0>(t)][std::get<1>(t)] == false) {

			answer = max(answer, std::get<2>(t));

			visit[std::get<0>(t)][std::get<1>(t)] = true;

			q.push(tlll(std::get<0>(t) + 1, std::get<1>(t), get<2>(t) + 1));
			q.push(tlll(std::get<0>(t) - 1, std::get<1>(t), get<2>(t) + 1));
			q.push(tlll(std::get<0>(t), std::get<1>(t) - 1, get<2>(t) + 1));
			q.push(tlll(std::get<0>(t), std::get<1>(t) + 1, get<2>(t) + 1));
		}
	}



}

int main(void) {

	lli h, w;
	cin >> h >> w;


	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			char c;
			cin >> c;

			if (c == '.') {
				graph[i + 1][j + 1] = 1;
			}
		}
	}


	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			if (graph[i][j] == 1)
				bfs(j, i);
		}
	}

	cout << answer << 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;
using namespace std;
#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x)                                                                    \
	sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<(c i) \
	{
sim > struct rge
{
	c b, e;
};
sim > rge<c> range(c i, c j) { return rge<c> {i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug
{
#ifndef LOCAL
	~debug()
	{
		cerr << endl;
	}
	eni( != ) cerr << boolalpha << i;
	ris;
} eni( == ) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d)
{
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d)
{
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
	sim dor(const c &)
	{
		ris;
	}
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
template <typename T>
using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define int long long
#define ld long double
#define pb push_back
#define mp make_pair
#define in insert
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define mod 1000000007
#define sz(v) (int)(v.size())
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define prec fixed << setprecision(12)
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define repr(i, a, b) for (int i = a; i >= b; i--)
#define test int t; cin >> t; while (t--)
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef set<int> si;
typedef map<int, int> mii;
typedef vector<pii> vpi;

void solve() {
	int r, d, x;
	cin >> r >> d >> x;
	rep(i, 1, 10) {
		// debug() << imie(x);
		cout << r*x - d << "\n";
		x = r * x - d;
	}
}

int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	// test
	solve();
	return 0;
}

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

//#define int long long

using namespace std;

int a[100001];

int main () {
	int n;
	cin >> n;
	string s, t;
	cin >> s >> t;
	int it = 0;	
	for (int i = 0;i < n;i ++) {
		bool ok = 0;
		for (int j = 0;j + i < n;j ++) {
			if (s[i + j] != t[j]) ok = 1; 
		}
		if (!ok) {
			it = n - i;
			break;
		}
	}
	cout << n + n - it;
    return 0;           		
}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
using namespace std;
using Int = long long;
typedef pair<int,int> P; typedef pair<Int,Int> Pl;
const int mod = 1e9+7;
const Int Inf = 1e17;
#define END {cout<<ans<<'\n'; return 0;}
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define Pr(t) priority_queue<t>
#define gPr(t) priority_queue<t,vector<t>,greater<t>>
#define V(t) vector<t>
#define rep(i,n) for(int(i)=0; i<n; i++)
#define rer(i,l,r) for(int i=l; i<=r; i++)
#define gnr(i,l,r) for(int i=r; i>=l; i--)
#define eb emplace_back
#define pri1(a) cout<<(a)<<'\n'
#define pri2(a,n) {rep(pri2i,n-1)cout<<a[pri2i]<<' '; cout<<a[n-1]<<'\n';}
#define prip(p) cout<<p.fi<<' '<<p.se<<'\n'
template<class T> inline bool cmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool cmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n,m,_,x,y,q;
string s,sb;
bool ok;
char cf,cb;

vector< bool > prime_table(int n) {
  vector< bool > prime(n + 1, true);
  if(n >= 0) prime[0] = false;
  if(n >= 1) prime[1] = false;
  for(int i = 2; i * i <= n; i++) {
    if(!prime[i]) continue;
    for(int j = i + i; j <= n; j += i) {
      prime[j] = false;
    }
  }
  return prime;
}

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

  cin>>n; V(bool)p=prime_table(5*55555);
  V(int)ans,pri; int id=5; rer(i,2,55555)if(p[i])pri.eb(i);
  for(int i:pri)if(i%10==1)ans.eb(i);
  /*while(ans.size()<n){
    x=pri[id]; ok=1;
    m=ans.size();
    rep(i,m-3){
      rer(j,i+1,m-3){
        rer(k,j+1,m-2){
          rer(l,k+1,m-1)if(p[x+ans[i]+ans[j]+ans[k]+ans[l]]){ok=0; break;}
          if(!ok)break;
        }
        if(!ok)break;
      }
      if(!ok)break;
    }
    id++;
    if(!ok)continue;
    ans.eb(x);
  }*/
  rep(i,n)cout<<ans[i]<<(i==n-1?'\n':' ');
}

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

int main(){
  int64_t N;
  vector<pair<int64_t, int64_t>> S;
  cin >> N;
    
  for (int i = 0; i< N; i++) {
    int a, b;
    cin >> b >> a;
    S.push_back(make_pair(a,b));
  }
  sort(S.begin(), S.end());
  
  int64_t tmp;
  int64_t count = 0;
  for (int64_t i = 0; i < N; i++) {
    tmp += S.at(i).second;
    if (tmp > S.at(i).first){
      cout << "No" << endl;
      count++;
      break;
    }
  }
  if (count == 0) {
    cout << "Yes" << endl;
  }
    
  
  
  
  
    
    
    
  return 0;
}
    
    
    

Measured memory_bytes: 6512
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author ExplodingFreeze
 */

#include <iostream>
#include <fstream>

#pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
#define int long long
#define f(i,a,b) for(int i=(a);i<(b);i++)
#define MOD 1000000007
using pii=std::pair<int,int>;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); <-- PUT IN main()/solve()!

using namespace std;

int n,abc[100005][3],ans[100005][3];
class CVacation {
public:
	void solve(std::istream& in, std::ostream& out) {
		in >> n;
		f(i,0,n)
			f(j,0,3)
				in >> abc[i][j];
		f(j,0,3)
			ans[0][j]=abc[0][j];
		f(i,1,n)
			f(j,0,3)
			{
				int jp1=j+1,jp2=j+2;
				if(jp1>2)
					jp1-=3;
				if(jp2>2)
					jp2-=3;
				ans[i][j]=abc[i][j]+max(ans[i-1][jp1],ans[i-1][jp2]);
			}
		out << max(ans[n-1][0],max(ans[n-1][1],ans[n-1][2])) << "\n";
	}
};


int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	CVacation solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define DESCEND greater<int>()  // sort 降順 大きい順
#define UNIQUE(vec) (vec).erase(unique(ALL((vec))), (vec).end());  // 必ずsortを行なってから
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
typedef long long ll;

const int MOD = 1000000007;  // 1 000 000 007


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

    // input
    string str;
    REP(i, 3) {
        cin >> str;
        cout << (char)toupper(str.front());
    }
    cout << "\n";
    
    return 0;
}


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

using namespace std;

int main(){
    int N;
    while(cin >> N){
        vector<int> A(N+1), B(N);
        for(auto& t : A) cin >> t;
        for(auto& t : B) cin >> t;
        long long res = 0;
        for(int i=N-1;i>=0;i--){
            for(int j=1;j>=0;j--){
                int d = min(A[i+j], B[i]);
                res += d;
                A[i+j] -= d;
                B[i] -= d;
            }
        }
        cout << res << endl;
    }
}

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


int main(){
  int n;
  cin >> n;
  map<string,int> mp;
  for(int i=0;i<n;++i){
    string s;
    cin >> s;
    mp[s]++;
  }
  vector<string> ss;
  int ma=0;
  for(auto p : mp){
    if(ma<p.second){
      ss.clear();
      ss.push_back(p.first);
      ma=p.second;
    }else if(ma==p.second){
      ss.push_back(p.first);
    }
  }
  for(int i=0;i<ss.size();++i){
    cout << ss[i] << endl;
  }
  return 0;
}


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

int main(){
    int A, B;
    cin >> A >> B;
    for(int i=0; i<1100; i++){
        if(A<=0.08*i && 0.08*i<(A+1) && B<=0.1*i && 0.1*i<(B+1)){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

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

template <std::uint_fast64_t Modulus> class modint {
    using u64 = std::uint_fast64_t;

public:
    u64 a;

    constexpr modint(const u64 x = 0) noexcept : a(x% Modulus) {}
    constexpr u64& value() noexcept { return a; }
    constexpr const u64& value() const noexcept { return a; }
    constexpr modint operator+(const modint rhs) const noexcept {
        return modint(*this) += rhs;
    }
    constexpr modint operator-(const modint rhs) const noexcept {
        return modint(*this) -= rhs;
    }
    constexpr modint operator*(const modint rhs) const noexcept {
        return modint(*this) *= rhs;
    }
    constexpr modint operator/(const modint rhs) const noexcept {
        return modint(*this) /= rhs;
    }
    constexpr modint& operator+=(const modint rhs) noexcept {
        a += rhs.a;
        if (a >= Modulus) {
            a -= Modulus;
        }
        return *this;
    }
    constexpr modint& operator-=(const modint rhs) noexcept {
        if (a < rhs.a) {
            a += Modulus;
        }
        a -= rhs.a;
        return *this;
    }
    constexpr modint& operator*=(const modint rhs) noexcept {
        a = a * rhs.a % Modulus;
        return *this;
    }
    constexpr modint& operator/=(modint rhs) noexcept {
        u64 exp = Modulus - 2;
        while (exp) {
            if (exp % 2) {
                *this *= rhs;
            }
            rhs *= rhs;
            exp /= 2;
        }
        return *this;
    }
};

using Mint = modint<1000000007>;

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

    std::vector<Mint> facts(n + 1);
    facts[0] = 1;
    for (int i = 1; i <= n; ++i)
        facts[i] = facts[i - 1] * i;

    Mint ans = 0;
    for (int i = 0; i <= std::min(k, n); ++i) {
        Mint comb = facts[n] / (facts[n - i] * facts[i]);
        ans += Mint(n - i) / n * comb * comb;
    }

    std::cout << ans.a << std::endl;
}

Measured memory_bytes: 1792
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

s = ns()
ans = 0
for i in s:
    if i == "o":
        ans += 1

if ans == 0:
    print(700)
if ans == 1:
    print(800)
if ans == 2:
    print(900)
if ans == 3:
    print(1000)


Measured memory_bytes: 3060
import math
n = int(input())
nn = (int(math.sqrt(n)) + 1) * 2
s = [i * (i + 1) // 2 for i in range(nn)]

for i in range(nn):
    if n <= s[i]:
        mx = i
        break

for i in range(mx, 0, -1):
    f = True

    if (s[mx] - i) == n:
        f = False

    if f:
        print(i)
    else:
        pass

Measured memory_bytes: 44268
N = int(input())
A = [int(i) for i in input().split()]
MOD = 10**9 + 7

def gcd(n, m):
    if m == 0:
        return n
    while m != 0:
        n, m = m, n % m
    return n

def lcm(n, m):
    return n * m // gcd(n, m)

L = 1
for a in A:
    L = lcm(L, a)

ans = 0
for a in A:
    ans += L // a

print(ans % MOD)


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

template <class T>
inline void read(T &res)
{
	res = 0; bool bo = 0; char c;
	while (((c = getchar()) < '0' || c > '9') && c != '-');
	if (c == '-') bo = 1; else res = c - 48;
	while ((c = getchar()) >= '0' && c <= '9')
		res = (res << 3) + (res << 1) + (c - 48);
	if (bo) res = ~res + 1;
}

template <class T>
inline T Min(const T &a, const T &b) {return a < b ? a : b;}

template <class T>
inline T Max(const T &a, const T &b) {return a > b ? a : b;}

typedef long double ld;

const int N = 8, M = 305, T = 34;

int n, C, l[N], p[N], f[M][M][T];
ld ans;

int main()
{
	read(n); read(C);
	for (int i = 1; i <= n; i++) read(l[i]), p[i] = i;
	std::sort(l + 1, l + n + 1);
	do
	{
		memset(f, 0, sizeof(f));
		f[0][l[n] * n][0] = 1;
		for (int i = 1; i < n * C; i++)
			for (int j = i; j <= n * C; j++)
				for (int S = 0; S < (1 << n - 1); S++)
				{
					f[i][j][S] += f[i - 1][j][S];
					int x = i % n; if (!x || ((S >> x - 1) & 1)) continue;
					f[i][Min(n * C, Max(j, i + l[p[x]] * n))]
						[S | (1 << x - 1)] += f[i - 1][j][S];
				}
		ans += f[n * C - 1][n * C][(1 << n - 1) - 1];
	} while (std::next_permutation(p + 1, p + n));
	for (int i = 1; i < n; i++) ans /= i * C;
	return printf("%.16Lf\n", ans), 0;
}

Measured memory_bytes: 12672
/* ****revpro**** */
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define endl     '\n'
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)    
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define mii      map<ll,ll>
using namespace std;

#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define N  100005
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;  
#define ordered_set tree<double, null_type,less<double>, rb_tree_tag,tree_order_statistics_node_update> 
ll eulerphi[122000];
ll primechk[122000];
void preprocess(void)
{
    int i, j;
    eulerphi[1]=1;
    for(i=2 ; i<=122000 ; i++)
    {
        eulerphi[i]=i;
        primechk[i]=1;
    }
    for(i=2 ; i<=122000 ; i++)
    {
        if(primechk[i]==1)
        {
            eulerphi[i]-=eulerphi[i]/i;
            for(j=2 ; i*j<=122000 ; j++)
            {
                primechk[i*j]=0;
                eulerphi[i*j]-=eulerphi[i*j]/i;
            }
        }
    }
}
ll add(ll x,ll y,ll mod=hell) { x += y; if(x >= mod) x -= mod; return x;}
ll sub(ll x,ll y,ll mod=hell) { x -= y; if(x < 0) x += mod; return x;}
ll mul(ll x,ll y,ll mod=hell) { return (x * 1ll * y) % mod;}
ll expo(ll base, ll exponent, ll mod=hell) {                //return base^exponent modulo modulus
    ll ans = 1;
    while(exponent !=0 ) {
        if((exponent&1) == 1) {
            ans = ans*base ;
            ans = ans%mod;
        }
        base = base*base;
        base %= mod;
        exponent>>= 1;
    }
    return ans%mod;
}
void solve()
{
  preprocess();
  ll n,k;
  cin>>n>>k;
  ll ans=0;
  rep(i,1,k+1){
    ans=add(ans,mul(expo(k/i,n),eulerphi[i]));
  } 
  cout<<ans<<endl;
}
signed main()
{
  
    /***********************************/
    unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
    mt19937_64 generator (seed);

  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS=1;
//  cin>>TESTS;
  while(TESTS--)
  {
    solve();
  }
  TIME
  return 0;
}

Measured memory_bytes: 5712
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(x, name)in(x)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<(x)<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(int, H, W);
  vector<vector<char>> s(H, vector<char>(W));
  each(y, s) {
    each(x, y) {
      in(x);
    }
  }
  vi dx = {0, -1, 0, 1};
  vi dy = {-1, 0, 1, 0};
  rep(i, 0, H) {
    rep(j, 0, W) {
      if (s[i][j] == '.') {
        continue;
      }
      int cnt = 0;
      rep(k, 0, 4) {
        int nx = j + dx[k];
        int ny = i + dy[k];
        if (nx < 0 || nx >= W || ny < 0 || ny >= H) {
          continue;
        }
        if (s[ny][nx] == '#') {
          cnt++;
        }
      }
      if (cnt == 0) {
        print("No");
        return;
      }
    }
  }
  print("Yes");
}


Measured memory_bytes: 256
program main
  implicit none
  integer :: n, i
  logical :: approved
  integer, allocatable :: a(:)
  read (*, *) n
  allocate (a(n))
  read (*, *) a(:)
  approved = .true.
  do i = 1, n
    if (mod(a(i), 2) == 0) then
      if (mod(a(i), 3) /= 0 .and. mod(a(i), 5) /= 0) then
        approved = .false.
      end if
    end if
  end do

  if (approved) then
    write (*, "(a)") "APPROVED"
  else
    write (*, "(a)") "DENIED"
  end if
end program main


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

int toidx(int c1, int c2, int c3) {return c1 + c2 * 301 + c3 * (301 * 301);}

int main() {
	int n;
    cin >> n;
    int c[3] = {0};
    rep(i, n) {
        int t;
        cin >> t;
        c[t-1]++;
    }
    int ci = toidx(c[0], c[1], c[2]);
    set<int> s{ci};
    vector<double> dp(301 * 301 * 301);
    dp[ci] = 1;
    double ans = 0;
    rep(_, c[0]+c[1]*2+c[2]*3) {
        set<int> nxt;
        for(int t: s) {
            double p = dp[t];
            int c1, c2, c3;
            c1 = t % 301;
            t /= 301;
            c2 = t % 301;
            c3 = t / 301;
            int c = c1 + c2 + c3;
            ans += p * double(n) / c;
            if (c1 > 0) {
                int u = toidx(c1-1, c2, c3);
                dp[u] += p * c1 / c;
                nxt.insert(u);
            }
            if (c2 > 0) {
                int u = toidx(c1+1, c2-1, c3);
                dp[u] += p * c2 / c;
                nxt.insert(u);
            }
            if (c3 > 0) {
                int u = toidx(c1, c2+1, c3-1);
                dp[u] += p * c3 / c;
                nxt.insert(u);
            }
        }
        s = move(nxt);
    }
    printf("%.16f\n", ans);
}

Measured memory_bytes: 217348
program semi_common_multiple
    implicit none
    integer(4):: n, m, i
    integer(4), allocatable:: a(:)
    integer(8):: gcd, lcm

    read*, n, m
    allocate(a(n))
    read*, a(:)
    a(:) = a(:) / 2

    do while(mod(a(1), 2) == 0)
        do i=1, n
            if(mod(a(i),2) /= 0) call die
            a(i) = a(i) / 2
        end do
        m = m / 2
    end do

    do i = 1, n
        if (mod(a(i), 2) == 0) call die
    end do

    lcm = 1

    do i=1,n
        gcd = calc_gcd(lcm,int(a(i),8))
        lcm = lcm/gcd*a(i)
    end do

    print*, (m/lcm+1_16)/2_16

contains
recursive function calc_gcd(a,b) result(ret)
integer(8):: a, b, ret
    if (mod(a,b) == 0)then
        ret = b
    else
    ret = calc_gcd(b,mod(a,b))
    endif
end function

subroutine die
    print*, 0
    stop
end subroutine
end program

Measured memory_bytes: 1152
#include<stdio.h>

int main(){
	int a,b;
	char op;
	while(1){
	scanf("%d %c %d", &a, &op, &b);
		if(op == '+'){
			printf("%d\n",a+b);
		} else if (op == '-'){
			printf("%d\n",a-b);
		} else if (op == '*'){
			printf("%d\n",a*b);
		} else if (op == '/'){
			printf("%d\n",a/b);
		} else {
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 600
#!/usr/bin/python
# -*- coding: utf-8 -*-

# def
def int_mtx(N):
    x = []
    for _ in range(N):
        x.append(list(map(int,input().split())))
    return np.array(x)

def str_mtx(N):
    x = []
    for _ in range(N):
        x.append(list(input()))
    return np.array(x)

def int_map():
    return map(int,input().split())

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

def print_space(l):
    return print(" ".join([str(x) for x in l]))

# import
import collections as col

import numpy as np
from scipy.sparse.csgraph import connected_components
from scipy.sparse import csr_matrix


# main code
N,M = int_map()

i = []
j = []

for z in range(0,M):
    a,b = int_map()
    i.append(a-1)
    j.append(b-1)
    
d = [1]*M

csr = csr_matrix((d,(i,j)),(N,N))


n, labels = connected_components(csr)

ll = list(labels)
aa = col.Counter(ll)
print(aa.most_common()[0][1])

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

void solve(long long A, long long B, long long H, long long M)
{
    auto Arad = 2 * M_PI * H / 12 + 2 * M_PI * 1 / 12 * M / 60;
    auto Brad = 2 * M_PI * M / 60;
    auto rad = min(abs(Brad - Arad), abs(Arad - Brad));

    auto ans = sqrt(pow((double)A * sin(rad), 2) + pow(((double)B - (double)A * cos(rad)), 2));
    cout << setprecision(15) << ans << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
// clang-format off
#pragma GCC diagnostic ignored "-Wunused-result"
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long H;
    scanf("%lld",&H);
    long long M;
    scanf("%lld",&M);
    solve(A, B, H, M);
    return 0;
}


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

int main(void) {
  int n,k;
  cin >> n >> k;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  sort(a.begin(),a.end(),greater<int>());

  int sum = 0;
  for(int i=0;i<k;i++){
    sum += a[i];
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <vector>
using namespace std;

int main() {
	
	array<bool,8> clr={false,false,false,false,false,false,false};
	vector<int> rate;
	int n;
	int max=0;
	int min=0;
	bool change = false;
	
	cin >> n;
	
	for(int i=0;i<n;++i){
		int tmp;
		cin >> tmp;
		rate.push_back(tmp);
	}
	
	for(int j=0;j<rate.size();++j){
		if(rate[j]>=3200){
			++max;
		}
		else if(clr[rate[j]/400]==false){
			clr[rate[j]/400]=true;
			++min;
			++max;
			change = true;
		}
	}
	
	if(change==false){
		++min;
	}
	
	cout << min << " " << max << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define X first
#define Y second
#define pii pair<ll,ll>
#define x1 dlfjl
#define x2 dkfj
#define x3 dflgkg
#define y1 dskgj
#define y2 dskfj
#define y3 dfhgdh
#define SQ 320
#define PI 3.14159265359
#define MOD 1000000007
typedef int ll;
using namespace std;
ll n,i,j,k,z,m,q,r,timer,v,tot,x,y,xx, yy,INF, sz;
ll a[100500], cnt[100500];
int main() {
    //freopen("input.txt","r",stdin);
    cin >> n >> k;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    for (int i = 0; i+1 < n; i++) {
        if (a[i] + a[i+1] >= k) {
            cout << "Possible" << endl;
            for (int j = 0; j < i; j++)
                cout << j+1 << endl;
            for (int j = n-2; j > i; j--)
                cout << j+1 << endl;
            cout << i+1 << endl;
            return 0;
        }
    }
    cout << "Impossible" << endl;
    return 0;
}


Measured memory_bytes: 1152
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <string>

using namespace std;

#define LL long long
#define mod 1000000007

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

LL exgcd(LL a,LL b,LL &x,LL &y)
{
    if(b==0)
    {          
        x=1;
        y=0;
        return a;
    }
    LL r=exgcd(b, a%b, x, y);
    LL t=y;
    y=x-(a/b)*y;    
    x=t;
    return r;
}
LL ny(LL x) {
	if (x == (LL)(0)) {
		return 1;
	}
	LL xx, yy;
	exgcd(x, mod, xx, yy);
	return xx;
}

int getcc(int r, int c) {
	LL res = 1;
	for (int i = c + 1; i <= (r + c); ++i) {
		res *= (LL)(i);
		res %= (LL)(mod);
	}
	for (int i = 1; i <= r; ++i) {
		res *= ny((LL)(i));
		res %= (LL)(mod);
	}
	return (int)(res);
	// C(r + c, r)
}

int getrc(int r, int c) {
	if (r == 0) {
		return c + 1;
	}
	if (c == 0) {
		return r + 1;
	}

	return (getcc(r + 1, c + 1) - 1 + mod) % mod;
}
int getrcBF(int r, int c) {
	int **rc = new int*[r + 1];
	for (int i = 0; i <= r; ++i) {
		rc[i] = new int[c + 1];
	}
	rc[0][0] = 1;
	for (int i = 1; i <= r; ++i) {
		rc[i][0] = 1;
	}
	for (int i = 1; i <= c; ++i) {
		rc[0][i] = 1;
	}
	for (int i = 1; i <= r; ++i) {
		for (int j = 1; j <= c; ++j) {
			rc[i][j] = rc[i][j - 1] + rc[i - 1][j];
			rc[i][j] %= mod;
		}
	}
	int res = 0;
	for (int i = 0; i <= r; ++i) {
		for (int j = 0; j <= c; ++j) {
			res += rc[i][j];
			res %= mod;
		}
	}
	return res;
}

int getCC(int r, int c) {
	int **rc = new int*[r + 1];
	for (int i = 0; i <= r; ++i) {
		rc[i] = new int[c + 1];
	}
	rc[0][0] = 1;
	for (int i = 1; i <= r; ++i) {
		rc[i][0] = 1;
	}
	for (int i = 1; i <= c; ++i) {
		rc[0][i] = 1;
	}
	for (int i = 1; i <= r; ++i) {
		for (int j = 1; j <= c; ++j) {
			rc[i][j] = rc[i][j - 1] + rc[i - 1][j];
			rc[i][j] %= mod;
		}
	}
	return rc[r][c];
}
int qkmod(int a, int n) {
	LL res = 1;
	LL aa = (LL)(a);
	while (n) {
		if (n & 1) {
			res *= aa;
			res %= (LL)(mod);
		}
		aa = (aa * aa) % (LL)(mod);
		n /= 2;
	}
	return int(res);
}

/*int main() {
	for (int i = 0; i <= 10; ++i, putchar('\n')) {
		for (int j = 0; j <= 10; ++j) {
			// printf("f(%d, %d) = %d\n", i, j, getrcBF(i, j));
			printf("%8d ", getCC(i + 1, j + 1) - 1);
		}
	}
	return 0;
}*/

int main() {
	int r1, c1, r2, c2;
	cin >> r1 >> c1 >> r2 >> c2;
	int r1c1 = getrc(r1 - 1, c1 - 1);
	int r1c2 = getrc(r1 - 1, c2);
	int r2c1 = getrc(r2, c1 - 1);
	int r2c2 = getrc(r2, c2);
	int res = r1c1 + r2c2;
	res %= mod;
	int dres = r1c2 + r2c1;
	dres %= mod;
	res -= dres;
	res += mod;
	res %= mod;
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl
int main() {
  int n, x;
  cin >> n >> x;
  vector<int> m(n);
  int sum = 0;
  rep(i, n) {
    cin >> m[i];
    sum += m[i];
  }
  x -= sum;
  sort(all(m));
  cout << n + x / m[0] << endl;
  return 0;
}

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

using namespace std;

typedef long long ll;

int main () {
	ll k,a,b;
	ll i, j;
	ll ret;
	
	cin >> k>>a>>b;
	
		for (i=a;i<=b;i++) {
			if (i%k==0) {
				cout << "OK"<<endl;
				return 0;
			}

		}
	cout << "NG" << endl;
	
	return 0;
}

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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << setprecision(20);
  
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  deque<int> d;
  rep(i, n) {
    int j = lower_bound(d.begin(), d.end(), a[i]) - d.begin();
    if (j == 0) {
      d.push_front(a[i]);
    } else {
      d[j-1] = a[i];
    }
  }
  cout << d.size() << endl;
  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=998244353,MAX=2005;
const ll INF=1LL<<61;

int W;
int h[MAX];
int L[MAX],R[MAX];
int st[MAX];

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int H;cin>>H>>W;
    vector<vector<int>> up(H,vector<int>(W));
    
    vector<string> S(H);
    for(int i=0;i<H;i++) cin>>S[i];
    
    for(int i=1;i<H;i++){
        for(int j=1;j<W;j++){
            int c=0;
            for(int a=-1;a<=0;a++){
                for(int b=-1;b<=0;b++){
                    if(S[i+a][j+b]=='#') c++;
                }
            }
            if(c%2==0) up[i][j]=1;
        }
    }
    
    for(int j=0;j<W;j++){
        for(int i=0;i<H;i++){
            if(up[i][j]==0) up[i][j]=-2;
            else if(up[i-1][j]!=-2) up[i][j]=up[i-1][j];
            else up[i][j]=i-1;
        }
    }
    
    int ans=max(H,W);
    
    W--;
    
    for(int z=1;z<H;z++){
        memset(h,0,sizeof(h));
        memset(L,0,sizeof(L));
        memset(R,0,sizeof(R));
        memset(st,0,sizeof(st));
        
        for(int j=0;j<W;j++){
            if(up[z][j+1]==-2) h[j]=0;
            else h[j]=z-up[z][j+1];
        }
        
        int t=0;
        for(int i=0;i<W;i++){
            while(t>0&&h[st[t-1]]>=h[i]) t--;
            L[i]= t==0 ? 0 :(st[t-1]+1);
            st[t++]=i;
        }
        
        t=0;
        for(int i=W-1;i>=0;i--){
            while(t>0&&h[st[t-1]]>=h[i]) t--;
            R[i]= t==0 ? W :(st[t-1]);
            st[t++]=i;
        }
        
        for(int i=0;i<W;i++){
            ans=max(ans,(h[i]+1)*(R[i]-L[i]+1));
        }
    }
    
    cout<<ans<<endl;
    
}


Measured memory_bytes: 20224
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n;i>=0;i--)
#define For(i,m,n) for(int i=m;i<n;i++)
#define Forr(i,m,n) for(int i=m;i>n;i--)
#define Sort(a) sort(a.begin(),a.end())
#define pb push_back
#define vl vector<ll>
#define vll vector<vector<ll>>
#define INF 999999999999

ll Solve(ll x){
  ll min=INF;
  Forr(i,(int)sqrt(x),0){
    if(x%i==0){
      if(min>x/i+i){
        min=x/i+i;
      }
    }
  }
  return min;
}

int main(){
  ll N;
  cin>>N;
  cout<<Solve(N)-2<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int a[3];
	int n = 3;
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	sort(a, a+n);
	cout << (a[1]-a[0])+(a[2]-a[1]) << endl;
	return 0;
}

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

int main()
{
  string str;
  int q;
  cin>>str>>q;
  for (int i = 0; i < q; ++i)
  {
    string op;
    cin>>op;
    
      if(op=="replace")
      {
        int a,b;
        string p;
        cin>>a>>b>>p;
        for (int i = a; i <= b; ++i)
        {
          str[i]=p[i-a];
        }
      }
      else if(op=="reverse")
      {
        int a,b;
        cin>>a>>b;
        string tmp=str.substr(a,b-a+1);
        reverse(tmp.begin(), tmp.end());
        for (int i = a; i <=b ; ++i)
        {
          str[i]=tmp[i-a];
        }
      }
      if(op=="print")
      {
        int a,b;
        cin>>a>>b;
        cout<<str.substr(a,b-a+1)<<endl;
      }
  }
}


Measured memory_bytes: 3224
#include <stdio.h>

#define UNION_FIND_MAX 10

int uf_table[UNION_FIND_MAX];

void uf_init(void) {
	int i;
	for(i=0;i<UNION_FIND_MAX;i++)uf_table[i]=0;
}

void uf_merge(int a,int b) {
	int next;
	while(uf_table[a]>0) {
		next=uf_table[a]-1;
		if(uf_table[next]>0)uf_table[a]=uf_table[next];
		a=next;
	}
	while(uf_table[b]>0) {
		next=uf_table[b]-1;
		if(uf_table[next]>0)uf_table[b]=uf_table[next];
		b=next;
	}
	if(a!=b)uf_table[a]=b+1;
}

int uf_issame(int a,int b) {
	int next;
	while(uf_table[a]>0) {
		next=uf_table[a]-1;
		if(uf_table[next]>0)uf_table[a]=uf_table[next];
		a=next;
	}
	while(uf_table[b]>0) {
		next=uf_table[b]-1;
		if(uf_table[next]>0)uf_table[b]=uf_table[next];
		b=next;
	}
	return a==b;
}

int main(void) {
	int connections[7];
	int input[28];
	int n,i;
	int kiten_num,first;
	while(scanf("%d",&n)==1) {
		for(i=0;i<n;i++)scanf("%d",&input[i]);
		for(i=0;i<7;i++)connections[i]=0;
		uf_init();
		for(i=0;i<n;i++) {
			connections[input[i]/10]++;
			connections[input[i]%10]++;
			uf_merge(input[i]/10,input[i]%10);
		}
		kiten_num=0;
		first=-1;
		for(i=0;i<7;i++) {
			if(connections[i]>0) {
				if(first<0)first=i;
				if(!uf_issame(first,i))kiten_num=100;
			}
			if(connections[i]%2)kiten_num++;
		}
		puts(kiten_num<=2?"Yes":"No");
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;
ll gcd( ll a, ll b )
{
	if(b==0)
	{
		return a;
	}
	else
	{
		return gcd( b, a%b );
	}
}
ll lcm (ll a, ll b)
{
	return (a*b)/gcd(a,b);
}
int main()
{

	ios_base:: sync_with_stdio(false); cin.tie(0);
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll card=b-a+1;
	ll lol=lcm(c,d);
	ll cc=b/c - (a-1)/c + b/d - (a-1)/d - (b/lol-(a-1)/lol);
	ll ans=card-cc;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>

using namespace std;
using lli = long long int;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (lli i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (lli i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

lli x;
int main() {
  cin >> x;
  lli ans = 2 * (x / 11) + (x % 11 >= 1 ? 1 : 0) + (x % 11 >= 7 ? 1 : 0);
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
// -*- coding:utf-8-unix -*-

#[macro_use]
extern crate lazy_static;
extern crate num_bigint; // 0.2.2
extern crate num_traits; // 0.2.8
use num_bigint::BigInt;
use num_bigint::ToBigInt;
use num_traits::abs;
use num_traits::Pow;
use num_traits::{One, Zero};

// use proconio::derive_readable;
use proconio::fastout;
use proconio::input;
// use std::convert::TryInto;
// use ascii::Chars;
use proconio::marker::{Bytes, Chars};
use std::cmp::*;
use std::collections::{BinaryHeap, HashMap, HashSet, VecDeque};
use std::io::*;
use std::ops::Range;
use std::str::FromStr;
use superslice::*;

use lazy_static::lazy_static;
use std::sync::Mutex;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

lazy_static! {
    // static ref PARENTS: Mutex<Vec<usize>> = Mutex::default();
    // static ref CHILDS: Mutex<Vec<Vec<usize>>> = Mutex::default();
    static ref ADJ: Mutex<Vec<Vec<usize>>> = Mutex::default();
}

// const MOD: usize = 9997063;
// const MOD: usize = 100_000_000_ + 7;

//tenka1-2019-C
// #[fastout]
fn main() {
    input![n: usize, k: usize, a: [usize; n]];

    let mut ng = -100;
    let mut ok = *a.iter().max().unwrap() as i64;

    /* ok と ng のどちらが大きいかわからないことを考慮 */
    while abs(ok - ng) > 1 {
        // eprintln!("{}, {}", ng, ok);
        let mid = (ok + ng) / 2;

        if is_ok(mid, k, &a) {
            ok = mid;
        } else {
            ng = mid;
        }
    }

    // return ok;

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

fn is_ok(v: i64, k: usize, a: &Vec<usize>) -> bool {
    if v <= 0 {
        return false;
    }
    return a
        .iter()
        .map(|a| (*a as f64 / v as f64).ceil() as i64 - 1)
        .sum::<i64>()
        <= k as i64;
}

// let mut values = VALUES.lock().unwrap();
// values.extend_from_slice(&[1, 2, 3, 4]);
// assert_eq!(&*values, &[1, 2, 3, 4]);

// -100000000
//  1000000000


Measured memory_bytes: 5728
n, m, *t = map(int, open(0).read().split())
inf = float('inf')
dp = [inf] * -~n
dp[1] = 0

import heapq

mn = []
path = eval('[],' * -~n)
for l, r, c in zip(*[iter(t)] * 3):
    path[l].append((r, c))


def ins(v, r):
    heapq.heappush(mn, (v, r))


for i in range(1, n + 1):
    while len(mn) and mn[0][1] < i:
        heapq.heappop(mn)
    if len(mn):
        dp[i] = min(dp[i], mn[0][0])
    for r, c in path[i]:
        ins(dp[i] + c, r)

if dp[n] == inf:
    print(-1)
else:
    print(dp[n])

Measured memory_bytes: 264720
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>

int main(){
  int a,b,c;
  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%d",&c);
  if(a>=b&&a>=c){
    printf("%d\n",(b*c)/2);
  }
  if(b>=a&&b>=c){
    printf("%d\n",(a*c)/2);
  }
  if(c>=a&&c>=b){
    printf("%d\n",(a*b)/2);
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
using namespace std;int main(){string s;cin>>s;if(s.size()>=4&&s.at(0)=='Y'&&s.at(1)=='A'&&s.at(2)=='K'&&s.at(3)=='I')cout<<"Yes"<<endl;else cout<<"No"<<endl;return 0;}


Measured memory_bytes: 256
// </> : towhid1zaman

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;typedef vector<ll> vll;
#define fill(a,b) memset(a, b, sizeof (a))
#define all(v) (v).begin(),(v).end()
#define sp(k) cout<<setprecision(k)<<fixed;
#define rep(i,a) for(int i=0; i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define unq(v) sort(all(v)),(v).erase(unique(all(v)),(v).end())
#define _ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define sqr(a) ((a)*(a))
#define sz(a) int(a.size())
#define ff first
#define ss second
#define pb push_back

const double pi = acos(-1.0);
const int mod = 1000000007; // (int)1e9+7
const int maxn = 2000100;

int main(){
        _ios;
        int a, b; cin >> a >> b;
        if(a>b){
            cout<<"safe"<<endl;
        }
        else cout<<"unsafe"<<endl;


return 0;
}



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

int main() 
{ 
  long long int n, k, i, soma = 0;
  scanf("%lld %lld", &n, &k); 
  long long int h[n];
   
  for(i=0; i<n; i++)
  { 
    scanf ("%lld", &h[i]);
  } 
  sort(h, h+n); 
  for(i=n-1; i>=0; i--) 
  { 
    if(k) {
      h[i] = 0;
      k--;
    }
    soma += h[i];
  } 
  printf("%lld\n", soma); 
  return 0; 
}

Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int c[8];
int main(){
  int n;
  cin >> n;
  int a[n],cnt=0,ans=0;
  for(int i=0;i<n;i++) {
    cin >>a[i];
    if(a[i]>=3200){
      cnt++;
    }
    else{
       if(a[i]>=1&&a[i]<=399) c[0]++;
       if(a[i]>400&&a[i]<=799) c[1]++;
       if(a[i]>=800&&a[i]<=1199) c[2]++;
       if(a[i]>=1200&&a[i]<=1599) c[3]++;
       if(a[i]>=1600&&a[i]<=1999) c[4]++;
       if(a[i]>=2000&&a[i]<=2399) c[5]++;
       if(a[i]>=2400&&a[i]<=2799) c[6]++;
       if(a[i]>=2800&&a[i]<=3199) c[7]++;
    }
  }
  for(int i=0;i<8;i++){
    if(c[i]>0) ans++;
  }
  if(cnt==0) cout <<ans<<" "<<ans<<endl;
  else if(ans==0) cout << 1<<" "<<cnt<<endl;
  else cout << ans<<" "<<ans+cnt<<endl;
}


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

ans = 2019
mod = 2019

if R - L >= 2019 - 1:
    ans = 0
else:
    for i in range(L, R):
        for j in range(i+1,R+1):
            t = ((i % mod) * (j % mod)) % mod
            if t <= ans:
                ans = t

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
const int MAX = 1e5 + 10;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
typedef long long ll;
using namespace std;
#define mul(a, b) (((i64)(a) * (b) ) % MOD)
#define sum(a, b) (((a) + (b) ) % MOD)

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

	#define endl '\n'

	#ifdef LOCAL_DEBUG
		freopen("data.in", "r", stdin );
	#endif
	int n; cin >> n;
	vector<string> ar(n);
	for(int i = 0; i <n; i++)
		cin >> ar[i];
	int ans = 0;
	vector<vector<int>> H(n, vector<int>(n));

	for(int ba = -(n - 1); ba <= n - 1; ba++){
		bool ok = true;;
		for(int i = 0; i <n ;i++)


			for(int j = 0;j < n; j++){
				if(ar[i][(j - ba + n) % n] != ar[j][(i - ba + n) % n]){
					ok = false;
					j = i = n;
				}
			}
		if(ok){
			if(ba < 0){
				ans += n + ba;
			}
			else{
				ans += n - ba;
			}
		}

	}
	cout << ans << endl;


}


Measured memory_bytes: 768
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
using namespace std;
#define i64  long long
#define lint long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807

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

  for (int i = 1; i < 10; i++)
  {
    for (int j = 1; j < 10; j++)
    {
      if(i*j == N)
      {
        cout<<"Yes"<<endl;
        return;
      }
    }
    
  }

  cout<<"No"<<endl;
  
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
const int N=100005;
using namespace std;
int a,b,c;
int main(){
	cin>>a>>b>>c;
	if(a==b) cout<<c;
	if(b==c) cout<<a;
	if(a==c) cout<<b;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Order{
    int a,b,c;
}

class Main {
    public static void main2(String args[]) {
        Scanner s = new Scanner(System.in);

        int n=s.nextInt();
        String ss=s.next();
        int q=s.nextInt();

        List<Order> querys=new ArrayList<>();

        for (int i = 0; i <q ; i++) {
            Order o=new Order();
            o.a=s.nextInt();
            o.b=s.nextInt();
            o.c=s.nextInt();
            querys.add(o);
        }
        for (int i = 0; i <q ; i++) {

            Order o=querys.get(i);

            if(o.a==1){

            }

        }



    }
    public static void main(String args[]) {
        Scanner s = new Scanner(System.in);

        int n=s.nextInt();
        int m=s.nextInt();

        int[] ret=new int[3];
        for (int i = 0; i <n ; i++) {
            ret[i]=-1;
        }
        HashMap<Integer,Integer> setted=new HashMap<>();
        for (int i = 0; i <m ; i++) {
            int ss=s.nextInt();
            int cc=s.nextInt();
            if(setted.get(ss)!=null&&cc!=setted.get(ss)){
                System.out.println("-1");
                return;
            }
            if(ss>n){
                System.out.println("-1");
                return;
            }
            setted.put(ss,cc);
            ret[ss-1]=cc;
        }
        for (int i = 0; i <n ; i++) {
            if(ret[i]==-1 && i==0 && n>=3){
                ret[i]=1;
            }else
            if(ret[i]==-1 && i==0 && n==2){
                ret[i]=1;
            }else
           if(ret[i]==-1){
               ret[i]=0;
           }
        }


        String hage="";
        for (int i = 0; i <n ; i++) {
           hage+=ret[i];
        }

        int va=Integer.parseInt(hage);
        if(String.valueOf(va).length()!=n){
            System.out.println("-1");
            return;
        }
        System.out.println(va);

    }
}


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

int main()
{
  int N;
  int a[110];
  cin >> N;
  for(int i = 0; i < N; ++i)
  {
    cin >> a[i];
  }
  
  int colors[8] = {0};
  int over3200 = 0;
  for(int i = 0; i < N; ++i)
  {
    if(a[i] < 3200)
    {
      colors[a[i]/400]++;
    }
    else
    {
      over3200++;
    }
  }
  
  int num = 0;
  for(int i = 0; i < 8; ++i)
  {
    if(colors[i] != 0)
    {
      num++;
    }
  }
  
  int min = num == 0 ? 1 : num;
  int max = num + over3200;
  
  cout << min << " " << max << endl;
}

Measured memory_bytes: 3568