akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <atcoder/lazysegtree>
using namespace std;
using namespace atcoder;
#define int long long
using vec_int = vector<int>;
using P = pair<int,int>;
using T = tuple<int,int,int>;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int charToInt(char c){
    char zero_num = '0';
    return (int)c - (int)zero_num;
}

struct S{
    int val;
    int q;
    int res;
};

struct F{
    int val;
    int q;
};

int mod=998244353;

vec_int amari(200001);


S op(S a, S b){
    /*
    cout<<"a:"<<a.val<<" "<<a.q<<" "<<a.keta<<endl;
    cout<<"b:"<<b.val<<" "<<b.q<<" "<<b.keta<<endl;
    cout<<"op"<<(a.val+b.val)%mod<<endl;
    */
    return S{(a.val+b.val)%mod, max(a.q,b.q), (a.res+b.res)%mod};
}

S e(){
    return S{0,-1,-2};
}

S mapping(F a, S b){
    if(a.q>b.q){
        return S{(a.val*b.res)%mod, a.q, b.res};
    }else{
        return b;
    }
}

F composition(F a, F b){
    if(a.q>b.q){
        return a;
    }else{
        return b;
    }
}

F id(){
    return F{1,-3};
}

signed main(){
int temp=1;
for(int i=0;i<200001;i++){
    amari.at(i) = temp;
    temp= (temp*10)%mod;
}


    int N, Q; cin>>N>>Q;
    vec_int L(Q), R(Q), D(Q);

    rep(i,Q) cin>>L.at(i)>>R.at(i)>>D.at(i);


    vector<S> initial(N);
    rep(i,N){
        initial.at(i) = S{1*amari.at(N-i-1),-1, 1*amari.at(N-i-1)};
    }
    lazy_segtree<S, op, e, F, mapping, composition, id> seg(initial);

    rep(i,Q){
        seg.apply(L.at(i)-1,R.at(i), F{D.at(i),i});
        cout<<seg.all_prod().val%mod<<endl;
        
    }


    return 0;
}

Measured memory_bytes: 30696
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define show(x) cout<<#x<<"="<<x<<"\n"
using namespace std;

int n,m;
string s;
int a[101];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout<<fixed;
#ifdef LOCAL_DEFINE
    FILE *stream1;
    //FILE *stream2;
    stream1=freopen("in","r",stdin);
    //stream2=freopen("out","w",stdout);
    if(stream1==NULL)return 0;
    //if(stream2==NULL)return 0;
#endif
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    reverse(a,a+n);
    int al=0,b=0;
    for(int i=0;i<n;i++){
        if(i&1)b+=a[i];
        else al+=a[i]; 
    }
    cout<<al-b<<endl;
#ifdef LOCAL_DEFINE
    cerr<<"Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";
    fclose(stream1);
    //fclose(stream2);
#endif
    return 0;
}


Measured memory_bytes: 256
a,b,c =input().split()
d=a,b,c
if int(d[0])>int(d[1]) : d=[d[1],d[0],d[2]]
if int(d[1])>int(d[2]) : d=[d[0],d[2],d[1]]
if int(d[0])>int(d[1]) : d=[d[1],d[0],d[2]]
a,b,c=d
print(a,b,c)


Measured memory_bytes: 5596
#include<bits/stdc++.h>
#define ll long long int
#define pragi(a,b) for(ll i = a;i<b;i++)
#define pragj(a,b) for(ll j = a;j<b;j++)
#define pragk(a,b) for(ll k = a;k>=b;k--)
#define all(v) (v.begin(),v.end())
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define MP make_pair
#define MT make_tuple
#define F first
#define S second
#define KAKA ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int mod = 1e9 + 7;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef long double ld;
typedef pair<int, int> pii;
//typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef pair<ll, ll> pll;
vector<ll> parent(1e6 + 5,-1);
vector<bool> is_prime(1e6 + 5,true);

void sieve()
{
    ll maxn = 1000004;
    is_prime[0] = is_prime[1] = false;
   // pragi(1,10000001)
    //parent[i] = -1;
    for(ll i = 2;i <= maxn;i++)
    {
        if(parent[i] == -1)
        {
            for(ll j = i;j <= maxn;j+=i)
            {
                is_prime[j] = false;
                if(parent[j] == -1) parent[j] = i;
            }
        }
    }
}
void Compute(ll n)
{
    KAKA
    vector<ll> v(n);
    ll hcf = 0;
    pragi(0,n)
    {
        cin>>v[i];
        hcf = __gcd(hcf,v[i]);
    }
    if(hcf != 1)
    {
        cout<<"not coprime"<<"\n";
    }
   // cout<<"Kaka"<<"\n";
   else{
    map<ll,ll> freq;
   pragi(0,n)
   {
       ll ele = v[i];
       map<ll,ll> mp;
       while(parent[ele] != -1)
       {
           mp[parent[ele]]++;
           ele /= parent[ele];
       }
      // mp[ele]++;
       for(auto p : mp)
       {
           if(p.S > 0) freq[p.F]++;
       }
   }
   bool ok = true;
   for(auto p : freq)
   {
       if(freq[p.F] > 1)
       {
         ok = false;
         break;
       }
   }
   if(ok) cout<<"pairwise coprime"<<"\n";
   else cout<<"setwise coprime"<<"\n";
    }
}
int main()
{
    KAKA
   sieve();
   /*pragi(1,10)
   {
       cout<<parent[i]<<" ";
   }
   cout<<"\n";*/
    ll n;
    cin>>n;
    Compute(n);
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  char a, b;
  cin >> a >> b;

  cout << ((a == b) ? "H" : "D") << endl;
  return 0;
}


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

int main(){
    int A;
    cin >> A;
    int d1,d2;
    int count = 0;
    int sum = 0;
    for(int i = 0; i < A; i++){
        cin >> d1 >> d2;
        if(d1 == d2){
            count++;
            if(count == 3){
                sum++;
            }
        }
        else count = 0;
    }
    if(sum >= 1){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#include <iostream>
#include <string.h>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
  int n,m,count=0;
  cin >>n >>m;
  int k[m],s[m][n],temp,p[m];
  for(int i=0;i<m;i++){
    for(int j=0;j<n;j++)s[i][j]==0;
  }
  for(int i=0;i<m;i++){
    cin >>k[i];
    for(int j=0;j<k[i];j++){
      cin >>temp;
      s[i][temp-1]=1;
    }
  }
  for(int i=0;i<m;i++)cin >>p[i];
  // {0, 1, ..., n-1} の部分集合の全探索
  for (int bit = 0; bit < (1<<n); ++bit){
     /* bit で表される集合の処理を書く */


        /* きちんとできていることを確認してみる */
        // bit の表す集合を求める
     int sum=0;
     for(int j=0;j<m;j++){
         int ans=0;
         for (int i = 0; i < n; ++i) {
             if (bit & (1<<i)) { // i が bit に入るかどうか
                 if(s[j][i]==1)ans++;
             }
         }
         if(ans%2==p[j])sum++;
      }
    if (sum==m)count++;
   }
  
   cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))
typedef long long ll;

int main(){
   
    vector<string> ans;
    while(true){
        int t; cin>>t;
        if(t==-1)break;
        string res;
        while(t!=0){
            res=(char)(t%4+'0')+res;;
            t/=4;
        }
        if(res=="")res="0";
        ans.push_back(res);
    }
    
    REP(i,ans.size())cout<<ans[i]<<endl;
    
    return 0;
}

Measured memory_bytes: 3092
import heapq
N = int(input())
A = list(map(int, input().split()))
heapq.heapify(A)
while True:
  m = heapq.heappop(A)
  n = heapq.heappop(A)
  if m + n >= 0:
    heapq.heappush(A, m)
    heapq.heappush(A, n)
    break
  else:
    heapq.heappush(A, -m)
    heapq.heappush(A, -n)
print(sum(A))

Measured memory_bytes: 14412
import java.util.*;

public class Main {

    static class Step {
        int t;
        int x;
        int y;

        public Step(int t, int x, int y) {
            this.t = t;
            this.x = x;
            this.y = y;
        }
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        List<Step> steps = new ArrayList<>();
        int N = scanner.nextInt();

        for (int i = 0; i < N; i++) {
            int t = scanner.nextInt();
            int x = scanner.nextInt();
            int y = scanner.nextInt();

            steps.add(new Step(t, x, y));
        }

        boolean can = true;
        int xStart = 0, yStart = 0, tStart = 0;
        for (int i = 0; i < steps.size(); i++) {
            int t = steps.get(i).t - tStart;
            int dist = Math.abs(steps.get(i).x - xStart) + Math.abs(steps.get(i).y - yStart);
            if (t < dist) {
                can = false;
            } else {
                can = t % 2 == dist % 2;
            }
            if (!can) {
                break;
            }
            tStart = steps.get(i).t;
            xStart = steps.get(i).x;
            yStart = steps.get(i).y;
        }


        if (can) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


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

//関数
    
    
    
//main関数
int main() {
    
    vector<vector<long>> nCk(60, vector<long>(60,1));
    for(int j=1;j<60;j++){
        for(int i=j+1;i<60;i++){
            nCk.at(i).at(j)=nCk.at(i-1).at(j-1)+nCk.at(i-1).at(j);
        }
    }
    
    
    //入力
    long N,P;
    cin>>N>>P;
    
    long odd=0,even=0;
    for(long i=0;i<N;i++){
        long A;
        cin>>A;
        if(A%2==0){
            even++;
        }else{
            odd++;
        }
    }
    
    //cout <<even<<" "<<odd<<endl;
    
    
    
    
    
    
    //計算
    long ansodd=0,anseven=0;
    for(long i=0;i<=even;i+=1){
        anseven+=nCk.at(even).at(i);
    }
    for(long i=P;i<=odd;i+=2){
        ansodd+=nCk.at(odd).at(i);
    }
    
    //出力
    cout<<anseven*ansodd<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <stdlib.h>


using namespace std;

int main(void) {
	//char str[4];

	//cin >> str;

	int count = 0;
	//for (int i = 0; i < 3; i++) {
	//	if (str[i] == 'R') count++;
	//}

	//cout << count << endl;

	char c1, c2, c3;
	cin >> c1 >> c2 >> c3;

	if (c1 == 'R' && c2 == 'R' && c3 == 'R') {
		cout << 3 << endl;
	}
	else if ((c1 == 'R' && c2 == 'R') || (c2 == 'R' && c3 == 'R')) {
		cout << 2 << endl;
	}
	else if (c1 == 'S' && c2 == 'S' && c3 == 'S') {
		cout << 0 << endl;
	}
	else {
		cout << 1 << endl;
	}

	return 0;
}



Measured memory_bytes: 3168
#!usr/bin/env python3
from collections import defaultdict
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] = SR()
    return l
mod = 1000000007
#A
def A():
    t,x = LI()
    print(t/x)

#B
def B():
    n= II()
    a = LI()
    m = max(a)
    if m >= sum(a)-m:
        print("No")
    else:
        print("Yes")


#C
def C():
    n,m = LI()
    x = LI()
    x.sort()
    l = [x[i+1]-x[i] for i in range(m-1)]
    l.sort()
    l = l[::-1]
    ans = sum(l[max(n-1,0):])
    print(ans)

#D
def D():
    n,k = LI()
    a = LI()
    k = list(map(int,list(bin(k)[2:])))
    l = len(k)
    for i in range(n):
        a[i] = list(map(int,list(bin(a[i])[2:])))
        l = max(l,len(a[i]))
    for i in range(n):
        for j in range(l-len(a[i])):
            a[i].insert(0,0)
    for j in range(l-len(k)):
        k.insert(0,0)
    s = [[0,0] for i in range(l)]
    pow2 = [1 for i in range(l)]
    for i in range(l-1)[::-1]:
        pow2[i] = pow2[i+1]*2
    for i in a:
        for j in range(l):
            s[j][0] += pow2[j]*i[j]
            s[j][1] += pow2[j]*(not i[j])
    dp = [0 for i in range(l+1)]
    small = False
    for i in range(l):
        if not small:
            if not k[i]:
                dp[i+1] += dp[i]+s[i][0]
            else:
                if s[i][0] >= s[i][1]:
                    dp[i+1] += dp[i]+s[i][0]
                    small = True
                else:
                    dp[i+1] += dp[i]+s[i][1]
        else:
            dp[i+1] += dp[i]+max(s[i])
    print(dp[l])

#E
if __name__ == "__main__":
    A()

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


Measured memory_bytes: 4720
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


struct LOC{
	LOC(int arg_row,int arg_col){

		row = arg_row;
		col = arg_col;
	}
	int row,col;
};

struct Info{

	vector<LOC> loc;
};

int H[4],W[4];
char table[4][4][5];
char base_map[4][11];
Info info[4];


bool rangeCheck(int row,int col){

	return row >= 0 && row <= 3 && col >= 0 && col <= 9;
}


bool is_OK(){

	vector<LOC> work;

	for(int not_use = 0; not_use < 4; not_use++){

		int perm[3];
		int index = 0;
		for(int i = 0; i < 4; i++){
			if(i == not_use)continue;

			perm[index++] = i;
		}

		do{

			bool tmp_FLG;
			index = 0;

			tmp_FLG = true;

			for(int row = 0; row < 4; row++){
				for(int col = 0; col < 10; col++){
					if(base_map[row][col] == '#')continue;

					base_map[row][col] = '#';
					work.push_back(LOC(row,col));

					for(int i = 0; i < 3; i++){

						int adj_row = row+info[perm[index]].loc[i].row;
						int adj_col = col+info[perm[index]].loc[i].col;

						if(rangeCheck(adj_row,adj_col) == false || base_map[adj_row][adj_col] == '#'){

							tmp_FLG = false;
							break;
						}
						base_map[adj_row][adj_col] = '#';
						work.push_back(LOC(adj_row,adj_col));
					}

					if(!tmp_FLG)break;

					index++;
				}
				if(!tmp_FLG)break;
			}

			if(index == 3)return true;

			for(int i = 0; i < work.size(); i++){

				base_map[work[i].row][work[i].col] = '.';
			}

			work.clear();

		}while(next_permutation(perm,perm+3));
	}

	return false;
}

int main(){

	for(int i = 0; i < 4; i++){

		scanf("%d %d",&H[i],&W[i]);

		for(int row = 0; row < H[i];row++){

			scanf("%s",table[i][row]);
		}

		//基準点からの相対位置を記録しておく
		for(int col = 0; col < W[i]; col++){

			if(table[i][0][col] == '#'){

				for(int diff_row = 0; diff_row < 4; diff_row++){
					if(diff_row >= H[i])continue;
					for(int diff_col = -3; diff_col < 4; diff_col++){
						if(col+diff_col < 0 || col+diff_col >= W[i])continue;

						if(diff_row != 0 || diff_col != 0){
							if(table[i][diff_row][col+diff_col] == '#'){

								info[i].loc.push_back(LOC(diff_row,diff_col));
							}
						}
					}
				}
				break;
			}
		}
	}

	int num_query;

	scanf("%d",&num_query);

	for(int loop = 0; loop < num_query; loop++){

		for(int row = 0; row < 4; row++){

			scanf("%s",base_map[row]);
		}

		if(is_OK()){

			printf("Yes\n");

		}else{

			printf("No\n");
		}
	}

	return 0;
}



Measured memory_bytes: 3160
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define int long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second

using namespace std;
int pallindr(string s, int i, int j)
{
	while (i <= j)
	{
		if (s[i] != s[j])
			return 0;
		i++;
		j--;
	}
	return 1;
}
int dp[1001][1001];
int pallindrome_partitioning(string s, int i, int j)
{
	if (i >= j)
		return 0;
	if (pallindr(s, i, j))
	{
		return dp[i][j] = 0;

	}

	if (dp[i][j] != -1)
		return dp[i][j];

	int ans = INT_MAX;
	for (int k = i; k < j; k++)
	{
		int left, right;
		if (dp[i][k] != -1)
			left = dp[i][k];
		else
		{
			left = pallindrome_partitioning(s, i, k);
			dp[i][k] = left;
		}

		if (dp[k + 1][j] != -1)
			right = dp[k + 1][j];
		else
		{
			right = pallindrome_partitioning(s, k + 1, j);
			dp[k + 1][j] = right;
		}

		int xx = left + right + 1;
		ans = min(ans, xx);
	}
	return dp[i][j] = ans;


}

int32_t main()
{
	std::ios::sync_with_stdio(false);


	string s, s1;
	cin >> s >> s1;
	int res = INT_MAX;
	for (int i = 0; i <= s.length() - s1.length(); i++)
	{
		string ex = s.substr(i, s1.length());
		//cout << ex << endl;
		int cnt = 0;
		for (int j = 0; j < ex.length(); j++)
		{
			if (ex[j] != s1[j])
				cnt++;
		}
		res = min(res, cnt);
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 3660
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Practice
{
    class Program
    {

        static void Main(string[] args)
        {
            SolveA(args);
            //SolveB(args);
            //SolveC(args);
            //SolveD(args);


        }
        static void SolveA(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] f = MakeFibonacci(n);
            Console.WriteLine(f[n]);
        }
        static int[] MakeFibonacci(int n)
        {
            int[] f = new int[n+1];
            f[0] = 1;
            f[1] = 1;
            for(int i=2;i<=n;++i)
            {
                f[i] = f[i - 1] + f[i - 2];
            }
            return f;
        }
    }

}



Measured memory_bytes: 9148
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <deque>
#include <string>
#include <stack>
#include <unordered_set>
#include <cmath>
#define endl '\n'
#define ll unsigned long long
//#define mod 1000000007
#define NCONS 101

using namespace std;

struct Pos {
	int x;
	int y;
};

struct Element {
	int idx;
	int times;
};

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

int map[NCONS][NCONS];
bool visited[NCONS][NCONS];
int H, W, N;
vector<Element> vec;

Element cur_i;
int acc_i;

void dfs(Pos cur)
{
	visited[cur.x][cur.y] = true;
	map[cur.x][cur.y] = cur_i.idx;
	acc_i += 1;
	if (acc_i >= cur_i.times)
	{
		if (vec.empty())
			return;
		cur_i = vec.back(); vec.pop_back();
		acc_i = 0;
	}
	for (int i = 0; i < 4; i++)
	{
		auto nx = cur.x + dx[i], ny = cur.y + dy[i];
		if (min(nx, ny) < 0 || nx >= H || ny >= W) continue;
		if (visited[nx][ny]) continue;
		dfs(Pos{ nx, ny });
	}
}



int main(void)
{
	cin.tie(NULL); ios_base::sync_with_stdio(false);
	cin >> H >> W >> N;
	for (int i = 1; i <= N; i++)
	{
		int temp; cin >> temp;
		vec.push_back(Element{ i, temp });
	}
	sort(vec.begin(), vec.end(), [](Element a, Element b) {return a.times < b.times; });
	cur_i = vec.back(); vec.pop_back();

	dfs(Pos{ 0, 0 });

	for (int i = 0; i < H; i++)
	{
		for (int j = 0; j < W; j++)
		{
			cout << map[i][j] << " ";
		}
		cout << endl;
	}
	
	return 0;
}

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

int main() {
    int N, M;
    cin >> N >> M;

    int left = 0, right = 100000;
    for (int i = 0; i < M; i++) {
        int l, r;
        cin >> l >> r;
        left = max(left, l);
        right = min(right, r);
    }
    if (right - left >= 0)
        cout << right - left + 1 << endl;
    else
        cout << 0 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 55;
const int Q = 1e9 + 7;

int C[N][N];
int f[N][N][N];
int n;

inline void add(int &A , int B) {
    A += B;
    if (A >= Q) A -= Q;
}

int main() {
    //cin >> n;
    n = 50;
    for (int i = 0 ; i <= n ; ++ i) {
        C[i][0] = 1;
        for (int j = 1 ; j <= i ; ++ j) {
            C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % Q;
        }
    }
    f[0][1][0] = 1;
    for (int i = 0 ; i <= n ; ++ i) {
        //cout << i << ' ' << f[i][0][0] << endl;
        if (i == n) break;
        if (i) {
            for (int j = 0 ; j < 50 ; ++ j) {
                for (int k = 0 ; k < 50 ; ++ k) {
                    add(f[i][j + 1][k + 1] , f[i][j][k]);
                }
            }
        }
        for (int j = 0 ; i + j <= n ; ++ j) {
            for (int k = 0 ; i + j + k <= n ; ++ k) {
                if (j + k > 0 && f[i][j][k]) {
                    for (int l = 0 ; l <= j ; ++ l) {
                        int x = j - l , y = k + l;
                        /*cout << i << ' ' << j << ' ' << k << f[i][j][k] << endl;
                        cout << x << ' ' << y << endl;
                        cout << (long long)f[i][j][k] * C[i + x + y][x] % Q
                        * C[i + y][y] % Q << endl;*/

                        add(f[i + j + k][l][0] , (long long)f[i][j][k] *
                            C[i + x + y][x] % Q * C[i + y][y] % Q);
                    }
                    for (int l = 1 ; l <= k ; ++ l) {
                        int x = j + l , y = k - l;
                        add(f[i + j + k][0][l] , (long long)f[i][j][k] *
                            C[i + x + y][x] % Q * C[i + y][y] % Q);
                    }
                }
            }
        }

    }
    cin >> n;
    cout << f[n][0][0] << endl;
}


Measured memory_bytes: 896
// Problem : A - Multiplication 1
// Contest : AtCoder - AtCoder Beginner Contest 169
// URL : https://atcoder.jp/contests/abc169/tasks/abc169_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define int long long
#define fastio                      \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0);
#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define db1(x) cout << #x << "=" << x << endl
#define db2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z)                                                       \
  cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z \
       << endl
#define dbp(x) \
  cout << #x << "= {" << (x.first) << ", " << (x.second) << "}" << endl;
#define dbv(v)                         \
  {                                    \
    cout << #v << " : ";               \
    for (auto x : v) cout << x << ' '; \
    cout << endl;                      \
  }
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define rep2(i, a, b) for (int i = a; i >= b; i--)
#define die(x) return cout << x << '\n', 0;

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

int32_t main() {
  fastio;

  int testcases;
  testcases = 1;
  // cin>>testcases;

  while (testcases--) {
    int a, b;
    cin >> a >> b;
    cout << a * b;
  }

  return 0;
}


Measured memory_bytes: 3656
//Author : pakhandi
//
using namespace std;

#include <bits/stdc++.h>

#define wl(n) while(n--)
#define fl(i,a,b) for(i=a; i<b; i++)
#define rev(i,a,b) for(i=a; i>=b; i--)

#define si(n) scanf("%d", &n)
#define sll(l) scanf("%lld",&l)

#define debug(x) cout<<"\n#("<<x<<")#\n"
#define nline printf("\n")

#define mem(a,i) memset(a,i,sizeof(a))

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

#define PB push_back
#define SZ size
#define MP make_pair

#define IGNORE cin.ignore (std::numeric_limits<std::streamsize>::max(), '\n');

const ll INF = (1LL << 58);
const bool DEBUG = 0;

int main()
{
	int i, j;

	cin >> i >> j;

	cout << (i + j) % 24;


	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <cstdlib>
#include <cmath>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
int main(){
    int n,m;
    cin >> n >> m;
    vector<int> vec(n);
    rep(i,n) cin >> vec[i];
    int sum=0;
    rep(i,n) sum+=vec[i];
    sort(vec.begin(),vec.end());
    reverse(vec.begin(),vec.end());
    double num=sum/(4.0*m);
    if(vec[m-1]>=num) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
n,m,k=map(int,input().split())
U = 2*10**5
MOD = 10**9+7
 
fact = [1]*(U+1)
fact_inv = [1]*(U+1)
 
for i in range(1,U+1):
  fact[i] = (fact[i-1]*i)%MOD
fact_inv[U] = pow(fact[U],MOD-2,MOD)
 
for i in range(U,0,-1):
	fact_inv[i-1] = (fact_inv[i]*i)%MOD
 
def comb(n,k):
  if k < 0 or k > n:
    return 0
  x = fact[n]
  x *= fact_inv[k]
  x %= MOD
  x *= fact_inv[n-k]
  x %= MOD
  return x

ans=0
for i in range(n):
    for j in range(m):
        if i!=0 and j!=0:
            ans+=2*(n-i)*(m-j)*(i+j)
        else:
            ans+=(n-i)*(m-j)*(i+j)
        ans%=MOD

print(ans*comb(n*m-2,k-2)%MOD)



Measured memory_bytes: 18804
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<iomanip>
#include<map>
#include<utility>
#include<string>
#include<unordered_map>
#include<queue>

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

using namespace std;

#define min_3(a, b, c) min(a, min(b, c))
#define max_3(a, b, c) max(a, max(b, c))
typedef long long ll;
typedef pair<int, int> P;

ll gcd(ll a, ll b){ return b? gcd(b, a%b):a;}
ll lcm(ll a, ll b){ return a/gcd(a,b)*b;}

int main(){
    int n, m;
    cin >> n >> m;
    if(n == m) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

using namespace std;

int main(){
    int a;
    scanf("%d",&a);
    int  n[a]; long long int sum=0;
    int min=0,max=0;
    
    for(int i=0; i<a; i++)
    {
        scanf("%d",&n[i]);
        if(i==0)
        {  
            min =n[i];
            max =n[i];
        }
        if(min>n[i])  min = n[i];
        if(max<n[i])  max = n[i];

        sum+=n[i];

    }
    printf("%d %d %lld\n",min,max,sum);
}



Measured memory_bytes: 2772
Str=[]
H=[]
h=[]
while True:
    x=input()
    if x=='-':
        break
    Str.append(x)
    m=int(input())
    for i in range(m):
        x=int(input())
        h.append(x)
    H.append(h)
    h=[]
for i in range(len(Str)):
    a=Str[i]
    for j in range(len(H[i])):
        a=''.join([a[H[i][j]:],a[:H[i][j]]])
    Str[i]=a
for str in Str:
    print(str)

Measured memory_bytes: 7624
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import re
import string

H, W = map(int, input().split())
N = int(input())
As = list(map(int, input().split()))

ret = []
r = []
for i, a in enumerate(As):
    while a > 0:
        if len(r) == W:
            ret.append(r)
            r = []
        r.append(i + 1)
        a -= 1
ret.append(r)

for i, r in enumerate(ret):
    if i % 2:
        print(*r[::-1])
    else:
        print(*r)



Measured memory_bytes: 5972
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;

int add( int x, int y ){
	return (x + y) % mod;
}

int dp[3010][3010][2], n, m, f, t;
ll sol;

int main(){
	scanf("%d %d", &n, &m);
	for ( int i = 1; i <= n; i++ )
		dp[0][i][0] = 1;
	dp[0][0][1] = 1;
	for ( int i = 0; i < m; i++ )
		for ( int j = 0; j <= n; j++ )
			for ( int k = 0; k < 2; k++ ){
				if ( j > 0 ) dp[i + 1][j][k | (j == 1)] += dp[i][j][k];
				if ( j > 0 ) dp[i + 1][j][k | (j == 1)] %= mod;
				if ( j > 0 ) dp[i + 1][j-1][k | (j == 1)] += dp[i][j][k];
				if ( j > 0 ) dp[i + 1][j-1][k | (j == 1)] %= mod;
				if ( j < n ) dp[i + 1][j][k] += dp[i][j][k];
				if ( j < n ) dp[i + 1][j][k] %= mod;
				if ( j < n ) dp[i + 1][j+1][k] += dp[i][j][k];
				if ( j < n ) dp[i + 1][j+1][k] %= mod;
			}
	for ( int i = 0; i <= n; i++ )
		sol += dp[m][i][1];
	printf("%lld\n", sol % ll(mod));
	
	return 0;
}


Measured memory_bytes: 70784
function Main(input) {
    var s = input;
	var sum = 0;
	for(var i=0; i<s.length; i++){
		sum+=Number(s[i]);
	}
	if(Number(s) % sum == 0){
		console.log('Yes');
	} else {
		console.log('No');
	}
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
import java.io.*;

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

		try {
			while (!(buf = br.readLine()).equals("0")) {
				int n = Integer.parseInt(buf);
				int scan[][] = new int[n][n];
				int x = 0;
				int y = 0;
				int p = 1;
				boolean flag = false;
				for (int i=0;i<n;i++) {
					if (flag) {
						x = 0;y = i;
						for (int j=0;j<=i;j++) {
							scan[x][y] = p++;
							x++;y--;
						}
						flag = false;
					} else {
						x = i;y = 0;
						for (int j=0;j<=i;j++) {
							scan[x][y] = p++;
							x--;y++;
						}
						flag = true;
					}
				}
				for (int i=n-2;i>=0;i--) {
					if (flag) {
						x = n-i-1;y = n-1;
						for (int j=0;j<=i;j++) {
							scan[x][y] = p++;
							x++;y--;
						}
						flag = false;
					} else {
						x = n-1;y = n-i-1;
						for (int j=0;j<=i;j++) {
							scan[x][y] = p++;
							x--;y++;
						}
						flag = true;
					}
				}
				System.out.println("Case "+count+":");
				for (int i=0;i<n;i++) {
					for (int j=0;j<n;j++) System.out.printf("%3d",scan[i][j]);
					System.out.println("");
				}
				count++;
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 19052
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
using namespace std;

int main(){
  int X,D;
  cin >> X >> D;
  int box[X][D];
  for(int i = 0;i < X;i++){
    for(int j = 0;j < D;j++){
      cin >> box[i][j];
    }
  }
  //cout << "N" << endl;
  long long len = 0;
  int ans = 0;
  for(int i = 0;i < X;i++){
    for(int j = i + 1;j < X;j++){
      len = 0;
      for(int l = 0;l < D;l++){
        int diff = abs(box[i][l] - box[j][l]);
        len += diff * diff;
      }
      for(int l = 0;l <= len;l++){
        if(l*l == len){
          ans++;
        }
      }
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3572
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <numeric>
#include <string>
#include <bitset>
#include <functional>

using ld = long double;
using vld = std::vector<ld>;
using vvld = std::vector<vld>;
using vvvld = std::vector<vvld>;
using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
using pll = std::pair<ll, ll>;
using vpll = std::vector<pll>;
using str = std::string;
using vstr = std::vector<str>;

template<typename T> bool chmin(T a, T &b) { return a < b ? b = a, true : false; }
template<typename T> bool chmax(T a, T &b) { return a > b ? b = a, true : false; }

constexpr ld PI = 3.141592653589793L;
constexpr ld EPS = std::numeric_limits<ld>::epsilon();

ll gcd(ll n, ll m) { return m ? gcd(m, n % m) : n; }
ll lcm(ll n, ll m) { return n / gcd(n, m) * m; }
bool is_prime(ll n) {
    if (n == 1) return false;
    for (ll i = 2; i * i <= n; i++)
        if (n % i == 0) return false;
    return true;
}
ll rpow(ll x, ll n) {
    if (n == 0) return 1;
    ll k = 1;
    for (; n > 1; n /= 2) {
        if (n & 1) k *= x;
        x *= x;
    }
    return k * x;
}
ll modpow(ll x, ll n, ll mod) {
    if (n == 0) return 1;
    ll k = 1;
    for (; n > 1; n /= 2) {
        if (n & 1) (k *= x) %= mod;
        (x *= x) %= mod;
    }
    return k * x % mod;
}
ll modcomb(ll n, ll r, ll mod) {
    if (r < 0 || n < r) return 0;
    chmin(n - r, r);
    ll mul = 1, div = 1;
    for (ll i = 0; i < r; i++) {
        (mul *= n - i) %= mod;
        (div *= i + 1) %= mod;
    }
    return mul * modpow(div, mod - 2, mod) % mod;
}

/*------------------------------------------------------------------------*/

void solve();

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15);

    solve();
}
void solve() {
    str s;
    std::cin >> s;

    std::unordered_map<char, ll> umap;
    for (ll i = 0; i < s.length(); i++)
        umap[s[i]]++;

    if (!!umap['N'] == !!umap['S'] && !!umap['E'] == !!umap['W'])
        std::cout << "Yes" << '\n';
    else
        std::cout << "No" << '\n';
}


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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;
const ll MAX = 3;
ll LIMIT = 35;

ll A[MAX][MAX];
ll x[4] = {0, 1, 0, -1};
ll y[4] = {1, 0, -1, 0};

ll dfs(pll s, ll match, pll prev = pll(-1, -1), ll cnt = 0) {
    if (match == MAX * MAX - 1) {
        return cnt;
    }
    if (LIMIT <= cnt)
        return INF;
    if (LIMIT < cnt + (MAX - s.first - 1) + (MAX - s.second - 1))
        return INF;

    ll ret = INF;
    REP(i, 4) {
        ll nx = x[i] + s.first, ny = y[i] + s.second;
        if (nx < 0 || ny < 0 || nx >= MAX || ny >= MAX)
            continue;
        if (prev.first == nx && prev.second == ny)
            continue;
        ll m = match;
        if (A[nx][ny] == nx * MAX + ny + 1)
            m--;
        else if (A[nx][ny] == s.first * MAX + s.second + 1)
            m++;
        swap(A[s.first][s.second], A[nx][ny]);
        ret = std::min(ret, dfs(pll(nx, ny), m, s, cnt + 1));
        swap(A[s.first][s.second], A[nx][ny]);
    }
    LIMIT = std::min(LIMIT, ret);
    return ret;
}

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

    pll s;
    REP(i, MAX) {
        REP(j, MAX) {
            cin >> A[i][j];
            if (A[i][j] == 0)
                s = pll(i, j);
        }
    }

    ll match = 0;
    REP(i, MAX) {
        REP(j, MAX) {
            ll num = i * MAX + j + 1;
            if (A[i][j] == num)
                match++;
        }
    }

    cout << dfs(s, match) << endl;
    return 0;
}


Measured memory_bytes: 3172
#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;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-9;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;


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

	char a;
	cin >> a;
	if ('A' <= a && a <= 'Z')cout << 'A' << endl;
	else cout << 'a' << endl;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int main(){
	int H,W;
	for(int a=0;a<1000000;a++){
		cin>>H>>W;
		if(H==0&&W==0){
			a=1000000;
		}
		else{
		
		for(int b=0;b<H;b++){
			for(int c=0;c<W;c++){
				if(b==0||b==H-1){
					cout<<"#";
				}
				else if(c==0||c==W-1){
					cout<<"#";
				}
				else{
					cout<<".";
				}
			}
			cout<<endl;
		}
		
		
			cout<<endl;
		
	}
}
}




Measured memory_bytes: 3112
#include <bits/stdc++.h>
#define ll long long
#define maxN 200005
#define mod 1000000007
using namespace std;
int n,k;
ll f[maxN];
int main()
{
    cin>>n>>k;
    for(int i=1;i<=n+1;++i) f[i]=(f[i-1]+(i-1))%mod;

    ll res=0;
    for(int sl=k;sl<=n+1;++sl)
    {
        ll L=f[sl];
        ll R=f[n+1]-f[n+1-sl];
        //cout<<sl<<" "<<L<<" "<<R<<endl;
        res=(res+(R-L+1)+mod)%mod;
    }
    cout<<res;
}


Measured memory_bytes: 5148
N=int(input())
S=input()
ans=0
s="abcdefghijklmnopqrstuvwxyz"
for i in range(1,N):
    T1=S[0:i]
    T2=S[i:N]
    count=0
    for c in s:
        if c in T1 and c in T2:
            count+=1
    ans=max(ans,count)
print(ans)


Measured memory_bytes: 9148
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;
	int m = 100000;
	
	void run() {
		Scanner sc = new Scanner(System.in);
		for(;;) {
			int w = sc.nextInt();
			int h = sc.nextInt();
			if( (w|h) == 0) break;
			int[][][][] dp = new int[h+1][w+1][2][2];
			dp[1][0][0][1] = dp[0][1][1][1] = 1;
			for(int i=1;i<=h;i++) for(int j=1;j<=w;j++) {
				dp[i][j][0][0] = (dp[i][j-1][0][0]+dp[i][j-1][0][1])%m;
				dp[i][j][1][0] = (dp[i-1][j][1][0]+dp[i-1][j][1][1])%m;
				dp[i][j][0][1] = dp[i-1][j][1][0]%m;
				dp[i][j][1][1] = dp[i][j-1][0][0]%m;
//				debug(i, j, dp[i][j]);
			}
			System.out.println( ( dp[h][w][0][0] + dp[h][w][1][0] )%m );
		}
		
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

Measured memory_bytes: 13000
from math import tan, radians, pi

A, B, X = map(int, input().split())

def solve(angle):
    c = A*tan(radians(angle))
    if c <= B:
        max_water = A*B - (A*c/2)
    else:
        d = B*tan(radians(90-angle))
        max_water = B*d/2
    return max_water >= X/A

ok = 0
ng = 90
for i in range(30):
    mid = (ok+ng)/2
    # print(mid, angle_to_max_water(mid))
    if solve(mid):
        ok = mid
    else:
        ng = mid
    # print(l, r)

print(ok)

Measured memory_bytes: 3064
# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-

import itertools


def main():
    N = int(input())
    D = list(map(int, input().split()))
    result = 0
    comb = list(itertools.combinations(D, 2))
    for a, b in comb:
        result += a * b
    print(result)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a: usize = read();
    let b: usize = read();
    println!("{}", a - b + 1);
}


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

using namespace std;

int main(void) {
  int N, M;
  cin >> N >> M;
  int l = 1;
  int r = N;

  for (int i = 0; i < M; ++i) {
    int L, R;
    cin >> L >> R;
    l = max(l, L);
    r = min(r, R);
  }
  cout << max(0, r - l + 1) << endl;
  return 0;
}


Measured memory_bytes: 3640
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);

		String s=sc.next();
		
		System.out.println(s.replaceAll("[a-z]", "x"));
	}
}

Measured memory_bytes: 24020
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <limits>
#include <bits/stdc++.h>
using namespace std;
long long x,y;
int gcd(int x,int y){
    if(y==0){
        return x;
    }else{
        return gcd(y,x%y);
    }
    
}
int main(){
    while(cin >> x >> y){
        cout << gcd(x,y) << " "<< x*y/gcd(x,y) <<endl;

    }
        
}



Measured memory_bytes: 2988
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9 + 7;
int main() {
	int N;
	cin >> N;
	for (int i = 1; i <= N; i++) {
		int x = i * 1.08;
		if (x == N) {
			cout << i << endl;
			return 0;
		}
	}
	cout << ":(" << endl;
}


Measured memory_bytes: 256
def num_divisors_table(n):
    table = [0] * (n + 1)
    
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
    
    return table
n=int(input())
print(sum(num_divisors_table(n-1)))


Measured memory_bytes: 16700
fn check(marutas: &Vec<f64>, size: usize, k: usize) -> bool {
    let size = size as f64;
    let mut t = 0;
    for &m in marutas {
        if m > size {
            t += (m / size).floor() as usize;
        }
        // m をsize以下にしたい
    }
    // println!("{:?}", (t, size));
    t <= k
}

fn solve() {
    let (n, k): (usize, usize) = (read::<usize>(), read::<usize>());
    let mut a: Vec<f64> = vec![];
    let mut ok: f64 = 0.0;
    for _ in 0..n {
        let v = read();
        a.push(v);
        ok = ok.max(v);
    }
    let mut ok = ok as usize;
    let mut no = 0;
    while ok - no > 1 {
        let m = (ok + no) / 2;
        if check(&a, m, k) {
            ok = m;
        } else {
            no = m;
        }
    }
    println!("{}", ok);
}

fn main() {
    let stack_size = 104_857_600;
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}

// =========
#[allow(unused_imports)]
use std::cmp::{max, min, Reverse};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};
#[allow(unused_imports)]
use std::process::exit;

#[allow(dead_code)]
const MOD: usize = 1000000007;

fn read<T: std::str::FromStr>() -> T {
    use std::io::Read;
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// =========


Measured memory_bytes: 3044
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(v) v.begin(), v.end()
#define revall(v) v.rbegin(), v.rend()
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){ if(y<h && y>=0 && x<w && x>=0) return true; return false; }
template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true; } return false; }






int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,x;cin >> n >> x;
	vector<ll> a(n);
	rep(i,n) cin >> a.at(i);
	ll ans = 0;
	rep(i,n - 1){
		ll t = a.at(i) + a.at(i + 1) - x;
		if(t <= 0) continue;
		ans += t;
		if(t > a.at(i + 1)){
			a.at(i + 1) = 0;
		}
		else a.at(i + 1) -= t;
	}
	cout << ans << endl;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdio>
using namespace std;
int bin[3];
char s[100000+10];
int main(){
	cin>>s;
	for(int i=0;i<strlen(s);i++)
		bin[s[i]-'a']++;
	int Min=min(bin[0],min(bin[1],bin[2]));
	bin[0]-=Min;
	bin[1]-=Min;
	bin[2]-=Min;
	if(bin[1]>=2 || bin[2]>=2 || bin[0]>=2)printf("NO\n");
	else printf("YES\n");
	return 0;
}

Measured memory_bytes: 384
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Scanner;

public class Main {

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

	public static void main(String[] arg) {
		while (true) {
			int N = sc.nextInt();
			if (N == 0) break;
			LinkedList<Segment> list = new LinkedList<Segment>();
			list.add(new Segment(-1, 0));
			list.add(new Segment(-2, 1000000001));
			for (int i = 0; i < N; ++i) {
				char command = sc.next().charAt(0);
				if (command == 'W') {
					int I = sc.nextInt();
					int S = sc.nextInt();
					ListIterator<Segment> itr = list.listIterator();
					Segment cur = itr.next();
					while (S > 0) {
						Segment next = itr.next();
						if (cur.i == -1) {
							if (next.pos - cur.pos <= S) {
								cur.i = I;
								S -= next.pos - cur.pos;
							} else {
								itr.previous();
								itr.previous();
								itr.add(new Segment(I, cur.pos));
								cur.pos += S;
								S = 0;
							}
						}
						cur = next;
					}
				} else if (command == 'D') {
					int I = sc.nextInt();
					ListIterator<Segment> itr = list.listIterator();
					while (itr.hasNext()) {
						Segment cur = itr.next();
						if (cur.i == I) {
							cur.i = -1;
							itr.previous();
							if (itr.hasPrevious()) {
								Segment prev = itr.previous();
								itr.next();
								itr.next();
								if (prev.i == -1) {
									itr.remove();
								}
							} else {
								itr.next();
							}
							if (itr.hasNext() && itr.next().i == -1) {
								itr.remove();
							}
						}
					}
				} else {
					int P = sc.nextInt();
					ListIterator<Segment> itr = list.listIterator();
					Segment cur = itr.next();
					while (itr.hasNext()) {
						Segment next = itr.next();
						if (P < next.pos) {
							System.out.println(cur.i);
							break;
						}
						cur = next;
					}
				}
			}
			System.out.println();
		}
	}

	static class Segment {
		int i, pos;

		public Segment(int i, int pos) {
			this.i = i;
			this.pos = pos;
		}
	}

}

Measured memory_bytes: 61496
#include <vector>
#include <map>
#include <set>
#include <sstream>
#include <iostream>
#include <limits>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<pair<int, int>> vii;
typedef stringstream ss;
const int mii = numeric_limits<int>::min();
const int mai = numeric_limits<int>::max();
const ll mil = numeric_limits<long long>::min();
const ll mal = numeric_limits<long long>::max();

#define REP(i, a, b) for(int i=a; i<=b; ++i)
#define RREP(i, a, b) for(int i=a; i>=b; --i)
#define PB(x) push_back(x)
#define MP(x, y) make_pair(x, y)

int main(int argc, char **argv) {
    int n, x, y;
    cin >> n >> x >> y;

    vector<vector<int>> dist(n+1, vector<int>(n+1, mai));

    /*REP(i, 1, n) {
        queue<int> next;
        next.push(i);
        set<int> visited;
        visited.insert(i);
        int currDist = 0;

        while(!next.empty()) {
            int lvlSize = next.size();

            while(lvlSize != 0) {
                int node = next.front();
                if(node != i) {
                    dist[i][node] = currDist;
                    dist[node][i] = currDist;
                }
                next.pop();
                if(node < n && visited.count(node + 1) == 0) {
                    next.push(node + 1);
                    visited.insert(node + 1);
                }
                if(node > 1 && visited.count(node - 1) == 0) {
                    next.push(node - 1);
                    visited.insert(node - 1);
                }
                if(node == x && visited.count(y) == 0) {
                    next.push(y);
                    visited.insert(y);
                }
                if(node == y && visited.count(x) == 0) {
                    next.push(x);
                    visited.insert(x);
                }
                --lvlSize;
            }

            ++currDist;
        }
    }*/

    vector<vector<int>> dists(n+1, vector<int>(n + 1, mai));

    REP(i, 1, n) {
        REP(j, 1, n) {
            int distIJ = min(abs(i-j), min(abs(x-i) + 1 + abs(y-j), abs(y-i) +1 + abs(x-j)));
            dists[i][j] = distIJ;
            dists[j][i] = distIJ;
        }
    }

    map<int, set<pair<int, int>>> dist1;

    REP(i, 1, n) {
        REP(j, 1, n) {
            if(i == j)
                continue;

            dist1[dists[i][j]].insert(MP(min(i, j), max(i, j)));
        }
    }

    REP(i, 1, n-1) {
        cout << (dist1[i].size() > 0 ? dist1[i].size() : 0) << endl;
    }

    return 0;
}

Measured memory_bytes: 125568