akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long int

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x;
    cin >> x;
    cout << (x-1)*2/11 + 1 << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>  
using namespace std;
using ll = long long int;
using pii = pair<int, int>;
#define rep(i,n) for(ll i=0; i<(ll)(n); i++)
ll l=1000000007;
string alphabet="abcdefghijklmnopqrstuvwxyz";

int main() {
  int n;  cin>>n;
  int a;
  for(int i=pow(2*n,0.5); i>=1;i--){
    if(i*(i+1)<2*n){a=i+1;break;}
  }//cout<<a;
  rep(i,a){
    if(i+1==a*(a+1)/2-n){continue;}
    cout<<i+1<<endl;
  }
}




Measured memory_bytes: 4036
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    int n;
    cin >> n;
    vector<int> arr(n, 0);
    int cnt = 0;
    for(int i = 0; i < n; i++) {
        cin >> arr[i];
        if (arr[i] != i+1)
            cnt += 1;
    }
    if (cnt == 0 || cnt == 2) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}



Measured memory_bytes: 256
namespace ABC123_C
{
    using System;
    using static System.Console;
    using System.Linq;
    using System.Collections.Generic;

    public class Program
    {
        static void Main(string[] args)
        {
            var n = ReadInput();
            var vehicles = ReadLinesAslong(5).ToList();

            WriteLine(Solve(n, vehicles));
        }

        public static long Solve(long n, List<long> vehicles)
        {
            var bottleNeck = vehicles.Select((x, i) => new { x, i })
                .Aggregate((min, working) => min.x > working.x ? working : min);
            var bottleNeckIndex = bottleNeck.i;
            var bottleNeckThroughput = bottleNeck.x;

            var beforeBottleNeck = bottleNeckIndex;

            long throughBottleNeck = (long)Math.Ceiling((double)n / (double)bottleNeckThroughput);

            var afterBottleNeck = vehicles.Count - bottleNeckIndex - 1;
            return beforeBottleNeck + afterBottleNeck + throughBottleNeck;
        }
        static IEnumerable<long> ReadLinesAslong(long n) => ReadLines(n).Select(x => long.Parse(x));
        static IEnumerable<string> ReadLines(long n)
        {
            for (long i = 0; i < n; i++) yield return ReadLine();
        }
        static long ReadInput() => long.Parse(ReadLine());
    }
}

Measured memory_bytes: 13396
import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
//const n = +input[0];
//const a = [];
//for(let i=0;i<n;i++){
//	a.push(input[i+1].split(" ").map((x:string):number=>+x));
//}

//const [n, m] = input[0].split(" ").map((x: string): number => +x);
//const a = input[1].split(" ").map((x: string): number => +x);

function compareFunc(a, b){
    return b-a;
}

const n: number = +input[0];
const p: number[] = input[1].split(' ').map((x: string): number => +x);

let ans: number = 0;
let mini: number = 10000000000;

for(let i = 0; i < n; i++){
    if (p[i] < mini){
        ans += 1;
        mini = p[i];
    }
}
console.log(ans);

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

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);


int main(void)
{
    ll n,k,cnt=0; cin>>n>>k;
    if((n+1)/2 >= k) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

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

int main(){
    int a, b, n, i, j;
    for( i = 0;; i++){
        cin >> a >> b;
        if( a == 0 && b == 0) break;
        for( i = 0; i < a; i++){
            for( j = 0; j < b; j++){
                cout << "#";
            }
            cout << endl;
        }
        if(i) cout << endl;
    }
}
    


Measured memory_bytes: 3092
<?php
    $splitted = str_split(trim(fgets(STDIN)));
//    $testcase = "WWWWW";
//    $splitted = str_split($testcase);
    $judge = $splitted[0];
    $num_change = 0;

    for($i = 1; $i < count($splitted); $i++){
//        echo $judge." next:",$splitted[$i]." count:".$num_change;
//        echo PHP_EOL;
        if($judge == $splitted[$i]){
        } else {
            $num_change++;
            $judge = $splitted[$i];
        }
    }
    echo $num_change;

?>

Measured memory_bytes: 21136
function Main(s) {
  var s = s.split("\n")[0].split(" ").map(e => e*1);
  var a = Math.max(s[0], s[2]), b = Math.min(s[1], s[3]);
  var c = a <= b;
  console.log(c ? b - a:0);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <cmath> 
#include <cctype>

using namespace std;

int main() {
    int A, B;
    int count = 0;
    cin >> A >> B;
    for (int num = A; num <= B; num++) {
        string str = to_string(num);
        if ((str[0] == str[4]) && (str[1] == str[3])) {
            count++;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		String str1 = scan.next();
		String str2 = scan.next();
		int num1 = scan.nextInt();
		int num2 = scan.nextInt();
		String str3 = scan.next();
		scan.close();
		
		if(str1.equals(str3)) {num1 = num1 - 1;}
		else if(str2.equals(str3)) {num2 = num2 - 1;}
		
		System.out.println(num1 + " " + num2);
	}
}


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

//  fastIO
#define endl "\n"

// types
#define ll long long

// vectors 
#define vec_i std::vec<int>

// vectors operations
#define pb push_back
#define eb emplace_back
#define size(a) ((int)(a.size()))

// useful math
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) ((a) >= (0)? (a):(-a)) 


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

using namespace std;

int main() {
    int a, b, c;
    bool flag = false;

    cin >> a >> b >> c;
    if(a >= c and c >= b) {
        flag = true;    
    }
    else if(b >= c and c >= a) {
        flag = true;
    }
    flag? cout << "Yes" : cout << "No";
    cout << endl;
}



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

int main(){
    int N;
    cin>>N;
    int open[110][15],sale[110][15];

    for(int i=0; i<N; i++){
        for(int j=0; j<10; j++){
            cin>>open[i][j];
        }
    }

    for(int i=0; i<N; i++){
        for(int j=0; j<11; j++){
            cin>>sale[i][j];
        }
    }

    long long ans = -(1<<30);

    for(int m=1; m< (1<<10); m++){
        long long sum = 0;

        for(int i=0; i<N; i++){
            int cur = 0;
            for(int j=0; j<10; j++){
                if(m & (1 << j)) if(open[i][j]) cur++;
            }
            sum += sale[i][cur];
        }
        ans = max(ans,sum);
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
import kotlin.math.*

fun str() = readLine()!!
fun int() = str().toInt()
fun long() = str().toLong()

fun read(d: String = " ") = str().split(d)
fun <T> list(d: String = " ", f: String.() -> T) = read(d).map { f(it) }
fun list() = list { toInt() }

fun <T> MutableList<T>.removeLast() = this.removeAt(this.lastIndex)

const val mod = 1000000007L

fun main() {
    abc000X()
}

fun abc000X() {
    val (a, b, c, d) = list { toLong() }

    var r = if (0 in a..b || 0 in c..d) 0 else a * c
    for (t in longArrayOf(a, b))
        for (u in longArrayOf(c, d))
            r = max(r, t * u)
    println(r)
}


Measured memory_bytes: 36492
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=105,INF=1<<30;

int main(){
    int N;cin>>N;
    vector<int> p(4),t(4);
    for(int i=0;i<4;i++){
        cin>>p[i];
    }
    for(int i=0;i<4;i++){
        cin>>t[i];
    }

    int ans=INF;

    for(int i=0;i<=100;i++){
        for(int j=0;j<=100;j++){
            for(int k=0;k<=100;k++){
                for(int l=0;l<=100;l++){
                    if(t[0]*i+t[1]*j+t[2]*k+t[3]*l>=N){
                        ans=min(ans,p[0]*i+p[1]*j+p[2]*k+p[3]*l);
                    }
                }
            }
        }
    }

    cout<<ans<<endl;
    
}





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

using namespace std;

const int N = 3e3 + 2;

int n, m, dp[N][N];
pair <int, int> par[N][N];
string s, t, ans;

int main(){
    cin >> s >> t;

    n = s.size();
    m = t.size();

    s = ' ' + s;
    t = ' ' + t;

    for(int i = 1; i <= n; i ++){
        for(int j = 1; j <= m; j ++){
            if(s[i] == t[j]){
                dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + 1);
                par[i][j] = {i - 1, j - 1};
            }
            if(dp[i][j] < dp[i - 1][j]){
                dp[i][j] = dp[i - 1][j];
                par[i][j] = {i - 1, j};
            }
            if(dp[i][j] < dp[i][j - 1]){
                dp[i][j] = dp[i][j - 1];
                par[i][j] = {i, j - 1};
            }
        }
    }

    while(n && m){
        if(s[n] == t[m]){
            ans += s[n];
        }
        pair <int, int> p = par[n][m];
        n = p.first;
        m = p.second;
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
}


Measured memory_bytes: 105856
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vint conf(n,0);
    vint mount(n,0);
    {
        int pre=0;
        REP(i,n){
            int h;
            cin >> h;
            mount[i]=h;
            if(h!=pre){
                conf[i]=1;
            }
            pre=h;
        }
    }
    {
        int pre=0;
        vint a(n);
        REP(i,n)cin >> a[i];
        for(int i=n-1;i>=0;--i){
            int h = a[i];
            if(conf[i]==1){
                if(h<mount[i] || (pre!=h&&h!=mount[i])){
                    cout << 0 << endl;
                    return 0;
                }
            }else{
                if(h!=pre){
                    conf[i]=1;
                    if(h>mount[i]){
                        cout << 0 << endl;
                        return 0;
                    }
                    mount[i]=h;
                }else{
                    mount[i] = min(mount[i], h);
                }
            }
            pre=h;
        }
    }
    ll ans = 1;
    REP(i,n){
        if(conf[i]==0){
            ans *= (ll)mount[i];
            ans = FIX(ans);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1408
ary = Array.new
while line = $stdin.gets
ary << line.chomp.split
end
ary.delete_at(0)
ary = ary[0].map(&:to_i)
ary.sort!{|a, b| a <=> b }
min = ary[0]
t = ary.length
flag = 0
until (min == 1) or (flag == 1)do
lastloop = min
t.times{|k|
kari = ary[k] % min 
if (kari != 0 )and (min > kari) then
    min = kari
end
}
  if lastloop == min then flag = 1 end
  end
print min

Measured memory_bytes: 10248
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAXN 200010
#define INF 1000000000
struct node
{
	int l,r,mx,mn,tg;
}t[MAXN*4];
int cnt,n,k,rt,tm,ans;
void Build(int &i,int l,int r)
{
	if(i==0) i=++cnt;
	if(l==r)
	{
		t[i].l=t[i].r=t[i].mx=t[i].mn=t[i].tg=0;
		return;
	}
	int mid=(l+r)>>1;
	Build(t[i].l,l,mid);
	Build(t[i].r,mid+1,r);
}
void PushDown(int i)
{
	if(t[i].tg)
	{
		int l=t[i].l,r=t[i].r,c=t[i].tg;
		if(l) t[l].tg+=c,t[l].mx+=c,t[l].mn+=c;
		if(r) t[r].tg+=c,t[r].mx+=c,t[r].mn+=c;
		t[i].tg=0;
	}
}
void PushUp(int i)
{
	t[i].mx=max(t[t[i].l].mx,t[t[i].r].mx);
	t[i].mn=min(t[t[i].l].mn,t[t[i].r].mn);
}
void Solve(int &i,int l,int r,int x)
{
	if(i==0) return;
	if(t[i].mn==x-1&&t[i].mx==x-1)
	{
		t[i].tg++;t[i].mx++,t[i].mn++;
		return;
	}
	if(t[i].mn>=x&&t[i].mx<x-1)
	{
		i=0;
		return;
	}
	PushDown(i);
	int mid=(l+r)>>1;
	Solve(t[i].l,l,mid,x);
	Solve(t[i].r,mid+1,r,x);
	PushUp(i);
	if(t[i].l==0&&t[i].r==0) i=0;
}
void Modify(int &i,int l,int r,int L,int R,int x)
{
	if(i==0) return;
	if(L<=l&&r<=R)
	{
		Solve(i,l,r,x);
		return;
	}
	PushDown(i);
	int mid=(l+r)>>1;
	if(L<=mid) Modify(t[i].l,l,mid,L,R,x);
	if(R>mid) Modify(t[i].r,mid+1,r,L,R,x);
	PushUp(i);
	if(t[i].l==0&&t[i].r==0) i=0;
}
void dfs(int i,int l,int r)
{
	if(i==0||t[i].mx<k) return;
	if(l==r)
	{
		if(t[i].mx==k) ans++;
		return;
	}
	PushDown(i);
	int mid=(l+r)>>1;
	dfs(t[i].l,l,mid);
	dfs(t[i].r,mid+1,r);
}
int main()
{
	t[0].mx=-INF;
	t[0].mn=INF;
	t[0].l=t[0].r=t[0].tg=0;
	scanf("%d%d%d",&n,&k,&tm);
	Build(rt,1,n);
	int l,r,x;
	while(tm--)
	{
		scanf("%d%d%d",&l,&r,&x);
		Modify(rt,1,n,l,r,x);
	}
	dfs(rt,1,n);
	printf("%d\n",ans);
}


Measured memory_bytes: 10540
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstring>
#include<queue>
#include<tuple>
#include<utility>
#include<map>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include<stdlib.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
#define MP make_pair
using Graph = vector<vector<int>>;
const ll mod = 998244353;
const long long INF = 1LL<<60;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
//const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
	mint dp[200005]={};
	mint dpsum[200005]={};
	dp[0] = 1;
	dpsum[0] = 1;
	int N, K;
	cin >> N >> K;
	vector<pair<int, int>> data;
	while(K--){
		int L, R;
		cin >> L >> R;
		data.push_back(MP(L, R));
	}

	FOR(i,1,N){
		FOR(j,0,data.size()){
			int r = i - data.at(j).first, l = i - data.at(j).second - 1;
			if (r < 0)
				continue;
			if(l<0)
				dp[i] += dpsum[r];
			else
				dp[i] += dpsum[r] - dpsum[l];
		}
		dpsum[i] = dpsum[i - 1] + dp[i];
	}

	//FOR(i,0,N)	cout << i << " " << dp[i] << endl;
	cout << dp[N - 1] << endl;

	return 0;
}



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


/* エイリアス */
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define endl '\n'

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define em emplace
#define mp make_pair


/* 関数マクロ */
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n, m) for (ll i = n; i <= m; ++i)
#define rep3(i, n, m) for (ll i = n; i >= m; --i)
#define all(v) v.begin(), v.end()
#define si(v) int(v.size())
#define UNIQUE(v) sort(all(v)), v.erase(unique(all(v)),v.end())


/* 定数 */
const ll mod = 1e9 + 7;
const ll infll = (1LL << 62) - 1;
const ll inf = (1LL << 30) - 1;


/* その他 */
template<class S, class T> inline bool chmax(S &a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class S, class T> inline bool chmin(S &a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> using pq = priority_queue<T>;
template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>;


signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  int n, t; cin >> n >> t;
  int ans = inf;

  rep(i, n) {
    int a, b; cin >> a >> b;
    if (b <= t) chmin(ans, a);
  }

  if (ans == inf) cout << "TLE" << endl;
  else cout << ans << endl;
}


Measured memory_bytes: 3648
import bisect
import numpy as np
import sys
input = sys.stdin.readline
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

a = S()
b = S()
c = S()

print(a[0]+b[1]+c[2])

Measured memory_bytes: 11996
#include<cstdio>
#include<algorithm>
#include<cstring>
#define lowbit(x) x&-x
#define M 100005
using namespace std;
void check_max(int &x,int y){if(x<y)x=y;}
int A[M],B[M];
struct Bin{
	int num[M];
	void clear(){memset(num,0,sizeof(num));}
	void Add(int x,int d){
		x++;
		while(x){
			check_max(num[x],d);
			x-=lowbit(x);
		}
	}
	int sum(int x){
		x++;
		int res=0;
		while(x<M){
			check_max(res,num[x]);
			x+=lowbit(x);
		}
		return res;
	}
}C;
int main(){
	C.clear();
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&A[i]),B[i]=A[i];
	sort(B+1,B+n+1);
	int id=unique(B+1,B+n+1)-B-1;
	for(int i=1;i<=n;i++)A[i]=lower_bound(B+1,B+id+1,A[i])-B;
	int mx=0;
	for(int i=1;i<=n;i++){
		int dp=C.sum(A[i])+1;
		C.Add(A[i],dp);
		check_max(mx,dp);
	}
	printf("%d\n",mx);
	return 0;
}

Measured memory_bytes: 1280
# 2019/03/09
# AtCoder Beginner Contest 121 - C

# Input
n, m = map(int,input().split())
ab = list()

for idx in range(n):
    ab.append(list(map(int,input().split())))

ab.sort()

bottle = 0
sum = 0
for idx in range(n):
    if bottle + ab[idx][1] >= m:
        sum += ab[idx][0] * (m - bottle)
        break
    else:
        sum += ab[idx][0] * ab[idx][1]
        bottle += ab[idx][1]
    
# Output
print(sum)


Measured memory_bytes: 27760
#include<stdio.h>

int main()
{
	int S;
	do{
		scanf("%d",&S);
	}while(0>S&&S>86400);
	if(S<60){
		int s=S;
		int h=0;
		int m=0;
		printf("%d:%d:%d\n",h,m,s);
	}
	else if(S<3600&&S>=60){
		int m=S/60;
		int s=S%60;
		int h=0;
		printf("%d:%d:%d\n",h,m,s);
	}
	else if(S>=3600){
		int a=S%3600;
		int s=a%60;
		int m=a/60;
		int h=S/3600;
		printf("%d:%d:%d\n",h,m,s);
	}
	return 0;
}

Measured memory_bytes: 1024
def main():
    N = int(input())
    A = int(input())
    B = int(input())
    C = int(input())
    D = int(input())
    E = int(input())

    # 最低これだけは利用しないといけない
    A_count = N // A + (0 if N % A == 0 else 1)
    B_count = N // B + (0 if N % B == 0 else 1)
    C_count = N // C + (0 if N % C == 0 else 1)
    D_count = N // D + (0 if N % D == 0 else 1)
    E_count = N // E + (0 if N % E == 0 else 1)

    # 利用順序は関係ないので, 最大のところがボトルネックとなる
    max_count = max([A_count, B_count, C_count, D_count, E_count])

    # これにこれを最後に置くとして, 4回だけ増やす
    print(max_count + 4)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
  int n, k;
  string s;
  cin >> n >> k;
  cin >> s;
  
  int cnt = 0;
  for(int i = 1; i < n; ++i) {
    if(s[i] != s[i-1]) ++cnt;
  }
  cnt = n-cnt-1;
  cout << min(n-1, cnt+2*k);
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <utility>
using namespace std;

#define MAX 1000005

int A[MAX];

int partition(int p, int r) {
  int x = A[r];
  int i = p - 1;
  for ( int j = p; j < r; j++ ) {
    if ( A[j] <= x ) {
      i++;
      swap(A[i], A[j]);
    }
  }
  swap(A[i + 1], A[r]);
  return i + 1;
}

int main() {
  int n;
  int q;

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

  q = partition(0, n - 1);

  for ( int i = 0; i < n; i++ ) {
    if ( i > 0 ) printf(" ");
    if ( i == q ) printf("[%d]", A[i]);
    else printf("%d", A[i]);
  }
  printf("\n");

  return 0;
}

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

#define sz(x) (int)x.size() 
#define pb push_back 
#define mp make_pair 
#define fi(a, b) for(int i=a; i<=b; i++) 
#define fj(a, b) for(int j=a; j<=b; j++) 
#define fo(a, b) for(int o=a; o<=b; o++) 
#define fdi(a, b) for(int i=a; i>=b; i--) 
#define fdj(a, b) for(int j=a; j>=b; j--) 
#define fdo(a, b) for(int o=a; o>=b; o--) 

#ifdef LOCAL
#define err(...) fprintf(stderr, __VA_ARGS__)
#else
#define err(...) while(false) {}
#endif

typedef long long ll; 
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef vector<int> vi; 
typedef vector<ll> vll;
typedef vector<pii> vpii; 
typedef vector<pll> vpll; 
typedef long double ld;
typedef unsigned long long ull;

/////////////////////////////////

ll const INF = 1e18;

ll ans;
int n, k;
vll l, r;

void solve() {
	ans = INF;
	if (sz(r) >= k) {
		ans = r[k - 1];
	}	
	if (sz(l) >= k) {
		ans = min(ans, abs(l[sz(l) - k]));
	}
	fi(1, k - 1) {
		int ql = k - i;
		int qr = i;
		if (ql > sz(l) || qr > sz(r)) continue;
		ll xl = l[sz(l) - ql];
		ll xr = r[qr - 1];
		if (ql == 1) {
			err("ql %d qr %d xl %lld xr %lld\n", ql, qr, xl, xr);
		}
		ans = min(ans, min(abs(xl), xr) * 2 + max(abs(xl), xr));
	}

	printf("%lld\n", ans);
}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	scanf("%d %d", &n, &k);
	fi(1, n) {
		int x;
		scanf("%d", &x);
		if (x >= 0) {
			r.pb(x);
		} else {
			l.pb(x);
		}
	}		       	
	solve();		

	
#ifdef LOCAL
	err("ELAPSED TIME: %.3Lf\n", (ld) clock() / CLOCKS_PER_SEC);
#endif	
	
	return 0;
}

Measured memory_bytes: 1656
/*==============================================*\
Codeforces ID:    mdshihab
 Atcoder ID :   mdshihab                                                 |
Name:     Md. Shihabul Minhaz                     |
Study:      CSE, JKKNIU                           |
Address:  Trishal, Mymensingh, Bangladesh         |
                                                  |
 mail:   mdshihabul20171@gmail.com                |
 FB  :   fb.com/mdshihabul.minhaz.7               |
 github: Shihabulminhaz                           |
stopstalk :  mdshihab                             |
                                                  |
@uthor   Md. Shihabul Minhaz (shihab)             |
\*===============================================*/


#include<bits/stdc++.h>
using namespace std;
#define fi(a) scanf("%d",&a);
#define fli(a) scanf("%ld",&a);
#define fll(a) scanf("%lld",&a);
#define pi(a) printf("%d\n",a);
#define ppi(i,a) printf("Case %d: %d\n",i,a);
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
void FI()
{
#ifndef ONLINE_JUDGE
    freopen("C:\\Users\\SHIHAB\\Desktop\\input.in","r",stdin);
#endif // ONLINE_JUDGE
}
ll arr[10000000];
int main()
{
    fast
    FI(); /// skip this line for compile
    ll n,l,j=0,ans=1;
    ll sum=0;
    cin >> n;

    for(ll i=1;i<=n;i++){
        for(ll j=i;j<=n;j+=i){
            arr[j]++;
        }
    }

    for(ll i=1;i<=n;i++){
        sum+=i*arr[i];
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 81736
#include <bits/stdc++.h>
#include <atcoder/all>

using namespace std;
using namespace atcoder;
 
#ifdef DEBUG
    #include "debug.h"
    #define dump(...)                                                              \
        DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
                << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
                << endl                                                            \
                << "    ",                                                         \
            dump_func(__VA_ARGS__)
#else
    #define dump(...)
#endif

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

#define int long long
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
#define ALL(v) (v).begin(), (v).end()
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
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 (a>b) { a=b; return 1; } return 0; }

/*
#define mod 1000000007 /*/
#define mod 998244353 //*/

typedef pair<int, int> P;
//#define INF (1LL<<60)

using S = long long;
using F = long long;

const S INF = 8e18;
const F ID = 8e18;

S op(S a, S b){ return std::max(a, b); }
S e(){ return -INF; }
S mapping(F f, S x){ return (f == ID ? x : f); }
F composition(F f, F g){ return (f == ID ? g : f); }
F id(){ return ID; }

void solve(){
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    rep(i,N) cin >> A[i];
    
    std::vector<S> v(300001);
    atcoder::lazy_segtree<S, op, e, F, mapping, composition, id> seg(v);
    
    rep(i,N){
        int m = seg.prod(max(0LL,A[i]-K), min(300001LL,A[i]+K+1));
        seg.apply(A[i],A[i]+1, m+1);
    }
    cout << seg.all_prod() << endl;
}


signed main(){
    cout << fixed << setprecision(18);
    cerr << fixed;
    solve();
}


Measured memory_bytes: 20124
#include <iostream>
#include <vector>
#include <string>
#include <stdlib.h>
#include <cmath>
#include <algorithm>

using namespace std;

const int64_t N_MAX = 100005;
const int64_t MOD = 1e9 + 7;
int64_t fac[N_MAX] = {1, 1};
int64_t inv[N_MAX] = {1, 1};
int64_t finv[N_MAX] = {1, 1};

// combinationを計算
int64_t comb(int n, int r)
{
  if (n < r) return 0;
  return fac[n] * finv[n - r] % MOD * finv[r] % MOD;
}

// combinationを求めるためのテーブル初期化
void comb_init()
{
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < N_MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

int main()
{
  int N;
  int K;
  vector<int> a;

  cin >> N >> K;
  a.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }

  comb_init();

  sort(a.begin(), a.end());

  int64_t mod_sum = 0;

  for (int i = 0; i < N; i++) {
    mod_sum += (comb(i, K - 1) * a[i] % MOD - comb(N - i - 1, K - 1) * a[i] % MOD) % MOD;
    mod_sum %= MOD;
  }

  cout << mod_sum << flush;

  return 0;
}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
int main(){
  char buf[6];
  string ans;
  cin >> buf;
  switch(buf[0]){
    case 'S':
      ans="Cloudy";
    break;
    case 'C':
      ans="Rainy";
    break;
    case 'R':
      ans="Sunny";
    break;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
N,M = map(int,input().split())
ABC = [list(map(int,input().split())) for _ in [0]*N ]
DEF = [list(map(int,input().split())) for _ in [0]*M ]

X = [0]*3003
Y = [0]*3003
INF = 10**9 + 10
X[-1] = -INF
Y[-1] = -INF
X[-2] = INF
Y[-2] = INF
i = 0
j = 0
for a,b,c in ABC:
    X[i] = a
    X[i+1] = b
    Y[j] = c
    i += 2
    j += 1
for d,e,f in DEF:
    X[i] = d
    Y[j] = e
    Y[j+1] = f
    i += 1
    j += 2
X = sorted(set(X))
Y = sorted(set(Y))
Xdict = {x:i for i,x in enumerate(X)}
Ydict = {y:i for i,y in enumerate(Y)}

nx = len(X)
ny = len(Y)
nxy = nx * ny

E = [[15]*nx for _ in [0]*ny]

E[0] = [7]*nx
E[-1] = [13]*nx
for i in range(ny):
    E[i][0] -= 4
    E[i][-1] -= 1

for a,b,c in ABC:
    y1 = Ydict[c]
    y0 = y1-1
    for x in range(Xdict[a],Xdict[b]):
        E[y0][x] &= 15-2
        E[y1][x] &= 15-8

for d,e,f in DEF:
    x1 = Xdict[d]
    x0 = x1-1
    for y in range(Ydict[e],Ydict[f]):
        E[y][x0] &= 15-1
        E[y][x1] &= 15-4

dX = [x2-x for x,x2 in zip(X,X[1:])]
dY = [y2-y for y,y2 in zip(Y,Y[1:])]
burst = False
x0 = Xdict[0]
y0 = Ydict[0]
ans = dX[x0]*dY[y0]
done = [[False]*nx for _ in [0]*ny]
done[y0][x0] = True
q = [(x0,y0)]
dxy = [(1,0),(0,1),(-1,0),(0,-1)]
while q:
    qq = []
    for x,y in q:
        e = E[y][x]
        for i in range(4):
            if (e>>i)&1 == 0 : continue
            dx,dy = dxy[i]
            jx = x+dx
            jy = y+dy
            if done[jy][jx]:continue
            done[jy][jx] = True

            if jx==0 or jx==nx-1 or jy==0 or jy==ny-1:
                burst = True
                ans = "INF"
                qq = []
                break
            ans += dX[jx]*dY[jy]
            qq.append((jx,jy))
        if burst:break
    q = qq

print(ans)

Measured memory_bytes: 211876
using System.Collections.Generic;
using System;

public class PriorityQueue<T> where T : IComparable
{
    private IComparer<T> _comparer = null;
    private int _type = 0;
    private T[] _heap;
    private int _sz = 0;
    private int _count = 0;
    /// <summary>
    /// Priority Queue with custom comparer
    /// </summary>
    public PriorityQueue(int maxSize, IComparer<T> comparer)
    {
        _heap = new T[maxSize];
        _comparer = comparer;
    }
    /// <summary>
    /// Priority queue
    /// </summary>
    /// <param name="maxSize">max size</param>
    /// <param name="type">0: asc, 1:desc</param>
    public PriorityQueue(int maxSize, int type = 0)
    {
        _heap = new T[maxSize];
        _type = type;
    }
    private int Compare(T x, T y)
    {
        if (_comparer != null) return _comparer.Compare(x, y);
        return _type == 0 ? x.CompareTo(y) : y.CompareTo(x);
    }
    public void Push(T x)
    {
        _count++;
        var i = _sz++;
        while (i > 0)
        {
            var p = (i - 1) / 2;
            if (Compare(_heap[p], x) <= 0) break;
            _heap[i] = _heap[p];
            i = p;
        }
        _heap[i] = x;
    }
    public T Pop()
    {
        _count--;
        T ret = _heap[0];
        T x = _heap[--_sz];
        int i = 0;
        while (i * 2 + 1 < _sz)
        {
            int a = i * 2 + 1;
            int b = i * 2 + 2;
            if (b < _sz && Compare(_heap[b], _heap[a]) < 0) a = b;
            if (Compare(_heap[a], x) >= 0) break;
            _heap[i] = _heap[a];
            i = a;
        }
        _heap[i] = x;
        return ret;
    }
    public int Count() => _count;
    public T Peek() => _heap[0];
    public bool Contains(T x)
    {
        for (int i = 0; i < _sz; i++) if (x.Equals(_heap[i])) return true;
        return false;
    }
    public void Clear()
    {
        while (this.Count() > 0) this.Pop();
    }
    public IEnumerator<T> GetEnumerator()
    {
        var ret = new List<T>();
        while (this.Count() > 0) ret.Add(this.Pop());
        foreach (var r in ret)
        {
            this.Push(r);
            yield return r;
        }
    }
    public T[] ToArray()
    {
        T[] array = new T[_sz];
        int i = 0;
        foreach (var r in this) array[i++] = r;
        return array;
    }
}

public class hello
{
    public static void Main()
    {
        var pq = new PriorityQueue<int>(2000001, 1);
        while (true)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            if (line[0][2] == 'd') break;
            if (line[0][0] == 'i') pq.Push(int.Parse(line[1]));
            else Console.WriteLine(pq.Pop());
        }
    }
}




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

int main(){
  int n,ans=0;cin>>n;
  vector<int> v(n,0),c(n,0);
  REP(i,n) cin>>v.at(i);
  REP(i,n) cin>>c.at(i);
  REP(i,n) if(v.at(i)-c.at(i)>0) ans+=v.at(i)-c.at(i);

  cout<<ans;
}

Measured memory_bytes: 256
// In the name of GOD
#include<bits/stdc++.h>
using namespace std;

#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";

#define     IOS         ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define 	setprecn(x) cout<<fixed<<setprecision(x);
#define 	ll          long long int
#define 	pb          push_back
#define 	pll         pair<ll,ll>
#define 	vll         vector<ll>
#define 	ff          first
#define 	ss          second
#define 	all(a)      (a).begin(),(a).end()
#define 	sz(x)       (ll)x.size()
#define 	mod         1000000007
#define 	inf         10000000000000007
#define 	rep(i,n)    for(ll i=0;i<n;i++)
#define 	repe(i,a,b) for(ll i=a;i<b;i++)
#define 	lbnd        lower_bound
#define 	ubnd        upper_bound
#define 	bs          binary_search

ll power(ll a,ll b,ll m=mod)
{
	if(b==0)
		return 1;
	if(b==1)
		return a;
	ll c=power(a,b/2,m);
	if(b%2==0)
		return((c%m)*(c%m))%m;
	return ((((c%m)*(c%m))%m)*(a%m))%m;
}
/********************************************************/
//	d.erase(unique(all(d)), d.end());



int main()
{
	IOS;
	ll n,k,m,i,j,c=0,cs=0,t;
	t=1;

	// cin>>t;
	string s;
	while(t--)
	{
		ll a,b;
		cin>>a>>b>>n;
		// n=s.length();
		// ll a[n];
		k=min(b-1,n);
		c=(a*k)/b;
		
		cout<<c;

		
		cout<<"\n";
	}
	return 0;
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
int main(void){

    int n;
    cin >> n;
    vector<int> p(n);
    for(int i=0; i<n; i++) cin >> p[i];
    
    for(int i=0; i<n-1; i++) {
        for(int j=i+1; j<n; j++) {
            
            vector<int> pp = p;
            
            bool flag = false;
            for(int k=0; k<n-1; k++) {
                for(int l=k+1; l<n; l++) {
                    if(pp[k]>pp[l]) {
                        flag = true;
                        break;
                    }
                }
                if(flag) break;
            }
            
            if(!flag) {
                cout << "YES" << endl;
                return 0;
            }

            swap(pp[i], pp[j]);
            
            flag = false;
            for(int k=0; k<n-1; k++) {
                for(int l=k+1; l<n; l++) {
                    if(pp[k]>pp[l]) {
                        flag = true;
                        break;
                    }
                }
                if(flag) break;
            }
            
            if(!flag) {
                cout << "YES" << endl;
                return 0;
            }
        }
    }
    

    cout << "NO" << endl;

    return 0;    
}


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

// alias templates
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

// alias declaration
using ll = long long;
using str = string;

using vll = V<ll>;
using vvll = V<vll>;
using vs = V<str>;

// loops
#define FOR(i, a, b)  for (ll i = (a); i <= (ll)(b); i++) // [a,b]
#define rFOR(i, a, b) for (ll i = (b); i >= (ll)(a); i--) // [b,a]
#define REP(i, a) FOR((i), 0, (ll)(a)-1) // [0,a-1]

// for debug
#define dbg(a) cerr << "  " << (#a) << ": " << (a) << "\n";

// procon common constants
const ll MOD_BIG = 1e9 + 7;

int main(void){
    ll L,R,l,r;
    cin >> L >> R;
    if(L%2019 > R%2019){
        cout << 0 << endl;
    }else if(L+2019 < R){
        cout << 0 << endl;
    }else{
        l = L % 2019;
        r = R % 2019;
        ll minn = 2019*2019;
        for(ll i=l;i<=r;i++){
            for(ll j=i+1;j<=r;j++){
                minn = min(minn,(i*j)%2019);
            }
        }
        cout << minn << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //  repマクロ
#define leng(n) (int)(log10(n)+1)  //  桁数
using namespace std;

signed main() {
  int A, B;
  cin >> A >> B;
  if (A > B) cout << A+A-1 << endl;
  if (A < B) cout << B+B-1 << endl;
  if (A == B) cout << A+A << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
typedef long long ll;
using namespace std;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

int main()
{
    ll n;
    cin >> n;
    ll m = INF;
    repi(i, 5, 0)
    {
        ll tmp;
        cin >> tmp;
        m = min(tmp, m);
    }
    ll div = (n + m - 1) / m - 1;
    cout << 5LL + div << endl;
    return 0;
}

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



using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;


//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)



int main(void){

	string a, b, c;
	cin >> a >> b >> c;

	if(a.back() == b.front() and b.back() == c.front()) cout << "YES" << endl;
	else cout << "NO" << endl;


	return 0;

}


Measured memory_bytes: 256
from itertools import product
import copy

h, w, k = map(int, input().split())
c = [None] * h
for i in range(h):
    c[i] = list(input())

ans = 0
state = list(product([0, 1], repeat=h+w))
for s in state:
    cc = copy.deepcopy(c)
    for i in range(h):
        if s[i] == 1:
            for j in range(w):
                cc[i][j] = 'x'
    for i in range(h, h+w):
        idx = i - h
        if s[i] == 1:
            for j in range(h):
                cc[j][idx] = 'x'
    count = 0
    for i in range(h):
        for j in range(w):
            #print(cc[i][j], end='')
            if cc[i][j] == '#':
                count += 1
        #print()
    if count == k:
        ans += 1
    #print(s, ans)
    #print('---')

print(ans)

Measured memory_bytes: 9776
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


void solve(){
    int N, K;
    cin >> N >> K;
    // int N = 2e5;
    // int K = 2e5;
    vector<int> A(N+10);
    vector<int> imos(N+10);
    REP(i,N){
        cin >> A[i];
        // A[i] = 0;
        imos[max(1, i+1-A[i])]++;
        imos[min(N+1, i+1+A[i]+1)]--;
    }
    REP(k,min(K,50)){
        vector<int> tmp(N+10);
        for(int i=2;i<=N+5;i++) imos[i] += imos[i-1];
        REP(i,N){
            A[i] = imos[i+1];
            // cout << A[i] << " ";
            tmp[max(1, i+1-A[i])]++;
            tmp[min(N+1, i+1+A[i]+1)]--;
        }
        imos = tmp;
    }
    REP(i,N) cout << A[i] << " ";
    cout << endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    // int T; cin >> T; REP(t,T) solve();
}

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

main() {
    int A,B; cin >> A >> B;
    if(B>=A)cout << A << endl;
    else cout << A-1 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
  
int main(){
   double xA,yA,xB,yB,xC,yC,xD,yD;
   while(cin >> xA >> yA >> xB >> yB >> xC >> yC >> xD >> yD){
      if(-0.0000000001 < (yA-yB)*(yC-yD) + (xC-xD)*(xA-xB) &&
     (yA-yB)*(yC-yD) + (xC-xD)*(xA-xB) < 0.0000000001)
     cout << "YES" << endl;
      else cout << "NO" << endl;
   }
   return 0;
}

Measured memory_bytes: 1224
s=input().split()
n=int(s[0])
x=int(s[1])
s=input().split()
ans=max(0,int(s[0])+int(s[1])-x)
prev=max(0,int(s[1])-ans)
for i in range(2,len(s)):
 now=max(0,int(s[i])+prev-x)
 ans+=now
 prev=int(s[i])-now
print(ans)

Measured memory_bytes: 11264
n = int(input())
a = list(map(int,input().split()))
arr = [0] * 100005
for val in a:
  arr[val] += 1
sums = sum(a)
q = int(input())
for _ in range(q):
  b, c = map(int,input().split())
  diff = (c-b) * (arr[b])
  sums += diff
  print(sums) 
  arr[c] += arr[b]
  arr[b] = 0

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

int main(){
	int a,b;
	while(1){
		cin >> a >> b;
		if( a == 0 && b == 0 ){
			break;
		}
		for(int i = 0; i < a; i++){
			for(int j = 0; j < b; j++){
				cout << "#";
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3088
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		int b = sc.nextInt();
      
        if((a+b)%2 == 0) {
          System.out.println((a+b)/2);
        } else {
          System.out.println("IMPOSSIBLE");
        }
	}
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; i++)
#define all(a) (a).begin(), (a).end()

int N;
vector<int> A, B, C;

int main () {
  cin >> N;
  A.resize(N), B.resize(N), C.resize(N);
  rep(i,N) cin >> A[i];
  rep(i,N) cin >> B[i];
  rep(i,N) cin >> C[i];

  sort(all(A)), sort(all(B)), sort(all(C));

  vector<ll> BC(N, 0);
  rep(i,N) {
    BC[i] = distance(upper_bound(all(C), B[i]), C.end());
  }
  for(int i = N-1; i > 0; --i) {
    BC[i-1] += BC[i];
  }

  ll ans = 0;
  rep(i,N) {
    int j = distance( B.begin(), upper_bound(all(B), A[i]));
    if(j < N) ans += BC[j];
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 2176
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String arg[]) {

		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int k = scan.nextInt();
		int a[] = new int[n + 1];
		for (int i = 1; i <= n; i++) {
			a[i] = scan.nextInt();
		}

		boolean dp[] = new boolean[k + 1];
		dp[0] = false;
		for (int i = 1; i <= k; i++) {
			boolean win = false;
			for (int j = 1; j <= n; j++) {
				if (a[j] > i) {
					continue;
				}
				if (!dp[i - a[j]]) {
					dp[i] = true;
				}
			}
		}
		if (dp[k]) {
			System.out.println("First");
		} else {
			System.out.println("Second");
		}

	}

}


Measured memory_bytes: 36140
import math
def euclid(a,b):
    if b==0:
        return a
    else:
        return euclid(b,a%b)
def factorize(n):
    a=[]
    while n%2==0:
        a.append(2)
        n//=2
    f=3
    while f*f<=n:
        if n%f==0:
            a.append(f)
            n//=f
        else:
            f+=2
    if n!=1:
        a.append(n)
    return a
z=list(map(int,input().split()))
print(len(set(factorize(euclid(z[0],z[1]))))+1)

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

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

/* Macros reg. ends here */

const ll INF = 1LL << 50;

ll n, m;
vvll to;
vll ans, ans2;
void dfs(ll u, ll pa) {
  ll add = 1;
  for (ll v : to[u]) {
    if (v == pa) continue;
    dfs(v, u);
    add = (add * (1 + ans[v])) % m;
  }
  ans[u] = add;
}

void dfs2(ll u, ll pa, ll pav) {
  ll add = (1 + pav);

  vll chl;
  for (ll v : to[u]) {
    if (v == pa) continue;
    chl.push_back(v);
  }
  ll nc = chl.size();
  assert(u == 0 || nc == (ll)to[u].size() - 1);
  vll lefm(nc, 1), rigm(nc, 1);
  repLRE(i, 1, nc - 1) lefm[i] =
      (lefm[i - 1] * ((1 + ans[chl[i - 1]]) % m)) % m;
  rrepLRE(i, nc - 2, 0) rigm[i] =
      (rigm[i + 1] * ((1 + ans[chl[i + 1]]) % m)) % m;
  map<ll, ll> uv;
  rep(i, nc) { uv[chl[i]] = (((lefm[i] * rigm[i]) % m) * (1 + pav)) % m; }

  for (ll v : to[u]) {
    if (v == pa) continue;
    dfs2(v, u, uv[v]);
    add = (add * (1 + ans[v])) % m;
  }
  ans2[u] = add;
}

int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  cin >> n >> m;

  to.resize(n);
  ans.assign(n, 0);
  rep(i, n - 1) {
    ll x, y;
    cin >> x >> y;
    x--, y--;
    to[x].push_back(y);
    to[y].push_back(x);
  }

  dfs(0, -1);
  ans2.assign(n, 0);
  dfs2(0, -1, 0);
  rep(i, n) cout << ans2[i]%m << endl;

  return 0;
}


Measured memory_bytes: 34816
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys,collections,itertools,re,math,fractions,decimal,random,array,bisect,heapq

# decimal.getcontext().prec = 50
# sys.setrecursionlimit(10000)
# MOD = 10**9 + 7

def solve(f):
    n = f.read_int()
    x = f.read_int_list()
    x0 = x[:]

    x.sort()
    med = x[n/2-1]
    ans = []
    for xi in x0:
        if xi > med:
            ans.append(med)
        else:
            ans.append(x[n/2])

    return "\n".join(map(str, ans))


class Reader(object):
    def __init__(self, filename=None):
        self.file = open(filename) if filename is not None else None
        self.case = 1

    def __readline(self):
        return self.file.next().strip() if self.file else raw_input()

    def next_case(self):
        self.file.next()
        self.case += 1

    def read_int(self): return int(self.__readline())
    def read_float(self): return float(self.__readline())
    def read_long(self): return long(self.__readline())
    def read_decimal(self): return decimal.Decimal(self.__readline())
    def read_str(self): return self.__readline()

    def read_int_list(self): return map(int, self.__readline().split())
    def read_float_list(self): return map(float, self.__readline().split())
    def read_long_list(self): return map(long, self.__readline().split())
    def read_decimal_list(self): return map(decimal.Decimal, self.__readline().split())
    def read_str_list(self): return self.__readline().split()

if __name__ == '__main__':
    filename = sys.argv[1] if len(sys.argv) > 1 else None
    f = Reader(filename)
    if f.file:
        while True:
            print "Case #%d\n"%f.case, solve(f)
            try:
                f.next_case()
            except StopIteration:
                break
    else:
        print solve(f)


Measured memory_bytes: 26624