akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
int dx9[9]={0,1,0,-1,1,-1,1,0,-1};
int dy9[9]={0,1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;
// << fixed << setprecision
// --------------------------------------
int x, t, n;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n >> x >> t;

  int s;
  if(n % x) s = n / x + 1;
  else s = n / x;
  cout << s * t << endl;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int x=0,y=0;
    for(int i=0;i<s.size();i++){
        x+=s[i]-'0';
        y=y*10+(s[i]-'0');
    }
    if(y%x==0)
        cout<<"Yes";
    else
        cout<<"No";

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  string s, t;
  cin >> s;
  cin >> t;

  int n = 0;
  for (int i = 0; i < 3; i++) {
    if (s[i] == t[i]) {
      n++;
    }
  }

  cout << n << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
						
#define fast_cin() ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define endl '\n'
#define int long long

const int N = 2e5 + 5;

int D, A;
int n;
pair<int, int> p[N];
				
int32_t main() {
	fast_cin();  

	cin >> n >> D >> A;
	for (int i = 1; i <= n; i++) {
		cin >> p[i].first >> p[i].second;
	}
	sort(p + 1, p + n + 1);
	int ans = 0, sum = 0;
	queue<pair<int, int> > q;
	for (int i = 1; i <= n; i++) {
		while (!q.empty() and p[i].first > q.front().first) {
			sum -= q.front().second;
			q.pop();
		}
		int health = p[i].second - sum;
		if (health <= 0) continue;
		int need = (health + A - 1) / A;
		ans += need;
		sum += need * A;	
		q.push({p[i].first + 2 * D, need * A});
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
typedef long long int ll;
#define FOR(i, a, b) for (ll i = (signed)(a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define EREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define MOD 1000000007
#define pb push_back
#define INF 93193111451418101
#define MIN -93193111451418101
#define EPS 1e-11
#define tp(a, b, c) make_tuple(a, b, c)
#define lb(a, b) lower_bound((a).begin(), (a).end(), (b))
#define ub(a, b) upper_bound((a).begin(), (a).end(), (b))
using namespace std;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
template <typename T> void fill_all(T &arr, const T &v) { arr = v; }
template <typename T, typename ARR> void fill_all(ARR &arr, const T &v) {
  for (auto &i : arr) {
    fill_all(i, v);
  }
}
//------------------変数-----------------------//
//-------------------関数----------------------//
int main() {
  ll itr = 0, maxa = 0;
  ll n, a[51];
  vector<P> v;
  cin >> n;
  REP(i, n) {
    cin >> a[i];
    if (maxa < abs(a[i])) {
      maxa = abs(a[i]);
      itr = i;
    }
  }
  if (a[itr] >= 0) {
    REP(i, n) { v.pb(P(itr + 1, i + 1)); }
    REP(i, n - 1) { v.pb(P(i + 1, i + 2)); }
  } else {
    REP(i, n) { v.pb(P(itr + 1, i + 1)); }
    for (ll i = n; i > 1; i--) {
      v.pb(P(i, i - 1));
    }
  }
  cout << v.size() << endl;
  for (auto &i : v) {
    cout << i.first << " " << i.second << endl;
  }
}


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

int h, w;
string map[50];
char ans[50][50];

int main() {
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		cin >> map[i];
	}

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (map[i][j] == '#') {
				ans[i][j] = '#';
			}
			else {
				int count = 0;
				for (int k = -1; k <= 1; k++) {
					for (int l = -1; l <= 1; l++) {
						if (i + k >= 0 && i + k <= h - 1 && j + l >= 0 && j + l <= w - 1 && map[i + k][j + l] == '#') {
							count++;
						}
					}
				}
				ans[i][j] = '0'+count;
			}
		}
	}

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cout << ans[i][j];
		}
		cout << endl;
	}
}

Measured memory_bytes: 380
using System;
using System.Collections.Generic;
using System.Runtime;
using System.Numerics;
using System.Linq;

namespace ABC153
{
    class Program
    {
        static void Main(string[] args)
        {

            ulong h = ulong.Parse(Console.ReadLine());
            ulong ans = 0;
            ulong c = 1;
            while (h>=1)
            {
                h = h / 2;
                ans += c;
                c *= 2;
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 11220
// Problem : D - Prediction and Restriction
// Contest : AtCoder Beginner Contest 149
// URL : https://atcoder.jp/contests/abc149/tasks/abc149_d
// Memory Limit : 1024.000000 MB 
// Time Limit : 2000.000000 milisec 
// Powered by CP Editor (https://github.com/coder3101/cp-editor2)

		/*Saurav Paul*/
#include<bits/stdc++.h>
using namespace std;

#define ll 					  long long int
#define boost		          ios_base::sync_with_stdio(0);
#pragma GCC optimize("O3")
#define loop(i,a,b)           for(ll i=a;i<=b;++i)
#define eb                    emplace_back
#define itoc(c)               ((char)(((int)'0')+c))
#define ctoi(c)               ((int)(((int)c)-'0'))
#define all(p)                p.begin(),p.end()
#define bug()				  debug() <<

///////////////////////

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef PAUL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define dbg(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#ifdef ONLINE_JUDGE
#define cerr if (false) cerr
#endif
int main() ;
void file(){
	#ifdef PAUL
		freopen("in.txt","r",stdin);
		//freopen("out.txt","w",stdout);
	#endif
}
void time(){
	#ifdef PAUL
		cerr << "\nTime elapsed: " << (double)(1.0 * (double)clock() / CLOCKS_PER_SEC) << " s.\n";
	#endif
}
///////////////////////
const int INF = 1e9 + 90;
const ll LINF = 1e18 + 90 ;
using pii = pair<int,int >;
using vec = vector<int> ;

int main()
{
     boost ;
     int n , k ; cin >> n >> k ;
     int r , s, p ; cin >> r >> s >> p ;
     string game ,S=string(n,'x'); cin >> game ;
     int ans = 0 ;
     for(int i = 0 ; i < n ;i ++){
             if(game[i] == 'r'){
                 if(i-k >= 0 && S[i-k]=='p'){
                     S[i] = 'x';
                 }
                 else ans += p, S[i] = 'p' ;
             }
             if(game[i] == 's'){
                 if(i-k >= 0 && S[i-k]=='r'){
                     S[i] = 'x';
                 }
                 else ans += r , S[i] = 'r';                 
             }
             if(game[i] == 'p'){
                 if(i-k >= 0 && S[i-k]=='s'){
                     S[i] = 'x';
                 }
                 else ans += s, S[i] ='s' ;                 
             }
    }
    bug() dbg(S) ;
    cout << ans << endl ;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include <bits/stdc++.h>
#include <utility>
#include <iomanip>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;

#define ld long double
#define ll long long

map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

const int N_MAX=100100;
vector<int> g[N_MAX];
int dp[N_MAX];
int N,M;
bool used[N_MAX];

int dfs(int s){
  if(used[s]) return dp[s];
  used[s]=true;
  int ret=0;
  for(auto t:g[s]){
    ret=max(ret,dfs(t)+1);
  }
  return dp[s]=ret;
}


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

  cin >> N >> M;

  int x[N_MAX],y[N_MAX];
  for(int i=0;i<N_MAX;i++){
    used[i]=false;
  }

  /*for(int i=0;i<N_MAX;i++){
    for(int j=0;j<N_MAX;j++){
      x[i][j]=0;
      //if(i==j)x[i][j]==1;
    }
  }*/


  for(int i=0;i<N_MAX;i++){
    dp[i]=0;
  }
  //int x,y;
  for(int i=0;i<M;i++){
    cin >> x[i] >> y[i];
    x[i]--;
    y[i]--;
    g[x[i]].push_back(y[i]);
  }

  int ans=0;
  for(int i=0;i<N;i++){
    ans=max(ans,dfs(i));
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 9088
#include "bits/stdc++.h"
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr_inv(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define rep(i,n) repr(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define MOD 1000000007
#define PI 3.1415926535
using namespace std;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
int main(void)
{
	int a, b, c, d, ans=0;

	cin>>a>>b>>c>>d;

	vector<bool> aa(100, false), bb(100, false);

	repr(i, a, b) aa[i]=true;

	repr(i, c, d) bb[i]=true;

	rep(i, 100){
		if(aa[i]&&bb[i]) ans++;
	}
	cout<<ans<<endl;
}

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

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

    map<int,int> mp;
    rep(i,8) mp[i] = -1;
    rep(i,n){
        int x,y;
        cin >> x >> y;
        mp[x] = y;
    }

    vector<int> v(8);
    rep(i,8) v[i] = i;

    vector<vector<char> > ans(8,vector<char>(8,'.'));
    do{
        bool flag = true;
        for(int i = 0; i < 8; i++){
            if(mp[i] == -1) continue;
            else {
                if(mp[i] != v[i]){
                    flag = false;
                    break;
                }
            }
        }

        for(int i = 0; i < 8; i++){
            for(int j = i + 1; j < 8; j++){
                if(j - i == abs(v[j] - v[i])) {
                    flag = false;
                    break;
                }
            }
        }

        if(flag) {
            for(int i = 0; i < 8; i++){
                ans[i][v[i]] = 'Q';
            }
            break;
        }
    } while(next_permutation(v.begin(),v.end()));

    rep(i,8) {
        rep(j,8){
            cout << ans[i][j];
        }
        cout << endl;
    }
}



Measured memory_bytes: 3124
#include <stdio.h>
#include <algorithm>

int main()
{
    int n;
    int a[200000];
    scanf("%d",&n);
    for(int i=0;i<n;i++)scanf("%d",&a[i]);
    std::sort(a,a+n);
    for(int i=0;i<n-1;i++) if(a[i]==a[i+1])
    {
        printf("NO\n");
        return 0;
    }
    printf("YES\n");
}

Measured memory_bytes: 896
from typing import List, Any


def read_int() -> int:
    return int(input().strip())


def read_ints() -> List[int]:
    return list(map(int, input().strip().split(' ')))


def solve() -> Any:
    a, b, c, d = read_ints()
    return max(a*d, a*c, b*c, b*d)


if __name__ == '__main__':
    print(solve())


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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
 
//Write From this Line

//const ll mod = 1e9+7;
//const ll mod = 998244353;

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

int main()
{
	int h, w;
	cin >> h >> w;

	int sh, sw;
	cin >> sh >> sw;
	int gh, gw;
	cin >> gh >> gw;
	sh--, sw--, gh--, gw--;

	vector<string> field(h);
	rep(i,h) cin >> field[i];

	vector<vector<bool>> seen(h, vector<bool> (w,false));
	vector<vector<int>> dist(h,vector<int>(w,inf));

	queue<P> q;
	queue<P> nq;
	q.push({sh,sw});
	nq.push({sh,sw});
	dist[sh][sw] = 0;
	seen[sh][sw] = true;
	while(1){
		bool u = true;
		while(!q.empty()){
			u = false;
			// BFSでコスト0で行けるところをマーキングする
			int y = q.front().first; 
			int x = q.front().second;
			nq.push({y,x});
			q.pop();
			rep(i,4){
				int ny = y + dy[i];
				int nx = x + dx[i];
				if(ny < 0 || ny >= h || nx < 0 || nx >= w) continue;
				if(seen[ny][nx]) continue;
				if(field[ny][nx] == '#') continue;

				q.push({ny,nx});
				seen[ny][nx] = true;
				dist[ny][nx] = dist[y][x];
			}
		} 
		while(!nq.empty()) {
			u = false;
			// コスト0で行けるところはマーキング済み。
			// nq からワープを使って行けるとこを登録していく
			int y = nq.front().first; 
			int x = nq.front().second;
			nq.pop();

			for(int i = -2; i <= 2; i++){
				for(int j = -2; j <= 2; j++){
					int ny = y + i;
					int nx = x + j;
					if(ny < 0 || ny >= h || nx < 0 || nx >= w) continue;
					if(seen[ny][nx]) continue;
					if(field[ny][nx] == '#') continue;

					dist[ny][nx] = dist[y][x] + 1;
					seen[ny][nx] = true;
					q.push({ny,nx});
				}
			}
		}
		if(u) break;
	}
	int ans = dist[gh][gw];
	if(ans == inf) ans = -1;
	cout << ans << endl;

	//rep(i,h){
	//	rep(j,w){
	//		cout << dist[i][j] << " ";
	//	}
	//	cout << endl;
	//}
}


Measured memory_bytes: 9688
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
//cout << fixed << setprecision(17) << res << endl;
const ll MOD = 998244353;

int main() {
    ll h, n;
    cin >> h >> n;
    for (ll i = 0 ; i < n; ++i) {
        ll a;
        cin >> a;
        h -= a;
    }
    if (h <= 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
a, b, c, x = 4.times.map { gets.to_i }
cnt = 0
(0..a).each do |i|
    (0..b).each do |j|
        (0..c).each do |k|
            cnt += 1 if i * 500 + j * 100 + k * 50 == x
        end
    end
end

puts cnt


Measured memory_bytes: 1788
n,t=map(int,input().split())
time=list(map(int,input().split()))
time.sort(reverse=True)
ans=0
be=0

for i in range(n):
  if i==0:
    pass
  else:
    if be-time[i]<t:
      ans+=be-time[i]
    else:
      ans+=t
  be=time[i]
    
print(ans+t)

Measured memory_bytes: 26836
import java.lang.Math.*

fun main(args: Array<String>) {
    val n = readInt()
    val a = readIntList()

    val b = mutableListOf<Int>()
    n.rep {
        b.add(0)
    }

    var M = 0

    n.rep(start = 1) {
        val m = n - it + 1
        val div = n / m

        var sum = 0
        div.rep(start = 1) {
            sum += b[m * it - 1]
        }

        if (sum % 2 == a[m - 1]) {
            b[m - 1] = 0
        } else {
            b[m - 1] = 1
            M++
        }
    }

    println(M)
    b.forEachIndexed { index, it ->
        if (it == 1) {
            print(index + 1)
            print(" ")
        }
    }
}

fun readList() = readLine()!!.split(' ')
fun readInt() = readLine()!!.split(' ').map(String::toInt).first()
fun readIntList() = readList().map(String::toInt)
fun readLongList() = readList().map(String::toLong)
fun readDoubleList() = readList().map(String::toDouble)

fun readPair(): Pair<String, String> {
    val splite = readLine()!!.split(' ')
    return Pair(splite[0], splite[1])
}

fun <T> List<T>.copy() = this.map { it }

// 速度のためforEachは避ける
inline fun Int.rep(start: Int = 0, body: (Int) -> Unit) {
    for (i in start until this + start) {
        body(i)
    }
}

inline fun Long.rep(start: Long = 0, body: (Long) -> Unit) {
    for (i in start until this + start) {
        body(i)
    }
}

// 約数のList
fun divisor(value: Long): List<Long> {
    val max = sqrt(value.toDouble()).toLong()
    return (1..max)
        .filter { value % it == 0L }
        .map { listOf(it, value / it) }
        .flatten()
        .sorted()
}

// 範囲内の素数を取得
// fromだけ指定すると戻り値の個数で素数判定ができる
fun prime(from: Long, to: Long = from): List<Long> {
    return (from..to).filter { i ->
        val max = Math.sqrt(i.toDouble()).toLong()
        (2..max).all { j -> i % j != 0L }
    }
}

// 素因数分解
fun decom(value: Long): List<Long> {
    if (value == 1L) return listOf(1)
    val max = Math.sqrt(value.toDouble()).toLong()
    return prime(2, max).filter { value % it == 0L }
}

// 最大公約数
fun gcd(a: Long, b: Long): Long {
    return if (a % b == 0L) b else gcd(b, a % b)
}

// 文字列を入れ替え
fun swap(base: String, a: String, b: String): String {
    return base.map {
        when (it) {
            a.toCharArray()[0] -> b
            b.toCharArray()[0] -> a
            else -> it.toString()
        }
    }.joinToString()
}

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

using namespace std;

vector<int> A{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main(){
	int n;
	cin >> n;
	cout << A[n - 1];
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    
    char s[6];
    
    scanf("%s",s);
    // 出力
  if(s[0] == 'S'){
	printf("Cloudy");
  }else if(s[0] == 'C'){
    printf("Rainy");
    
  }else if(s[0] == 'R'){
	printf("Sunny");

  }
 
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<stdlib.h>
#include<math.h>
#include<algorithm>
#include<string.h>
using namespace std;

int main(){
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL); 

	long long  n; cin >> n; long long mult = 1;
	for (int i = 1; i <=n; i++){
		mult = (i% 1000000007 * mult% 1000000007)%1000000007;
		
	}
	cout << mult << endl;
	return 0;
}




Measured memory_bytes: 3640
#include <iostream>
#include <vector>

using namespace std;

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

    vector<int> A(N), B(N), C(N-1);
    for (int i = 0; i < N; i++) cin >> A[i];
    for (int i = 0; i < N; i++) cin >> B[i];
    for (int i = 0; i < N - 1; i++) cin >> C[i];

    int sum = B[A[0] - 1];
    for (int i = 1; i < N; i++) {
        sum += B[A[i] - 1];
        if (A[i - 1] + 1 == A[i]) sum += C[A[i - 1] - 1];
    }

    cout << sum << endl;
}


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

int main(){
    int N,K;
    cin >> N >> K;
    int h[N] = {};
    for(int i = 0; i < N; i++){
        cin >> h[i];
    }

    int ans = 0;
    for(int i = 0; i < N; i++){
        if(h[i] >= K){
            ans++;
        }
    }

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

Measured memory_bytes: 640
#include<stdio.h>
int main(void)
{
  int A[100],N,i,temp,j,count=0;
  
  scanf("%d",&N);
  for(i=0;i<N;i++){scanf("%d",&A[i]);}
  for(j=0;j<N;j++)
    {
  for(i=N-1;i>0;i--)
    {      if(A[i-1]>A[i])
	{
	  temp=A[i-1];
	  A[i-1]=A[i];
	  A[i]=temp;
	  count++;
	}
    }
    }
  for(i=0;i<N;i++){printf("%d",A[i]); if(i != N-1){printf(" ");}}
  printf("\n%d\n",count);
  return 0;
}

Measured memory_bytes: 604
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

    public String next() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    long n = sc.nextLong();
    if (n == 1) {
      System.out.println(0);
      return;
    }
    long sqrt = 2L;
    while (sqrt * sqrt <= n) {
      sqrt++;
    }
    int count = 0;
    for (long i = 2L; i <= sqrt; i++) {
      if (n == 1L) break;
      if (n % i != 0) continue;
      int z = 0;
      while (n % i == 0) {
        z++;
        n /= i;
      }
      int c = 1;
      while (c <= z) {
        z -= c;
        c++;
        count++;
      }
    }
    if (n != 1L) count++;
    System.out.println(count);
  }
}

Measured memory_bytes: 32664
#include <iostream>
using namespace std;
typedef long long ll;
const ll maxn = 1e5 + 5;
ll n,a,b,t;
ll h[maxn];
bool ok(ll mid)
{
	ll need = 0;
	for(ll i = 0;i < n; ++i)
	{
		need += (max(0ll,h[i] - b * mid) + t - 1ll) / t;
	}
	return need <= mid;
}
int main()
{
	cin>>n>>a>>b;
	t = a - b;
	for(ll i = 0;i < n; ++i)
	{
		cin>>h[i];
	}
	ll left = 0ll,right = 1000000005ll;
	while(left + 1 < right)
	{
		ll mid = (left + right) >> 1;
		if(ok(mid))
		{
			right = mid;
		}
		else
		{
			left = mid;
		}
		// printf("left = %lld,right = %lld\n",left,right);
	}
	cout<<right<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
const int INF=2e9+1;
int n,f[10001];
struct data {
    int x,y;
}a[10001];
bool cmp(data p,data q) {
    return p.x+p.y<q.x+q.y;
}
int main() {
    scanf("%d",&n);
    for (int i=1;i<=n;i++)
        scanf("%d%d",&a[i].x,&a[i].y);
    sort(a+1,a+n+1,cmp);
    for (int i=0;i<=n+1;i++) f[i]=INF;
    f[0]=0;
    for (int i=1;i<=n;i++) {
        for (int j=i;j>=1;j--)
            if (f[j-1]<=a[i].x)
                f[j]=min(f[j],f[j-1]+a[i].y);
    }
    for (int i=1;i<=n+1;i++)
        if (f[i]==INF) {
            printf("%d\n",i-1);
            return 0;
        }
    return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
a=[]
for i in range(m+1):
    a.append(0)
for i in range(n):
    b= list(map(int,input().split()))
    for j in range(1,b[0]+1):
        a[b[j]]+=1
c=0
for i in range(len(a)):
    if a[i]==n:
        c+=1
print(c)


Measured memory_bytes: 3060
import java.util.*;
import java.lang.*;
import java.io.*;

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

        int A = sc.nextInt();
        int B = sc.nextInt();
        int counter = 0;

        for(int i = A; i <= B; i++){
            String str = String.valueOf(i);
            StringBuffer rstr = new StringBuffer(str);
            rstr.reverse();

            if(str.equals(rstr.toString())){
                counter++;
            }
        }


        System.out.println(counter);
    }
}

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

#define all(v) (v).begin(), (v).end()
#define sortv(v) sort(all(v))
#define uniqv(v) (v).erase(unique(all(v)), (v).end())
#define pb push_back
#define FI first
#define SE second
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define test 1
#define TEST if(test)

using namespace std;

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

const int MOD = 1000000007; // 998244353
const int INF = 2e9;
const ll INFLL = 1e18;
const int MAX_N = 200000;

int N, Q;
vector<int> gp[MAX_N+1];

int p[MAX_N+1];
int cost[MAX_N+1];

void dfs(int x){
	for(int i : gp[x]){
		if(p[x]==i)	continue;
		p[i] = x;
		cost[i]+=cost[x];
		dfs(i);
	}
}


int main(){
	cin>>N>>Q;
	for(int i=0; i<N-1; i++){
		int a, b;
		scanf("%d%d", &a, &b);
		gp[a].pb(b); gp[b].pb(a);
	}
	dfs(1);
	for(int i=0; i<Q; i++){
		int a, b;
		scanf("%d%d", &a, &b);
		cost[a]+=b;
	}
	dfs(1);
	for(int i=1; i<=N; i++){
		printf("%d ", cost[i]);
	}
	return 0;
}


Measured memory_bytes: 24320
#include<iostream>
using namespace std;
int main(){
  
  int a,b;
  char op;
  while (1){
  cin >> a >> op >> b ;
    if (op=='+'){
      cout << a+b << endl;
    }else if(op=='-'){
      cout << a-b << endl;
    }else if(op=='*'){
      cout << a*b << endl;
    }else if(op=='/'){
      cout << a/b << endl;
    }else if(op=='?')
      break;
  }

  
    
    
    
  
    
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(first,second) '(' << first << ',' << second << ')'
ll MOD = 1000000007;
ll INF = 214748364700000000;
long double EPS = 1e-11;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<pair<ll,ll>>>;

ll A[1010][1010];
ll p[1010];
bool done[1010];

int main(){
   ll N;cin >> N;
   rep(i,N) rep(j,N-1){
       cin >> A[i][j];
       A[i][j]--;
   }
   ll ans = 0,cnt = 0;
   rep(i,N*(N-1)/2){
       ans++;
       bool update = 1;
       fill(done,done+1000,true);
       rep(j,N-1) FOR(k,j+1,N){
           if(A[j][p[j]] == k && A[k][p[k]] == j && done[j] && done[k]){
               p[j]++;
               p[k]++;
               done[j] = 0;
               done[k] = 0;
               cnt++;
               update = 0;
           }
       }
       /*rep(j,N) cout << p[j] << ' ';
       cout << endl;*/
       if(i > 4000){
           cout << N * (N-1) / 2 << endl;
           return 0;
       }
       if(cnt == N * (N-1) / 2) break;
       if(update){
           cout << -1 << endl;
           return 0;
       }
   }
   cout << ans << endl;
}


Measured memory_bytes: 8192
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define mod 1000000007
#define inf 1e18
#define inp(arr,n) for(int i=0;i<n;i++) cin>>arr[i]
#define fr(i,a,b) for(int i=a;i<=b;i++)
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int T=1;
    while (T--) {
        int n,k;
        cin>>n>>k;
        int arr[n];
        inp(arr,n);
        sort(arr,arr+n);
        int sum=0;
        fr(i,0,k-1) sum+=arr[i];
        cout<<sum<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#ifdef LOCAL
#include<debug.h>
#else
#define db(...) 21
#endif
#define sz(a) ((int)(a).size())
#define found(m,x) ((m).find(x)!=(m).end())
#define uset unordered_set
#define umap unordered_map
#define a(x) (x).begin(),(x).end()
#define fo(i,n) for(int i=0;i<(int)n;i++)
#define Fo(i,k,n) for(int i=k;k<n?i<=(int)n:i>=(int)n;k<n?i++:i--)
#define input(v,n) fo(i,n)cin>>v[i]
using vi = vector<int>;
using vpi = vector<pair<int,int>>;
using pi = pair<int,int>;

const int nax = 1e7+2;
const int mod = 1e9+7; //1e9+2667 :: 0xcf : inf, 0xc0 -inf
const int inf = numeric_limits<int> :: max() - (int)9e6;
// ===================== MANASH =================== //
int d[nax];
void test() {
	int n;
	cin >> n;
	for( int i = 1; i <= n; i++) {
		for( int j = i; j <= n; j+=i) {
			d[j]++;
		}
	}
	int ans = 0;
	for( int i = 1; i <= n; i++) {
		ans += i*(d[i]);
	}

	cout << ans;

}

signed main() {

	ios_base :: sync_with_stdio(false);
	cin.tie(NULL);

	#ifdef LOCAL
	freopen("input.txt","r",stdin);
	#endif

	int T = 1;
	//cin >> T;
	while(T--) {
		test();
		cout << "\n";
	}
	return 0;

}

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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

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

    int n, m, l;
    cin >> n >> m >> l;
    vector<vector<P>> sub(5); // sub[i] := i曜日の(mask, 幸福)
    while (m--)
    {
        int d, a, k, t;
        cin >> d >> a >> k >> t;
        a--;
        int mask = 0;
        for (int i = a; i < a + k; i++)
            mask |= 1 << i;
        sub[d].push_back(P(mask, t));
    }
    // w[i][j] := i曜日にj個使うときの幸福最大
    vector<vector<int>> w(5, vector<int>(l + 1, -INF));
    for (int i = 0; i < 5; i++)
    {
        // dp[i][j] := i個でmask jでの幸福最大
        vector<vector<int>> dp(l + 1, vector<int>(1 << n, -INF));
        dp[0][0] = 0;
        for (auto p : sub[i])
        {
            int mask = p.first, t = p.second;
            for (int j = l - 1; j >= 0; j--)
            {
                for (int k = (1 << n) - 1; k >= 0; k--)
                {
                    if (dp[j][k] == -INF)
                        continue;
                    if (k & mask)
                        continue;
                    dp[j + 1][k | mask] = max(dp[j + 1][k | mask], dp[j][k] + t);
                }
            }
        }
        for (int j = 0; j <= l; j++)
        {
            for (int k = 0; k < (1 << n); k++)
            {
                w[i][j] = max(w[i][j], dp[j][k]);
            }
        }
    }
    // ret[i][j] := i日目まででj科目取る時の最大値
    vector<vector<int>> ret(5, vector<int>(l + 1, -INF));
    for (int j = 0; j <= l; j++)
        ret[0][j] = w[0][j];
    for (int i = 1; i < 5; i++)
    {
        for (int j = 0; j <= l; j++)
        {
            for (int k = 0; k <= l; k++)
            {
                if (j - k < 0)
                    continue;
                ret[i][j] = max(ret[i][j], ret[i - 1][j - k] + w[i][k]);
            }
        }
    }
    int ma = 0;
    for (int j = 0; j <= l; j++)
        ma = max(ma, ret[4][j]);
    cout << ma << endl;
}



Measured memory_bytes: 3272
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf3 = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;


void main() {
    int n, a, b;
    scan(n, a, b);
    int mx = min(a, b);
    int mn = max(0, a + b - n);
    writeln(mx, " ", mn);
}









void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
//const ll MOD=998244353;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, -1, 1};

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

/*複数の整数に対する素因数分解、素数判定*/

//エラトステネスの篩
//前処理でmake_eratos() デフォルトで150msくらい
const int MAX_for_eratos=10000100;
int eratos[MAX_for_eratos];
int prime_number_list[MAX_for_eratos/2];

void make_eratos(){
  rep(i,MAX_for_eratos) eratos[i]=-1;
  //2の倍数だけ先にやっちゃう
  prime_number_list[0]=2;
  for(int j=2;j<MAX_for_eratos;j+=2) eratos[j]=2; 
  int k=1;
  for(int i=3;i<MAX_for_eratos;i+=2){
    if(eratos[i]>-1) continue;
    prime_number_list[k]=i; k++;
    eratos[i]=i;
    if(i>MAX_for_eratos/i+1) continue;
    for(int j=i*i;j<MAX_for_eratos;j+=i) if(eratos[j]==-1) eratos[j]=i;
  }
  
  return;
}
//osa_k法による素因数分解
//普通の因数分解と同様N==1の時に注意
//前処理make_eratos必要
vector<pair<ll,ll>> prime_factorize(ll N){
  vector<pair<ll,ll>> ret={};
  for(int i=0;N>MAX_for_eratos-100&&prime_number_list[i]*(ll)prime_number_list[i]<=N;i++){
    if(N%prime_number_list[i]!=0) continue;
    ll a=prime_number_list[i];
    ll ex=0;
    while(N%a==0){
      ex++;
      N/=a;
    }
    ret.push_back({a,ex});
  }
  if(N>MAX_for_eratos-100) {ret.push_back({N,1}); return ret;}
  while(N>1){
    ll ex=0;
    ll a=eratos[N];
    while(N%a==0){
      ex++;
      N/=a;
    }
    ret.push_back({a,ex});
  }
  
  return ret;
}

//素数判定
//前処理make_eratos必要
bool is_prime(ll N) {
  if(N==1) return false;
  if(N<=MAX_for_eratos-100) return N==eratos[N];
  else{
    for(int i=0;prime_number_list[i]*(ll)prime_number_list[i]<=N;i++){
      if(N%prime_number_list[i]==0) return false;
    }
    return true;
  }
}

/*終わり*/

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  // cout << fixed << setprecision(15);

  make_eratos();
  vector<ll> vec(100001,0); rep(i,100000) if(i+1!=2&&is_prime(i+1)&&is_prime((i+2)/2)) vec[i+1]=1;
  vector<ll> cum(100002,0); rep(i,100001) cum[i+1]=cum[i]+vec[i];
  
  /*
  rep(i,8){
    if(i!=0) cout<<" ";
    cout<<vec[i];
  }
  cout<<endl;
  */
  
  ll Q; cin>>Q;
  rep(i,Q){
    ll l,r; cin>>l>>r;
    cout<<cum[r+1]-cum[l]<<'\n';
  }
  return 0;
}

Measured memory_bytes: 46300
#include<stdio.h>
long max(long x, long y)
{
    if (x > y)
        return x;
    else
        return y;
}
int main()
{
    long n, k;
    scanf("%ld %ld", &n, &k);
    long ans = 0;
    long i;
    long a, b, c, d;
    if (k != 0)
    {
        for (i = k + 1; i <= n; i++)
        {
            a = n / i;
            b = i - k;
            c = (n % i) + 1;
            if (c != 1)
                d = max(0, c - k);
            else
                d = 0;
            ans += ((a*b) + d);
        }
    }
    else
        ans = n * n;
    printf("%ld\n", ans);
    return 0;
}

Measured memory_bytes: 128
c = []
for i in range(3):
    x = list(map(int, input().split()))
    c.append(x)

ans = 'Yes'
diff_w = [c[0][1]-c[0][0], c[0][2]-c[0][1]]
for i in range(3):
    for j in range(1 ,3):
        if c[i][j] -c[i][j-1] != diff_w[j-1]:
            ans = 'No'
            break
diff_h = [c[1][0]-c[0][0], c[2][0]-c[1][0]]
for i in range(1, 3):
    for j in range(3):
        if c[i][j]-c[i-1][j] != diff_h[i-1]:
            ans = 'No'
            break

print(ans)


Measured memory_bytes: 3064
n=int(input())


# a,b,c=map(int,input().split())

a=list(map(int,input().split()))

flg=True
for i in a:
    if i%2==0:
        if not (i%3==0 or i%5==0):
            flg=False;break
        else:
            flg=True
    


if flg:
    print("APPROVED")
    
else:
    print("DENIED")

Measured memory_bytes: 3060
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
XYC = [input().split() for _ in range(M)]
ans = min(a) + min(b)
for x, y, c in XYC:
  discount_price = a[int(x) - 1] + b[int(y) - 1] - int(c)
  ans = min(ans, discount_price)
print(ans)

Measured memory_bytes: 45728
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace Tasks
{
    public class B
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var K = Scanner.Scan<int>();
            var S = Scanner.Scan<string>();
            var answer = S.Length <= K ? S : (S.Substring(0, K) + "...");
            Console.WriteLine(answer);
        }

        public static class Scanner
        {
            private static Queue<string> queue = new Queue<string>();
            public static T Next<T>()
            {
                if (!queue.Any()) foreach (var item in Console.ReadLine().Trim().Split(" ")) queue.Enqueue(item);
                return (T)Convert.ChangeType(queue.Dequeue(), typeof(T));
            }
            public static T Scan<T>() => Next<T>();
            public static (T1, T2) Scan<T1, T2>() => (Next<T1>(), Next<T2>());
            public static (T1, T2, T3) Scan<T1, T2, T3>() => (Next<T1>(), Next<T2>(), Next<T3>());
            public static (T1, T2, T3, T4) Scan<T1, T2, T3, T4>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>());
            public static (T1, T2, T3, T4, T5) Scan<T1, T2, T3, T4, T5>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>(), Next<T5>());
            public static IEnumerable<T> ScanEnumerable<T>() => Console.ReadLine().Trim().Split(" ").Select(x => (T)Convert.ChangeType(x, typeof(T)));
        }
    }
}


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

int main() {
  int a,b;
  cin >> a >> b;
  if((a + b) % 2 == 0){
    cout << (a + b) / 2 << endl;
  }
  else{
    cout << (a + b) / 2 + 1 << endl;
  }
}

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define int long long
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;

signed main(){
    int x,y;
    cin >> x >> y;
    if(x == 2 || y == 2) cout << "No\n";
    else if((x == 4 || x == 6 || x == 9 || x == 11) && (y == 4 || y == 6 || y == 9 || y == 11)) cout << "Yes\n";
    else if((x == 1 || x == 3 || x == 5 || x == 7 || x == 8 || x == 10 || x == 12) && ( y == 1 || y == 3 || y == 5 || y == 7 || y == 8 || y == 10 || y == 12)) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}

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

int main()
{
	int a, b, c, d = 0 ;
	cin >> a >> b >> c ;
	
	for ( int i = a; i <= b; i++ )
	{
		if ( c % i == 0 )
			d++;
	}
	cout << d << endl;
	
}

Measured memory_bytes: 1164
#include <cstdio>

using namespace std;

int main() {
  int x;
  while (scanf("%d", &x) == 1) {
    int i = 0, ws[10];
    for (int n = 9; n >= 0; n--) {
      int w = 1 << n;
      if (x >= w) {
        x -= w;
        ws[i++] = w;
      }
    }
    while (i >= 2)
      printf("%d ", ws[--i]);
    printf("%d\n", ws[0]);
  }
  return 0;
}

Measured memory_bytes: 0
//libraries
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//namespace
using namespace std;
using namespace __gnu_pbds;

//typedef
//typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

//define
#define i(X) cin>>X;
#define ol(X) cout<<X<<endl;
#define os(X) cout<<X<<" ";
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define line cout<<"\n";
#define pbp(a,b) push_back(make_pair(a,b));
#define vll(A) vector<ll> A;
#define ivt(A,n,p) vector<ll> A(n,p);
#define vst(A) sort(A.begin(),A.end());
#define rvst(A) sort(A.rbegin(),A.rend());
#define forin(i,a,b) for(ll i=a;i<=b;i++)
#define forde(i,a,b) for(ll i=a;i>=b;i--)
#define fio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const long long inf=(long long)1e18;
long long MOD=(long long)(1e9+7);

ll power(ll x,ll y)
{
    if (y == 0)
        return 1;
    ll p = power(x, y/2) % MOD;
    p = (p * p) % MOD;

    return (y%2 == 0)? p : (x * p) % MOD;
}
ll modInverse(ll a)
{
   return power(a,MOD-2);
}

bool p(ll a[],ll n,ll mn,ll k)
{
	forin(i,0,n-1)
	{
		k-=(a[i]+mn-1)/mn-1;
		if(k<0)
		return false;
	}
	return k>=0;
}
int main() 
{
	// #ifndef ONLINE_JUDGE
    //    freopen ("input.txt" , "r" , stdin);
	// 	// freopen ("OUTPUT.txt" , "w" , stdout);
	// #endif
	fio;
	ll testcase=1;
	//cin>>testcase;
	while(testcase--)
	{
		ll n,k;
		cin>>n>>k;
		ll ans=0;
		ll a[n];
		forin(i,0,n-1)
		{
			cin>>a[i];
		}
		ll mn=1,mx=1e9+5;
		while(mn!=mx)
		{
			ll md=(mn+mx)/2;
			if(p(a,n,md,k))
			{
				mx=md;
			}
			else
			{
				mn=md+1;
			}
		}
		cout<<mn<<endl;
	}
	return 0;
}

Measured memory_bytes: 5220
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    int N; cin >> N;
    int field[2][N];

    for(int i=0; i<2; i++){
        for(int j=0; j<N; j++) cin >> field[i][j];
    }

    int ans = 0;
    for(int i=0; i<N; i++){
        int tmp = 0;
        for(int j=0; j<N; j++){
            if(j <= i) tmp += field[0][j];
            if(j >= i) tmp += field[1][j];
        }
        ans = max(ans, tmp);
    }

    cout << ans << endl;
}

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

using namespace std;
typedef long long ll;

#define REP(i, n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i, n) for(ll i=(ll)(n-1);i>=0;i--)
#define FOR(i, a, b) for(ll i=(ll)(a); i<=(ll)(b); i++)
#define RFOR(i, a, b) for(ll i=(ll)(a);i>=(ll)(b); i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

int dp[3000][3000];

signed main()
{
	string s, t;
	cin >> s >> t;
	if(s[0]==t[0])dp[0][0]=1;
	FOR(i, 1, s.size()-1){
		if(t[0]==s[i]){
			dp[i][0]=1;
		}else{
			dp[i][0] = dp[i-1][0];
		}
	}
	FOR(k, 1, t.size()-1){
		if(t[k]==s[0]){
			dp[0][k]=1;
		}else{
			dp[0][k] = dp[0][k-1];
		}
	}
	FOR(i, 1, s.size()-1){
		FOR(k, 1, t.size()-1){
			if(s[i]==t[k]){
				dp[i][k] = dp[i-1][k-1]+1;
			}else{
				dp[i][k] = max(dp[i-1][k], dp[i][k-1]);
			}
		}
	}
	string ans = "";
	int i=s.size()-1, k=t.size()-1;
	while(i>=0 and k>=0){
		if(i==0){
			if(s[i]==t[k]){
				ans = s[i]+ans;
				break;
			}else{
				k--;
			}
		}else if(k==0){
			if(s[i]==t[k]){
				ans = s[i]+ans;
				break;
			}else{
				i--;
			}
		}else{
			if(s[i]==t[k]){
				ans = s[i]+ans;
				i--;k--;
			}else{
				if(dp[i][k-1]>dp[i-1][k]){
					k--;
				}else{
					i--;
				}
			}
		}

	}
	cout << ans << endl;
}


Measured memory_bytes: 38800
A=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(A[int(input())-1])

Measured memory_bytes: 3060
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

void abc_160a();

void abc_161a();

void abc_162a();

void abc_163a();

void abc_164a();

void abc_165a();

int main()
{
  //abc_160a();
  //abc_161a();
  //abc_162a();
  //abc_163a();
  //abc_164a();
  abc_165a();


}

void abc_160a()
{
  string S;
  cin >> S;

  if (S[2] == S[3] && S[4] == S[5]) cout << "Yes\n";
  else cout << "No\n";
}

void swap(int& a, int& b)
{
  int tmp;
  tmp = a;
  a = b;
  b = tmp;
}

void abc_161a()
{
  int x, y, z;
  cin >> x >> y >> z;

  swap(x, y);
  swap(x, z);

  cout << x << " " << y << " " << z << "\n";
}

void abc_162a()
{
  string s;
  cin >> s;
  for (char c : s)
  {
    if (c == '7')
    {
      cout << "Yes\n";
      return;
    }
  }

  cout << "No\n";
}

void abc_163a()
{
  int R;
  cin >> R;

  cout << (double)(2 * R * M_PI);
}

void abc_164a()
{
  int s, w;
  cin >> s >> w;

  if (s <= w) cout << "unsafe\n";
  else cout << "safe\n";
}

void abc_165a()
{
  int k, a, b;
  cin >> k >> a >> b;

  for (int i = a; i <= b; ++i)
  {
    if (i % k == 0)
    {
      cout << "OK\n";
      return;
    }
  }

  cout << "NG\n";
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
 
using namespace std;
 
int main(void) {
 
  long long ans = 0;
  int k, a, b;
  cin >> k >> a >> b;
  for (int i = a; i <= b; i++) {
  	if(i % k == 0) {
    	ans = 1;
    }
    
  }
 
  cout << (ans ? "OK" : "NG") << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
const int maxn = 400400;
vector<pair<int, int> > to[maxn];
long long val[maxn], vis[maxn];
void bad(){
	cout << "No" << endl;
	exit(0);
}
long long mn[2];
void dfs(int u, int d){
	vis[u] = 1;
	mn[d] = min(mn[d], val[u]);
	for(auto nxt : to[u]){
		if(!vis[nxt.first]){
			val[nxt.first] = nxt.second - val[u];
			dfs(nxt.first, d ^ 1);
		} else {
			if(val[nxt.first] != nxt.second - val[u]) bad();
		}
	}
}
int main(){
	int r, c; cin >> r >> c;
	int n; cin >> n;
	for(int i = 0; i < n; i++){
		int x, y, v; cin >> x >> y >> v;
		x--; y--;
		to[x].push_back({r + y, v});
		to[r + y].push_back({x, v});
	}
	for(int i = 0; i < r + c; i++){
		if(!vis[i]){
			mn[0] = 1<<30;
			mn[1] = 1<<30;
			dfs(i, 0);
			if(mn[0] + mn[1] < 0) bad();
		}	
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 23168
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        logic cal = new logic();
        System.out.println(cal.calc());
    }

    public static class logic{
        private double a = 0, b = 0;
        private double ans;
        private int ret;

        private int calc(){
            Scanner sc = new Scanner(System.in);
            a = sc.nextInt();
            b = sc.nextInt();
          	sc.close();
    
            ans = (b - 1) / (a - 1);
            if (ans % 1 != 0) {
                ret = (int)ans + 1;
            }else{
                ret = (int)ans;
            }
            
            return ret;
        }
    }

}

Measured memory_bytes: 21972
#include<iostream>

using namespace std;

int main() {
	int a[2],max=0;
	for (int i = 0; i < 3; i++) {
		cin >> a[i];
		if (max < a[i])max = a[i];
	}
	if (max * 2 == a[0] + a[1] + a[2])cout << "Yes" << endl;
	else cout << "No" << endl;
		return 0;
}

Measured memory_bytes: 256