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

const int cycle_a = 12 * 60;
const int cycle_b = 60;


int main() {
  int a, b, h, m;
  cin >> a >> b >> h >> m;
  double angle_a = ((double) (h*60+m) / cycle_a) * 360;
  double angle_b = ((double) m / cycle_b) * 360;
  double angle = angle_b - angle_a;
  double c2 = a*a + b*b - 2*a*b*cos(M_PI / 180 * angle);
  double c = sqrt(c2);
  printf("%.20f\n", c);
}


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll N;
    cin >> N;

    vector<ll> A(N);
    vector<ll> B(N);

    REP(i, N){
        cin >> A[i] >> B[i];
    }

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());

    if(N%2 == 1){
        cout << B[N/2] - A[N/2] + 1 << endl;
        return 0;
    }
    else{
        double a=0;
        double b=0;

        a = (double(A[N/2])+double(A[N/2-1]))/2;
        b = (double(B[N/2])+double(B[N/2-1]))/2;   

        // cout << a << " " << b << endl;
        cout << ll((b-a)*2) + 1 << endl;
        
        // cout << a << endl;
        // cout << b << endl;
        // cout << c << endl;

        // cout << a+b-c << endl;
    }
    return 0;
}

Measured memory_bytes: 6372
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;

main() {
    int64_t n, w;
    cin >> n >> w;

    // weight, value
    vector<pair<int64_t, int64_t>> items(n);
    for (auto&& ii : items) {
        cin >> ii.first >> ii.second;
    }

    constexpr auto MAX_VALUE = 100000L;
    vector<int64_t> ans(MAX_VALUE + 1, 2L << 40);
    ans[0] = 0;
    for (const auto& item : items) {
        auto weight = item.first;
        auto value = item.second;

        for (auto v : irange(MAX_VALUE, -1L, -1L)) {
            auto current_weight = ans[v];

            auto next_weight = current_weight + weight;
            if (next_weight > w) {
                continue;
            }

            auto next_value = v + value;
            ans[next_value] = min(ans[next_value], next_weight);
        }
    }

    for (auto v : irange(MAX_VALUE, -1L, -1L)) {
        if (ans[v] <= w) {
            cout << v << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
template <typename T> bool chmax(T &u, const T z) { if (u < z) {u = z; return true;} else return false; }
template <typename T> bool chmin(T &u, const T z) { if (u > z) {u = z; return true;} else return false; }
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define ll long long
typedef pair<ll, ll> P;
const ll INF = 1LL << 60;
//const int MOD = 1000000007;
const ll MOD=998244353;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

int main(){
  string s;
  cin>>s;
  int n=s.size();
  rep(i,n-1){
    string t=s.substr(i,2);
    if(t=="AC"){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 3624
from collections import deque, Counter


N, X, Y = map(int, input().split())

edge = [[] for _ in range(N)]
for i in range(1, N - 1):
    edge[i].append(i + 1)
    edge[i].append(i - 1)
edge[0].append(1)
edge[N - 1].append(N - 2)
edge[X - 1].append(Y - 1)
edge[Y - 1].append(X - 1)


C = Counter()
for i in range(N):
    path = [float('inf')] * N
    path[i] = 0
    q = deque()
    q.append((i, 0))
    while q:
        p, step = q.popleft()
        for np in edge[p]:
            if path[np] > step + 1:
                q.append((np, step + 1))
                path[np] = step + 1
    for j in range(i + 1, N):
        C[path[j]] += 1

for i in range(1, N):
    print(C[i])


Measured memory_bytes: 55772
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  string s;
  cin >> s;
  int n = sz(s);
  ll x = 0;
  rep(i,n){
    x+=s[i]-'0';
  }
  if(x%9)cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
  return 0;
}

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

using namespace std;

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

    int x, n;
    cin >> x >> n;
    vector<int> p(n);
    vector<bool> used(102);
    for(int i = 0; i < n; i++)
    {
        cin >> p[i];
        used[p[i]] = true;
    }
    int ans = INT_MAX;
    for(int i = 0; i <= 101; i++)
    {
        if(!used[i])
        {
            if(abs(i - x) < abs(ans - x))
                ans = i;
        }
    }
    cout << ans;

    return 0;
}


Measured memory_bytes: 3652
n,s=map(int,input().split())
t=[0]*(s+1)
m=998244353
a=list(map(int,input().split()))
ans=0
for i in range(n):
    d=t.copy()
    if a[i]<=s:
        for j in range(a[i],s+1):
            t[j]+=d[j-a[i]]
        t[a[i]]+=i+1
    ans+=t[-1]
    ans%=m
print(int(ans))

Measured memory_bytes: 3808
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <string>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#include <cassert>
using namespace std;
#define len(n) (int)n.length()
#define pb push_back
#define ll long long
#define make_pair mkp
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define ALL(v) (v).begin(), (v).end()
#define dbg(n) cerr << "//" << #n << ":" << n <<endl
typedef pair<ll, ll> LLARR;
#define INF 999999999

int w[100003];
int n,k;

ll check(ll p)
{
	ll ret = 0;
	ll tmp = 0;
	ll i = 0;
	REP(j, k)
	{
		ll s = 0;
		while (s + w[i] <= p)
		{
			s += w[i];
			i++;
			if (i == n)
				return n;
		}
	}
	return i;
}

int main()
{
	ios::sync_with_stdio(false);

	cin >> n >> k;
	REP(i, n)
	{
		cin >> w[i];
	}

	ll ma = 10000 * 100000;
	ll l = 0;
	ll r = ma;
	ll mid = 0;
	while (l + 1 < r)
	{
		mid = (l + r) / 2;
		if (check(mid) >= n)
		{
			r = mid;
		}
		else
		{
			l = mid;
		}
	}
	cout << r << endl;
	return 0;
}

Measured memory_bytes: 3536
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

#define INF 1e9
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

ll N,M,ans=0;
vll A, S;
map<ll, ll> cnt;

void solve(){
    S.resize(N+1,0);
    rep(i,N)
        S[i+1] = S[i] + A[i];

    rep(i,N+1)
        S[i] %= M;

    rep(i,N+1)
        cnt[S[i]]++;

    for(auto itr=cnt.begin(); itr!=cnt.end(); itr++)
        ans += itr->second * (itr->second -1) / 2;

    cout << ans << endl;
}

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

    solve();
}


Measured memory_bytes: 5760
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    string S;
    cin >> S;
    int count = 0;
    
    for(int i = 0; i < S.size()/2; i++){
        if(S[i] != S[S.size()-1-i]){
            count += 1;
        }
    }
    cout << count;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
const int INF = 1e6;
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uld = unsigned long long;
using P = pair<int,int>;
const ll mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    int n,k,q;
    cin >> n >> k >> q;
    int point[n+1]={k-q};
    rep(i,q){
        int p;
        cin >> p;
        point[p]++;
    }
    rep1(i,n){
        cout << (point[i] > q-k ? "Yes" : "No") << endl;
    }
}

Measured memory_bytes: 4072
#include <iostream>
#include <cstdio>

using namespace std;
typedef long long LL;
const int MAXN = 1e6 + 8;


int main()
{
    #ifdef LOCAL
    freopen("a.txt", "r", stdin);
    //freopen("a.out", "w", stdout);
    int T = 4;
    while(T--){
    #endif // LOCAL
    ios::sync_with_stdio(false); cin.tie(0);

    LL n, i, ans = 0, tmp, cnt = 0;
    cin >> n;

    while(n){
        ans += n % 10;
        if(n / 10) tmp = n / 10;
        n /= 10;
        cnt++;
    }
    ans = max(ans, tmp - 1 + (cnt-1)*9);
    cout << ans << endl;



    #ifdef LOCAL
    cout << endl;
    }
    #endif // LOCAL
    return 0;
}



Measured memory_bytes: 256
n=int(input())
nowx, nowy, nowt = 0, 0, 0
for i in range(n):
	t,x,y = map(int,input().split())
	k = t-nowt-abs(nowx-x)-abs(nowy-y)
	if k >= 0 and k % 2 == 0:
		nowx, nowy, nowt = x, y, t
	else:
		print("No")
		exit()
print("Yes")


Measured memory_bytes: 3060
n,k=map(int,input().split())
hList=[]
for i in range(n):
  hList.append(int(input()))
hList.sort()
#print(hList)
ans=100000000000000
for i in range(n-k+1):
  tmp=hList[i+k-1]-hList[i]
  if(ans>tmp):
    ans=tmp
print(ans)


Measured memory_bytes: 7384
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

LL x, y;

int main(void) {
    cin >> x >> y;
    LL ans = INF;
    if (-x == y) {
        cout << 1 << endl;
        return 0;
    }
    if (x < 0 && y < 0) {
        if (x > y) {
            ans = llabs(llabs(x) - llabs(y)) + 2;
            ans = min(ans, -y - x + 1);
        } else {
            ans = min(ans, y - x);
        }
    } else if (x < 0) {
        if (-x > y) {
            ans = y - x;
            ans = min(ans, -x - y + 1);
        } else {
            ans = y + x + 1;
        }
    } else if (y < 0) {
        if (x < -y) {
            ans = llabs(x + y) + 1;
        } else {
            ans = 1 + y + x;
        }
    } else {
        if (x < y) {
            ans = y - x;
        } else {
            ans = 1 + y + x;
            ans = min(ans, -y + x + 2);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 384
import java.util.Scanner;
import java.util.StringJoiner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        String[] s = sc.next().split("");
        s[k - 1] = s[k - 1].toLowerCase();
        StringJoiner sj = new StringJoiner("");
        for (int i = 0; i < n; i++) {
            sj.add(s[i]);
        }
        System.out.println(sj.toString());
    }

}


Measured memory_bytes: 23124
#include <cstdio>
#include <algorithm>

bool done[1000];
int w[1000];
int s[1000];
int pos[10000];

inline void swap(int *a, int i, int j){
    int tmp = a[i];
    a[i] = a[j];
    a[j] = tmp;
    return;
}

int partition(int *a, int n){
    int x = a[n-1];
    int i,j;
    i=0;
    for(j=0;j<n-1;j++){
        if(a[j]<x){
            swap(a,i,j);
            i++;
        }
    }
    swap(a,i,j);
    return i;
}

void quickSort(int *a, int n){
    if(n<1)return;

    int q = partition(a,n);
    quickSort(a,q);
    quickSort(a+q+1,n-q-1);

    return;
}

int researchPass(int p, int min){
    done[p] = true;
    if(pos[w[p]]==p)return 0;

    int l=0,sum=0;
    int i = p;
    int lmin = 10001;

    while(true){
        done[i] = true;

        l++;
        sum+=w[i];
        if(w[i]<lmin)lmin=w[i];

        i = pos[w[i]];
        if(i==p)break;
    }

    int c1 = (l-2) * lmin + sum;
    int c2 = (l+1) * min + lmin + sum;
    return std::min(c1,c2);
}

int solve(int n, int min){
    int i,cost=0;
    for(i=0;i<n;i++){
        if(done[i])continue;
        cost += researchPass(i,min);
    }
    return cost;
}

int main(){
    int i,n,min=10001;

    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",w+i);
        if(w[i]<min)min=w[i];
        s[i]=w[i];
        done[i] = false;
    }

    quickSort(s,n);

    for(i=0;i<n;i++){
        pos[s[i]]=i;
    }

    printf("%d\n",solve(n,min));

    return 0;
}



Measured memory_bytes: 2792
<?php
  
 fscanf(STDIN,"%d",$n);
 $a_li = array();
 for($i=0;$i<$n;$i++){
   $a_li[] = trim(fgets(STDIN));
 }

//print_r($a_li);
$index = $a_li[0];
if($index==2){
  echo "1\n";
  exit;
}
 for($i=1;$i<count($a_li);$i++){
   //echo $a_li[$index-1]."\n";
   if($a_li[$index-1]==2){
     echo ($i+1)."\n";
     exit;
   }
   $index = $a_li[$index-1];
 }

echo "-1\n";
 

Measured memory_bytes: 12792
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> A(N+2);
  for(int i = 0; i < N; ++i) cin >> A[i+1];
  int ans = 0;
  for(int i = 1; i <= N+1; ++i){
    ans += abs(A[i]-A[i-1]);
  }
  for(int i = 1; i <= N; ++i){
    cout << ans - abs(A[i]-A[i-1]) - abs(A[i]-A[i+1]) + abs(A[i+1]-A[i-1]) << endl;
  }
  return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <algorithm>
#include <string.h>
using namespace std;
int A ,B, C;
int max(int a, int b){
  if(a > b) return a;
  else return b;
}

int main(int argc, char const *argv[]) {
  cin >> A >> B >> C;
  int ans = 0;
  while(A<=B){
    B = B - A;
    ans++;
  }

  if (ans <= C) cout << ans << endl;
  else cout << C << endl;


  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int p[131072],minp[131072],cnt=0;
long long ans[505][505];
int main()
{
	for(int i=2;i<=100000;i++)
	{
		if(!minp[i])
		{
			p[cnt]=i;
			minp[i]=i;
			cnt++;
		}
		for(int j=0;j<cnt&&p[j]<=minp[i]&&(long long)i*p[j]<=100000;j++)
		{
			minp[i*p[j]]=p[j];
		}
	}
	for(int i=0;i<500;i++)
	{
		for(int j=0;j<500;j++)
		{
			int left=i+j;
			int right=i-j+500;
			if((i+j)&1)
			{
				ans[i][j]=(long long)p[left>>1]*p[(left+1)>>1]*p[(right>>1)+500]*p[((right+1)>>1)+500]+1;
			}
			else
			{
				ans[i][j]=(long long)p[left>>1]*p[(right>>1)+500];
			}
		}
	}
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			printf("%lld",ans[i][j]);
			if(j==n-1)
			{
				putchar('\n');
			}
			else
			{
				putchar(' ');
			}
		}
	}
	return 0;
}

Measured memory_bytes: 5504
#include<iostream>
#include<cstring>
#include<cstdio>
#define next dskjf

using namespace std;

const int mo=1e9+7;

int f[100001],next[100001][3],sum[100001],ans=0;
char s[100001];

int main()
{
	scanf("%s",s+1);int len=strlen(s+1);
	bool bo=false;
	sum[0]=0;sum[1]=(s[1]=='a')?1:2;
	for(int i=2;i<=len;i++) 
	{
		sum[i]=(sum[i-1]+((s[i]=='a')?1:2))%3;
		if(s[i]==s[i-1]) bo=true;
	}
	if(!bo) {cout<<1<<endl;return 0;}
	memset(next,-1,sizeof(next));
	for(int i=len;i>=0;i--)
	{
		for(int j=0;j<=2;j++) next[i][j]=next[i+1][j];
		if(i<len) next[i][sum[i+1]]=i+1;
	}
	f[0]=1;
	for(int i=0;i<=len;i++)
	{
		for(int j=1;j<=2;j++)
		{
			int yu=next[i][(sum[i]+j)%3]; 
			if(yu!=-1) f[yu]=(f[yu]+f[i])%mo;
		}
		if((i>0)&&(sum[i]==sum[len])) ans=(ans+f[i])%mo;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2304
from collections import Counter
n, x, y = map(int, input().split())
dist = []
for i in range(1, n + 1):
	for j in range(i + 1, n + 1):
		d = min(abs(j - i), abs(x - i) + 1 + abs(y -j), abs(y - i) + 1 + abs(x - j))
		dist.append(d)

counter = Counter(dist)
for k in range(1, n):
	print(counter[k])

Measured memory_bytes: 67800
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
/*多倍長整数/cpp_intで宣言
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
*/

//#pragma gcc target ("avx2")
//#pragma gcc optimization ("o3")
//#pragma gcc optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0
#define addf(T) [](T a, T b){return (a + b);}
#define minf(T) [](T a, T b){return min(a, b);}
#define maxf(T) [](T a, T b){return max(a, b);}


using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const long double PI = acos(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

ll lcm(ll number1, ll number2) {
	return number1 / gcd(number1, number2) * number2;
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	int n;
	scanf("%d", &n);
	vector<int> a(n);
	rep(i, n)scanf("%d", &a[i]);
	sort(all(a));
	printYN(!distance(unique(all(a)), a.end()));

	Please AC;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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;}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n, m;
    cin >> n >> m;
    if (n == 1 && m == 0) {
        cout << 0 << endl;
        return;
    }
    if (n == 2 && m == 0) {
        cout << 10 << endl;
        return;
    }
    if (n == 3 && m == 0) {
        cout << 100 << endl;
        return;
    }

    vi v(n, -1);
    int s, c;
    REP(i, m) {
        cin >> s >> c;
        s--;
        if (v[s] != -1 && v[s] != c) {
            cout << -1 << endl;
            return;
        }
        if (v[s] == -1 || v[s] == c) v[s] = c;
    }
    bool b = false;
    string ans = "";
    if (n == 1) {
        if (v[0] == -1) cout << 0 << endl;
        else cout << v[0] << endl;
    } else if (n == 2) {
        if (v[0] == 0) {
            cout << -1 << endl;
        } else if (v[0] == -1) {
            cout << 1;
            if (v[1] == -1) cout << 0 << endl;
            else cout << v[1] << endl;
        } else {
            cout << v[0];
            if (v[1] == -1) cout << 0 << endl;
            else cout << v[1] << endl;
        }
    } else if (n == 3) {
        if (v[0] == 0) {
            cout << -1 << endl;
        } else if (v[0] == -1) {
            cout << 1;
            if (v[1] == -1) cout << 0;
            else cout << v[1];
            if (v[2] == -1) cout << 0 << endl;
            else cout << v[2] << endl;
        } else {
            cout << v[0];
            if (v[1] == -1) cout << 0;
            else cout << v[1];
            if (v[2] == -1) cout << 0 << endl;
            else cout << v[2] << endl;
        }
    }
}


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

signed main(){
    string S;
    cin >>S;
    int ans,count;
    ans=count=0;
    REP(i,S.size()){
        if(S[i]=='A'||S[i]=='C'||S[i]=='G'||S[i]=='T'){
            count++;
        }
        if(S[i]!='A'&&S[i]!='C'&&S[i]!='G'&&S[i]!='T'){
            count=0;
        }
        ans=max(ans,count);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
using namespace std;

int main()
{
	string S;
	cin >> S;
	S[3] = '8';
	cout << S << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int a, b;
    cin>>a>>b;
    int N;
    cin>>N;
    int flg = 0;
    for (int i = 0; i < N; i++)
    {
        int s,f;
        cin>>s>>f;
        if(f<=a||b<=s) continue;
        else flg = 1;

        /* code */
    }
    cout<<flg<<endl;
    return 0;
    
}


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

using namespace std;

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

using i64 = long long;
using pii = pair<i64, i64>;

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

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

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

  int x[8];
  rep(i, 5) cin >> x[i];

  int minv = INF;
  rep(i, 5) {
    int res = 0;
    rep(j, 5) {
      if (j == i) continue;
      res += 10 * ((x[j] + 9) / 10);
    }
    chmin(minv, res + x[i]);
  }

  cout << minv << "\n";

  return 0;
}

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

int main() {
  int n, d, x, day;
  cin >> n >> d >> x;
  int a[n];
  REP(i, n) cin >> a[i];

  REP(i, n) {
    day = 1;
    while (day <= d) {
      x += 1;
      day += a[i];
    }
  }
  cout << x << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    cin>>n;
    int m;
    m=n%10;
    if(m==3){
        cout<<"bon"<<endl;
    }
    else if(m==0 ||m==1||m==6|| m==8){
        cout<<"pon"<<endl;
    }
    else {
        cout<<"hon"<<endl;
    }
    
}


Measured memory_bytes: 3624
n,a,b=map(int,input().split())
if a==0:
    print(0)
elif n%(a+b)==0:
    print(n//(a+b)*a)
elif n%(a+b)>a:
    print(n//(a+b)*a+a)
else:
    print(n//(a+b)*a+n%(a+b))
    

Measured memory_bytes: 2940
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    n,k = LI()
    s = input()
    for i in range(k-1):
        print(s[i],end = "")
    print(s[k-1].lower(),end = "")
    for i in range(k,n):
        print(s[i],end = "")
    print()
    return

#B
def B():
    s = S()
    k = int(s[0])*10+int(s[1])
    l = int(s[2])*10+int(s[3])
    if k == 0:
        if l == 0:
            print("NA")
        elif l < 13:
            print("YYMM")
        else:
            print("NA")
    elif k < 13:
        if l == 0:
            print("MMYY")
        elif l < 13:
            print("AMBIGUOUS")
        else:
            print("MMYY")
    else:
        if l == 0:
            print("NA")
        elif l < 13:
            print("YYMM")
        else:
            print("NA")

#C
def C():
    n,k = LI()
    ans = 0
    for i in range(1,n+1):
        l = k/i
        ans += 1/n*1/(2 << max(0,math.ceil(math.log(l,2))))
    print(ans*2)
    return

#D
def D():

    return

#E
def E():
    n = I()

    return

#F
def F():
    n = I()

    return

#Solve
if __name__ == "__main__":
    C()


Measured memory_bytes: 40560
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdio>
#include <vector>
#include <bitset>
#include <cstring>
#include <utility>
#include <iostream>
#include <algorithm>
#define LL long long
#define Rg register
#define RI register int
#define RC register char
#define ed puts("") 
#define pair pair<LL,LL>
#define space putchar(' ')
using namespace std;
    
template <typename tp> inline void read(tp & x)
{	
    x=0;
    RI f=1;
    RC c=getchar();
    while(c<'0' || c>'9'){if(c=='-') f=-1;c=getchar(); }
    while(c>='0' && c<='9'){x=(x<<1)+(x<<3)+(c^48);c=getchar();} 
 	x*=f;
} 	
    
template <typename Tp> inline void print(Tp x)
{		
    if(x<0) x=-x,putchar('-');
    if(x>9) print(x/10);
    putchar(x%10+'0');
}	

LL x,y;
LL tempa,tempb;
const LL inf=0x3f3f3f3f;
LL Ans1,Ans2,Ans3,Ans4;
LL Ans;

inline LL Min(LL a,LL b)
{
	if(a<b)
		return a;
	return b;
}

inline LL ans1()//y由x+a组成
{
	LL c=tempb-tempa;
	if(c>0)
		return c;
	else 
		return inf;	
} 


inline LL ans2()//y由x-a组成
{
	LL c=tempb-tempa;
	if(c<0)
	{
		LL hh=-c+2;
		return hh;
	}
	else
		return inf;
} 
	
inline LL ans3()//y由-x+a组成 先按下B再按a次A 
{
	LL c=y+x;
	if(c>=0)	
	{
		LL hh=c+1;	
		return hh;
	}
	return inf;
}	
	
inline LL ans4()//y由-x-a组成 先按a次A 再按1次B 
{
	LL c=y+x;
	if(c<=0)
	{
		LL hh=-c+1;
		return hh; 
	}
	return inf; 
}	

	
int main()
{
	read(x);
	read(y);
	tempa=x;
	tempb=y;
	Ans1=ans1();
	Ans2=ans2();
	Ans3=ans3();
	Ans4=ans4();
	Ans=Min(Ans1,Ans2);
	Ans=Min(Ans,Ans3);
	Ans=Min(Ans,Ans4);
	printf("%lld",Ans);
	return 0;
}

Measured memory_bytes: 888
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define seg_size 524288
long long people[200000] = {};
long long visited[200000] = {};
vector<pair<long long,long long>> rights[200000];
vector<pair<long long,long long>> lefts[200000];
int main() {
#define int long long
	int n, m;
	cin >> n >> m;
	REP(i, m) {
		int a, b, c;
		cin >> a >> b >> c;
		rights[a].push_back(make_pair(b, c));
		lefts[b].push_back(make_pair(a, c));
	}
	for (int i = 1;i <= n;++i) {
		if (visited[i] == 0) {
			queue<int> now;
			map<int, int> kaburi;
			visited[i] = 1;
			now.push(i);
			while (now.empty() == false) {
				int ho = now.front();
				now.pop();
				for (int q = 0;q < rights[ho].size();++q) {
					if (visited[rights[ho][q].first] == true) {
						if (people[rights[ho][q].first] - people[ho] != rights[ho][q].second) {
							cout << "No" << endl;
							return 0;
						}
					}
					else {
						people[rights[ho][q].first] = people[ho] + rights[ho][q].second;
						visited[rights[ho][q].first] = 1;
						now.push(rights[ho][q].first);
					}
				}
				for (int q = 0;q < lefts[ho].size();++q) {
					if (visited[lefts[ho][q].first] == true) {
						if (people[lefts[ho][q].first] - people[ho] != -lefts[ho][q].second) {
							cout << "No" << endl;
							return 0;
						}
					}
					else {
						people[lefts[ho][q].first] = people[ho] - lefts[ho][q].second;
						visited[lefts[ho][q].first] = 1;
						now.push(lefts[ho][q].first);
					}
				}
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 23168
#include<iostream>

using namespace std;

int main(){

    long min, max, sum=0;
    long input_num;
    unsigned int n;

    cin >> n;

    for(int i=0;i<n;i++){
        cin >> input_num;
        sum += input_num;
        if(i == 0){
            min = input_num;
            max = input_num;
        }else{
            if(min > input_num){
                min = input_num;
            }
            if(max < input_num){
                max = input_num;
            }
        }
    }

    cout << min << " " << max << " " << sum << endl;

    return 0;

}


Measured memory_bytes: 3112
// In the Name of Allah. Ya Ali!
#include<bits/stdc++.h>
typedef long long ll;
const ll MAX_N = 1e5+5;
const ll MOD = 1e9+7;
using namespace std;

int dp[MAX_N];
int h[MAX_N];
int n;

int main()
{
    cin >> n;
    for(int i = 1;i<=n;++i)
        cin >> h[i];
    dp[1] = 0;
    dp[2] = abs(h[2]-h[1]);
    for(int i = 3;i<=n;++i)
        dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
    cout << dp[n];
    return 0;
}


Measured memory_bytes: 1024
/*
...........__________    							 |										    ___  __
.............|       |     						     |											 |   /
.............|       |     						     |									  		 |  /
.............|       |                               |                         __                | /      _______
.............|_______|  _______            _______   |______   ________   /|  /  |               |/       |      |
.............| \               | |      | |          |      |          | / | /   |               |\       |
.............|  \       _______| |      | |_______   |      |   _______|   |/    |               | \      |
.............|   \      |      | |      |         |  |      |  |       |   |     |               |  \     |
.........  __|    \__|  |______| |______| ________|  |      |_ |_______|   |     |__|           _|   \__ _|        .

*/
#include<bits/stdc++.h>
using namespace std ;
#define int 				long long
#define ull 				unsigned long long int
#define ld 					long double
#define vi 					vector<int>
#define vii 				vector<pair<int,int>>
#define vvi 				vector<vector<int>>
#define pf 					push_front
#define popb 				pop_back
#define pb 					push_back
#define eb 					emplace_back
#define pii 				pair<int,int>
#define prec(x) 			fixed<<setprecision(15)<<x
#define all(x) 				x.begin(),x.end()
#define rall(x) 			x.rbegin(),x.rend()
#define mset(a,b) 			memset(a,b,sizeof(a))
#define mcpy(a,b) 			memcpy(a,b,sizeof(a))
#define fo0(i,n) 			for(int i=0,i##end=n;i<i##end;i++)
#define fo1(i,n) 			for(int i=1,i##end=n;i<=i##end;i++)
#define fo(i,a,b) 			for(int i=a,i##end=b;i<=i##end;i++)
#define foe(i,x)			for(__typeof((x).end())i=(x).begin();i!=(x).end();++i)
#define fre(i,x)			for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i)
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define inf 1e18
const int mod=1e9+7;
const int N=4e5+10;

void raushan_kumar(){
	int n,k;cin>>n>>k;
	int a[n];
	fo0(i,n){
		cin>>a[i];
	}
	sort(a,a+n);
	reverse(a,a+n);
	int sum=0;
	for(int i=k;i<n;i++){
		sum+=a[i];
	}
	cout<<sum;
}

int32_t main()
{
	
	fast;int t=1;
	//cin>>t;
	while(t--){
		raushan_kumar();
	}

}

Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>

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

int main()
{
    int N, K; scanf("%d %d", &N, &K);
    int *A = (int *)malloc(sizeof(int) * (N + 9));
    rep(i,N) scanf("%d", &A[i]);

    int ans = (N - 1) / (K - 1);
    if ((N - 1) % (K - 1)) ++ans;
    printf("%d\n", ans);

    free(A);
    return 0;
}


Measured memory_bytes: 512
a = ["A","B","C","D","E","F","G",
    "H","I","J","K","L","M","N",
    "O","P","Q","R","S","T","U",
    "V","W","X","Y","Z"]
N = int(input())
S = input()
o = ""
for s in S:
  o += a[(a.index(s)+N)%26]

print(o)

Measured memory_bytes: 3060
/*

*/
#include<iostream>
#include<iomanip>
#include<ios>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<string>
#include<algorithm>
#include<utility>
#include<math.h>
#include<cstdlib>
#define rep(i, n) for(int i=0;i<n;i++)
#define repb(i, a, b) for(int i=a;i<b;i++)
#define MAX_N 10000

using namespace std;
typedef pair<int, int> P;
typedef long long int ll;

const int INF = 1<<30;
const ll MOD = ll(1e9+7);

int main(){
  string s;cin>>s;
  cout<<s.substr(0, 3)<<endl;
  // system("read -n 1 -s -p \"Press any key to continue...\"");
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef int ll;
typedef long double ld;
const ll N = 55;
char en = '\n';
ll inf = 1e16;
ll mod = 998244353;
ll power(ll x, ll n, ll mod) {
  ll res = 1;
  x %= mod;
  while (n) {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}
ll n, m, S;
ll a[N];
ll b[N];
ll c[N];
ll d[N];

struct node {
  ll v, a, b;
  node() {}
  node(ll v, ll a, ll b) : v(v), a(a), b(b) {}
};

vector<node> adj[N];

int arrival[N][2700];
ll ans[N];
void dijkstra(int source, int destination) {
  for (int i = 1; i <= n; i++) {
    for (ll coin = 0; coin < 2700; coin++) {
      arrival[i][coin] = inf;
    }
  }
  arrival[source][S] = 0;

  fill(ans, ans + N, inf);
  // dist, (u, coins)
  set<pair<int, pair<int, int>>> s;
  s.insert({0, {source, S}});
  while (!s.empty()) {
    auto x = *(s.begin());
    s.erase(x);

    ll u = x.second.first;
    ans[u] = min(ans[u], x.first);

    ll coin = x.second.second;
    if (coin > 2550)
      continue;
    for (auto it : adj[x.second.first]) {

      ll v = it.v;
      ll a = it.a;
      ll b = it.b;
      if ((coin - a) < 0)
        continue;

      if (arrival[v][coin - a] > (arrival[u][coin] + b)) {
        s.erase({arrival[v][coin - a], {v, coin - a}});
        arrival[v][coin - a] = arrival[u][coin] + b;
        s.insert({arrival[v][coin - a], {v, coin - a}});
      }
    }
    if (arrival[u][coin + c[u]] > (arrival[u][coin] + d[u])) {
      s.erase({arrival[u][coin + c[u]], {u, coin + c[u]}});
      arrival[u][coin + c[u]] = arrival[u][coin] + d[u];
      s.insert({arrival[u][coin + c[u]], {u, coin + c[u]}});
    }
  }
}

// sample problem: https://codeforces.com/problemset/problem/229/B
// sample solution: https://codeforces.com/contest/229/submission/57464807

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

  cin >> n >> m >> S;
  S = min(S, 2530ll);

  for (ll i = 1; i <= m; i++) {
    ll u, v, a, b;
    cin >> u >> v >> a >> b;
    adj[u].emplace_back(v, a, b);
    adj[v].emplace_back(u, a, b);
  }

  for (ll i = 1; i <= n; i++)
    cin >> c[i] >> d[i];

  dijkstra(1, 1);
  for (ll t = 2; t <= n; t++) {
    cout << ans[t] << en;
  }

  return 0;
}


Measured memory_bytes: 8108
N = int(input())
t = [0]*(N+1)
x = [0]*(N+1)
y = [0]*(N+1)
t[0] = 0
x[0] = 0
y[0] = 0
for n in range(N):
  n = n+1
  t[n], x[n], y[n] = map(int, input().split())

ans = "Yes"
for n in range(N):
    dt = t[n+1] - t[n]
    dist = abs(x[n+1] - x[n]) + abs(y[n+1] - y[n])
    if (dt < dist) or ((dt - dist) % 2 == 1):
        ans = "No"

print(ans)

Measured memory_bytes: 11636
#include <atcoder/lazysegtree>
#include <atcoder/modint>
#include <iostream>
#include <vector>
using namespace std;

using mint = atcoder::modint998244353;

struct S {
    mint value;
    mint base;
};
using F = int;

ostream& operator << (ostream& out, const S& data) {
    out << "[" << data.value.val() << " , " << data.base.val() << "]";
    return out;
}

S op(S a, S b) { return {a.value + b.value, a.base + b.base}; }
S default_data() { return {0, 0}; }
S apply_lazy(F lazy, S data) {
    if (lazy == 0) {
        return data;
    }
    return {lazy * data.base, data.base}; 
}
F push_lazy(F root, F child) {
    if (root == 0) {
        return child;
    }
    return root;
}
F default_lazy() { return 0; }

using SegTree = atcoder::lazy_segtree<S, op, default_data, F, apply_lazy,
                                      push_lazy, default_lazy>;


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

    int N, Q;
    cin >> N >> Q;

    auto leaves = vector<S>(N);
    mint base = 1;
    for (int i = 0; i < N; i++) {
        leaves[i] = {base, base};
        base = base * 10;
    }
    auto tree = SegTree(leaves);

    while (Q--) {
        int l, r, d;
        cin >> l >> r >> d;
        l--; 
        r--;
        tree.apply(N - 1 - r, N - l, d);
        cout << tree.all_prod().value.val() << endl;
    }

    return 0;
}

Measured memory_bytes: 9804
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define MOD 1000000007
#define ll long long
#define int long long 
#define INF 1e18
#define ar array
#define f first
#define s  second
#define REP(i,n) for (int i=0;i<(n);i++)
#define wt(x) int x;cin>>x;while(x--)
#define watch(x) cerr << "\n" << (#x) << " is " << (x) << endl
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>; 

void  c_p_c(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  #ifndef ONLINE_JUDGE
  freopen("input1.txt","r",stdin);

  freopen("output1.txt","w",stdout);
#endif
}

int power(int a,int b,int mod){
  a=a%mod;
  if(a==0){
    return 1;
  }
  int res=1;
  while(b){
    if(b&1){
      res=(res*a)%mod;
    }
    b>>=1;
    a=(a*a)%mod;
  }
  return res;
}

int  MMI(int p){
  return power(p,MOD-2,MOD);

}

int32_t main()
{
 c_p_c();
 int n,k;
 cin>>n>>k;
 int a[n];
 for(int i=0;i<n;i++){
  cin>>a[i];
 }
 int lo=1;
 int hi=MOD;
  while(lo<hi){
    ll mid = (lo+hi)/2;
    ll cnt = 0;
    for(int i=0;i<n;i++)
      cnt += (a[i]-1)/mid;
 
    if(cnt <= k)
      hi = mid;
    else
      lo = mid+1;
  }
 
  cout<<lo<<"\n";


return 0;

}








   



   








Measured memory_bytes: 5140
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <map>
#include <numeric>
#include <functional>
#include <math.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)

int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    vector<vector<int>> G(N);
    for (int m = 0; m < M; ++m) {
        int A, B;
        cin >> A >> B;
        --A; --B;
        G[A].push_back(B);
    }
    
    vector<int> Ans;
    for (int n = 0; n < N; ++n) {
        vector<int> Used(N, 0);
        vector<int> Prev(N, -1);
        queue<int> Q;
        Q.push(n);
        Used[n] = 1;
        while (!Q.empty()) {
            int m = Q.front(); Q.pop();
            for (int k : G[m]) {
                if (!Used[k]) {
                    Used[k] = 1;
                    Prev[k] = m;
                    Q.push(k);
                } else if (k == n) {
                    vector<int> Temp;
                    int l = m;
                    while (1) {
                        Temp.push_back(l);
                        l = Prev[l];
                        if (l == -1) break;
                    }
                    if (Ans.empty() || Temp.size() < Ans.size()) {
                        Ans = move(Temp);
                    }
                }
            }
        }
    }
    
    if (Ans.empty()) {
        cout << -1 << endl;
    } else {
        cout << Ans.size() << '\n';
        for (int a : Ans) {
            cout << a+1 << '\n';
        }
    }

    return 0;
}


Measured memory_bytes: 384
H,W=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
h,w=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき

print(H*W - h*W - w*H + h*w)

Measured memory_bytes: 2940
#include <cstdio>
#include <iostream>
using namespace std;
long long f[1001][1001][2][2][2],q[1001],w[1001],e[1001];
int main()
{
	int i,j,a,b,c,n,m;
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;i++)
		scanf("%lld%lld%lld",&q[i],&w[i],&e[i]);
	for(a=0;a<=1;a++)
		for(b=0;b<=1;b++)
			for(c=0;c<=1;c++)
				for(i=0;i<=n;i++)
					for(j=0;j<=m;j++)
						f[i][j][a][b][c]=-10000000000000000LL;
	for(a=0;a<=1;a++)
		for(b=0;b<=1;b++)
			for(c=0;c<=1;c++)
				for(i=0;i<=n;i++)
					f[i][0][a][b][c]=0;
	long long ans=0;
	for(i=1;i<=n;i++)
		for(j=1;j<=m&&j<=i;j++)
			for(a=0;a<=1;a++)
				for(b=0;b<=1;b++)
					for(c=0;c<=1;c++)
					{
						long long q1=1,q2=1,q3=1;
						if(a==0)q1=-1;
						if(b==0)q2=-1;
						if(c==0)q3=-1;
						f[i][j][a][b][c]=max(f[i-1][j][a][b][c],f[i-1][j-1][a][b][c]+q1*q[i]+q2*w[i]+q3*e[i]);
						if(j==m)ans=max(ans,f[i][j][a][b][c]);
					}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 62848
#include<cstdio>
int main()
{
	char a,b,c,d,e,f;
	scanf("%c%c%c%c%c%c",&a,&b,&c,&d,&e,&f);
	int flag=1;
	if(a==b)
	flag=0;
	if(c!=d)
	flag=0;
	if(e!=f)
	flag=0;
	if(flag==1)
	printf("Yes\n");
	else
	printf("No\n");
}

Measured memory_bytes: 128
N = int(input())
S = input()

left = {c: 0 for c in S}
right = {c: 0 for c in S}
for c in S:
    right[c] += 1

ans = 0
common = 0
for i in range(N):
    left[S[i]] += 1
    right[S[i]] -= 1
    if left[S[i]] == 1 and right[S[i]] >= 1:
        common += 1
    elif left[S[i]] > 1 and right[S[i]] == 0:
        common -= 1

    ans = max((ans, common))

print(ans)


Measured memory_bytes: 3064
def getCount(target, index):
    count = 0
    key_char = target[index]
    
    for char in target[index::] :
        if (key_char == char) :
            count += 1
        else :
            break
    
    return count

s = input()
k = int(input())

head_seq = getCount(s, 0)

if head_seq == len(s) :
    print((len(s) * k) // 2)
elif s[0] != s[-1:] :
    position = 0
    replace_count = 0
    while position < len(s) :
        temp_seq = getCount(s, position)
        replace_count += temp_seq // 2
        position += temp_seq
    
    print(replace_count * k)
else :
    target_str = s[head_seq::] + s[0:head_seq:]

    position = 0
    replace_count = 0
    while position < len(target_str) :
        temp_seq = getCount(target_str, position)
        replace_count += temp_seq // 2
        position += temp_seq

    tail_seq = getCount(target_str[::-1], 0)
    org_head_seq = getCount(s, 0)
    org_tail_seq = getCount(s[::-1], 0)

    print(replace_count * k - tail_seq // 2 + org_head_seq // 2 + org_tail_seq // 2)


Measured memory_bytes: 3064
#include<iostream>
using namespace std;
#define MAX 100000
typedef long long llong;
int n,k;
llong T[MAX];

int check(llong p){
int i = 0;
for(int j = 0 ; j < k ; j++){
llong s = 0;
while(s + T[i] <= p){
s += T[i];
i++;
if(i == n) return n;
}
}
return i;
}

int solve(){
llong left = 0;
llong right = 100000 * 10000;
llong mid;
while(right - left > 1){
mid = (left + right) / 2;
int v = check(mid);
if(v >= n) right = mid;
else left = mid;
}

return right;
}

main(){
cin >> n >> k;
for(int i = 0 ; i < n ; i++) cin >> T[i];
llong ans = solve();
cout << ans << endl;
}



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

int main() {
  int N, yellow;
  cin >> N;
  yellow = 0;
  for (int i = 0; i < N; i++) {
    string S;
    cin >> S;
    
    if (S == "Y") {
      yellow++;
      break;
    }
    
  }
  if (yellow == 1) {
      cout << "Four" << endl;
  }
  if (yellow == 0) {
    cout << "Three" << endl;
  }
}
  


Measured memory_bytes: 256