akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const int MAXN = 110;

int N, X[MAXN];

int main()
{
	ios_base::sync_with_stdio(0);

	cin >> N;
	int sum = 0;
	for (int i = 0; i < N; i++)
	{
		cin >> X[i];
		sum += X[i];
	}

	ll ans = 0, P = sum / N;
	for (int i = 0; i < N; i++)
		ans += (ll) (X[i] * X[i]);
	ans -= (ll) 2 * P * sum;
	ans += (ll) N * P * P;

	if (sum % N == 0)
	{
		cout << ans;
		return 0;
	}

	ll ans2 = ans + (ll) 2 * P * sum - (ll) N * P * P;
	P++;
	ans2 = ans2 - (ll) 2 * P * sum + (ll) N * P * P;
	cout << min(ans, ans2);
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
const int Maxn=100+7;
int n;
bool b;
string s[Maxn];
bool good(int l){
	for(int i=0;i<l;i++){
		if(s[l]==s[i])
			return false;
	}
	return true;
}
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>s[i];
		if(good(i)==false || (i!=0 && s[i-1][(int)s[i-1].size()-1]!=s[i][0]))
			b=true;
	}
	//|| s[i-1][(int)s[i-1].size()-1]!=s[i][0]
	if(b==true)
		cout<<"No";
	else
		cout<<"Yes";
}


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

typedef long long ll;

int main(){
    int N,K;
    cin>>N>>K;
    ll cnt;
    ll ans;
    cnt = N/K;

    ans = cnt*cnt*cnt;

    if(K % 2 == 0) {
        ll add = 0;
        for(int i=1; i<=N; i++){
            if(i % K == K/2 && (K % 2 == 0)){
                add++;
            }
        }
        ans += add*add*add;
    }

    cout<<ans<<endl;

    return 0;        
}

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

int main(){
	for(int index = 1; index <= 9 ; index++){
		for(int jndex = 1 ; jndex <= 9 ; jndex++){
			cout<<index<<"x"<<jndex<<"="<<index*jndex<<endl;
		}
	}
	
} 

Measured memory_bytes: 3072
#include<stdio.h>

main()
{
	int m,f,r;
	
	do{
		scanf(" %d %d %d",&m,&f,&r);
		if(m==-1 && f==-1 && r == -1){
			break;
		}
		
		if(m == -1 || f == -1){
			printf("F\n");
		} else if(m+f>=80){
			printf("A\n");
		} else if(m+f>=65){
			printf("B\n");
		} else if(m+f>=50){
			printf("C\n");
		} else if(m+f>=30){
			if(r>=50){
				printf("C\n");
			} else {
				printf("D\n");
			}
		} else {
			printf("F\n");
		}
	}while(1);
	return 0;
}
	

Measured memory_bytes: 584
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long int ll;
typedef long double ld;
const ll INF=(1LL<<62);
const ld pi=acosl((ld)-1);
// const ll mod = 1000000007;
const ll mod = 1234567;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
#define endn "\n"

bool solve(){
    ll n,a;cin>>n>>a;
    vector<ll>x(n);
    rep(i,n)cin>>x[i];
    ll max_J=50*60;
    vector<vector<vector<ll>>>dp(n+1,vector<vector<ll>>(n+1,vector<ll>(max_J,0)));
    rep(i,n+1)rep(k,n+1)rep(j,max_J)dp[i][k][j]=0;
    
    dp[0][0][0]=1;
    rep(i,n)rep(j,n+1)rep(k,max_J){
        if(dp[i][j][k]==0)continue;
        //use
        dp[i+1][j+1][k+x[i]]+=dp[i][j][k];
        dp[i+1][j][k]+=dp[i][j][k];
    }
    ll ans=0;
    rep(j,n+1){
        if(j==0)continue;
        ans+=dp[n][j][j*a];
    }
    cout<<ans<<endl;
    return false;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout<<fixed<<setprecision(30);
    solve();
}


Measured memory_bytes: 62592
n = int(input())
v = list(map(int, input().split()))
odd = [0] * (10 ** 5 + 5)
even = [0] * (10 ** 5 + 5)
for i in range(n):
    if i % 2 == 0:
        even[v[i]] += 1
    else:
        odd[v[i]] += 1
sum_odd = sum(odd)
sum_even = sum(even)
ans = sum_odd + sum_even
max_odd = max(odd)
max_even = max(even)
if odd.index(max_odd) != even.index(max_even):
    print(sum_odd + sum_even - max_even - max_odd)
else:
    odd.sort()
    even.sort()
    if odd[-1] - odd[-2] > even[-1] - even[-2]:
        ans -= odd[-1] + even[-2]
    else:
        ans -= odd[-2] + even[-1]
    print(ans)

Measured memory_bytes: 20640
import sys

if __name__ == "__main__":
    N = int(input())
    plan = [list(map(int, input().split(' '))) for i in range(N)]
    for i in range(N):
        time = plan[i][0]
        if abs(plan[i][1]) > time or abs(plan[i][2]) > time:
            print('No')
            sys.exit()
        if abs(plan[i][1]) + abs(plan[i][2]) > time:
            print('No')
            sys.exit()
        if ((abs(plan[i][1]) + abs(plan[i][2])) % 2) != (time % 2):
            print('No')
            sys.exit()
    print('Yes')

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

int main(){
  int c[4][4];
  string ans = "No";
  bool truth = false;
  for(int i=1;i<4;i++){
    for(int j=1;j<4;j++){
      cin >> c[i][j];
    }
  }
  int a[4],b[4];
  for(int i=0;i<=100;i++){
    a[1]=i;
    b[1]=c[1][1]-i;
    b[2]=c[1][2]-i;
    b[3]=c[1][3]-i;
    a[2]=c[2][1]-b[1];
    a[3]=c[3][1]-b[1];
    if(b[1]>=0&&b[2]>=0&&b[3]>=0&&a[2]>=0&&a[3]>=0){
      if(a[2]==c[2][2]-b[2]&&a[2]==c[2][3]-b[3]){
        if(a[3]==c[3][2]-b[2]&&a[3]==c[3][3]-b[3]){
          ans = "Yes";
          //cout << a[1] <<" "<< a[2] <<" "<< a[3] <<" "<< b[1] <<" "<< b[2] <<" "<< b[3] << endl;
          break;
        }
      }
    }
  }
  cout << ans <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
using P = pair <int, int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 
ll MOD = 1000000007;
ll INF =1<<30;

int main(){
    string s;
    cin >> s;
    ll n = s.size();
    ll bla = 0,whi=0;
    rep(i,n){
        if(s[i]=='B')bla++;
        else whi++;
    }
    ll ans1=0,ans2=0;
    rep(i,n){
        if(s[i]=='B') ans1+=i;
    }
    for(int i = whi;i<n;i++)ans2+=i;
    cout << ans2-ans1<<endl;
}

Measured memory_bytes: 3748
s = gets.rstrip
q = gets.rstrip.to_i

queries = []
q.times do |i|
    query = gets.rstrip
    if query.length > 1 then
        queries << query.split(" ")
    else
        queries << query
    end
end

s = [s]
  
isReversed = false
queries.each do |qi|

    if qi == "1" then
        isReversed = isReversed ^ true
    else
        temp, f, c = qi
        if f == "1" then
            if not isReversed then
                #s = c + s
                s.unshift(c)
            else
                #s = s + c
                s.push(c)
            end
        else
            if not isReversed then
                #s = s + c
                s.push(c)
            else
                #s = c + s
                s.unshift(c)
            end
        end
    end
end

if isReversed then
    puts s.join.reverse
else
    puts s.join
end


Measured memory_bytes: 55376
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int count = 0;
		while (N / K != 0) {
			count++;
			N = N / K;
		}
		System.out.println(count + 1);

	}
}


Measured memory_bytes: 23252
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}



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

	vector<int> a(n);
	rep(i, n) cin >> a[i];
	multiset<int> s(all(a));
	rep(i,n){
		s.erase(s.find(a[i]));
		cout << *s.rbegin() << endl;
		s.insert(a[i]);
	}

	return 0;
}

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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

const int MAX_N = 15;
const ll INF = 1000100100100100100;

int main()
{
    int n, k; cin >> n >> k;
    vector<int> a(n);
    rep(i,n) cin >> a[i];

    ll ans = INF;

    rep(i,(1<<n)){
        bitset<MAX_N> b(i);

        ll cost = 0;
        if(b.count() == k){
            if(!b.test(0)) continue;

            int ori_a = a[0];

            for(int j=1; j<n; j++){
                if(b.test(j)){
                    if(a[j] > ori_a){
                        ori_a = a[j];
                    }else{
                        cost += ori_a - a[j] + 1;
                        ori_a = ori_a + 1;
                    }
                }else{
                    if(ori_a < a[j]){
                        ori_a = a[j];
                    }
                }
            }
        }else{
            cost = INF;
        }
        ans = min(ans, cost);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3612
#include<iostream>
#include<algorithm>
using namespace std;
int a[100000];
int b[100000];
int c[100000];
int d[100000];
signed main(){
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i]>>b[i]>>c[i];
    d[i]=0;
  }
  for(int i=0;i<n;i++){
    while(1){
      if(a[i]>=1 && b[i]>=1 && c[i]>=1){
	d[i]=d[i]+1;
	a[i]=a[i]-1;
	b[i]=b[i]-1;
	c[i]=c[i]-1;
      }
      else{
	if(a[i]>=2 && b[i]>=1 && c[i]>=0){
	  d[i]=d[i]+1;
	  a[i]=a[i]-2;
	  b[i]=b[i]-1;
	}
	else{
	  if(a[i]>=3){
	    d[i]=d[i]+1;
	    a[i]=a[i]-3;
	  }
	  else{
	    break;
	  }
	}
      }
    }
    cout<<d[i]<<"\n";
  }
  return(0);
}


Measured memory_bytes: 3116
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		int a=scan.nextInt();
		int b=scan.nextInt();
		int c=scan.nextInt();
		
		if(a<b&&b<c){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 26176
// ref. https://img.atcoder.jp/agc020/editorial.pdf

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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; }

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

ll f(ll x, ll a) {
  return x - (x%a);
}

// return true if n can be result in 2 or smaller.
bool checkSmall(vector<ll>& a, ll n) {
  ll now = n;
  rep(i, a.size()) {
    now = f(now, a[i]);
  }
  return now <= 2;
}

// return true if n can be result in 2 or larger.
bool checkLarge(vector<ll>& a, ll n) {
  ll now = n;
  rep(i, a.size()) {
    now = f(now, a[i]);
  }
  return now >= 2;
}

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll k;
  cin >> k;
  vector<ll> a(k);
  ll maxA = 0;
  rep(i, k) {
    cin >> a[i];
    maxA = max(maxA, a[i]);
  }
  ll largest, smallest;

  // Here, we find the result in binary search.
  {
    ll l = 2, r = k * maxA + 3;
    // find the result in [l, r). find the boundary in [t, t, .., t, f, .. , f]
    while (r - l > 1) {
      ll m = (l + r)>>1;
      if (checkSmall(a, m)) {
        l = m;
      } else {
        r = m;
      }
    }
    largest = l;
  }

  {
    ll l = 1, r = k * maxA + 2;
    // find the result in (l, r]. find the boundary in [f, f, ..., f, t, .., t]
    while (r - l > 1) {
      ll m = (l + r)>>1;
      if (checkLarge(a, m)) {
        r = m;
      } else {
        l = m;
      }
    }
    smallest = r;
  }

  // For Debug
  // cout << "smallest: " << smallest << endl;
  // cout << "largest: " << largest << endl;

  if (smallest <= largest) {
    cout << smallest << " " << largest << endl;
  } else { // invalid
    cout << -1 << endl;
  }
}


Measured memory_bytes: 1024
N = int(input())
K = int(input())
X = list(map(int, input().split()))


def diff_ball_K(N, K):
    return [N - K]


ball_K = list(map(lambda x: K - x, X))



diff = [min(a,b) for a,b in zip(X, ball_K)]
print(sum(diff)*2)

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

int solnC(int n,vector<vector<int> > &arr){
	int dp[n][3];
	if(n<2) return max(arr[0][0],max(arr[0][1],arr[0][2]));
	dp[n-1][0]=arr[n-1][0];
	dp[n-1][1]=arr[n-1][1];
	dp[n-1][2]=arr[n-1][2];
	// dp[n-2]=abs(arr[n-1]-arr[n-2]);
	for(int i=n-2;i>=0;i--){
		for(int k=0;k<3;k++){
			int a=(k+1)%3,b=(k+2)%3;
			dp[i][k] = arr[i][k]+max(dp[i+1][a],dp[i+1][b]);
		}
		// cout<<dp[i][0]<<" "<<dp[0][1]<<" "<<dp[0][2]<<endl;
	}
	return max(dp[0][0],max(dp[0][1],dp[0][2]));
}
int main(){
	int n;
	cin>>n;
	vector<vector<int> > arr(n,vector<int>(3));
	for(int i=0;i<n;i++) cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
	cout<<solnC(n,arr)<<endl;
}

/*
int solnB(int n,int k,vector<int>& arr){
	int dp[n];
	if(n<2) return 0;
	dp[n-1]=0;
	// dp[n-2]=abs(arr[n-1]-arr[n-2]);
	for(int i=n-2;i>=0;i--){
		dp[i]=INT_MAX;
		for(int j=1;j<=k&&i+j<n;j++)
			dp[i] = min(dp[i],abs(arr[i]-arr[i+j])+dp[i+j]);
	}
	return dp[0];
}
int solnA(int n,vector<int>& arr){
	int dp[n];
	if(n<2) return 0;
	dp[n-1]=0;
	dp[n-2]=abs(arr[n-1]-arr[n-2]);
	for(int i=n-3;i>=0;i--){
		dp[i] = min(abs(arr[i]-arr[i+1])+dp[i+1],abs(arr[i]-arr[i+2])+dp[i+2]);
	}
	return dp[0];
}
*/

Measured memory_bytes: 9852
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

long long int A,B,C;

int main() {
	ios::sync_with_stdio(false);
	cin >> A >> B >> C;
	for (int i = 0; i < 1000; i++) {
		if (A % 2 || B % 2 || C % 2) {
			cout << i << endl;
			return 0;
		}
		long long int a, b, c;
		a = (B + C) / 2;
		b = (A + C) / 2;
		c = (A + B) / 2;
		A = a;
		B = b;
		C = c;

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

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

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

  int N, M;
  cin >> N >> M;
  cout << (1900 * M + 100 * (N - M)) * (1 << M) << endl;
  return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define ll long long
#define For(i,a,b) for(register int i=a;i<=b;i++)
#define Forr(i,a,b) for(register int i=a;i>=b;i--)
using namespace std;
inline void read(int &x)
{
    int p=1;
    x=0;
    char c=getchar();
    while(!isdigit(c)){if(c=='-')p=-1;c=getchar();}
    while(isdigit(c)){x=(x<<3)+(x<<1)+(c^'0');c=getchar();}
    x*=p;
}
int n,ans,a[15],b[15];
inline void dfs(int x,int cj)
{
	if(x==n+1)
	{
		if(cj%2==0)ans++;
		return;
	}
	For(i,a[x]-1,a[x]+1)
	{
		b[x]=i;
		dfs(x+1,cj*i);
	}
}

int main()
{
	read(n);
	For(i,1,n)read(a[i]);
	dfs(1,1);
	printf("%d\n",ans);
	return 0;
}

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

int main(){
    int N;
    cin >> N;
    vector<int> data(N,0);
    for(int i=0;i<N;i++){
        cin >> data.at(i);
    }
    sort(data.begin(),data.end());
    long long sum = accumulate(data.begin(),data.end(),0LL);
  	int min = data.at(0);
  	int max = data.at(N-1);
  	cout << min << " " << max << " " << sum << endl;
}


Measured memory_bytes: 3140
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a=700;
    string s;
    cin>>s;
    for(int t=0;t<3;t++)
    {
        if(s[t]=='o')
            a+=100;
    }
    cout<<a<<'\n';
    
    return 0;
}


Measured memory_bytes: 256
import sys 

n = int(input())

sum = 0

for i in range(1, n + 1):
	last = n // i * i 
	count = (last - i) // i + 1

	#print(last, count)

	s = (i + last)  * count // 2 
	#print(s)
	sum += s

print(sum)

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

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

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

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

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


//cout<<" "<<endl;
int main(){
  int N;cin>>N;
  cout<<(N+1)/2<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define ct(string) cout << string << endl

int n;
struct Card {char suit, value;};

void selectionSort(vector<Card> &vec) {
    rep(i,n) {
        int minn = i;
        for (int j=i; j<n; j++) { //i以降で最小の
            if (vec.at(j).value < vec.at(minn).value) minn = j;
        }
        swap(vec.at(i), vec.at(minn));
    }
}

void bubbleSort(vector<Card> &vec) {
    int count=0;
    bool flag=true;
    int i=0;
    while (flag) {
        flag = false;
        for (int j=n-1; j>i; j--) {
            if (vec.at(j).value < vec.at(j-1).value) {
                swap(vec.at(j), vec.at(j-1));
                flag = true;
            }
        }
        i++;
    }
}

void cout_vector(vector<Card> vec) {
    rep(i,n-1) {
        cout << vec.at(i).suit << vec.at(i).value << " ";
    }
    ct(vec.at(n-1).suit << vec.at(n-1).value);
}

bool isStable(vector<Card> x, vector<Card> y) {
    rep(i,n) {
        if (x.at(i).suit != y.at(i).suit) return false;
    }
    return true;
}

int main() {
    cin >> n;
    vector<Card> b(n), s(n);
    rep(i,n) cin >> b.at(i).suit >> b.at(i).value;
    s = b;
    bubbleSort(b);
    selectionSort(s);
    cout_vector(b);
    ct("Stable");
    cout_vector(s);
    if (isStable(b,s)) ct("Stable");
    else ct("Not stable");
}


Measured memory_bytes: 3168
from collections import Counter
n,*a=map(int,open(0).read().split())
one=[i+x for i,x in enumerate(a)]
two=[i-x for i,x in enumerate(a)]
def cnt(l):
	ret=sum(x*(x-1)//2 for x in Counter(l).values())
	return ret
print(cnt(one+two)-cnt(one)-cnt(two))

Measured memory_bytes: 69140
#include <cstdio>

using namespace std;

int main() {
    int a, b, c, k;
    scanf("%d%d%d%d", &a, &b, &c, &k);
    while (a >= b) {
        b *= 2;
        k--;
    }
    while (b >= c) {
        c *= 2;
        k--;
    }
    if (k < 0)
        puts("No");
    else
        puts("Yes");
    return 0;
}

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

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))

using namespace std;
using ll = long long;
using pii = pair<int, int>;

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'000'000'001;
constexpr ll LLINF = 4'000'000'000'000'000'001;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; ++i){
        cin >> a[i];
    }
    vector<int> b(n), c(n);
    for(int i = 0; i < n; ++i){
        if(i > 0) b[i] = b[i-1];
        b[i] = max(b[i], a[i]);
    }
    for(int i = n - 1; i >= 0; --i){
        if(i < n-1) c[i] = c[i+1];
        c[i] = max(c[i], a[i]);
    }
    for(int i = 0; i < n; ++i){
        int ans = 0;
        if(i > 0) ans = max(ans, b[i-1]);
        if(i < n-1) ans = max(ans, c[i+1]);
        cout << ans << "\n";
    }
    return 0;
}

Measured memory_bytes: 3968
#include<bits/stdc++.h>
using namespace std;
int main(void){
  string o,e;
  cin>>o>>e;
  for(int i=0;i<o.size();i++){
    cout<<o[i];
    if(i<e.size()){
      cout<<e[i];
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main(void){
double x1,y1,x2,y2,r;
scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
if(x1>x2){
if(y1>y2)r=sqrt(pow((x1-x2),2)+pow((y1-y2),2));
else r=sqrt(pow((x1-x2),2)+pow((y2-y1),2));
}else{
if(y1>y2)r=sqrt(pow((x2-x1),2)+pow((y1-y2),2));
else r=sqrt(pow((x2-x1),2)+pow((y2-y1),2));
}
printf("%f\n",r);
return 0;
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
 
int main(){
long long  N;
  cin >> N;
long long mi = 1000000000000010;  
long long ni;  
long long d[5];  
for(int i = 0;i < 5;i++){
  cin >> d[i];                     // A,B,C,D,E
  mi = min(mi, d[i]);
}  
  if(mi >= N) cout << 5 << endl;
  else{
  ni = N / mi;
  if(N % mi  != 0){
    ni++;
   }
    cout << 4 + ni << endl;

  }  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int a[100];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		if (a[i] % 2 == 0 && !(a[i] % 3 == 0 || a[i] % 5 == 0)) {
			cout << "DENIED";
			return 0;
		}
	}
	cout << "APPROVED";
}

Measured memory_bytes: 256
#include<stdio.h>
int main () {
   int n, u, k, v, i, j;
   int G[100][100] = {0};

   scanf("%d", &n);
   for (i = 0; i < n; i++) {
     scanf("%d", &u);
     scanf("%d", &k);
     for (j = 0; j < k; j++) {
       scanf("%d", &v);
       G[u-1][v-1] = 1;
     }
   }

   for (i = 0; i < n; i++) {
    printf("%d", G[i][0]);

    for (j = 1; j < n; j++) {
      printf(" %d", G[i][j]);
    }

    printf("\n", G[i][0]);
   }
   return 0;
   
}

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

#define stirng string
#define vvi vector<vector<int>>
#define vi vector<int>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

const int inf = 1e9 + 7;

/*int main() {
  string a;
  cin >> a;
  string s = "";
  for (int i = 0; i < 10; i++) {
    s += a[i];
  }
  for (int i = 0; i < 44; i++) {
    int t = s[0 + i] - '0';
    int u = s[1 + i] - '0';
    s += (t + u) % 10 + '0';
  }
  cout << s[54] << endl;
  return 0;
}*/
int main() {
  int a, b;
  int p = 1;
  while (cin >> a >> b && a != 0 && b != 0) {
    if (p == 0) {
      cout << endl;
    }
    p = 0;
    int flag = 1;
    for (int i = a; i <= b; i++) {
      if (i % 100 == 0 && i % 400 != 0) {
        // continue;
      } else if (i % 4 == 0 && i % 100 != 0) {
        cout << i << endl;
        flag = 0;
      } else if (i % 400 == 0) {
        cout << i << endl;
        flag = 0;
      } else {
        // continue;
      }
    }
    if (flag) {
      cout << "NA" << endl;
    }
  }
  return 0;
}



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

int main(){
    int n;
    cin >> n;
    vector<int> P(n), Q(n), R(n);
    rep(i,n) {
        cin >> P[i];
        R[i] = P[i];
    }
    rep(i,n) cin >> Q[i];
    int a=1, b=1;
    int A, B;
    sort(R.begin(), R.end());
    do{
        bool jp=1, jq=1;
        rep(i,n) if(P[i] != R[i]) jp=0;
        rep(i,n) if(Q[i] != R[i]) jq=0;
        (jp) ?A=a :a++;
        (jq) ?B=b :b++;
    }while(next_permutation(R.begin(), R.end()));
    cout << abs(A-B) << endl;
}

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

int main(){
   int x,y,n[4],m[4];
   int h,b,i,j;
   
   while(1){
      cin >> x >> y;
      if(x+y==0) break;
      
      h=0; b=0;
      
      for(i=3; i>0; i--){
         n[i]=x/pow(10,i);
         x-=n[i]*pow(10,i);
         m[i]=y/pow(10,i);
         y-=m[i]*pow(10,i);
      }
      n[0]=x; m[0]=y;
      
      for(i=0;i<4;i++){
         if(n[i]==m[i]) h++;
         else for(j=0;j<4;j++){
            if(n[i]==m[j]) b++;
         }
      }
      
      cout << h << " " << b << endl;
   }
   
   return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int(v.size())
#define all(v) v.begin(), v.end()
#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)

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

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  string s; cin >> s;

  int n = si(s) - 1;

  ll ans = 0;
  rep(bit, 1<<n) {
    ll sum = s[0] - '0';

    rep(i, n) {
      if (bit & (1<<i)) {
        ans += sum;
        sum = s[i+1] - '0';
      } else sum = sum * 10 + (s[i+1] - '0');
    }

    ans += sum;
  }

  cout << ans << endl;
  
  return (0);
}

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

int main(){
        int n,i,ans=1;
        char s,spre;
        cin >> n;
        cin >> spre;
        for(i=1;i<n;++i){
                cin >> s;
                if(s==spre) continue;
                else{
                        ++ans;
                        spre = s;
                }
        }
        cout << ans << endl;
        return 0;
}

Measured memory_bytes: 3608
def ans b, m, n
  r = 1
  while true
    r_new = r
    m.times do |m0|
      n.times do |n0|
        if b[n0][m0] == '@' then

          if (n0 - 1 >= 0) and (b[n0-1][m0] == '.') then
            b[n0-1][m0] = '@'
            r_new += 1
          end

          if (n0 + 1 < n) and (b[n0+1][m0] == '.') then
            b[n0+1][m0] = '@'
            r_new += 1
          end

          if (m0 - 1 >= 0) and (b[n0][m0-1] == '.') then
            b[n0][m0-1] = '@'
            r_new += 1
          end

          if (m0 + 1 < m) and (b[n0][m0+1] == '.') then
            b[n0][m0+1] = '@'
            r_new += 1
          end
        end
      end
    end
    if r_new == r then
      break
    else
      r = r_new
    end      
  end
  return r
end

while true do

  mn = $stdin.gets.chop.split(/ /).map { |x| x.to_i }
  m = mn[0]
  n = mn[1]

  if m == 0 and n == 0 then
    break
  else
    b = []
    n.times do
      b.push $stdin.gets.chomp
    end

    r = ans b, m, n
    printf("%d\n", r)
  end
  
end



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

int main(void) {
  //input
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n;i++) {
    cin >> a.at(i);
  }

  //selectionsort
  int min;
  int count=0;
  for (int i = 0; i < n-1; i++) {
    min = i;
    for (int j = i+1; j < n; j++) {
        if (a.at(j) < a.at(min)) {
          min = j;
        }
      }
        if (min != i) {
          swap(a.at(i), a.at(min));
          count++;
      }
    }

  //display
  for (int i = 0; i < n; i++) {
    cout << a.at(i);
    if (i != n-1)
    cout << " ";
  }
  cout << endl;
  cout << count << endl;
}


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

int main() {
  int N, x;
  cin >> N >> x;
  vector<int> a(N);
  for(int i = 0; i < N; i++) cin >> a.at(i);
  sort(a.begin(), a.end());
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (i == N - 1 && x > a.at(i)) {}
    else if (a.at(i) <= x) {
      ans++;
      x -= a.at(i);
    }
    else
      break;
  }
  cout << ans << endl;
}

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

using i64 = int64_t;

constexpr i64 INF = 1e9;

struct Node{
    int x, y;
    i64 cost;
};

char grid[1004][1004]={0};
i64 mini[1004][1004]={0};

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

int main(){
    int h, w;
    cin >> h >> w;
    queue<Node> que;
    for(int i=0;i<h;++i){
        for(int j=0;j<w;++j){
            cin >> grid[i][j];
            if(grid[i][j] == '#'){
                mini[i][j] = 0;
                que.push({j, i, 0});
            }else{
                mini[i][j] = INF;
            }
        }
    }

    i64 ans = 0;
    while(!que.empty()){
        auto curr = que.front(); que.pop();
        for(int d=0;d<4;++d){
            int ny = curr.y + dy[d], nx = curr.x + dx[d];
            if(nx < 0 || nx >= w || ny < 0 || ny >= h)continue;
            if(grid[ny][nx] == '#')continue;
            i64 cost = curr.cost + 1;
            if(mini[ny][nx] < cost)continue;
            mini[ny][nx] = cost;
            que.push({nx, ny, cost});
            ans = max(ans, cost);
            grid[ny][nx] = '#';
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 25524
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using E = System.Linq.Enumerable;

class Program
{
    static void Main(string[] args)
    {
        //var n = long.Parse(Console.ReadLine());
        //var nm = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var ST = Console.ReadLine().Split();
        var S = ST[0];
        var T = ST[1];
        Console.WriteLine(T+S);
      
    }
}


Measured memory_bytes: 11092
#include "bits/stdc++.h"

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 11451419194545;

vector<ll > divisor(ll n) {
  vector< ll > div;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      div.push_back(i);
      //重複許すマジ
      if(i * i != n) div.push_back(n / i);
    }
  }
  sort(div.begin(), div.end());
  return (div);
}

int main(){

    ll N; cin >> N;

    vector<ll > div = divisor(N);

    ll ans = INF;

    for(ll i = 0; i < div.size() / 2 + 1; i++){
        //cout << div[i] << " " << div[div.size() - i - 1] << endl;
        ans = min(div[i] - 1 + div[div.size() - i - 1] - 1, ans);
    }

    cout << ans << endl;
    

}

Measured memory_bytes: 384
#include<complex>
#include<iostream>
int main(){const double E=1e-10;int n;double x1,y1,x2,y2,x3,y3,x4,y4;std::cin>>n;while(n--){std::cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;std::cout<<((std::abs((y2-y1)*(x4-x3)-(y4-y3)*(x2-x1))<E)?"YES\n":"NO\n");}}

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

int main(){
  string s;
  cin >> s;
  
  string ans = "Yes";
  for(auto i=0; i<s.size(); i++){
    if((i%2 == 0 and s.at(i) == 'L') or 
       (i%2 == 1 and s.at(i) == 'R')){
      ans = "No";
      break;
    }
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 256
#ifdef LOCAL
//#define _GLIBCXX_DEBUG
#endif
//#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<char> Vc;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;
typedef vector<vector<char>> VVc;
typedef vector<vector<vector<ll>>> VVV;
typedef vector<vector<vector<vector<ll>>>> VVVV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define rEach(i, mp) for (auto i = mp.rbegin(); i != mp.rend(); ++i)
#ifdef LOCAL
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgset(st) cerr << #st << ":"<<endl; for (auto i = st.begin(); i != st.end(); ++i) { cerr << *i <<" ";}cerr<<endl;
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#else
#define dbg(...)
#define dbgmap(...)
#define dbgset(...)
#define dbgarr(...)
#define dbgdp(...)
#endif
#define out(a) cout<<a<<endl
#define out2(a,b) cout<<a<<" "<<b<<endl
#define vout(v) rep(i,v.size()){cout<<v[i]<<" ";}cout<<endl
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

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

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,v.size())i>>v[j];return i;}

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int solve(){
    ll n;
    cin>>n;
    ll cnt = 0;
    ll d;
    cin>>d;
    rep(i,n){
        ll x,y;
        cin>>x>>y;
        if(x*x + y*y <= d*d){
            cnt++;
        }
    }
    out(cnt);
    return  0;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);
//    ll T;
//    cin>>T;
//    while(T--)
    solve();
}


Measured memory_bytes: 3636
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int x=sc.nextInt();
		int y=sc.nextInt();
		long ans=0;
		if(x==1){
			ans+=300000;
		}else if(x==2){
			ans+=200000;
		}else if(x==3){
			ans+=100000;
		}
		if(y==1){
			ans+=300000;
		}else if(y==2){
			ans+=200000;
		}else if(y==3){
			ans+=100000;
		}
		if(y==1 && x==1){
			ans+=400000;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 21844
package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
	"strings"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	nStr, _ := reader.ReadString('\n')
	aStr, _ := reader.ReadString('\n')
	bStr, _ := reader.ReadString('\n')
	cStr, _ := reader.ReadString('\n')
	dStr, _ := reader.ReadString('\n')
	eStr, _ := reader.ReadString('\n')
	nStr = strings.Trim(nStr, "\n")
	aStr = strings.Trim(aStr, "\n")
	bStr = strings.Trim(bStr, "\n")
	cStr = strings.Trim(cStr, "\n")
	dStr = strings.Trim(dStr, "\n")
	eStr = strings.Trim(eStr, "\n")

	n, err := strconv.Atoi(nStr)
	if err != nil {
		log.Fatalln(err)
	}
	a, err := strconv.Atoi(aStr)
	if err != nil {
		log.Fatalln(err)
	}
	b, err := strconv.Atoi(bStr)
	if err != nil {
		log.Fatalln(err)
	}
	c, err := strconv.Atoi(cStr)
	if err != nil {
		log.Fatalln(err)
	}
	d, err := strconv.Atoi(dStr)
	if err != nil {
		log.Fatalln(err)
	}
	e, err := strconv.Atoi(eStr)
	if err != nil {
		log.Fatalln(err)
	}

	var min int
	for _, num := range []int{a, b, c, d, e} {
		if min == 0 || num < min {
			min = num
		}
	}

	bottleNeck := n / min
	if n%min != 0 {
		bottleNeck++
	}
	sum := bottleNeck + 4

	fmt.Println(sum)
}


Measured memory_bytes: 640
def toString(n):
    if n <= 26:
        return chr(64 + n)
    elif n % 26 == 0:
        return toString(n // 26-1) + chr(90)
    else:
        return toString(n // 26) + chr(64 + n % 26)

N = int(input())
Alpha = toString(N)
alpha = Alpha.lower()
print(alpha)
    

Measured memory_bytes: 9164
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <cassert>
#include <random>
using namespace std;
using ll = long long;


int main() {
	int H, W, K; cin >> H >> W >> K;
	vector<string> s(H);
	for (int i = 0; i < H; i++) {
		cin >> s[i];
	}
	vector<vector<int>> acc(H, vector<int>(W + 1));
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			acc[i][j + 1] = acc[i][j] + (s[i][j] == '1');
		}
	}
	auto func = [&](int sep) -> int {
		int ret = 0;
		int prev = 0;
		int cnt = 0;
		for (int c = 0; c < W; c++) {
			bool flag = false;
			int sum = 0;
			for (int r = 0; r < H; r++) {
				sum += acc[r][c + 1] - acc[r][prev];
				if ((sep >> r) & 1) {
					flag |= sum > K;
					sum = 0;
				}
			}
			if (sum > K && c == 0) {
				return 1e9;
			}
			flag |= sum > K;
			if (flag) {
				ret++;
				prev = c;
				c--;
			}
			cnt++;
			if (cnt > 10*W) {
				return 1e9;
			}
		}
		return ret;
	};
	auto cnto = [](int b) {
		int ret = 0;
		for (int i = 0; i < 9; i++) {
			ret += (b >> i) & 1;
		}
		return ret;
	};
	int ans = 1e9;
	for (int sep = 0; sep < (1 << (H - 1)); sep++) {
		ans = min(ans, func(sep) + cnto(sep));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;

int main() {
  int n;

  while(1) {
    vector<float> che(3, 0);
    cin >> che[0] >> che[1] >> che[2];
    if(che[0] == 0.0 && che[1] == 0.0 && che[2] == 0.0) break;
    cin >> n;

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

    int r[10000] = {0};
    for(int i = 0; i < n; i++) {
      cin >> r[i];
      if((r[i]*r[i]*4) > ((che[0]*che[0])+(che[1]*che[1])))
        cout <<	"OK" <<	endl;
      else
        cout <<	"NA" <<	endl;
    }
    che.clear();
  }
  return 0;
}



Measured memory_bytes: 3252
#include<cstdio>
#include<vector>
#include<algorithm>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

const int INF=1<<29;

template<class T>
class binary_heap{
	const static int N_MAX=3000;
	int n;
	T a[N_MAX+1];
public:
	binary_heap():n(0){}
	const T &find_min()const{ return a[1]; }
	void insert(const T &x){
		int u=++n;
		a[u]=x;
		while(u!=1 && a[u/2]>a[u]) swap(a[u/2],a[u]), u/=2;
	}
	void delete_min(){
		a[1]=a[n--];
		for(int u=1;2*u<=n;){
			int v=2*u;
			if(2*u+1<=n && a[2*u]>a[2*u+1]) v++;
			if(a[v]<a[u]) break;
			swap(a[v],a[u]);
			u=v;
		}
	}
	bool empty()const{ return n==0; }
	int size()const{ return n; }
};

struct edge{ int v,cost1,cost2; };

int main(){
	for(int m,n;scanf("%d%d",&m,&n),n;){
		vector<edge> G[100];
		rep(i,m){
			int u,v,cost1,cost2; scanf("%d%d%d%d",&u,&v,&cost1,&cost2); u--; v--;
			G[u].push_back((edge){v,cost1,cost2});
			G[v].push_back((edge){u,cost1,cost2});
		}

		int q; scanf("%d",&q);
		while(q--){
			int s,t,type; scanf("%d%d%d",&s,&t,&type); s--; t--;

			int d[100];
			rep(u,n) d[u]=(u==s?0:INF);
			static binary_heap< pair<int,int> > H; H.insert(make_pair(0,s));
			while(!H.empty()){
				int d_now=H.find_min().first,u=H.find_min().second;
				H.delete_min();

				if(d[u]<d_now) continue;

				rep(i,G[u].size()){
					const edge &e=G[u][i];
					int d2=d_now+(type==0?e.cost1:e.cost2);
					if(d[e.v]>d2){
						d[e.v]=d2;
						H.insert(make_pair(d2,e.v));
					}
				}
			}

			printf("%d\n",d[t]);
		}
	}

	return 0;
}

Measured memory_bytes: 1168
#include <iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<limits>
#include<string.h>
#include<vector>
#include<stack>
#include<queue>
using namespace std;

int main()
{
    int a,b;
    cin>>a;
    b=a+a*a+a*a*a;
    cout<<b<<endl;

    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1000000007 // 1e9+7
#define PI 3.1415926525
#define ll long long int // 10^18
#define INF 1000000001 // 1e9+1

int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
//---------------------------
int n;
int f[100][5][2];
ll p[100][11];

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  cin>>n;
  REP(i,n){
    REP(j,5){
      cin>>f[i][j][0]>>f[i][j][1];
    }
  }
  REP(i,n){
    REP(j,11){
      cin>>p[i][j];
    }
  }
  ll maxn=-INF;
  REP(i1,2){
    REP(i2,2){
      REP(i3,2){
        REP(i4,2){
          REP(i5,2){
            REP(i6,2){
              REP(i7,2){
                REP(i8,2){
                  REP(i9,2){
                    REP(i10,2){
                      if(i1==0 && i2==0 && i3==0 && i4==0 && i5==0 && i6==0 && i7==0 && i8==0 && i9==0 && i10==0)continue;
                      ll gain=0;
                      REP(i,n){
                        int cnt=0;
                        if(f[i][0][0]==i1 && i1==1)cnt++;
                        if(f[i][0][1]==i2 && i2==1)cnt++;
                        if(f[i][1][0]==i3 && i3==1)cnt++;
                        if(f[i][1][1]==i4 && i4==1)cnt++;
                        if(f[i][2][0]==i5 && i5==1)cnt++;
                        if(f[i][2][1]==i6 && i6==1)cnt++;
                        if(f[i][3][0]==i7 && i7==1)cnt++;
                        if(f[i][3][1]==i8 && i8==1)cnt++;
                        if(f[i][4][0]==i9 && i9==1)cnt++;
                        if(f[i][4][1]==i10 && i10==1)cnt++;
                        gain+=p[i][cnt];
                      }
                      maxn=max(maxn,gain);
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  P(maxn);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <stdio.h>
#include <cmath>
#include <iomanip>
typedef long double ld;
using namespace std;

int main()
{
    int n;
    cin >> n;
    double ans = 0;
    double a;
    for (int i = 0; i < n; i++)
    {
        cin >> a;
        ans += 1/a;
    }
    ans = 1/ans;
    cout << setprecision(16) << ans << endl;
}


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

int main(){
ll X,K,D,dis,m,z;
cin>>X>>K>>D;

if(X<0)
    {
        X=X*(-1);
    }
if(D>=X && K%2==1){
    dis=D-X;
}
else if(D>=X && K%2==0){
    dis=X;
}
else if(D<X){
       z=X/D;
        m=min(z,K);
    if((z%2==0 && K%2==0)||(z%2==01 && K%2==1)||K<z)
    {
        dis=X-m*D;
    }
    else{
        dis=abs(X-(m+1)*D);
    }
}
cout<<dis<<endl;
}


Measured memory_bytes: 3600
#include<iostream>
#include <climits>
#include<vector>
using namespace std;

long long llabs(long long n){
    if(n < 0)
        return n*(-1);
    else
        return n;
}

int main(){
    long long N, K;
    vector<long long> x;
    cin >> N >> K;
    for(int i=0;i<N;i++){
        long long temp;
        cin >> temp;
        x.push_back(temp);
    }

    long long min_idx = 0;
    long long min_dist = INT_MAX;
    for(int i=0;i<N-K+1;i++){
        //long long dist = min(x[i+K-1]-x[i]+llabs(x[i+K-1]), x[i+K-1]-x[i]+llabs(x[i]));
        long long dist = min(llabs(x[i+K-1])+llabs(x[i+K-1]-x[i]), llabs(x[i])+llabs(x[i+K-1]-x[i]));
        if(min_dist > dist){
            min_dist = dist;
        }
    }

    cout << min_dist << endl;

    return 0;
}


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

using namespace std;

typedef long long ll;

int main () {
	ll n, m;
	ll i, j;
	map<char,int> s;
	ll ret;
	int len;
	
	char w[100];
	
	cin >> w;
	len = strlen(w);
	for (i=0;i<len;i++) {
		s[w[i]]++;
	}
	
	for (auto itr = s.begin(); itr != s.end(); ++itr){
		if (itr->second % 2 == 1) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 256