akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

//https://beta.atcoder.jp/contests/arc102/submissions/3118322

class Main{
	static class Edge{
		int a,b,c;

		public Edge(int a,int b,int c){
			super();
			this.a=a;
			this.b=b;
			this.c=c;
		}
	};

	static int nextBit(StringBuilder str,int idx){
		for(int i=idx+1;i<str.length();++i){
			if(str.charAt(i)=='1')
				return i;
		}
		return str.length()-1;
	}

	static Scanner s=new Scanner(System.in);

	public static void main(String[] $){
		int L=s.nextInt()-1;

		if(L==1){
			System.out.println("2 2");
			System.out.println("1 2 0");
			System.out.println("1 2 1");
			return;
		}

		boolean flag=false;
		StringBuilder str=new StringBuilder();
		HashMap<Integer,Integer> m=new HashMap<>();
		for(int i=20;i>=0;i--){
			if(!flag&&(L&(1L<<i))==0) continue;
			flag=true;
			m.put(str.length(),(1<<i));
			str.append((L&(1L<<i))==0?'0':'1');
		}

		ArrayList<Edge> ret=new ArrayList<>();

		for(int i=1;i<str.length();++i){
			ret.add(new Edge(i,i+1,0));
			ret.add(new Edge(i,i+1,m.get(i)));
		}

		int num=0;
		for(int i=0;i<str.length();++i){
			if(str.charAt(i)=='0') continue;
			num+=m.get(i);
			ret.add(new Edge(1,nextBit(str,i)+1,num));
		}

		System.out.println(str.length()+" "+ret.size());
		ret.forEach(o->System.out.println(o.a+" "+o.b+" "+o.c));
	}
}


Measured memory_bytes: 28372
/*
　　　∫ ∫ ∫
　　　ノヽ
　　（＿　 ）
　（＿　　　 ）
（＿＿＿＿＿＿ ）
　ヽ(´･ω･)ﾉ　
　　 |　 /
　　 UU
*/
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
using P = pair<ll, ll>;
typedef vector<int> vi;
const int MOD = (int)1e9 + 7;
const ll INF = 1LL << 60;
const int inf = 1<<30;
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 REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = s; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
#define mp make_pair
template <typename T>
ostream& operator<<(ostream& os, vector<T> &V){
    int N = V.size();
    REP(i,N){
        os << V[i];
        if (i!=N-1) os << " ";
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, pair<T,T> const&P){
    os << P.first;
    os << " ";
    os << P.second;
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> &S){
    auto it=S.begin();
    while(it!=S.end()){
        os << *it;
        os << " ";
        it++;
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, deque<T> &q){
    for(auto it=q.begin();it<q.end();it++){
        os<<*it;
        os<<" ";
    }
     os<<endl;
    return os;
}
vector<pair<int,int>> dxdy = {mp(0,1),mp(1,0),mp(-1,0),mp(0,-1)};
ll sum(vector<ll>& A){
    ll res = 0;
    for(auto a:A) res+=a;
    return res;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    int N = S.size();
    ll ans=0;
    int max_bit = 1<<(N-1);
    REP(bit,max_bit){
        vector<ll> A;
        A.push_back(S[0]-'0');
        REP(i,N-1){
            if ((1<<i)&bit){
                A.push_back(S[i+1]-'0');
            }else{
                (A.back()*=10)+=S[i+1]-'0';
            }
        }
        ans += sum(A);
    }

    cout << ans << endl;
}

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

int main() {
    int D;
    cin >> D;
    
    cout << "Christmas";
    rep(i, 25 - D) cout << " Eve";
    cout << endl;
    return 0;
}


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

using namespace std;

const int N = 200 * 1000 + 17;
const int MOD = 1000 * 1000 * 1000 + 7;

int n, m, q, x, y;
string s, t;

bool read() {
    if (!(cin >> n >> m >> q >> x >> y >> s >> t))
        return false;

    return true;
}

bool lose_lr() {
    int l = 0, r = m - 1;

    for (int i = q - 1; i >= 0; --i) {
        if (s[i] == 'L' && t[i] == 'L') {
            ++l;
            ++r;
        } else if (s[i] == 'L' && t[i] == 'R') {
            if (l == 0) ++l;
        } else if (s[i] == 'L') {
            ++l;
        } else if (s[i] == 'R' && t[i] == 'L') {
            if (r == m - 1) --r;
        } else if (s[i] == 'R' && t[i] == 'R') {
            --l;
            --r;
        } else if (s[i] == 'R') {
            --r;
        } else if (t[i] == 'L') {
            ++r;
        } else if (t[i] == 'R') {
            --l;
        }

        if (l > m - 1 || r < 0 || l > r)
            return true;

        l = max(0, l);
        r = min(m - 1, r);
    }

    return !(l <= y && y <= r);
}

bool lose_ud() {
    swap(n, m);
    int l = 0, r = m - 1;

    for (int i = 0; i < q; ++i) {
        s[i] = (s[i] == 'L' ? 'U' : (s[i] == 'R' ? 'D' : (s[i] == 'U' ? 'L' : 'R')));
        t[i] = (t[i] == 'L' ? 'U' : (t[i] == 'R' ? 'D' : (t[i] == 'U' ? 'L' : 'R')));
    }

    for (int i = q - 1; i >= 0; --i) {
        if (s[i] == 'L' && t[i] == 'L') {
            ++l;
            ++r;
        } else if (s[i] == 'L' && t[i] == 'R') {
            if (l == 0) ++l;
        } else if (s[i] == 'L') {
            ++l;
        } else if (s[i] == 'R' && t[i] == 'L') {
            if (r == m - 1) --r;
        } else if (s[i] == 'R' && t[i] == 'R') {
            --l;
            --r;
        } else if (s[i] == 'R') {
            --r;
        } else if (t[i] == 'L') {
            ++r;
        } else if (t[i] == 'R') {
            --l;
        }

        if (l > m - 1 || r < 0 || l > r)
            return true;

        l = max(0, l);
        r = min(m - 1, r);
    }

    return !(l <= x && x <= r);
}

void solve() {
    --x, --y;

    if (lose_lr() || lose_ud())
        cout << "NO\n";
    else
        cout << "YES\n";
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    while (read())
        solve();

    return 0;
}



Measured memory_bytes: 920
n,m = map(int,input().split())

i = 1
yakusuu = []
while i*i <= m:
    if m%i==0:
        yakusuu.append(i)
        if i*i != m:
            yakusuu.append(m//i)
        
    i += 1

yakusuu.sort()

for i in yakusuu:
    if n <= i:
        print(m//i)
        break
    

Measured memory_bytes: 2940
#include<stdio.h>


int main() {
	int N;
	int A[100];

	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d", &A[i]);
	}
	for (int j = N - 1; j >= 0; j--) {
		printf("%d", A[j]);
		if (j)printf(" ");
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 2668
//#define TIMER_
#include <bits/stdc++.h>
using namespace std;
#define rep(i,r) for(int i = 0; i < (r); i++)
#define pb push_back
#define ALL(a) a.begin(), a.end()
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using ll = long long;
using ull = unsigned long long;

int main() {
  fastio;
  int N, K;
  cin >> N >> K;
  unordered_map<int,int> mp;
  rep(z, K) {
    int D;
    cin >> D;
    for (int i = 0; i < D; i++) {
      int A;
      cin >> A;
      mp[A]++;
    }
  }
  cout << (N - mp.size()) << endl;
  
  #ifdef TIMER_
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
  #endif
}


Measured memory_bytes: 3660
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define rrep(i, n) for(ll i = 0; i <= (n); ++i)
#define FOR(i, m, n) for(ll i = m; i < (n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vii = vector<vi>;
using pii = pair<int, int>; 
using vl = vector<ll>;
using vll = vector<vl>;
using pll = pair<ll, ll>;

int main() {
    ll N;
    cin >> N;
    vl A(N);
    rep(i, N){
        cin >> A[i];
    }
    sort(all(A));
    reverse(all(A));
    ll ans = 0;
    ans += A[0];
    FOR(i, 1, N/2){
        ans += 2*A[i];
    }
    if(N % 2 != 0){
        ans += A[N/2];
    }
    cout << ans;
}

Measured memory_bytes: 4836
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
 
int main() {
  int x;
  cin >>x;
  x -= 400;
  x = x / 200;
  int ans = 8 - x;
  cout << ans << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef std::map<std::string, int> container;
typedef std::pair<std::string, int> value_type;

struct second_order {
    bool operator()(const value_type &x, const value_type &y) const {
        return x.second < y.second;
    }
};

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

    std::map<string, int> map;
    string key = "";
    for(int i = 0; i < n; ++i) {
        cin >> key;
        map[key]++;
    }

    std::priority_queue<value_type, std::vector<value_type>, second_order> que;
    std::pair<std::string, int> p;

    for(pair<string, int> p : map) {
        que.push(p);
    }

    int max = que.top().second;
    vector<string> str;
    for(int i = 0; !que.empty(); ++i) {
        value_type item = que.top();
        if(max != item.second) {
            break;
        }
        str.push_back(item.first);
        que.pop();
    }

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

    for(auto itr : str)
        std::cout << itr << std::endl;

    return 0;
}


Measured memory_bytes: 32880
//保留所有权利。
#include<iostream>
#include<stdio.h>//printするよ
#include<vector>
#include<algorithm>//辞書順はnext_permutationだよ
#include<set>
#include<string>
#include<sstream>
#include<string.h>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<utility>//swapで数値交換するよ
//END OF LIBRARIES.
#define rt "\n"//改行を最速化させるよ
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define vcin(v) for (int i = 0; i < (v).size(); i++) { cin >> (v)[i]; }
#define sort(s) sort(s.begin(),s.end())
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define cncn int cnt=0
#define smsm int sum=0
#define str srting
#define v vector
#define please return
#define AC 0//おまじないだよ
#define Rapid cin.tie(0);ios::sync_with_stdio(false)
//END OF DEFINE.
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vcha;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
//printf("%02d:%02d:%02d\n", h, m, s);・・・2文字は埋める・h、m、ｓ
//END OF TYPEDEF.

//最大公約数（GCD）を求めるよ
//最小公倍数（LCM）は＜＜　A × B ÷ GCD　 ＞＞で求まるよ

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}
int x = 0, y = 0, z = 0,n = 0;
string s = "";
asas;
cncn;
//BEGIN OF CODE.
int main(void){
	cin >> s;
	string ans;
	rep(i, s.size()) {
		if (s[i] == '0') {
			ans += '0';
		}
		if (s[i] == '1') {
			ans += '1';
		}
		if (s[i] == 'B') {
			if (ans.size() != 0) {
				ans.erase(ans.size() - 1);
			}
		}
	}
	cout << ans << rt;
	please AC;
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())
#define rsort(v) sort(all(v)); reverse(all(v))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template<typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template<typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template<typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template<typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template<typename T> inline T power(T x, i64 n) { T r = 1; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template<typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }

void solve() {
  string s;
  cin >> s;
  vi32 x(4);
  rep(i, 4) x[i] = s[i] - '0';
  function<bool(int)> month = [&](int x) {
    if (x == 0 || x > 12) return false;
    return true;
  };
  int a = x[0] * 10 + x[1], b = x[2] * 10 + x[3];
  {
    if (!month(a) && !month(b)) {
      cout << "NA" << '\n';
      return;
    }
  }
  if (month(a) && month(b)) {
    cout << "AMBIGUOUS" << '\n';
    return;
  }
  if (month(b)) {
    cout << "YYMM" << '\n';
  } else {
    cout << "MMYY" << '\n';
  }
}


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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    if(s[0] == s[1] && s[1] == s[2]) cout << "No" << endl;
    else cout << "Yes" << endl;
}

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

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int main(){
  string top;
  while(cin >> top, top != "-"){
    string left, right, bottom, res;
    cin >> left >> res;

    char center = left[0];
    left.erase(0, 1);
    while(!top.empty() || !left.empty()){
      if(res.find(center, 0) == string::npos && !left.empty()){
	right.push_back(center);
	center = left[0];
	left.erase(0, 1);
      }else if(!top.empty()){
	bottom.push_back(center);
	center = top[0];
	top.erase(0, 1);
      }
    }
    if(res.find(center, 0) == string::npos) right.push_back(center);

    cout << right << endl;
  }
  return 0;
}

Measured memory_bytes: 1200
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
	
	int N,K;
	cin>>N>>K;
	int ans=1;
	for(int i=1;i<=N-1;i++)
		ans*=K-1;
	cout<<ans*K<<endl;
		
	return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())

if n % 2 == 1:
    for i in range(m):  
        print(i+1, n-i)
else:
    middle = int((m+1)/2)
    for i in range(middle):
        print(i+1, n-i)
    for i in range(middle, m):
        print(i+2, n-i)

Measured memory_bytes: 9276
import numpy as np
W, H, N = map(int, input().split())
x_s = [0] * N
y_s = [0] * N
a_s = [0] * N
for i in range(N):
    x_s[i], y_s[i], a_s[i] = map(int, input().split())

l = np.zeros((H, W))
for x, y, a in zip(x_s, y_s, a_s):
  if a == 1:
    l[:, :x] = 1
  elif a == 2:
    l[:, x:] = 1
  elif a == 3:
    l[(H-y):, :] = 1
  else: #a=4
    l[:(H-y), :] = 1
print(np.count_nonzero(l==0))

Measured memory_bytes: 18724
N, K =(int(i) for i in input().split())
R, S, P = (int(i) for i in input().split())
T = input()
ans = 0
d = {}
d["r"] = P
d["s"] = R
d["p"] = S
rens = [0] * N
for i in range(N):
    if i>=K and T[i-K] == T[i]:
        rens[i] = rens[i-K] + 1
    if rens[i] %2 == 0:
        ans += d[T[i]]
print(ans)

Measured memory_bytes: 40816
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
 
const int mx=200010;
const ll mod=1e9+7;


int main(){
  string s;
  cin >> s;
  int ans=0;
  rep(i,3)if(s[i]=='1'){ans++;}
  
  cout << ans << endl;
  return 0;
}

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

int main() {
  int n,ans=0; cin >> n;
  vector<int> p(n);
  
  for(int i=0; i<n; i++) cin >> p.at(i);
  for(int i=0; i<n-2; i++) {
    if(p.at(i) > p.at(i+1) && p.at(i+1) > p.at(i+2)) ans++;
    if(p.at(i) < p.at(i+1) && p.at(i+1) < p.at(i+2)) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long

using namespace std;

LL dp[41][1<<17];

int main(){

    LL N,X[3];
    cin>>N>>X[0]>>X[1]>>X[2];
    X[0]+=X[1]+X[2];
    X[1]+=X[2];
    LL INF=1000000007;
    fill(dp[0],dp[N+1],0);
    dp[0][0]=1;

    REP(i,N){
        REP(j,1<<X[0]){
            REP(k,10){
                LL num = (j<<1) + 1;
                num <<=k;
                num &=((1<<X[0]) -1);
                if((num>>(X[2]-1))&1&&(num>>(X[1]-1))&1&&(num>>(X[0]-1))&1)continue;
                dp[i+1][num]+=dp[i][j];
                dp[i+1][num]%=INF;
            }
        }
    }

    LL sum=0;
    REP(j,1<<(X[0])){
        sum += dp[N][j];
        sum%=INF;
    }

    LL ans=1;
    REP(i,N){
        ans*=10;
        ans%=INF;
    }

    ans +=INF-sum;
    ans%=INF;
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 42240
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
signed main(){
  init_io();
  string s;
  cin >> s;
  ll n = s.size();
  if(n%2==1){
    cout <<"No\n";
  }else{
    for(int i=1;i<n;i+=2){
      if(s[i]!='i'||s[i-1]!='h'){
        cout <<"No\n";
        return 0;
      }
    }
    cout <<"Yes\n";
  }
}


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

int abs(int x){
    return x > 0 ? x : -x;
}

int main(void){
    vector<int> x,y;
    int n;
    double D1 = 0,D2 = 0,D3 = 0,D0 = 0;
    cin >> n;
    for(int i = 0;i < n;i++){
        int t;
        cin >> t;
        x.push_back(t);
    }
    for(int i = 0;i < n;i++){
        int t;
        cin >> t;
        y.push_back(t);
    }
    
    //D1
    for(int i = 0;i < n;i++){
        int d = abs(x[i] - y[i]);
        D1 += d;
        D2 += pow(d,2);
        D3 += pow(d,3);
        if(d > D0)D0 = d;
    }
    D2 = pow(D2,1/2.00000);
    D3 = pow(D3,1/3.00000);
    printf("%.8f\n%.8f\n%.8f\n%.8f\n",D1,D2,D3,D0);
    return 0;
}



Measured memory_bytes: 3416
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define INF 1000000000000000000
#define all(x) x.begin(), x.end()
#define PI 3.141592653589793

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

    vector<ll> dp(N, INF);
    dp[0] = 0;
    dp[1] = abs(H[1] - H[0]);
    for (int i = 2; i < N; i++) {
        dp[i] = min(dp[i], dp[i - 1] + abs(H[i] - H[i - 1]));
        dp[i] = min(dp[i], dp[i - 2] + abs(H[i] - H[i - 2]));
    }

    cout << dp[N - 1] << endl;
}

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

#define rep(i, N) for (ll i = 0; i < N; i++)
#define rep1(i, N) for (ll i = 1; i <= N; i++)
#define repr(i, N) for (ll i = N-1; i >= 0; i--)
#define repr1(i, N) for (ll i = N; i > 0; i--)

#define INF 1000000007

using ll = long long;
using namespace std;

typedef pair<int,int> P;

int main(){
    int W,H,N,ans=0;
    cin >> W >> H >> N;
    bool bitmap[100][100];
    rep(i,H)
        rep(j,W)
            bitmap[i][j] = true;

    rep(i,N){
        int x,y,a;
        cin >> x >> y >> a;
        if(a == 1){
            rep(j,H)
                rep(k,x)
                    bitmap[j][k] = false;
        }
        if(a == 2){
            rep(j,H)
                for(int k=x;k<W;k++)
                    bitmap[j][k] = false;
        }
        if(a == 3){
            rep(j,y)
                rep(k,W)
                    bitmap[j][k] = false;
        }
        if(a == 4){
            for(int j=y;j<H;j++)
                rep(k,W)
                    bitmap[j][k] = false;
        }
    }

    rep(i,H)
        rep(j,W)
            if(bitmap[i][j]) ans++;
    
    cout << ans;
    //printf("%.15lf",ans);
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
A = [int(i) for i in input().split()]

xors = lambda x, y: sum([(a & x) ^ y for a in A])
memo = {}

def dp(bind, bit):
  if bit < 0: return 0
  if (bind, bit) in memo: return memo[(bind, bit)]

  x = 1 << bit

  if bind and not(K & x):
    ans = xors(x, 0) + dp(True, bit-1)
  else:
    ans = max(xors(x, x) + dp(bind, bit-1), xors(x, 0) + dp(False, bit-1))

  memo[(bind, bit)] = ans
  return ans

print(dp(True, 40))


Measured memory_bytes: 14984
#include <stdio.h>

int a[1000];
int b[1000];

int main(void)
{
	int n, m, i;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", a + i);
	}
	scanf("%d", &m);
	for (i = 0; i < m; i++) {
		scanf("%d", b + i);
	}
	i = 0;
	while (i < n && i < m && a[i] == b[i]) ++i;
	puts((i == n && i < m) || (i < n && i < m && a[i] < b[i])? "1" : "0");
	return 0;
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;
using Graph = vector<vector<int>>; // グラフ型
using pint = pair<int, int>;

int main()
{
    int N, M;
    cin >> N >> M;
    vector<long long> H(N);
    REP(i, N)
    cin >> H[i];
    vector<int> G(N, 1);
    vector<bool> seen(N, false);
    REP(i, M)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        if (H[a] > H[b])
        {
            G[b] = 0;
        }
        else if (H[a] == H[b])
        {
            G[a] = G[b] = 0;
        }
        else
        {
            G[a] = 0;
        }
    }

    ll ans = 0;
    REP(i, N)
    {
        ans += G[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 4516
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
    ll n,k;
    string s;
    cin>>n>>k;
    cin>>s;
    for(int i=0;i<n;i++)
    {
        if(i==k-1)
            cout<<(char(s[i]-'A'+'a'));
        else
            cout<<s[i];
    }
    
}
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <vector>
#include <iomanip>
using namespace std;
#define P(x) cout << x << endl
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
    int n;
    int flag =0;
    string str;
    cin>>n;
   vector<string> arare(n);
   rep(i,n){
       cin >> str;
       if(str =="Y"){
           flag =1;
           break;
       }
   }
   if(flag ==1) P("Four");
   else P("Three");
}


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

struct Parser {
    using itr = string::const_iterator;
    itr now;
    int ans;
    const struct ex {
        vector<char> _012;
        ex() {
            _012.resize(10);
            for(int i = 0; i < 10; ++i) {
                _012[i] = char('0' + i);
            }
        }
    } ex;
    // <expr> ::= [<numb>] | [<expr>+]
    // <numb> ::= [1-9] [0-9]*
    Parser(const string &s) {
        now = s.begin();
        ans = expr(now);
    }
    // <expr> ::= [<numb>] | [<expr>+]
    int expr(itr &now) {
        next(now, '[');
        vector<int> num;
        // <expr> ::= [<expr>+]
        if(*now == '[') {
            while(*now != ']') {
                num.push_back(expr(now));
            }
        // <expr> ::= [<numb>]
        } else {
            num.push_back(numb(now));
            // next(now, ']');
        }
        next(now, ']');
        sort(num.begin(), num.end());
        int sz = num.size();
        int sum = 0;
        for(int i = 0; i < (sz + 1) / 2; ++i) {
            sum += num[i];
        }
        return sum;
    }
    // <numb> ::= [1-9] [0-9]*
    int numb(itr &now) {
        int ret = 0;
        while(1) {
            if('0' <= *now and *now <= '9') {
                ret *= 10;
                ret += (*now) - '0';
                next(now, ex._012);
            } else {
                ret = (ret + 1) / 2;
                return ret;
            }
        }
    }
    void next(itr &now, const char expected) {
        vector<char> req = {expected};
        next(now, req);
    }
    void next(itr &now, const vector<char> &expected) {
        for(char c: expected){
            if(*now == c){
                now++;
                return;
            }
        }
        // デバッグ用
        fprintf(stderr, "Expected: ");
        for(char c: expected) fprintf(stderr, "%c", c);
        fprintf(stderr, "\nGot: %c\n", *now);
        fprintf(stderr, "Rest: ");
        while(*now) fprintf(stderr, "%c", *now++);
    }
};

int main() {
    int n; cin >> n;
    while(n--) {
        string s; cin >> s;
        Parser parse(s);
        cout << parse.ans << endl;
    }
    return 0;
}



Measured memory_bytes: 3164
#include <algorithm>
#include <iostream>
#include <queue>
#include <set>
#include <utility>
#include <vector>

using std::cin;
using std::cout;
using std::endl;

using std::vector;
using std::set;
using std::pair;
using std::make_pair;
using std::priority_queue;

using std::min;

typedef long long int ll;
const ll INF = 1e18;

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

    vector<vector<ll>> e(n, vector<ll>(n, INF));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cin >> e[i][j];
        }
    }

    for(int k = 0; k < n; k++){
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++){
                if(e[i][k] + e[k][j] < e[i][j]){
                    cout << -1 << endl;
                    return 0;
                }
            }
        }
    }

    ll sum = 0;
    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            if(e[i][j] == INF){
                continue;
            }

            bool redundant = false;
            for(int k = 0; k < n; k++){
                if(k != i && k != j && e[i][j] == e[i][k] + e[k][j]){
                    redundant = true;
                    break;
                }
            }
            if(!redundant){
                sum += e[i][j];
            }
        }
    }

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int n, a, b, ans = 1e9;
int A[100], B[100], C[100];
int dp[555][555];

int main()
{
	cin >> n >> a >> b;
	double d = a/b;
	
	for(int i=1; i <= n; i++)
		cin >> A[i] >> B[i] >> C[i];
	for(int i=0; i <= 400; i++)
		for(int h=0; h <= 400; h++)
			dp[i][h] = 1e9;
	
	dp[0][0] = 0;
	for(int i=1; i <= n; i++)
		for(int h=400; h >= 0; h--)
			for(int j=400; j >= 0; j--)
				if(dp[h][j] != 1e9) {
					int x = h+A[i];
					int y = j+B[i];
					
					if(dp[x][y] > dp[h][j]+C[i])
						dp[x][y] = dp[h][j]+C[i];
				}
	
	for(int i=1; i <= 400; i++)
		if (a*i <= 400 && b*i <= 400)
		ans = min(ans, dp[a*i][b*i]);

	if(ans == 1e9)
		ans = -1;
	cout << ans;
}

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

int main(void)
{
    int n;
    
    cin >> n;
    
    map<int, long long> ball;
    map<int, long long>::iterator itr;
    int a[200000];
    
    for (int i = 0; i < n; i++) {
        int tmp;
        cin >> tmp;
        a[i] = tmp;
        if (ball.count(tmp) == 0) ball[tmp] = 1;
        else ball[tmp]++;
    }
    
    long long ball_conb_sum = 0;
    map<int, long long> ball_result_tmp = ball;
    for (itr = ball_result_tmp.begin(); itr != ball_result_tmp.end(); ++itr) {
        long long tmp_num = ball[itr->first];
        itr->second = tmp_num * (tmp_num-1) / 2;
        ball_conb_sum += itr->second;
    }

    map<int, long long> ball_result = ball;
    for (itr = ball_result.begin(); itr != ball_result.end(); ++itr) {
        long long tmp = ball[itr->first] - 1;
        long long me = (tmp<=1) ? 0 : tmp * (tmp-1) / 2;
        long long other = ball_conb_sum - ball_result_tmp[itr->first];
        itr->second = me + other;
    }

    for (int i = 0; i < n; i++)
        cout << ball_result[a[i]] << endl;
        
    return 0;
}


Measured memory_bytes: 26112
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

string s,t;
vector<vector<int> > ls;
void input(){
    fast_io();
    cin >> s >> t;
}

ll solve(){
    ls.resize(30);
    for (int i = 0; i < s.length(); i++)
    {
        ls[s[i]-'a'].push_back(i);
    }
    ll last = -1;
    ll ans = 0;
    for (int j = 0; j < t.length(); j++)
    {
        if(ls[t[j]-'a'].empty()) return -1;
        auto itr = upper_bound(ls[t[j]-'a'].begin(),ls[t[j]-'a'].end(),last);
        if(itr==ls[t[j]-'a'].end()){
            ans += (ll)s.length();
            last = -1;
            itr = upper_bound(ls[t[j]-'a'].begin(),ls[t[j]-'a'].end(),last);
        }
        last = *itr;
    }
    ans += last+1;
    return ans;
}   

int main()
{
    input();
    cout << solve() << "\n";
    return 0;
}

Measured memory_bytes: 1228
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
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; }
const ll INF=1LL<<60;
const int inf=1<<30;
const int mod=1e9+7;
const int MOD=998244353;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    double a,b,c,d,e,f;cin >> a >> b >> c >> d >> e >> f;
    int u=a*100,v=0;
    double t=0;
    for(int i=0;i*a*100<=f;i++){
        for(int j=0;i*a*100+j*b*100<=f;j++){
            for(int k=0;k*c<=e*(i*a+j*b);k++){
                for(int l=0;k*c+l*d<=e*(i*a+j*b);l++){
                    if(i*a*100+j*b*100+k*c+l*d>f){
                        continue;
                    }
                    if(t<(double)(k*c+l*d)/(i*a*100+j*b*100)){
                        t=(double)(k*c+l*d)/(i*a*100+j*b*100);
                        u=i*a*100+j*b*100+k*c+l*d;
                        v=k*c+l*d;
                    }
                }
            }
        }
    }
    cout << u << " " << v << endl;
}

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

int main(){

        int a, b, c, i, counter = 0;

        cin >> a >> b >> c;

        for(i = a; i <= b; i++){

                if(c % i == 0){
                        counter++;
                }
        }
        cout << counter << endl;

        return 0;

}



Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;	cin >> n;
  string s="APPROVED";

  for(int i=0;i<n;i++){
    int x;	cin >> x;
    if(x%2==0){
      if(!(x%3==0||x%5==0)){
        s="DENIED";
      }
    }
  }
  cout << s;
}

Measured memory_bytes: 3608
as = []
5.times do
  as << gets.to_i
end
k = gets.to_i

as.each do |a1|
  as.each do |a2|
    if (a1 - a2).abs > k
      puts ":("
      exit
    end
  end
end

puts "Yay!"
# n = gets.to_i
# as = gets.split.map(&:to_i)


Measured memory_bytes: 1788
#include<iostream>
#include<algorithm>
#include<string>

using namespace std;

int n;
int cost[20][20];
int edgenum[20];
int dis[20];//?????????????????????????????§??????????????¢????????????????????????

void dfs(int idx,int totalcost,int parent) {
	if (edgenum[idx] == 1) {
		dis[idx] = -1;
		return;
	}
	dis[idx] = totalcost;
	for (int i = 0; i < n; i++) {
		if (cost[idx][i] > 0 && i != parent) {
			dfs(i, totalcost + cost[idx][i], idx);
		}
	}
}

int main() {
	while (cin >> n, n) {
		int ans = 0;
		for (int i = 0; i < n - 1; i++) {
			int a, b, c;
			cin >> a >> b >> c;
			cost[a - 1][b - 1] = cost[b - 1][a - 1] = c;
			ans += (c * 2);
		}
		for (int i = 1; i < n; i++) {
			int ct = 0, idx = 0;
			for (int j = 0; j < n; j++) {
				if (cost[i][j] > 0)ct++, idx = j;
			}
			edgenum[i] = ct;
			if (ct == 1) {
				ans -= (cost[i][idx] * 2);
			}
		}
		dfs(0, 0, -1);
		int biggest = 0;
		for (int i = 0; i < n; i++) {
			biggest = std::max(biggest, dis[i]);
		}
		std::cout << ans - biggest << std::endl;
		for (int i = 0; i < n; i++)for (int j = 0; j < n; j++)cost[i][j] = 0;
		for (int i = 0; i < n; i++)dis[i] = 0;
		for (int i = 0; i < n; i++)edgenum[i] = 0;
	}
	return 0;
}

Measured memory_bytes: 3036
package main

import (
	"fmt"
	"math"
)

const n = 100003

func min(x, y int) int {
	if x <= y {
		return x
	}
	return y
}

func findMin(nums []int) int {
	m := n
	for _, v := range nums {
		if v < m {
			m = v
		}
	}
	return m
}

func findPrime(x int) int {
	nums := make([]int, n)
	for i := 0; i < n; i++ {
		nums[i] = i + 2
	}

	primes := make([]int, 0)
	for true {
		p := findMin(nums)

		if p >= x {
			return p
		}
		if p > int(math.Sqrt(n)) {
			break
		}
		primes = append(primes, p)
		i := 0
		for i < len(nums) {
			if nums[i]%p == 0 {
				nums = append(nums[:i], nums[i+1:]...)
				continue
			}
			i++
		}
	}
	for _, v := range nums {
		primes = append(primes, v)
	}
	for _, v := range primes {
		if v >= x {
			return v
		}
	}
	return -1
}

func main() {
	var x int
	fmt.Scan(&x)

	fmt.Println(findPrime(x))
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include<math.h>
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

int main() {
  int r,a,b;
  cin>>r>>a>>b; 
  if((10*a+b)%4==0){
    
  cout<<"YES"<<endl;
  }
  else{
    cout<<"NO"<<endl;
  }
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int INF = 1e9+5;
int main(){
    int sz;
    cin>>sz;
    int arr[sz];
    vector<int> dp(sz,INF);
    dp[0]= 0;
    for(int i = 0;i<sz;i++) cin>>arr[i];
    for(int i = 0;i<sz;i++){
        for(int j =i+1;j<i+3;j++){
            if(j<sz){
                dp[j] = min(dp[j],dp[i]+abs(arr[i]-arr[j]));
            }
        }
    }cout<<dp[sz-1]<<endl;


}


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

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

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
const int NIL = -1;
const ld PI = acos(-1);

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

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 DEBUG

struct ps {
	int p;
	string s;
};

int main(){
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//cout << fixed << setprecision(6);
	int n, m;
	cin >> n >> m;
	vector<int> p(m);
	vector<string> s(m);
	rep(i, m) cin >> p[i] >> s[i];

	vector<bool> isAc(n+1, true);
	vector<int> WAnum(n+1, 0);
	int wa = 0;
	int ac = 0;
	rep(i, m){
		if(isAc[p[i]]){
			if(s[i] == "WA") WAnum[p[i]]++;
			else if(s[i] == "AC"){
				isAc[p[i]] = false;
				ac++;
				wa += WAnum[p[i]];
			}
		}
	}

	printf("%d %d\n", ac, wa);
	return 0;
}


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

int main(){
   int n;
   cin >> n;
   vector<ll> a(n),b(n);
   for(int i=0; i<n; i++){
       cin >> a.at(i) >> b.at(i);
   }
   sort(a.begin(),a.end());
   sort(b.begin(),b.end());
   ll left,right;
   if(n%2==0){
       left=(a.at(n/2-1)+a.at(n/2));
       right=(b.at(n/2-1)+b.at(n/2));
       cout << right-left+1 << endl;
   }
   else{
       left=a.at((n-1)/2);
       right=b.at((n-1)/2);
       cout << right-left+1 <<endl;
   }
}

Measured memory_bytes: 6360
N, M = map(int, input().split())
vote = list(map(int, input().split()))
sum = sum(vote)
cnt = 0
 
 
for i in range(0,len(vote)):
    if sum / 4 / M <= vote[i]:
        cnt+= 1
 
 
if cnt >= M:
    print("Yes")
else: print("No")

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(x) x.begin(),x.end()
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

ll n,k;
vector<ll>a;
ll eps=1e-9;
int check(double mid){
    ll cnt=0;
   // int ok=0;
    rep(i,n){
   //     if(a[i]==mid)ok=1;
        if(a[i]<=mid)continue;
        cnt+=(a[i]+mid-0.01)/mid-1;
    }
    //if(cnt==0&&!ok)return 0;
    if(cnt<=k)return 1;
    return 0;
}
ll solve(){
   double l=0,r=1e9;
   for(int i=0;i<100;i++){
       double mid=l+(double)(r-l)/2;
    //   cout<<l<<" "<<r<<" "<< mid<<endl;
       if(check(mid))r=mid;
       else l=mid;
   }
   return ceil(l);
}

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

    cin>>n>>k;
    a.resize(n);
    rep(i,n)cin>>a[i];
    cout<<solve()<<endl;
    return 0;
}

Measured memory_bytes: 4772
import java.lang.*;  
import java.io.*;  
import java.util.*;  
  
class Main {
// Driver code
 public static String getAlpha(long num) {

    String result = "";
    while (num > 0) {
      num--; // 1 => a, not 0 => a
      long remainder = num % 26;
      char digit = (char) (remainder + 97);
      result = digit + result;
      num = (num - remainder) / 26;
    }

    return result;
  } 
public static void main (String[] args) 
{ 
    Scanner sc = new Scanner(System.in);
    long n = sc.nextLong();
    System.out.println(getAlpha(n));
} 
} 

Measured memory_bytes: 39108
# デジャヴュ。ゼロから始めるのではなく消していってゼロにする
# なぜか1WA

s = input()
while True:
    if len(s) == 0:
        print("YES")
        exit()
    elif len(s) <= 4:
        print("NO")
        exit()
    else:
        # 長さの処理しなくてもエラーにはならんっぽい
        if s[-7:] == "dreamer":
            s = s[:-7]
        elif s[-6:] == "eraser":
            s = s[:-6]
        elif s[-5:] == "dream" or s[-5:] == "erase":
            s = s[:-5]
        else:
            print("NO")
            break


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

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int x, y;
	cin >> x >> y;
	if ((y&1) || (y > 4*x) || (y < 2*x)) {
		cout << "No\n";
		return 0;
	}
	cout << "Yes\n";
	return 0;
}

Measured memory_bytes: 3580
#include<queue>
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N;
char F[511][511];
int col[511];

int main() {
    scanf("%d", &N);
    REP (i, N) scanf("%s", F[i]);

    int black = 0;
    REP (i, N) black += count(F[i], F[i] + N, '#');

    if (black == N*N) {
	puts("0");
	return 0;
    }
    if (black == 0) {
	puts("-1");
	return 0;
    }

    int vert = 0;
    REP (j, N) {
	int cnt = 0;
	REP (i, N) if (F[i][j] == '#') cnt++;
	if (cnt == N) {
	    vert++;
	    col[j] = 1;
	}
    }
    int ans = 2 * N;
    REP (i, N) REP (j, N) if (F[i][j] == '#') {
	int tmp = count(F[j], F[j] + N, '.') + N - vert;
	amin(ans, tmp);
    } else {
	int tmp = count(F[j], F[j] + N, '.') + N - vert + 1;
	tmp += col[j];
	amin(ans, tmp);
    }
    printf("%d\n", ans);

    return 0;
}



Measured memory_bytes: 512
N = gets.to_i
as = gets.split.map(&:to_i)
count_table = Hash.new { 0 }
as.each { |a| count_table[a] += 1 }
candidates = count_table.select { |_, c| c >= 2 }.sort_by { |(a, _)| -a }
if candidates.size >= 1 && candidates[0][1] >= 4
  puts candidates[0][0] ** 2
elsif candidates.size >= 2
  puts candidates[0][0] * candidates[1][0]
else
  puts 0
end


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

int main(void){
	int n,l;
	cin >> n >> l;
	vector<string> ary(n);
	rep(i,n) cin >> ary[i];
	sort(_all(ary));
	string ans="";
	rep(i,n) ans+=ary[i];
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
module.exports=function(r){var e={};function t(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return r[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=r,t.c=e,t.d=function(r,e,n){t.o(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:n})},t.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},t.t=function(r,e){if(1&e&&(r=t(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var o in r)t.d(n,o,function(e){return r[e]}.bind(null,o));return n},t.n=function(r){var e=r&&r.__esModule?function(){return r.default}:function(){return r};return t.d(e,"a",e),e},t.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},t.p="",t(t.s=0)}([function(r,e,t){t(1)(t(2).readFileSync("/dev/stdin","UTF-8"))},function(r,e){function t(r,e){return function(r){if(Array.isArray(r))return r}(r)||function(r,e){var t=[],n=!0,o=!1,u=void 0;try{for(var i,l=r[Symbol.iterator]();!(n=(i=l.next()).done)&&(t.push(i.value),!e||t.length!==e);n=!0);}catch(r){o=!0,u=r}finally{try{n||null==l.return||l.return()}finally{if(o)throw u}}return t}(r,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}r.exports=function(r){var e=r.split("\n"),n=t(e[0].split(" ").map(function(r){return Number(r)}),2),o=n[0],u=n[1],i=new Array(o).fill(1),l=new Array(o).fill(0);l[0]=1;for(var f=0;f<u;f++){var a=t(e[f+1].split(" ").map(function(r){return Number(r)-1}),2),c=a[0],p=a[1];i[c]-=1,i[p]+=1,1==l[c]?l[p]=1:1==i[p]&&(l[p]=0)}for(var d=0,s=0;s<o;s++)0!=l[s]&&i[s]>0&&(d+=1);console.log(d)}},function(r,e){r.exports=require("fs")}]);

Measured memory_bytes: 30708