akhauriyash/Code-Regression huggingface dataset:
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define int long long
#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 LOCAL
~debug() { cerr << '\n'; }
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 imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
const ll MOD = 1e9 + 7 ;
const ll N = 2e5 + 10 ;
const ll INF = 1e18 + 10 ;
const double EPS = 1e-6 ; 
signed main(){
    fastio
    int h , n ; 
    cin >> h >> n ; 
    int sum = 0 ; 
    for(int i = 0; i < n; i++){
        int x ;
        cin >> x ; 
        sum += x ; 
    }
    if ( sum >= h ) {
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
    return 0; 
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
  int a,b;
  char op;
  cin >> a >> op >> b;
  while(op!='?'){
    int c;
    if(op=='+') c=a+b;
    if(op=='-') c=a-b;
    if(op=='*') c=a*b;
    if(op=='/') c=a/b;
    cout << c << endl;
    cin >> a >> op >> b;
  }
  return 0;
}






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

long long maxll(long long a, long long b){return a > b ? a : b;}

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a.begin(), a.end());

    vector<long long> aa(n + 1, 0);
    for (int i = 0; i < n; i++)
    {
        aa[i + 1] = aa[i] + a[i];
    }

    vector<pair<int,int>> bc(m);
    for (int i = 0; i < m; i++)
    {
        int b, c;
        cin >> b >> c;
        bc[i] = make_pair(c, b);
    }
    sort(bc.begin(), bc.end());
    reverse(bc.begin(), bc.end());

    vector<long long> cc(n + 1, 0);
    int iter = 0;
    for (int i = 0; i < m; i++)
    {
        for (int j = 0; j < bc[i].second; j++)
        {
            cc[iter + 1] = cc[iter] + bc[i].first;
            if(iter == n)break;
            iter++;
        }
        if(iter == n)break;
    }
/*
    for (int i = 0; i < n + 1; i++)cout << aa[i] << " ";
    cout << endl;
    for (int i = 0; i < n + 1; i++)cout << cc[i] << " ";
    cout << endl;
*/
    long long ans = 0;
    for (int i = 0; i <= n; i++)
    {
        //cout << -aa.at(i) + cc.at(i) + aa.at(n) << " ";
        ans = maxll(ans, -aa.at(i) + cc.at(i) + aa.at(n));
    }
    cout << ans << endl;
}

Measured memory_bytes: 5840
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,o,n) for(int i=o; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

#define pb push_back
#define eb emplace_back

#define X first
#define Y second

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

const ll MOD = 1e9+7;

int mp[10][10];
int ans;
bool check(int a, int b, int c, int d, int e,
int oa, int ob, int oc, int od, int oe){
  if(a==oa &&
b==ob &&
c==oc &&
d==od &&
     e==oe ) return 0;
	return mp[ mp[ mp[ mp[ mp[0][a] ][b] ][c] ][d] ][e] == 0;
}

int main(){
	ans = 0;
	rep(i,10) rep(j,10){
		cin >> mp[i][j];
	}

	rep(a,10) rep(b,10) rep(c,10) rep(d,10){
		int e = mp[ mp[ mp[ mp[0][a] ][b] ][c] ][d];
		bool f = false;
		rep(i,10) if(i!=a) f |= check(i,b,c,d,e,a,b,c,d,e);
		rep(i,10) if(i!=b) f |= check(a,i,c,d,e,a,b,c,d,e);
		rep(i,10) if(i!=c) f |= check(a,b,i,d,e,a,b,c,d,e);
		rep(i,10) if(i!=d) f |= check(a,b,c,i,e,a,b,c,d,e);
		rep(i,10) if(i!=e) f |= check(a,b,c,d,i,a,b,c,d,e);
		f |= check(b,a,c,d,e,a,b,c,d,e);
		f |= check(a,c,b,d,e,a,b,c,d,e);
		f |= check(a,b,d,c,e,a,b,c,d,e);
		f |= check(a,b,c,e,d,a,b,c,d,e);
		if( f ) ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define repi(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define SIZE_OF_ARRAY(array)    (sizeof(array)/sizeof(array[0]))
typedef long long ll;
using namespace std;
const ll mod = 1e9+7;
const ll INF = 1LL << 60;

int main(){
  ll x;
  cin >> x;
  ll i=100;
  ll ans=0;
  while(x>i){
    i+=(i*0.01);
    ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3592
import sys
sys.setrecursionlimit(10**9)
INF=10**18
def input():
    return sys.stdin.readline().rstrip()

def main():
    N,M,L=map(int,input().split())
    d=[[INF]*N for _ in range(N)]
    for _ in range(M):
        A,B,C=map(lambda x:int(x)-1,input().split())
        d[A][B]=C+1
        d[B][A]=C+1
    Q=int(input())
    for k in range(N):
        for i in range(N):
            for j in range(N):
                d[i][j]=min(d[i][j],d[i][k]+d[k][j])
    d2=[[INF]*N for _ in range(N)]
    for i in range(N):
        for j in range(N):
            if d[i][j]<=L:
                d2[i][j]=1
    for k in range(N):
        for i in range(N):
            for j in range(N):
                d2[i][j]=min(d2[i][j],d2[i][k]+d2[k][j])
    for _ in range(Q):
        s,t=map(lambda x:int(x)-1,input().split())
        dist=d2[s][t]
        if dist>=INF:
            print(-1)
        else:
            print(dist-1)
            
if __name__ == '__main__':
    main()


Measured memory_bytes: 57688
n = gets.chomp.to_i
a = gets.split.map(&:to_i)
b = gets.split.map(&:to_i)
c = gets.split.map(&:to_i)

sum = 0
prev = 100
(0..(n-1)).each do |i|
  sum += b[a[i] - 1]
  if a[i] - 1 == prev + 1
    sum += c[prev]
  end
  prev = a[i] - 1
end
puts sum

Measured memory_bytes: 1788
using System;
using System.Windows;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

class Program
{
  static int n;
  static List<int>[] G;
  static int[] color;
  
    static void Main(string[] args)
    {
      //入力を受け取る
      var N = int.Parse(Console.ReadLine());
      var d = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
      Array.Sort(d);
      
      var min = d[N/2-1];
      var max = d[N/2];
      
      Console.WriteLine(max-min);

    }
}




Measured memory_bytes: 20064
#include <cstdio>
#include <cstring>
#include <algorithm>
#define int long long
#define P 998244353
using namespace std;

typedef long long ll;

int Fac[300010], Rev[300010];

ll powmod(ll x, ll y = P - 2, ll p = P) {
    ll ans = 1;
    while(y) {
        if(y & 1) ans = ans * x % p;
        x = x * x % p;
        y >>= 1;
    }
    return ans;
}

ll C(ll x, ll y) {
    if(x < 0 || y < 0 || x < y) return 0;
    return Fac[x] * Rev[y] % P * Rev[x - y] % P;
}

signed main() {
    int n, a, b, k;
    scanf("%lld%lld%lld%lld", &n, &a, &b, &k);
    for(int i = 0; i <= 300000; i++) Fac[i] = !i ? 1 : Fac[i - 1] * i % P;
    for(int i = 300000; i >= 0; i--) Rev[i] = i == 300000 ? powmod(Fac[i]) : Rev[i + 1] * (i + 1) % P;
    ll ans = 0;
    for(int i = 0; i <= n; i++) {
        ll tmp = k - a * i;
        if(tmp % b == 0) ans = (ans + C(n, i) * C(n, tmp / b)) % P;
    }
    printf("%lld\n", ((ans % P + P) % P));
    return 0;
}

Measured memory_bytes: 4864
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

bool check(vector<int> &v1, vector<int> &v2){
    vector<int> cnt(5);
    for(auto e : v1) ++cnt[e];
    for(auto e : v2) ++cnt[e];
    int dup = 0;
    for(int i = 0; i < 5; ++i) if(cnt[i] > 1) ++dup;
    return dup <= 1;
}

long long solve(int n, vector<int> &a){
    vector<vector<int>> v;
    vector<vector<int>> v2;
    for(int i = 0; i < n; ++i)
        for(int j = 0; j < i;++j){
            v.push_back({j, i});
            for(int k = 0; k < j; ++k){
                v2.push_back({k, j, i});
                for(int l = 0; l < k; ++l){
                    v2.push_back({l, k, j, i});
                }
            }
        }

    vector<vector<vector<int>>> v3(1);
    for(auto &vv : v2) v3.push_back({vv});
    for(auto &vv : v2) for(auto &vvv : v2) if(check(vv, vvv)) v3.push_back({vv, vvv});
    int tmp = 0;

    for(auto vx : v3)
        for(int i = 0; i < (1<<v.size()); ++i){
            vector<long long> cnt(n);
            int pop = 0;
            for(auto vvx : vx){
                pop += vvx.size()-1;
                for(auto e : vvx){
                    ++cnt[e];
                }
            }
            bool okok = true;
            for(int j = 0; j < (int)v.size(); ++j){
                if(~i >> j & 1) continue;
                for(auto vvx : vx) if(!check(vvx, v[j])) okok = false;
                for(auto e : v[j]) ++cnt[e];
                ++pop;
            }
            if(!okok) continue;
            bool ok = true;
            for(int j = 0; j < n; ++j) if(cnt[j] > a[j]) ok = false;
            if(!ok) continue;
            tmp = max(tmp, pop);
        }

    return accumulate(a.begin(), a.end(), 0ll) - tmp;
}

int main(){
    vector<int> a(5);
    int n;
    cin >> n;
    for(int i = 0; i < n; ++i) cin >> a[i];
    cout << solve(n, a) << endl;
}

Measured memory_bytes: 3164
import math

N = int(input())
A = list(map(int, input().split()))

dic = {}
for i in range(N):
  if A[i] in dic:
    dic[A[i]] += 1
  else:
    dic[A[i]] = 1

memo = [0 for i in range(10 ** 6)]
ans = 0
for k in dic:
  tmp  =dic[k]
  if tmp >= 2:
    if memo[tmp] == 0:
      memo[tmp] = tmp * (tmp - 1) // 2
      ans += memo[tmp]
    else:
      ans += memo[tmp]

for i in range(N):
  tmp = dic[A[i]]
  if tmp == 1:
    print(ans)
  elif tmp == 2:
    print(ans - 1)
  else:
    print(ans - tmp * (tmp - 1) // 2 + (tmp - 1) * (tmp - 2) // 2)




Measured memory_bytes: 32544
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if(n % 2 == 0) {
			System.out.println(n/2);
		}else {
			System.out.println(n/2 + 1);
		}
	}

}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    string S;
    cin >> S;
    int N = S.size();
    ll dp[N+1][4];
    dp[N][0] = dp[N][1] = dp[N][2] = 0;
    dp[N][3] = 1;
    for(int i = N-1;i >= 0;i--){
        int m1 = (S[i] == '?' ? 3 : 1);
        rep(j,0,3){
            int m2 = (S[i] == '?' || S[i] == (j + 'A') ? 1 : 0);
            dp[i][j] = (dp[i+1][j] * m1 + dp[i+1][j+1] * m2) % MOD;
        }
        dp[i][3] = (dp[i+1][3] * m1) % MOD;
    }
    cout << dp[0][0] << endl;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
//#include <ext/numeric>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define oo 0x3f3f3f3f
#define OO 0x3f3f3f3f3f3f3f3f
#define popcount(n) __builtin_popcount(n)
#define popcountll(n) __builtin_popcountll(n)

using namespace std;
//using namespace __gnu_cxx;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const double PI = acos(-1.0), EPS = 1e-6;
const long long inf = 2e12 + 12;
const int MAXN = 100005, MAXM = 10000007, Mod = 1000000007 , MAXLog = 20;

int main() {
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "rt", stdin);
//    freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0), cout.precision(10), cout << fixed;


    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<int> black(n, 0);
    vector<int> white(n, 0);
    black[0] = (s[0] == '#');
    for (int i = 1; i < n; ++i) {
        black[i] = black[i - 1] + (s[i] == '#');
    }
    white[n - 1] = (s[n - 1] == '.');
    for (int i = n - 2; i >= 0; --i) {
        white[i] = white[i + 1] + (s[i] == '.');
    }
    int ans = INT_MAX;
    for (int i = 0; i < n - 1; ++i) {
//        cout << i << ' ' << black[i] << ' ' << white[i + 1] << '\n';
        ans = min(ans, black[i] + white[i + 1]);
    }
    ans = min(ans, black[n - 1]);
    ans = min(ans, white[0]);

    cout << ans << '\n';



    return 0;
}

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

int main() {
	int N[3], K;
	cin >> N[0] >> N[1] >> N[2] >> K;
	sort(N, N+3);
	cout << (N[2] << K) + N[1] + N[0];
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

一番大きい数字を2^K倍する、以上
*/

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

const int MAXN = 100000 + 10;
const int BIG = 1000000000LL * 1000LL;

int cnt;
int pref;
int make_num(int x) {
    int y = pref * 10 + x;
    while (y < BIG) {
        y = 10*y+9;
    }
    return y;
}

bool check(int x) {
    cout << "? " << x << endl;
    string s;
    cin >> s;
    return s == "Y";
}

int32_t main() {
    ios_base::sync_with_stdio(0);

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

        int p = 0, q = 9;
        if (i == 0) p = 1;

        while (p < q) {
            int s = (p+q)/2;
            cerr << "s " << s << endl;
            int n = make_num(s);
            bool r = check(n);

            if (r) {
                q = s;
            } else {
                p = s+1;
            }
        }
        pref = 10 * pref + p;

        if (pref >= 1000000000) break;
        cerr << "pref " << pref <<endl;
    }
    while (pref % 10 == 0) pref /= 10;

    int ans = pref;
    if (pref % 10 < 9) {
        if (check(pref+1)) {
            cout << "! " << pref << endl;
            return 0;
        }
    } else {
        if (!check((pref-1) * 10)) {
            cout << "! " << pref << endl;
            return 0;
        }
    }
    while (pref < BIG) {
        pref = pref * 10 + 9;
        ans *= 10;
        if (check(pref)) {
            cout << "! " << ans << endl;
            return 0;
        }
    }


    cout << "! " << pref << endl;
    return 0;
}


Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int a, b=0;
    cin >> a;

    b += a % 10;
    a = a / 10;
    b += a % 10;
    a = a / 10;
    b += a % 10;

    cout << b << endl;
}

Measured memory_bytes: 3608
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <map>
#include <vector>
#include <string>
#include <set>

using namespace std;
typedef long long ll;
const ll MOD = 998244353;
const int MAXN = 4100;

int K, N;
ll pascal[MAXN][MAXN];

int main()
{
    ios_base::sync_with_stdio(0);
    pascal[0][0] = 1;
    for (int i = 1; i < MAXN; i++)
        for (int j = 0; j < MAXN; j++)
        {
            pascal[i][j] = pascal[i-1][j];
            if (j)
                pascal[i][j] = (pascal[i][j] + pascal[i-1][j-1]) % MOD;
        }

    cin >> K >> N;
    for (int i = 2; i <= 2 * K; i++)
    {
        int n2 = 0, n1 = 0;
        for (int j = 1; j <= K; j++)
        {
            if (j * 2 == i) continue;
            if ((i - j) <= K && (i - j) >= 1)
                n2++;
            else
                n1++;
        }
        n2 /= 2;
        //cout << n2 << " " << n1 << "\n";

        ll res = 0;
        ll p2 = 1;
        for (int j = 0; j <= n2; j++)
        {
            if (j)
                p2 = (p2 * 2) % MOD;
            if (j > N) continue;
            if (j == 0 && n1 == 0) continue;
            res = (res + pascal[n2][j] * (p2 * pascal[N+n1-1][j+n1-1] % MOD)) % MOD;
            if (i % 2 == 0)
                res = (res + pascal[n2][j] * (p2 * pascal[N+n1-2][j+n1-1] % MOD)) % MOD;
        }
        cout << res << "\n";
    }
}

Measured memory_bytes: 131584
#include <bits/stdc++.h> 
using namespace std;
#define int long long int
#define float double
#define pb push_back
#define FF first
#define SS second
#define N 201000
#define MOD 1000000007
#define fn(i,n) for(int i=0;i<n;i++)
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define pii pair<int,int>
#define INF 1000000000000000000
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

signed main() 
{
    speed;
    //freopen("input.txt", "r", stdin);
   // freopen("output.txt", "w", stdout);
    
    int n,W;
    cin>>n>>W;
    int A[n],B[n];
    for(int i=0;i<n;i++)
    {
    	cin>>A[i]>>B[i];
    }
    int dp[n+1][W+1];
    for(int i=0;i<n+1;i++)
    {
    	for(int j=0;j<W+1;j++)
    	{
    		if(i==0 || j==0) dp[i][j]=0;
    		else if(A[i-1]<=j) dp[i][j]=max(B[i-1]+dp[i-1][j-A[i-1]],dp[i-1][j]);
    		else dp[i][j]=dp[i-1][j];
    	}
    }
    cout<<dp[n][W];
}


Measured memory_bytes: 79232
//「区間[l, r]をすべてtrueにする」「区間[l, r]がすべてtrueか判定する」
//→「区間に1を足す」「区間の最小値が1以上かを判定する」
//これはStarrySky木ですね。間違いない。なんだこれは…典型だなぁ…
//（StarySky木を自力で書いたことがないので、verify代わりに実装してみます）
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
using namespace std;

const int DEPTH = 17;
const int INF = 114514;

class StarrySky {
	int all[1 << (DEPTH + 1)];		//all[i] = ノードiと対応する区間に一様に足された値
	int part[1 << (DEPTH + 1)];		//part[i] = all[iの親, 祖先]を無視したときの, ノードiと対応する区間の最小値 (all[i]は反映する)
	
public:
	StarrySky() {
		for (int i = 0; i < (1 << (DEPTH + 1)); i++) {
			all[i] = part[i] = 0;
		}
	}
	
	//区間[l, r)にvを足す
	void add(int l, int r, int v, int a = 0, int b = (1 << DEPTH), int id = 0) {
		if (b <= l || a >= r) return;
		if (l <= a && b <= r) { all[id] += v; part[id] += v; return; }
		add(l, r, v, a, a + (b - a) / 2, id * 2 + 1);
		add(l, r, v, a + (b - a) / 2, b, id * 2 + 2);
		part[id] = min(part[id * 2 + 1], part[id * 2 + 2]) + all[id];
	}
	
	//区間[l, r)の最小値を求める
	int getMin(int l, int r, int a = 0, int b = (1 << DEPTH), int id = 0) {
		if (b <= l || a >= r) return INF;
		if (l <= a && b <= r) return part[id];
		int u = getMin(l, r, a, a + (b - a) / 2, id * 2 + 1);
		int v = getMin(l, r, a + (b - a) / 2, b, id * 2 + 2);
		return min(u, v) + all[id];
	}
};

typedef tuple<int, int, int, int, int> T;	//(time, type, l, r, ans_id), type=1:設置, type=0:移動
int n, m, q;
vector<T> query;
StarrySky seg;

signed main() {
	int i;
	
	cin >> n >> m >> q;
	for (i = 0; i < m; i++) {
		int d, a, b;
		cin >> d >> a >> b;
		query.push_back(T(d, 1, a, b, -1));
	}
	for (i = 0; i < q; i++) {
		int e, s, t;
		cin >> e >> s >> t;
		query.push_back(T(e, 0, s, t, i));
	}
	sort(query.begin(), query.end());
	
	static bool ans[100000];
	for (i = 0; i < query.size(); i++) {
		int type = get<1>(query[i]);
		int l = get<2>(query[i]);
		int r = get<3>(query[i]);
		int id = get<4>(query[i]);
		
		if (type == 1) seg.add(l, r, 1);
		if (type == 0) {
			ans[id] = (seg.getMin(l, r) >= 1);
		}
	}
	
	for (i = 0; i < q; i++) {
		if (ans[i]) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}


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

#define rep(i,n) for(int i=0; i<n ; ++i)
#define REP(i,a,b) for(int i=a; i<b; ++i)
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

//プロトタイプ宣言
void faster(void);
ll gcd(auto , auto);
ll get_digent(auto);
ll POW(auto , auto);
ll vec_max(auto & , string);
ll vec_min(auto & , string);

int main(){
  faster();
  ll n,k;
  cin >> n >> k;
  cout << (n - 1 + k - 1 - 1)/(k - 1) << endl;
}

/*
必ず変更するときに１を含んでいる必要があるため、１に変更可能な最大個数はｋ－１個
それ故、仮に端から順にｋ－１個ずつ区切っていったとすると、その区間の個数が変更する最小値となる。
よって、ｎ－１/ｋ－１が解となるが、ｎ－１がｋ－１で割り切れなかった場合、繰り上げる必要があるため、
ｎ＋ｋ－３/ｋ－１となっている。
*/




























//以下、ライブラリ

//同期解除
void faster(void){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

//ユークリッドの互除法
ll gcd(auto a, auto b) {
  return (b ? gcd(b, a%b) : a);
} 

//桁数取得
ll get_digent(auto x){
  string s;
  s = to_string(x);
  ll digent = s.size();
  return digent;
} 

//べき乗計算
ll POW(auto x, auto y){
  if(y==0) return 1;
  if(y%2 == 1){
    ll temp = POW(x,y-1);
    return (temp*x);
  }
  else{
    ll temp = POW(x,y/2);
    return temp*temp;
  }
} 

//配列内の最大要素の添え字取得or要素取得
ll vec_max(auto &v, string s){
  auto itr = max_element(v.begin(),v.end());
  ll element = *itr;
  ll place = itr - v.begin();
  if(s == "element") return element;
  else if(s == "place") return place;
  else return -1;
}

//配列内の最小要素の添え字取得or要素取得
ll vec_min(auto &v, string s){
  auto itr = min_element(v.begin(),v.end());
  ll element = *itr;
  ll place = itr - v.begin();
  if(s == "element") return element;
  else if(s == "place") return place;
  else return -1;
}

Measured memory_bytes: 256
from collections import defaultdict
n = int(input())
cnt = defaultdict(int)
for s in input():
    cnt[s] += 1

for _ in range(n-1):
    tmp = defaultdict(int)
    for s in input():
        tmp[s] += 1
    for k in cnt.keys():
        cnt[k] = min(cnt[k], tmp[k])

ans = []
for k, v in cnt.items():
    ans.extend([k]*v)
print(''.join(sorted(ans)))


Measured memory_bytes: 9452
import sys
import bisect

s = input()
t = input()

dic = {}

for i, c in enumerate(s):
    if c not in dic:
        dic[c] = []
        
    dic[c].append(i)

currentIndex = -1
roop = 0

for c in t:
    if c not in dic:
        print(-1)
        sys.exit()
    
    if currentIndex >= dic[c][-1]:
        roop += 1
        currentIndex = dic[c][0]
    else:
        index =  bisect.bisect_right(dic[c], currentIndex)
        currentIndex = dic[c][index]

result = (roop * len(s)) + currentIndex + 1
print(result)


Measured memory_bytes: 7540
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int mod=1000000007;
const int INF=1001001001;

vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}

vector<vector<int>>g;
vector<vector<int64_t>>dist;
vector<int64_t>ans;
void dfs(int now,int back){
  for(int i=0;i<g[now].size();i++){
    int next=g[now][i];int nc=dist[now][i];
    if(next==back){continue;}
    ans[next]=ans[now]+nc;
    dfs(next,now);
  }
}

int main() {
  int N;
  cin>>N;
  g.resize(N);
  ans.resize(N);
  dist.resize(N);
  for(int i=0;i<N-1;i++){
    int a,b,c;
    cin>>a>>b>>c;
    a--;b--;
    g[a].emplace_back(b);dist[a].emplace_back(c);
    g[b].emplace_back(a);dist[b].emplace_back(c);
  }
  
  int Q,K;
  cin>>Q>>K;
  K--;
  dfs(K,-1);
  //for(int i=0;i<N;i++){cout<<ans[i]<<endl;}
  for(int i=0;i<Q;i++){
    int x,y;
    cin>>x>>y;
    x--;y--;
    int64_t t=ans[x]+ans[y];
    cout<<t<<endl;
  }
  return 0;  
}

Measured memory_bytes: 21152
L=[]

def make_lunlun(A):
    
    # print(A)
   
    if not 0<A<10**10 :
        return
    
    global L
    # print(A)
    
    L.append(A)
    
    if(A%10 != 9):
        make_lunlun(A*10 + (A%10)+1)

    
    if(A!=0):
        make_lunlun(A*10+(A%10))

    
    if(A%10 != 0):
        make_lunlun(A*10 +(A%10)- 1)

    
k=int(input())


for i in range(10):
    make_lunlun(i)
  
L=list(set(L))
L.sort()

print(L[k-1])

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

int main(void){
  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;
  cout << (char)toupper(s1[0]) << (char)toupper(s2[0]) << (char)toupper(s3[0]) << endl;
}


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

int main() {
	int i,n,b,c,d;
	cin >> n;
	b=100000;
	for (i=0;i<n;i++){
		b=b*1.05;
		c=b%1000;
		d=b/1000;
		if(c!=0){
			b=(d+1)*1000;
		}
	}
	cout << b<<endl;
	return 0;
}

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

int main() {

  int N, A;
  cin >> N;
  
  int l = 30;
  int m = 0;
  
  for (int i = 0; i < N; i++) {
  	int n = 0;
    cin >> A;
    if (A % 2 == 1) {
      l = 0;
      break;
    }
    else{
      while (A % 2 == 0) {
      	A /= 2;
      	n++;
      }
    }
    
    if (n < l) {
      l = n;
    }
    
  } 
  
  cout << l << endl;
  
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		long INF = Long.MAX_VALUE/2;
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt() , M = sc.nextInt(), L = sc.nextInt();
		long to[][] = new long[N][N];
		for(long tmp[]:to)Arrays.fill(tmp,INF);
		for(int i=0;i<M;i++) {
			int A = sc.nextInt()-1, B = sc.nextInt()-1;
			long C = sc.nextInt();
			if(C>L)C=INF;
			to[A][B]=to[B][A]=C;
		}
		int Q = sc.nextInt();
		int query[][] = new int[Q][2];
		for(int i=0;i<Q;i++) {
			int s = sc.nextInt()-1, t = sc.nextInt()-1;
			query[i][0]=s;
			query[i][1]=t;
		}
		sc.close();
		
		//最短距離がL以下なら、そこは1度で移動できる。
		//１度で移動できる場所をすべて、埋めてそれを元に全点対の移動回数配列を埋める。
		
		
		
		for(int k=0;k<N;k++) {
			for(int i=0;i<N;i++) {
				for(int j=0;j<N;j++) {
					to[i][j]=Math.min(to[i][j], to[i][k]+to[k][j]);
				}
			}
		}
		
		long times[][] = new long[N][N];
		for(int i=0;i<N;i++) {
			for(int j=0;j<N;j++) {
				if(to[i][j]<=L)times[i][j]=1;
				else times[i][j]=INF;
			}
		}
		
		//最短移動回数を求める
		for(int k=0;k<N;k++) {
			for(int i=0;i<N;i++) {
				for(int j=0;j<N;j++) {
					times[i][j]=Math.min(times[i][j], times[i][k]+times[k][j]);
				}
			}
		}
	
		StringBuilder sb = new StringBuilder();
		for(int i=0;i<Q;i++) {
			int start = query[i][0], goal = query[i][1];
			if(times[start][goal]==INF)sb.append(-1);
			else sb.append(times[start][goal] - 1);
			sb.append("\n");
		}
		System.out.println(sb.toString());
	}
}


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

int GCD(int x,int y) {
	int p = max(x,y);
	int q = min(x,y);
	while (p % q != 0) {
		p %= q;
		int temp = q;
		q = p;
		p = temp; 
	}
	return q;
}

int main() {
	int a,b;
	cin >> a >> b;
	int loc[a];
	int dif[a];
	int ans;
	for (int i = 0;i < a;i++) {
		cin >> loc[i];
		if (i == 0) {
			dif[i] = abs(b-loc[i]);
		} else {
			dif[i] = abs(loc[i] - loc[i-1]);
		}
	}
	ans = dif[0];
	for (int i = 1;i < a;i++) {
		ans = GCD(ans,dif[i]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
import java.io.InputStream;
import java.util.Scanner;

public class Main {
	private static boolean isPrime(int x) {

		// Eratosthenes sieve

		if (x == 1) { return  false;}
		if (x == 2) { return true;}
		if (x % 2==0) { return false;}

		for (int i = 3; i < Math.sqrt(x)+1; i++) {
			if (x % i == 0) {
				return false;
			}
		}
		return true;
	}

	public static int countPrimes(InputStream ins) {
		Scanner sc = new Scanner(ins);
		int numOfList = sc.nextInt();

		int primes = 0;
		for (int i = 0; i < numOfList; i++) {
			int num = sc.nextInt();
			if (isPrime(num)) {
				primes++;
			}
		}
		return primes;
	}

	public static  void main (String[] args) throws Exception {
		int primes = countPrimes(System.in);
		System.out.println(primes);
	}
}

Measured memory_bytes: 31108
#include <bits/stdc++.h>
using namespace std;
int dp[1002][1002];
const long long mod = (long long)(1e9+7);

int main() 
{
    int n,m;
    cin >> n >> m;
    char a[n+1][m+1];
    
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cin >> a[i][j];
            
            if(a[i][j]=='#') dp[i][j] = 0;
        }
    }
    
    dp[1][1] = 1;
    
    for(int j=2;j<=m;j++) {
        if(a[1][j]=='.') dp[1][j] = dp[1][j-1];
    }
    
    for(int i=2;i<=n;i++) {
        if(a[i][1]=='.') dp[i][1] = dp[i-1][1];
    }
    
    for(int i=2;i<=n;i++){
        for(int j=2;j<=m;j++){
            if(a[i][j]=='.') {
                long long temp = 1LL*dp[i-1][j];
                temp += (1LL*dp[i][j-1]);
                temp%=mod;
                dp[i][j] = temp;
            }
        }
    }
    

    cout<<dp[n][m]<<endl;
    
	return 0;
}

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

int main(void) {
  ios::sync_with_stdio(false);
  int64_t X, K, D;
  cin >> X >> K >> D;

  int64_t Y = abs(X) / D;
  int64_t Z = abs(X) % D;
  if (Y == K) {
    cout << Z << endl;
  } else if (K < Y) {
    int64_t ZZ = (Y - K) * D + Z;
    cout << ZZ << endl;
  } else {  // Y < K
    int64_t ZZ = 0;
    if ((K - Y) % 2) {
      ZZ = D - Z;
    } else {
      ZZ = Z;
    }
    cout << ZZ << endl;
  }
  return 0;
}


Measured memory_bytes: 3648
#include <stdio.h>

void main()
{
  int n;
  long sum=0;
  scanf("%d",&n);
  int a[n];
  for (int i=0;i<n;i++)
    scanf("%d",&a[i]);
  for (int i=1;i<n;i++)
  {
    if (a[i]<a[i-1])
    {
        sum+=(a[i-1]-a[i]);
        a[i]+=(a[i-1]-a[i]);
    }
  }
  printf("%ld",sum);
}  

Measured memory_bytes: 2492
// 人の提出コード(16117611)のコピペ。
// OverflowになるはずなのになんでACしてるの…？
 
use proconio::*;
use proconio::marker::*;
 
fn run() {
    input! {
        h: usize,
        w: usize,
        src: (Usize1, Usize1),
        dst: (Usize1, Usize1),
        mut s: [Chars; h],
    }
    for s in s.iter_mut() {
        for _ in 0..2 {
            s.insert(0, '#');
            s.push('#');
        }
    }
    for _ in 0..2 {
        s.insert(0, vec!['#'; w + 4]);
        s.push(vec!['#'; w + 4]);
    }
    let h = h + 4;
    let w = w + 4;
    let src = (src.0 + 2, src.1 + 2);
    let dst = (dst.0 + 2, dst.1 + 2);
    let mut used = vec![vec![false; w]; h];
    used[src.0][src.1] = true;
    let mut que = std::collections::VecDeque::new();
    que.push_back(src);
    for i in 0.. {
        if que.is_empty() {
            println!("-1");
            return;
        }
        let mut a = vec![];
        while let Some((x, y)) = que.pop_front() {
            a.push((x, y));
            for d in [!0, 0, 1, 0, !0].windows(2) {
                let x = x + d[0];
                let y = y + d[1];
                if !used[x][y] && s[x][y] != '#' {
                    used[x][y] = true;
                    que.push_back((x, y));
                }
            }
        }
        if used[dst.0][dst.1] {
            println!("{}", i);
            return;
        }
        for (x, y) in a {
            for p in [!1, !0, 0, 1, 2].iter() {
                for q in [!1, !0, 0, 1, 2].iter() {
                    let x = x + *p;
                    let y = y + *q;
                    if !used[x][y] && s[x][y] != '#' {
                        used[x][y] = true;
                        que.push_back((x, y));
                    }
                }
            }
        }
    }
}
 
fn main() {
    run();
}

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

const int NOT_FOUND=-1;

int linerSearch(int key,int A[],int n){
	int i=0;
	A[n]=key;
	
	while(A[i]!=key){
		i++;
	}
	if(i==n){
		return NOT_FOUND;
	}
	
	return i;
}

int main(){
	int n;
	cin>>n;
	
	int S[10001];
	for(int i=0;i<n;i++){
		cin>>S[i];
	}

	int q;
	cin>>q;
	
	int T[500];
	for(int i=0;i<q;i++){
		cin>>T[i];
	}
	
	int C=0;
	
	for(int i=0;i<q;i++){
		if(linerSearch(T[i],S,n)!=NOT_FOUND){
			C++;
		}
	}

	cout<<C<<endl;
	
	return 0;
}

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

using namespace std;

int main()
{
  int N;
  vector<int> h;
  cin >> N;

  for(int i = 0; i < N; i++)
  {
    int he;
    cin >> he;
    h.push_back(he);
  }

  vector<int> dp(N, 0);
  dp[1] = abs(h[0] - h[1]);

  for(int i = 2; i < N; i++)
  {
      dp[i] = min(dp[i-1] + abs(h[i-1] - h[i]), dp[i-2] + abs(h[i-2] - h[i]));
  }

  cout << dp[N-1] << '\n';

  return 0;
}



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

#define REP(i ,n) for(int i=0 ;i < n; i++)
#define REPB(i ,n) for(int i=n; i >= 0; i--)
#define FOR(i ,m ,n) for(int i=m; i < n; i++)
#define FORB(i, m, n) for(int i=m; i>= n; i--)
#define ll long long
#define pb push_back
#define popb pop_back
#define debug(i) cout<< #i<< "= "<< i << endl
using namespace std;
    int ten[200001];
ll make(int n,int k){
    ll t=1;
    int a = n - k + 1;
    FOR(i,n,k+1){
        t *= ten[i];
    }
    return t;
}
int main(){
    int n,k;
    cin >> n >> k;
    int a = n - k;

    ll mark[a+1];
    string ans[a];

    REP(i,n){
        int t;
        cin >> t;
        ten[i] = t;
    } 


    REP(i,a+1) mark[i] = 1;

 REP(i,a){
        if(ten[(i+k)]>ten[i]) ans[i] = "Yes";
        else ans[i] = "No";
 }
    REP(i,a)cout << ans[i]  << endl;
    //REP(i,n) cout <<  "Ten " << i << " " <<  ten[i] << endl;
   // REP(i,a+1) cout << "M " << make(i,k) << endl;
}

Measured memory_bytes: 12124
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;
char a;
int main(){
	cin>>a;
	if(a=='a'||a=='e'||a=='i'||a=='o'||a=='u') printf("vowel");
	else printf("consonant");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=3e5+10;
const int mod=1e9+7;
const int inf=0x3f3f3f3f;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,k,ans=0;
	cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		int x;
		cin>>x;
		if(x>=k) ans++;
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using P = pair<int,int>;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1000000007
#define INF 100000000000000000
#define EPS 1e-9
const vector<vector<int>> DXY={{-1,0},{1,0},{0,-1},{0,1}};

//----***パーツ***----
#define fi first
#define se second
#define pb push_back
#define re return
#define br break

//----***入出力***---
void print() { std::cout << "\n"; }
template <class T>void print(const T &x) {std::cout << x<<"\n";}
template <class T, class... Args>void print(const T &x, const Args &... args) {std::cout << x << " ";print(args...);}
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);};}initial_;

signed main(){
  int N;cin>>N;
  map <int,int> mp;
  int a;
  REP(i,0,N){
    cin>>a;
    mp[a]++;
  }
  if(mp[0]==N){
    print("Yes");
    re 0;
  }
  if(N%3!=0){
    print("No");
    re 0;
  }

  vector<int> keys;
  each(m,mp){
    for (int i = 0; i < m.second / (N / 3); i++){
      keys.pb(m.first);
    }
  }
  if(keys.size()==3&&(keys[0]^keys[1]^keys[2])==0){
    print("Yes");
    re 0;
  }
  print("No");


}


Measured memory_bytes: 5120
using System;
using System.Linq;
public class c
{
  public static void Main()
  {
    int[] AB=Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    string ans="No";
    if(AB[0]*AB[1]%2==1)ans="Yes";
    Console.WriteLine(ans);
  }
}

Measured memory_bytes: 13268
n, m=input().split(' ')
n = int(n)
m = int(m)
nn = 0
mm = 0
for i in range(m):
	nn = nn + n * pow(10, i)
for i in range(n):
	mm = mm + m * pow(10, i)    
if n < m:
  print(nn)
else:
  print(mm)

Measured memory_bytes: 3064
N, M = map(int, input().split())
Hs = list(map(int, input().split()))
As = [list(map(int, input().split())) for _ in range(M)]
rlt = [1]*N

for a in As:
  if Hs[a[0]-1] < Hs[a[1]-1]:
    rlt[a[0]-1] = 0
  elif Hs[a[0]-1] > Hs[a[1]-1]:
    rlt[a[1]-1] = 0
  else:
    rlt[a[0]-1] = 0
    rlt[a[1]-1] = 0
    
print(sum(rlt))

Measured memory_bytes: 93380
/*"Success isn't permanent, failure isn't fatal,
                                      it's the courage to continue that counts"*/
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define ll long long 
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define lpri(n) printf("%lld",n)
#define pri(n) printf("%d",n)
#define pln() printf("\n")
#define priln(n) printf("%d\n",n)
#define lpriln(n) printf("%lld\n",n)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define pb push_back     
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define inf INT_MAX
#define ninf INT_MIN
const int mod=1e9+7;         
const int N=2e5+4;

int main()
{
	int n;

	scn(n);

	vector<int> fa(n+1,0);

	int a[n];

	rep(i,0,n)
	{
		scn(a[i]); fa[a[i]]++;
	}

	ll sum=0;

	rep(i,1,n+1)
	{
		ll here=(1LL*fa[i]*(fa[i]-1))/2;

		sum+=here;
	}

	rep(i,0,n)
	{
		ll temp=sum;

		if(fa[a[i]])
		{
			temp-=(fa[a[i]]-1);
		}

		lpriln(temp);
	}

    return 0;
}

Measured memory_bytes: 4096
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define PI acos(-1)
typedef  long long ll;
ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}
using namespace std;

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

   vector<int> a(n,0);
   rep(i,n){
      cin>>a[i];
   }
   vector<int> b(n,0);
   rep(i,n){
      b[i]=a[i];
   }
   sort(b.begin(),b.end());

   int ma=b[n-1];
   int mama=b[n-2];

   rep(i,n){
      if(a[i]==ma) cout<<mama<<endl;
      else cout<<ma<<endl;

   }



return 0;
}



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

int main() {
  int N, K;
  cin >> N >> K;
  int d;
  int sunuke[N] = {0};
  
  for (int i=0; i<K; i++) {
    cin >> d;
    int A[d] = {0};
    for (int j=0; j<d; j++) cin >> A[j];
	for (int j=0; j<d; j++) sunuke[A[j]-1]++;
  }
  
  int counter=0;
  for (int i=0; i<N; i++) {
    if (sunuke[i] == 0) counter++;
  }
  cout << counter << endl;
}


Measured memory_bytes: 3640
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.Scanner;
import java.util.Collections;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String longWord = "";
		Map<String, Integer> count = new HashMap<>();
		String tmp;
		String manyWord = "";
		int max = 0;
		while (sc.hasNext()) {
			if(!count.containsKey((tmp = sc.next()))){
				if(tmp.length() > longWord.length()){
					longWord = tmp;
				}
				count.put(tmp, 1);
			}else{
				count.put(tmp, count.get(tmp) + 1);
				if(max < count.get(tmp)){
					max = count.get(tmp);
					manyWord = tmp;
				}
			}
		}
		System.out.println(manyWord + " " + longWord);
	}
}


Measured memory_bytes: 25728
package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
	"sort"
)

// github.com/EndlessCheng/codeforces-go
func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var n, v, w int
	Fscan(in, &n)
	a := make([]int, n)
	for i := range a {
		Fscan(in, &a[i])
	}
	g := make([][]int, n)
	for i := 1; i < n; i++ {
		Fscan(in, &v, &w)
		v--
		w--
		g[v] = append(g[v], w)
		g[w] = append(g[w], v)
	}
	ans := make([]int, n)
	dp := []int{}
	var f func(v, fa int)
	f = func(v, fa int) {
		if i := sort.SearchInts(dp, a[v]); i < len(dp) {
			old := dp[i]
			dp[i] = a[v]
			ans[v] = len(dp)
			for _, w := range g[v] {
				if w != fa {
					f(w, v)
				}
			}
			dp[i] = old
		} else {
			dp = append(dp, a[v])
			ans[v] = len(dp)
			for _, w := range g[v] {
				if w != fa {
					f(w, v)
				}
			}
			dp = dp[:len(dp)-1]
		}
	}
	f(0, -1)
	for _, v := range ans {
		Fprintln(out, v)
	}
}

func main() { run(os.Stdin, os.Stdout) }


Measured memory_bytes: 76204
import java.io.*;
import java.nio.CharBuffer;
import java.util.NoSuchElementException;

public class Main {

    public static void main(String[] args) {
        SimpleScanner scanner = new SimpleScanner(System.in);
        PrintWriter writer = new PrintWriter(System.out);

        int n = scanner.nextInt();
        int first = 0, second = 0, idx = -1;
        for (int i = 0; i < n; ++i) {
            int a = scanner.nextInt();
            if (a > first) {
                second = first;
                first = a;
                idx = i;
            } else if (a > second) {
                second = a;
            }
        }
        for (int i = 0; i < n; ++i) {
            writer.println(i == idx ? second : first);
        }

        writer.close();
    }

    private static class SimpleScanner {

        private static final int BUFFER_SIZE = 10240;

        private Readable in;
        private CharBuffer buffer;
        private boolean eof;

        SimpleScanner(InputStream in) {
            this.in = new BufferedReader(new InputStreamReader(in));
            buffer = CharBuffer.allocate(BUFFER_SIZE);
            buffer.limit(0);
            eof = false;
        }


        private char read() {
            if (!buffer.hasRemaining()) {
                buffer.clear();
                int n;
                try {
                    n = in.read(buffer);
                } catch (IOException e) {
                    n = -1;
                }
                if (n <= 0) {
                    eof = true;
                    return '\0';
                }
                buffer.flip();
            }
            return buffer.get();
        }

        void checkEof() {
            if (eof)
                throw new NoSuchElementException();
        }

        char nextChar() {
            checkEof();
            char b = read();
            checkEof();
            return b;
        }

        String next() {
            char b;
            do {
                b = read();
                checkEof();
            } while (Character.isWhitespace(b));
            StringBuilder sb = new StringBuilder();
            do {
                sb.append(b);
                b = read();
            } while (!eof && !Character.isWhitespace(b));
            return sb.toString();
        }

        int nextInt() {
            return Integer.valueOf(next());
        }

        long nextLong() {
            return Long.valueOf(next());
        }

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

Measured memory_bytes: 44700
def main():
    N, M, X, Y = map(int, input().split())
    x = list(map(int, input().split()))
    y = list(map(int, input().split()))
    for t in range(X + 1, Y + 1):
        if t > max(x) and min(y) >= t:
            print('No War')
            exit()
    print('War')


main()


Measured memory_bytes: 3060
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <bitset>
#include <complex>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl;
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
typedef complex<double> CD;

int main() {
	while (true) {
		double q; cin >> q;
		if (q == -1)break;

		double x = q / 2.;
		while (true) {
			x = x - (pow(x, 3) - q) / (3 * pow(x, 2));
			if (abs(pow(x, 3) - q) < 0.00001*q)break;
		}
		printf("%.20f\n", x);
	}

}


Measured memory_bytes: 3424
// Problem : B - Greedy Takahashi
// Contest : AtCoder Beginner Contest 149
// URL : https://atcoder.jp/contests/abc149/tasks/abc149_b
// Memory Limit : 1024.000000 MB 
// Time Limit : 2000.000000 milisec 
// Powered by CP Editor (https://github.com/coder3101/cp-editor)

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using ld = long double;
#define all(x) (x).begin(),(x).end()
#define io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int main () {
	ll a,b,k;
	scanf ("%lld %lld %lld",&a,&b,&k);
	if (k > a) {
		printf ("0 %lld\n",max(0LL,b-(k-a)));
	} else {
		printf ("%lld %lld\n",a-k,b);
	}
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type Val struct {
	id, num int
}
type ByNum []Val

func (a ByNum) Len() int           { return len(a) }
func (a ByNum) Less(i, j int) bool { return a[i].num < a[j].num }
func (a ByNum) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	a, b := sc.nextInt(), sc.nextInt()
	if a*b%2 == 0 {
		fmt.Fprintln(wtr, "Even")
	} else {
		fmt.Fprintln(wtr, "Odd")
	}

	wtr.Flush()
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
string S;
vector<P> OI;
bool check(int h){
  //cout << "h " << h << endl;
  int tk=S.size()-1;
  if( OI.size() < h ) return false;
  for(int i=0;i<h;i++){
    tk=min( tk, OI[i].second );
  }
  int res = 0;
  int H=h;
  h--;
  for(int i=0;i<(int)S.size()&&h>-1;i++){
    if( (i<tk&&S[i] == 'I') || S[i] == 'J' ){
      //cout << i << " -> ";
      while( h>-1 && i >= OI[h].first ) h--;
      if( h>-1 ){
        //cout << OI[h].first << " -> " << OI[h].second << endl;
        res++;
        h--;
      } 
    }
  }
  // cout << H << " "<< res << endl;
  return res==H;
}
int N;
int main(){
  cin >> N;
  cin >> S;
  int st=0,ed=(int)S.size()/3;
  int oc=S.size()-1;
  for(int i=(int)S.size()-1;i>-1;i--){
    oc = min(oc,i-1);
    if( S[i] == 'I' ){
      P p = P(-1,i);
      for(;oc>-1;oc--){
        if( S[oc] == 'O' ){
          p.first=oc;
          oc--;
          break;
        }
      }
      if( p.first!=-1 ) OI.push_back( p );
    }
  }
  //for(int i=0;i<OI.size();i++) cout << OI[i].first << ", "<<OI[i].second << endl;
  
  int res = 0;  
  while(st<=ed){
    int h=(st+ed)/2;
    if( check(h) ){
      st = h+1;
      res=h;
    } else {
      ed = h-1;
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 8628