akhauriyash/Code-Regression huggingface dataset:
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    ll D;
    cin >> D;

    vector<ll> c(26);
    ll sum_c = 0;
    rep(0, i, 26)
    {
        cin >> c.at(i);
        sum_c += c.at(i);
    }

    vector<vector<ll>> s(D, vector<ll>(26, 0));
    rep(0, i, D)
    {
        rep(0, j, 26)
        {
            cin >> s.at(i).at(j);
        }
    }

    ll score = 0, dec = 0; // i日目のスコア、スコアの減少量
    vector<vector<ll>> d(D + 1, vector<ll>(26, 0));
    vector<ll> t(D), ans(D);
    rep(0, i, D)
    {
        // 今日開くコンテスト
        ll today_i = 0;
        ll today_score = 0;
        // i日目に各コンテストを開催したと仮定して満足度を求める
        rep(0, j, 26)
        {
            ll sum = s.at(i).at(j);
            sum = sum - (dec + sum_c - (c.at(j) * (d.at(i).at(j)) + 1));
            if (today_score < sum)
            {
                today_i = j;
                today_score = sum;
            }
        }

        // ループが終了したら今日開くコンテストが決まるので、last(d,i)を更新する
        rep(0, j, 26)
        {
            d.at(i + 1).at(j) = d.at(i).at(j) + 1;
        }
        d.at(i + 1).at(today_i) = 0;

        /*
        rep(0, j, 26)
        {
            cout << d.at(i + 1).at(j) << ' ';
        }
        cout << endl;
        */

        // decの更新
        dec = 0;
        rep(0, j, 26)
        {
            dec += c.at(j) * d.at(i + 1).at(j);
        }
        /*
        cout << dec << endl;
        */

        // 答え
        t.at(i) = today_i + 1;
        ans.at(i) = score + today_score;
    }

    rep(0, i, D)
    {
        cout << t.at(i) << endl;
    }
}


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

using namespace std;
int a[200050],n,k;
bool check(int mid)
{
	int ans=0;
	for(int i=1;i<=n;i++)
	{
      if(a[i]>mid)
		 ans+=a[i]/mid;
		
	}
  if(ans>k) return 0;
	return 1;
}
int main()
{
	
	cin>>n>>k;
	int l=1,r=-1;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		r=max(a[i],r);
	}
	int ans=0;
	while(l<=r)
	{
		int mid=(l+r)/2;
		if(check(mid))
		{
			r=mid-1;
			ans=mid;
		}
		else l=mid+1;
	}
	cout<<ans;
	return 0;
} 


Measured memory_bytes: 4340
#include<iostream>
#include<string>
#include<cctype>

using namespace std;

string toUpper(string s){
    string t=s;
    for(int i=0;i<s.size();i++){
        t[i]=toupper(s[i]);
    }
    return t;
}
int main(){
    string target,source;
    cin>>target;
    target=toUpper(target);
    
    int cnt=0;
    
    while(1){
        cin>>source;
        if(source=="END_OF_TEXT")break;
            source=toUpper(source);
        if(target==source)cnt++;
    }
    cout<<cnt<<endl;
    
    return 0;
}


Measured memory_bytes: 3040
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
int f(int bigger, int smaller) {
    int ret = 2 * smaller * (bigger / smaller);
    int next_smaller = bigger % smaller;
    if (next_smaller == 0) return ret - smaller;
    return ret + f(smaller, next_smaller);
}

signed main() {
    int N, X;
    cin >> N >> X;
    int bigger = max(N - X, X);
    int smaller = min(N - X, X);
    cout << f(bigger, smaller) + N << endl;
    return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
p_cumsum = [0]
for p in map(int, input().split()):
  p_cumsum += [p_cumsum[-1]+p]
pk_max = 0
for i in range(k, n+1):
  pk_max = max(pk_max, p_cumsum[i]-p_cumsum[i-k])
print((pk_max+k)/2)

Measured memory_bytes: 24676
#include<iostream>
#include<string>

using namespace std;

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

int main(){

	string x,s;
	cin >> x;

	rep(i,x.size())
	rep(j,26)
	if(x[i]-65==j)
	s+=(j+23)%26+65;

	cout << s << endl;

    return 0;

}

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

int main(){
    int n,k;
    cin >> n >> k;
    int l[n];
    for(int i=0;i<n;i++){
        cin >> l[i];
    }
    sort(l,l+n,greater<int> ());
    int sam=0;
    for(int i=0;i<k;i++){
        sam += l[i];
    }
    cout << sam << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include <cmath>
#include <limits>

using namespace std;
#define int long  long int
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

signed main()
{
	int N;
	cin >> N;
	vector<pair<int, int>>A(N);
	for (int i = 0; i < N; i++)
	{
		cin >> A[i].first;
		A[i].second = i + 1;
	}
	sort(A.begin(), A.end());
	for (int i = 0; i < N; i++)
	{
		cout << A[i].second;
		if (i != N - 1)cout << " ";
	}
}

Measured memory_bytes: 2432
let f n = if n mod 2 = 0 then n/2 else 3 * n + 1
let rec g n lst cont =
  let m = f n in
  if List.mem m lst then cont+1 else g m (n :: lst) (cont+1)
let () =
  Scanf.scanf "%d\n" (fun s -> g s [] 1)
  |> print_int

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <cstring>



#define REP(i, n) for (long long i = 0; i < (n); i++) 
#define ll long long

using namespace std;

int main(){
    ll N,K;
    cin >> N >> K;
    ll res = 0;
    ll zerogoe = -1;

    vector <ll> x(N);

    REP(i,N)
    {
        cin >> x[i];
        if(x[i] >= 0)
        {
            zerogoe = i;
        }
    }
    REP(i,N)
    {
        if(x[i] >= 0)
        {
            zerogoe = i;
            break;
        }
    }

    ll j = 0;
    ll kaishi = 0;
    ll tmp, tmp_bai;
    ll iMin = 1000000000;

    //開始位置の調整
    if(zerogoe - 1 >= K)
    {  
        kaishi = zerogoe - 1 - K; 
    }

    for(j = kaishi; j < N; j++)
    {
        if(j + K - 1 > N - 1)break;
        if(x[j] >= 0)
        {
            //すべて正
            //K = 1のときはjとなる必要がある
            iMin = min(iMin, x[j + K - 1]);
            //これ以上はminの更新はない
            break;
        }
        else
        {
            //先頭は負
            //末尾も負か
            if(x[j+K-1] < 0)
            {
                iMin = min(iMin,abs(x[j]));
            }
            else
            {
                //大移動する
                if(abs(x[j]) > abs(x[j+K-1]))
                {
                    tmp = abs(x[j]) + 2*abs(x[j+K-1]);
                }
                else
                {
                    tmp = 2*abs(x[j]) + abs(x[j+K-1]);
                }
                iMin = min(iMin,tmp);
            }
        }
    }

    cout << iMin << endl;
}




Measured memory_bytes: 1024
n = gets.split.map(&:to_i).sort
ans = 0
m = n[2] - n[1]
ans += m
n[0] += m
if (n[2] - n[0]).odd?
  n[1] += 1
  n[2] += 1
  ans += 1
end
ans += (n[2] - n[0]) / 2
puts ans

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);

    int a=0;
    int b=0;
    int c=0;
    int d=0;

    int n;
    cin >> n;
    for (int i=0;i<=n-1;i++)
    {
        string s;
        cin >> s;
        if (s=="AC")
        {
            a++;
        }
        else if (s=="WA")
        {
            b++;
        }
        else if (s=="TLE")
        {
            c++;
        }
        else if (s=="RE")
        {
            d++;
        }
    }

    cout << "AC x " << a << endl;
    cout << "WA x " << b << endl;
    cout << "TLE x " << c << endl;
    cout << "RE x " << d << endl;
    return 0;
}

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

#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define lfs <<fixed<<setprecision(10)<<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = n; i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = n - 1; i >= (ll)(m); i--)
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>v,ll n){cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
template<typename T>
void emp(map<T,ll>&m, T x){m.emplace(x,0).first->second++;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

int main(){
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  ll res=0,res1=INF,res2=-INF,buf=0;
  bool judge = true;
  string s,t;cin>>s>>t;
  auto dp=vec(s.size()+1,t.size()+1,0LL);
  auto pre=vec(s.size()+1,t.size()+1,MP(-1LL,-1LL));
  rep(i,0,s.size())rep(j,0,t.size()){
    if(s[i]==t[j]){
      dp[i+1][j+1]=dp[i][j]+1;
      pre[i+1][j+1]=MP(i,j);
    }
    else if(dp[i][j+1]>dp[i+1][j]){
      dp[i+1][j+1]=dp[i][j+1];
      pre[i+1][j+1]=pre[i][j+1];
    }
    else{
      dp[i+1][j+1]=dp[i+1][j];
      pre[i+1][j+1]=pre[i+1][j];
    }
  }
  string ret;
  ll n=s.size(),m=t.size();
  ll x=n,y=m;
  while(x!=-1&&y!=-1){
    auto k=pre[x][y];
    x=k.fi;
    y=k.se;
    if(x!=-1&&y!=-1)ret.PB(s[x]);
  }
  reverse(ALL(ret));
  cout<<ret<<endl;
  return 0;
}

Measured memory_bytes: 211584
#include<algorithm>
#include<climits>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<utility>
#include<vector>
 
#define lint long long
#define REP(i, x, n) for(int i = x ; i < n ; i++)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> s(n);
    int ans = 0;
    rep(i, n){
        cin >> s[i];
        ans += s[i];
    }
    if(ans % 10 == 0){
        SORT(s);
        bool flag = true;
        rep(i, n){
            if(s[i] % 10 != 0){
                ans -= s[i];
                flag = false;
                break;
            }
        }
        if(flag){
            cout << 0 << endl;
        }else{
            cout << ans << endl;
        }
    }else{
        cout << ans << endl;
    }
    return 0;
}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

template<typename T>
constexpr T inf = static_cast<T>(pow(10, static_cast<int>(log10(numeric_limits<T>::max())))) + 7;
constexpr llong mod = 1e9+7;

int main() {
  map<string, int> m;
  m["Sunny"] = 0;
  m["Cloudy"] = 1;
  m["Rainy"] = 2;
  string s[3] = {"Sunny", "Cloudy", "Rainy"};

  string S;
  cin >> S;
  cout << s[(m[S] + 1) % 3] << endl;

  return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <unordered_map> 
#include <unordered_set>

using namespace std;

typedef pair<long long int, long long int> P;
typedef tuple<int, int, int> T;

long long int INF = 1e18;
long long int MOD = 998244353;

vector<P> factors[1100000];
long long int cnt[1100000];
long long int S[1100000];
long long int memo[1100000];
long long int rem[1000];

void func(int id, int num, int cur){
	if(id == factors[num].size()){
		if(cur != num){
			S[cur] += S[num];
		}
		memo[cur] = S[cur];
		return;
	}
	P p = factors[num][id];
	for(int i = 0; i <= p.second; i++){
		func(id + 1, num, cur);
		cur *= p.first;
	}
}

long long int func3(int id, int num, int cur){
	if(id == factors[num].size()){
		return memo[cur];
	}
	long long int ret = 0;
	for(int i = 0; i <= rem[id]; i++){
		ret += func3(id + 1, num, cur);
		cur *= factors[num][id].first;
	}
	return ret;
}

long long int func2(int id, int num, int cur){
	if(id == factors[num].size()){
		if(num == cur){
			return cnt[cur] * (cnt[cur] - 1) / 2 % MOD * num % MOD;
		}
		memo[cur] += memo[cur] - func3(0, num, cur);
		return memo[cur] / cur % MOD * memo[num] % MOD;
	}
	int lim = factors[num][id].second;
	for(int i = 0; i < lim; i++){
		cur *= factors[num][id].first;
	}
	long long int ret = 0;
	for(int i = 0; i <= lim; i++){
		rem[id] = i;
		ret += func2(id + 1, num, cur);
		cur /= factors[num][id].first;
	}
	return ret;
}

int main(){
	for(int i = 2; i <= 1000100; i++){
		if(factors[i].size() == 0){
			long long int num = i;
			for(int pNum = 1; num <= 1000100; pNum++){
				for(int j = num; j <= 1000100; j += num){
					if(pNum != 1){
						factors[j].pop_back();
					}
					factors[j].push_back(P(i, pNum));
				}
				num *= i;
			}
		}
	}
	int N;
	cin >> N;
	for(int i = 0; i < N; i++){
		int num;
		cin >> num;
		cnt[num] += 1;
	}
	long long int ans = 0;
	for(int i = 1; i <= 1000100; i++){
		S[i] = cnt[i] * i;
		if(S[i] > 0){
			func(0, i, 1);
			ans += func2(0, i, 1);
			ans %= MOD;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 122496
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(v) for (auto itr = v.begin(), itr != v.end(); ++itr)
#define LB(v, x) lower_bound(v.begin(), v.end(), x) - v.begin()
#define UB(v, x) upper_bound(v.begin(), v.end(), x) - v.begin()
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

    int N, M;
    cin >> N >> M;
    vector<int> A(M);
    REP(i, M) cin >> A[i];
    int res = N;
    REP(i, M) res -= A[i];
    if (res < 0) res = -1;
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 3660
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <stdio.h>
#include <string>

using namespace std;

void solve(int N, int M, vector<int> x) {
  if (N >= M) {
    printf("0\n");
  } else {
    int ans = 0;
    vector<int> xx(M - 1, 0);
    for (int i = 0; i < M - 1; i++) {
      xx[i] = x[i + 1] - x[i];
    }
    sort(xx.begin(), xx.end());
    for (int i = 0; i < max(0, M - N); i++) {
      ans += xx[i];
    }
    printf("%d\n", ans);
  }
}

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> x(M);
  for (int i = 0; i < M; i++) {
    cin >> x[i];
  }
  sort(x.begin(), x.end());
  solve(N, M, x);
  return 0;
}

Measured memory_bytes: 1408
import java.util.Scanner;
class Main {
    public static void main (String[] args) throws java.lang.Exception {
        Scanner sc = new Scanner(System.in);
        while(true) {
            int a = sc.nextInt();
            String op = sc.next();
            int b = sc.nextInt();
            if(op.equals("?")) break;
            if(op.equals("+")) System.out.println(a + b);
            if(op.equals("-")) System.out.println(a - b);
            if(op.equals("*")) System.out.println(a * b);
            if(op.equals("/")) System.out.println(a / b);
        }
    }
}



Measured memory_bytes: 26220
using System;
using System.Linq;

namespace H
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] b = Console.ReadLine().Split().Select(int.Parse).ToArray();
            long c = 0;
            for (int i = 0; i < x[0]; i++) c += a[i];
            long d = 0;
            for (int i = 0; i < x[1]; i++) d += b[i];
            Console.WriteLine(c * d);
        }
    }
}


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


int main(){
  int i,s;
  int count[4] = {0,0,0,0};
  
  string S;
  cin >> S;
  
  for(i=0; i<4; i++){
    for(s=0; s<4; s++){
      if(S[i] == S[s])
        count[i]++;
    }
  }
  
  if(count[0] == 2 && count[1] == 2 && count[2] == 2 && count[3] == 2)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


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

long long n, t, a, b;
map<long long, long long> m;
priority_queue<long long, vector<long long>, greater<long long> > pq;
int main(){
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> t;
		if(m.count(t) == 0) m[t] = 1;
		else m[t]++;
	}
	for(map<long long, long long>::reverse_iterator it = m.rbegin(); it != m.rend(); it++){
		if(it->second >= 4){
			pq.push(it->first);
			pq.push(it->first);
		} else if(it -> second >= 2) pq.push(it->first);
		while(pq.size() > 2) pq.pop();
	}
	if(pq.size() < 2){
		cout << 0;
		return 0;
	}
	a = pq.top(); pq.pop();
	b = pq.top(); pq.pop();
	cout << a*b;
}


Measured memory_bytes: 6528
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
#define MOD 924844033
#define ll long long
#define MAX 888888
inline int read()
{
	int x=0;bool t=false;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if(ch=='-')t=true,ch=getchar();
	while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();
	return t?-x:x;
}
struct Line{int v,next;}e[MAX];
int h[MAX],cnt=1;
inline void Add(int u,int v){e[cnt]=(Line){v,h[u]};h[u]=cnt++;}
int n,f[MAX],g[MAX],size[MAX];
int jc[MAX],jv[MAX],inv[MAX];
void dfs(int u,int ff)
{
	size[u]=1;
	for(int i=h[u];i;i=e[i].next)
	{
		int v=e[i].v;if(v==ff)continue;
		dfs(v,u);size[u]+=size[v];
		++f[size[v]];
	}
	++f[n-size[u]];
}
int C(int n,int m){if(m>n)return 0;return 1ll*jc[n]*jv[m]%MOD*jv[n-m]%MOD;}
int N,l,r[MAX],W[MAX];
int fpow(int a,int b)
{
	int s=1;
	while(b){if(b&1)s=1ll*s*a%MOD;a=1ll*a*a%MOD;b>>=1;}
	return s;
}
void NTT(int *P,int opt)
{
	for(int i=1;i<N;++i)if(i>r[i])swap(P[i],P[r[i]]);
	for(int i=1;i<N;i<<=1)
	{
		int w=fpow(5,(MOD-1)/(i<<1));W[0]=1;
		for(int k=1;k<i;++k)W[k]=1ll*W[k-1]*w%MOD;
		for(int p=i<<1,j=0;j<N;j+=p)
			for(int k=0;k<i;++k)
			{
				int X=P[j+k],Y=1ll*P[i+j+k]*W[k]%MOD;
				P[j+k]=(X+Y)%MOD;P[i+j+k]=(X+MOD-Y)%MOD;
			}
	}
	if(opt==-1)
	{
		reverse(&P[1],&P[N]);
		for(int i=0,inv=fpow(N,MOD-2);i<N;++i)P[i]=1ll*P[i]*inv%MOD;
	}
}
int main()
{
	n=read();
	for(int i=1;i<n;++i)
	{
		int u=read(),v=read();
		Add(u,v);Add(v,u);
	}
	dfs(1,0);
	jc[0]=jv[0]=inv[0]=inv[1]=1;
	for(int i=1;i<=n;++i)jc[i]=1ll*jc[i-1]*i%MOD;
	for(int i=2;i<=n;++i)inv[i]=1ll*inv[MOD%i]*(MOD-MOD/i)%MOD;
	for(int i=1;i<=n;++i)jv[i]=1ll*jv[i-1]*inv[i]%MOD;
	for(N=1;N<n+n;N<<=1)++l;
	for(int i=0;i<N;++i)r[i]=(r[i>>1]>>1)|((i&1)<<(l-1));
	for(int i=0;i<=n;++i)f[i]=1ll*f[i]*jc[i]%MOD;
	for(int i=0;i<=n;++i)g[i]=jv[n-i];
	NTT(f,1);NTT(g,1);
	for(int i=0;i<N;++i)f[i]=1ll*f[i]*g[i]%MOD;
	NTT(f,-1);
	for(int i=1;i<=n;++i)f[i]=1ll*f[i+n]*jv[i]%MOD;
	for(int i=1;i<=n;++i)f[i]=(1ll*n*C(n,i)%MOD+MOD-f[i])%MOD;
	for(int i=1;i<=n;++i)printf("%d\n",f[i]);
	return 0;
}


Measured memory_bytes: 37760
#include<iostream>
#include<string>
#include <algorithm>
using namespace std;
int main()
{
  int a, b;
  cin >> a >> b;
  int v=0;
  for(int i=0; i < (b-a); ++i){
    v += i;
  }
  cout << v-a << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
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;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL<<60;
int main( ){
    ll k;
    cin>>k;
    ll res=0;
    rep(i,1,k+1){
        rep(j,1,k+1){
            rep(l,1,k+1){
                res+=gcd(i,gcd(j,l));
            }
        }
    }
    cout<<res<<endl;
    return 0;
}




Measured memory_bytes: 3676
#include <stdio.h>

int check (int year) {
    int ret;
    if (year % 400 == 0) {
        ret = 1; 
    } else if (year % 100 == 0) {
        ret = 0; 
    } else if (year % 4 == 0) {
        ret = 1; 
    } else {
        ret = 0; 
    }
    return ret;
}

int main(void) {
    int start = 0;
    while (1) {
        int a;
        int b;
        scanf("%d %d", &a, &b);

        if (a == 0 && b == 0) {
            break;
        } else if (start) {
            printf("\n");
        }
        int exist = 0;
        int i;
        for (i = a; i <= b; i++) {
            if (check(i) == 1) {
                printf("%d\n", i);
                exist = 1;
            }
        }
        if (exist == 0) {
            printf("NA\n", i);
        }
        start = 1;
    }
    return 0;
}

Measured memory_bytes: 1796
#include<iostream>
#include<algorithm>

using namespace std;

int main(void) {
	string s, t;
	cin >> s >> t;
	sort(s.begin(), s.end());
	sort(t.begin(), t.end());
	reverse(t.begin(), t.end());
	//第一引数 < 第二引数 なら　マイナス
	//第一引数 > 第二引数 なら　プラス
	if (strcmp(s.c_str(), t.c_str()) < 0) {
		printf("Yes");
	}
	else {
		printf("No");
	}
}

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

int n,m,k,mod,f[110][110][110],g[110][110][110],mi[110][10010],h[110][110][110],jc[110],inv[110];

int quickmi(int a,int b)
{
	int t=1;
	for (; b; b>>=1,a=1ll*a*a%mod)
		if (b&1) t=1ll*t*a%mod;
	return t;
}

int main()
{
	scanf("%d%d%d%d",&n,&m,&k,&mod),jc[0]=1;
	for (int i=1; i<=100; i++) jc[i]=1ll*jc[i-1]*i%mod;
	inv[100]=quickmi(jc[100],mod-2);
	for (int i=100; i; i--) inv[i-1]=1ll*inv[i]*i%mod;
	for (int i=0; i<=k; i++)
	{
		mi[i][0]=1;
		for (int j=1; j<=n*m; j++) mi[i][j]=1ll*mi[i][j-1]*i%mod;
	}
	for (int i=1; i<=k; i++)
	{
		h[i][1][0]=0,h[i][0][0]=1;
		for (int j=1; j<=100; j++) h[i][0][j]=1,h[i][1][j]=(mi[i][j]-mi[i-1][j]+mod)%mod;
		for (int j=2; j<=100; j++)
		{
			h[i][j][0]=0;
			for (int k=1; k<=100; k++) h[i][j][k]=1ll*h[i][j-1][k]*h[i][1][k]%mod;
		}
	}
	g[0][0][0]=1ll*jc[n]*jc[m]%mod;
	for (int i=1; i<=k; i++)
	{
		for (int j=0; j<=n; j++)
			for (int l=0; l<=m; l++) if (g[i-1][j][l])
				for (int o=j; o<=n; o++) 
					f[i][o][l]=(f[i][o][l]+1ll*g[i-1][j][l]*mi[k-i+1][l*(o-j)]%mod*h[i][o-j][m-l]%mod*inv[o-j])%mod;
		for (int j=0; j<=n; j++)
			for (int l=0; l<=m; l++) if (f[i][j][l])
				for (int o=l; o<=m; o++) 
					g[i][j][o]=(g[i][j][o]+1ll*f[i][j][l]*mi[i][(o-l)*(n-j)]%mod*h[k-i+1][o-l][j]%mod*inv[o-l])%mod;
	}
	return printf("%d\n",g[k][n][m]),0;
}

Measured memory_bytes: 19712
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;

int main(){
    int a, b;
    cin >> a >> b;
    if(1<=a && a<=9 && 1<=b && b<=9){
        cout << a*b << endl;
    }
    else cout << -1 << endl;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll N = 1e9+7;
const int n_max = 1e5+10;

int main(){
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n)cin >> a[i];
    multiset<int> st;
    rep(i,n){
        bool ok = false;
        if(!i){
            st.insert(a[i]);
            continue;
        }
        auto st_min = st.begin();
        auto temp = st.lower_bound(a[i]);
        auto st_max = st.end();st_max--;
        if(st_min != temp)temp--;
        else{
            st.insert(a[i]);
            continue;
        }
        st.erase(temp);
        st.insert(a[i]);
    }
    cout << st.size() << endl;
    return 0;
}

Measured memory_bytes: 5376
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    // 整数の入力
    int N = sc.nextInt();
    int M = sc.nextInt();

    List<Integer> aiList = new ArrayList<>();
    for (int i = 0; i < N; i++) {
      aiList.add(sc.nextInt());
    }

    int sum = aiList.stream().mapToInt(i -> i).sum();
    long count = aiList.stream().filter(i -> i >= (double) sum / (4 * M)).count();

    // 出力
    System.out.println(count >= M ? "Yes" : "No");
  }
}


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

string s;

int main()
{
	cin>>s;
	int ans = 1000;
	for(int i = 0; i < s.size() - 2; i++)
	{
		int val = (s[i] - '0')*100 + (s[i + 1] - '0')*10 + (s[i + 2] - '0');
		if(abs(val - 753) < ans) ans = abs(val - 753);
	}
	cout<<ans<<'\n';
}


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

#define rep(i,a) for(int i = 0;i < (a); i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)
#define repd(i,a,b) for(int i = (a); i >= (b); i--)
#define repit(i,a) for(__typeof((a).begin()) i = (a).begin(); i != (a).end(); i++)
#define all(u) (u).begin(),(u).end()
#define rall(u) (u).rbegin(),(u).rend()
#define UNIQUE(u) (u).erase(unique(all(u)),(u).end())
#define pb push_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
#define PI acos(-1.0)

using namespace std;

typedef long long ll;
typedef vector<int> vi;

int h, w, c, p[16][16];

bool in(int x, int y) { return 0 <= x && x < w && 0 <= y && y < h; }

int ans, op[8], q[16][16];
bool ved[16][16];

void shock(int x, int y, int c, int nc)
{
    if (!in(x, y) || q[y][x] != c || ved[y][x]) return;
    q[y][x] = nc;
    ved[y][x] = true;

    const int dx[] = {1, 0, -1, 0};
    const int dy[] = {0, 1, 0, -1};
    rep(i, 4)
	shock(x + dx[i], y + dy[i], c, nc);
}

int cnt;

void ponyo(int x, int y, int c)
{
    if (!in(x, y) || q[y][x] != c || ved[y][x]) return;
    ved[y][x] = true;
    ++cnt;

    const int dx[] = {1, 0, -1, 0};
    const int dy[] = {0, 1, 0, -1};
    rep(i, 4)
	ponyo(x + dx[i], y + dy[i], c);
}

void attempt()
{
    rep(y, h) rep(x, w) q[y][x] = p[y][x];
    rep(i, 5) {
	memset(ved, 0, sizeof(ved));
	shock(0, 0, q[0][0], op[i]);
    }

    memset(ved, 0, sizeof(ved));
    cnt = 0;
    ponyo(0, 0, c);
    ans = max(ans, cnt);
}

void dfs(int d, int prev)
{
    if (d == 5) {
	attempt();
	return;
    }
    for (int i = 1; i <= 6; ++i) {
	op[d] = i;
	dfs(d + 1, i);
    }
}

int solve()
{
    ans = 0;
    dfs(0, 0);
    return ans;
}

int main() {
    while (cin >> h >> w >> c && h) {
	rep(y, h) rep(x, w) cin >> p[y][x];
	op[4] = c;

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

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) noexcept {
  return std::vector<T>(n, std::forward<T>(val));
}

template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) noexcept {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}

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


Measured memory_bytes: 764
import sys

n, m = map(int, input().split())
INF = 10 ** 9
dp = [INF] * (1 << n)
dp[0] = 0
bits = [0] + [1 << i for i in range(n)]
get_bits = bits.__getitem__

for _ in [0] * m:
  a, b = map(int, sys.stdin.readline().split())
  s = sum(map(get_bits, map(int, sys.stdin.readline().split())))
  for t in range(1 << n):
    if (dp[t] == -1):
      continue
    dp[t | s] = min(dp[t | s], dp[t] + a)

print(dp[-1] if dp[-1] != INF else -1)


Measured memory_bytes: 42476
#include <iostream>
#include <string>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int m = (s[5] - '0') * 10 + s[6] - '0';
  if (m <= 4) {
    cout << "Heisei" << endl;
  } else {
    cout << "TBD" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
using namespace std;
#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,X,n) for(int i=(X);i<(n);i++)
#define EREP(i,n) for(int i=1;i<=(n);i++)
#define Endl endl
/*
long long int gcd(long long int a,long long int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
*/
int main(){
	long long int n,m,ans,e=1,last=2,count=0;
	cin>>n>>m;
	for(long long int i=1;n<=m;i++){
		n*=2;
		ans=i;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define PRECISION std::cout << std::fixed << std::setprecision(20);
  
using namespace std;
 
const ll inf = 1e17;
const ll N = 1e2+20;
const ll bits = 30;
const ll mod = 1e9+7;


int main(){

ll a,b,c;
cin>>a>>b>>c;

if(a+b+c>=22) cout<<"bust\n";
else cout<<"win\n";


}

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

ll n,t,a[100005],m,M,d,rez;
unordered_set<ll> s;

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

    cin>>n>>t;
    t-=(t%2==1);
    for(ll i=0;i<n;i++)
        cin>>a[i];

    m=a[0];
    M=a[0];
    for(ll i=1;i<n;i++)
    {
        if(a[i]>M)
        {
            M=a[i];
            if(d<M-m)
                d=M-m;
        }
        if(a[i]<m)
        {
            m=a[i];
            M=a[i];
        }
    }

    for(ll i=0;i<n;i++)
    {
        if(s.count(a[i]-d))
            rez++;
        s.insert(a[i]);
    }

    cout<<rez<<endl;

    return 0;
}


Measured memory_bytes: 8092
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <unordered_map>
#include <cmath>
using namespace std;

typedef unsigned int uint;
typedef long long llong;
typedef unsigned long long ullong;
// -2.1e-9 <= int <= 2.1e9
// -9.2e-18 <= long long <= 9.2e18
// 0 <= unsigned int <= 4.2e9
// 0 <= unsigned long long <= 18.4e18

const double PI=3.1415926535897932;
int main()
{
    int R;
    cin >> R;
    double ans = 2.0 * PI * R;
    cout << fixed << setprecision(14);
    cout << ans << endl;
}


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

using namespace std;

using ll = long long;

int main()
{
    ll N;
    string S, T;
    cin >> N >> S >> T;
    for(int i = 0; i < N; ++i){
        cout << S[i] << T[i];
    }
    cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int x[100005],a[100005],d[100005],inv[100005],p[100005],tmp[100005],ans[100005],fd[100005];
int main()
{
	int n,m;
	long long k;
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&x[i]);
		d[i]=x[i]-x[i-1];
		inv[i]=i;
		ans[i]=i;
	}
	scanf("%d%lld",&m,&k);
	for (int i=0;i<m;i++)
	{
		scanf("%d",&a[i]);
		swap(inv[a[i]],inv[a[i]+1]);
	}
	for (int i=1;i<=n;i++)
	p[inv[i]]=i;
	while (k)
	{
		if (k%2)
		{
			for (int i=1;i<=n;i++)
			ans[i]=p[ans[i]];
		}
		for (int i=1;i<=n;i++)
		tmp[i]=p[p[i]];
		for (int i=1;i<=n;i++)
		p[i]=tmp[i];
		k/=2;
	}
	for (int i=1;i<=n;i++)
	fd[ans[i]]=d[i];
	long long sum=0;
	for (int i=1;i<=n;i++)
	{
		sum+=fd[i];
		printf("%lld\n",sum);
	}
}

Measured memory_bytes: 6880
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(sys.stdin.readline())
def ria(): return list(map(int, sys.stdin.readline().split()))
def ws(s): sys.stdout.write(s); sys.stdout.write('\n')
def wi(n): sys.stdout.write(str(n)); sys.stdout.write('\n')
def wia(a, sep=' '): sys.stdout.write(sep.join([str(x) for x in a])); sys.stdout.write('\n')


def solve(n):
    k = n // 1000
    if n % 1000 > 0:
        k += 1
    return k * 1000 - n


def main():
    n = ri()
    wi(solve(n))


if __name__ == '__main__':
    main()


Measured memory_bytes: 61820
import kotlin.math.*

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() // single long
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map(String::toInt) // list of ints
private fun readLongs() = readStrings().map(String::toLong) // list of longs

fun main() {
    val (s, w) = readInts()

    println(if (w >= s) "unsafe" else "safe")
}


Measured memory_bytes: 36428
#include <stdio.h>

int main(void){
    char s[11],t[12];
    scanf("%s",&s);
    scanf("%s",&t);

    for (int i=0; s[i]!='\0'; i++){
        if (s[i]!=t[i]){
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;
}


Measured memory_bytes: 1612
import java.io.*;
public class Main{
	public static void main(String [] args) throws NumberFormatException, IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int t=0;
		for(int i=1;0!=(t=Integer.parseInt(br.readLine()));i++){
			System.out.println("Case "+i+": "+t);
		}}}

Measured memory_bytes: 27168
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		
		StringBuilder s = new StringBuilder();
		s.append(br.readLine());
		System.out.println(new Problem(s).solve());
		
		
		br.close();
	}
	
}
class Problem{
	StringBuilder s;
	
	public Problem(StringBuilder s) {
		this.s = s;
	}
	public String solve() {
		String result="No";
		
		if (s.toString().contains("a")
				&& s.toString().contains("b")
				&& s.toString().contains("c")) {
			result="Yes";
		}	
		return result;
	}
}


Measured memory_bytes: 21204
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
  
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
 
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
	return r;
}


void get(char &x){
	if(x == '1') x = '0';
	else x = '1';
}
ll cur[N], ans[N];

void solve()
{
	double n;
	cin >> n;
	cout << fixed << setprecision(10) << acos(-1.0) * n * 2; 
}



 
 
int main()
{
    Red;
  	// int T; cin >> T; while(T--)
    solve();
    return 0;

}

Measured memory_bytes: 3780
using System;
using System.Collections.Generic;
using System.Linq;
namespace ABC154C
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            HashSet<int> dic = new HashSet<int>();
            string res = "YES";
            foreach (var item in a)
            {
                if (!dic.Add(item))
                {
                    res = "NO";
                    break;
                }
            }
            Console.WriteLine(res);
        }
    }
}


Measured memory_bytes: 34908
def main():
  N,M = map(int, input().split())
  A = list(map(int, input().split()))
  A = sorted(A,reverse=True)

  counter = 0

  for i in range(M):
    if A[i]*4*M >= sum(A):
      counter+=1
    else:
      pass

  if counter == M:
    print('Yes')
  else:
    print('No')


if __name__ == "__main__":
  main()

Measured memory_bytes: 3060
function Main(input){
	inputs = input.trim().split(' ');
	nums = inputs.map(inputs=>parseInt(inputs,10));
    a = nums[0]+(nums[0]-1);
    b = nums[1]+(nums[1]-1);
    c = nums[0]+(nums[1]);
	console.log(Math.max(a, b, c));
}
 
Main(require("fs").readFileSync("/dev/stdin","utf8"));

Measured memory_bytes: 7372
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <cmath>
 
#define rep(i,n) for(int i = 0;i < (n);i++)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)

using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<int, int> > vpi;
typedef vector<pair<ll, ll> > vpl;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  int ans = 1;
  rep(i, n){
    if(ans > k) ans += k;
    else ans *= 2;
  }
  cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    string S; cin >> S;
    vector<string> V = {
        "dreamer",
        "eraser",
        "dream",
        "erase"};
    
    reverse(begin(S), end(S));
    rep(i,V.size()) reverse(begin(V[i]), end(V[i]));
    int cur = 0;
    int pos = 0;
    while (1) {
       if (S.find(V[cur], pos) == pos) {
           pos += V[cur].size();
           if (pos == S.size()) {
               cout << "YES" << endl;
               return 0;
           }
           cur = 0;
           continue;
       } 
        if (++cur < V.size()) continue;
        cout << "NO" << endl;
        return 0;
    }
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
int main(void)
{
    int a,b,c;
    cin>>a>>b>>c;
    multiset < string > s;
    for (int i = 0;i < a;++i)
        s.insert("a");
    for (int i = 0;i < b;++i)
        s.insert("b");
    for (int i = 0;i < c;++i)
        s.insert("c");
    while (s.size() > 1)
    {
        string str = *s.begin();
        str += *s.rbegin();
        s.erase(s.begin());
        auto it = s.end();--it;
        s.erase(it);
        s.insert(str);
    }
    cout << (*s.begin()) << '\n';
    return 0;
}


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

int main(){
    string S;
    vector<int> ans;
    cin >> S;

    int l = 0, r = 0;
    for (int i = 0; i < S.length(); ++i){
        if (S[i] == 'R'){
            r++;
        }else{
            l++;
            if(i == S.length() - 1 || S[i+1] == 'R'){
                for (int j = 0; j < r-1; ++j) ans.push_back(0);
                if (abs(l-r) % 2 == 0){
                    int k = (l + r)/2;
                    ans.push_back(k);
                    ans.push_back(k);
                }else{
                	if (r % 2 == 1){
	                    ans.push_back((r+l)/2+1);
	                    ans.push_back((r+l)/2);
                	}else{
	                    ans.push_back((r+l)/2);
	                    ans.push_back((r+l)/2+1);
                	}
                }
                for (int j = 0; j < l-1; ++j) ans.push_back(0);
                l = 0; r = 0;
            }
        }
    }
    for (auto a : ans){
	    cout << a << " ";
    }cout << endl;
    return 0;
}

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

#define li long long int
#define rep(i, to) for (li i = 0; i < ((li)(to)); i++)
#define MOD 1000000007
typedef pair<li, li> PI;

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

	li res = n - 1;
	for (li i = 2; i <= min(1000000ll, n); ++i) {
		if (n % i == 0) {
			res = min(res, i - 1 + (n / i) - 1);
		}
	}
	cout << res << endl;
	return 0;
}

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

N, M = map(int, input().split())
a = [0]*M
mod = 10**9+7

for i in range(M):
    a[i] = int(input())

a = set(a)
DP = [0]*(N+1)
DP[0] = 1
if 1 in a:
    DP[1] = 0
else:
    DP[1] = 1

for i in range(2, N+1):
    if(i not in a):
        DP[i] = (DP[i-1]+DP[i-2])%mod
        
print(DP[-1])

Measured memory_bytes: 13164
#include <iostream>
#include <vector>
typedef long long ll;
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<ll> h(n);
    bool flag = true;
    for (int i = 0; i < n; i++)
    {
        cin >> h[i];
    }

    for (int i = 0; i < n - 1; i++)
    {
        if (h[i] < h[i + 1])
        {
            h[i + 1] = h[i + 1] - 1;
        }
        else if (h[i] == h[i + 1])
        {
            ;
        }
        else
        {
            flag = false;
            break;
        }
    }

    if (flag)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 1024
A, B, C, D, E, F = map(int, input().split())
W = set()
S = set()
wtr = 100*A
sgr = 0

i = 1
j = 0
while(wtr <= F):
  while(wtr <= F):
    W.add(wtr)
    wtr = i*A*100 + j*B*100
    j +=1
  i +=1
  j = 0
  wtr = i*A*100 + j*B*100
  
i = 0
j = 0
while(sgr <= F):
  while(sgr <= F):
    S.add(sgr)
    sgr = i*C + j*D
    j +=1
  i +=1
  j = 0
  sgr = i*C + j*D
answtr = 100*A
anssgr = 0
  
for wtr in W:
  for sgr in S:
    if (sgr*(answtr+anssgr) > anssgr*(wtr+sgr)) and (sgr*(100+E)<=E*(wtr+sgr) and (wtr+sgr<=F)):
      answtr = wtr
      anssgr = sgr
      if anssgr*(100+E)==E*(answtr+anssgr):
        print("{} {}".format(answtr+anssgr, anssgr))
        exit()
print("{} {}".format(answtr+anssgr, anssgr))

Measured memory_bytes: 3188
import java.io.*;
import java.util.StringTokenizer;

class Main {
    public static void main(String args[]) {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	try {
	    int n = Integer.parseInt(br.readLine());
	    for (int i=0;i<n;i++) {
		Double x[] = new Double[4];
		Double y[] = new Double[4];
		StringTokenizer st = new StringTokenizer(br.readLine());
		for (int j=0;j<4;j++) {
		    x[j] = Double.parseDouble(st.nextToken());
		    y[j] = Double.parseDouble(st.nextToken());
		}
		Double vx[] = new Double[2];
		Double vy[] = new Double[2];
		vx[0] = x[1]-x[0];
		vx[1] = x[3]-x[2];
		vy[0] = y[1]-y[0];
		vy[1] = y[3]-y[2];
		if (parallelism(vx[0],vy[0],vx[1],vy[1])) System.out.println("YES");
		else System.out.println("NO");
	    }
	} catch (Exception e) {
	    e.printStackTrace();
	}
    }

    public static boolean parallelism(Double x1,Double y1,Double x2,Double y2) {
        if (Math.abs(Math.round(Math.pow(100000,2)*(x1*y2-x2*y1)))==0.0) return true;
	else return false;
    }
}

Measured memory_bytes: 17000
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
int dp[1 << 15][15];
int cnt[1 << 15];
int m[15][15];
int main()
{
	int num, way;
	scanf("%d%d", &num, &way);
	int sum = 0;
	for (int i = 0; i < way; i++)
	{
		int za, zb, zc;
		scanf("%d%d%d", &za, &zb, &zc);
		za--, zb--;
		m[za][zb] = m[zb][za] = zc;
		sum += zc;
	}
	for (int p = 0; p < (1 << num); p++)
	{
		for (int i = 0; i < num; i++)
		{
			for (int j = i + 1; j < num; j++)
			{
				if ((p&(1 << i)) != 0 && (p&(1 << j)) != 0)cnt[p] += m[i][j];
			}
		}
	}
	for (int i = 0; i < (1 << num); i++)for (int j = 0; j < num; j++)dp[i][j] = -1000000000;
	for (int p = 0; p < (1 << num); p++)if (p & 1)dp[p][0] = cnt[p];
	for (int p = 0; p < (1 << num); p++)
	{
		for (int i = 0; i < num; i++)
		{
			if ((p&(1 << i)) == 0)continue;
			for (int j = 0; j < num; j++)
			{
				if (p&(1 << j))continue;
				if (m[i][j] == 0)continue;
				int mask = (1 << num) - 1 - p - (1 << j);
				int now = mask;
				for (;;)
				{
					dp[p | now | (1 << j)][j] = max(dp[p | now | (1 << j)][j], dp[p][i] + m[i][j] + cnt[now | (1 << j)]);
					if (now == 0)break;
					now--;
					now &= mask;
				}
			}
		}
	}
	printf("%d\n", sum - dp[(1 << num) - 1][num - 1]);
}

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

int main(int argc, char const *argv[])
{
	int n, d, a; cin >> n >> d >> a;
	vector<pair<int, int>> v(n);
	rep(i, n) {
		int x, h; cin >> x >> h;
		v[i] = make_pair(x, h);
	}
	sort(v.begin(), v.end());

	ll ans = 0;
	ll sum = 0;
	queue<pair<ll, ll>> que; // <x, damage>
	rep(i, n) {
		ll x = v[i].first, h = v[i].second;
		while(not que.empty() and que.front().first < x) {
			sum -= que.front().second;
			que.pop();
		}
		h -= sum;
		if (h <= 0) continue;
		int time = (h + a - 1) / a;
		ans += time;
		sum += a * time;
		que.push(make_pair(x + 2 * d, a * time));
	}

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


Measured memory_bytes: 3456