akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] H = Console.ReadLine().Split(' ');
            int S = int.Parse(H[0]);
            int W = int.Parse(H[1]);

            if (S <= W) 
            Console.WriteLine("unsafe");
            else
            Console.WriteLine("safe");

        }
    }
}


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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)

using ll = long long;
using P = std::tuple<int,int>;

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

int S[1000];
bool dp[111][100100];

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

    int N;
    std::cin >> N;

    for(int i=0;i<N;++i){
        std::cin >> S[i];
    }

    dp[0][0] = true;

    for(int i=0;i<N;++i){
        for(int j=0;j<100100;++j){
            dp[i+1][j] |= dp[i][j];
            if(j + S[i] < 100100){
                dp[i+1][j+S[i]] |= dp[i][j];
            }
        }
    }

    int res = 0;
    for(int i=0;i<100100;++i){
        if(dp[N][i] && i % 10 > 0){res = i;}
    }

    std::cout << res << std::endl;
}


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

int main(void){
    int N,W;
    cin>>N>>W;
    
    long long w[N+1],v[N+1];
    long long dp[N+1][W+1];
    for(int i=0;i<N;i++){
        cin>>w[i+1]>>v[i+1];
    }
  
    memset(dp,0,sizeof(dp));
    for(int i=1;i<=N;i++){
        for(int j=0;j<=W;j++){
            if(w[i]>j)dp[i][j]=dp[i-1][j];
            else dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i]]+v[i]);
        }
    }
    
    cout<<dp[N][W]<<endl;
}


Measured memory_bytes: 79104
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    numbers=[2,1]
    number = int(input())

    for i in range(2,number+1):
        numbers.append(numbers[i-1]+numbers[i-2])
    print(numbers[-1])
    
if __name__=="__main__":
    main()

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

int main() {
  int N;
  cin >> N;
  int ans;
  int x=0;
  vector<int> vec(N);
  
  for(int i=0;i<N;i++){
  cin >> vec.at(i);
  }
  for(int i=0;i<N;i++){
   if(x<= vec.at(i)){
     x=vec.at(i);
     ans++;
     
    }
  }
  
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ull unsigned long long
#define ll long long
#define ld long double
#define PSET(x,y) fixed<<setprecision(y)<<x
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define lop(i,a,b) for(ll i=a;i<b;i++)
#define lopr(i,a,b) for(ll i=a;i>=b;i--)
#define all(v) (v).begin(),(v).end()
#define mp make_pair
#define pb push_back
#define mt make_tuple
#define eb emplace_back
#define ff first
#define ss second
#define pi pair<int,int>
#define pll pair<ll, ll>
#define ti tuple<int,int>
#define tll tuple<ll, ll>
#define si set<int>
#define sll set<ll>
#define maxheap priority_queue<ll>
#define minheap priority_queue<ll,vector<ll>,greater<ll>>
#define state tuple<int,int,int>
#define graph map<ll,list<ll>>

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const ld PI = asin(1) * 2;
inline int sbt(int x){return __builtin_popcount(x);} //returns number of set bits

using namespace std;

#define TRACE
#ifdef TRACE
#define deb(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ',');
        cerr.write(names, comma - names) << " : " << arg1<<" | ";
        __f(comma+1, args...);
    }
#else
#define deb(...)
#endif

#define SIZE 0

bool comp(int i, int j){
	int ui = i%10;
	int uj = j%10;

	if(ui==0)
		return true;

	if(uj==0)
		return false;
	
	return ui>uj;
}

int main(){
    // clock_t tStart = clock();
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    
    FastIO
    
    vector<int> vec(5);

    lop(i,0,5){
 		cin>>vec[i];   
    }

	sort(all(vec),comp);	
	// lop(i,0,5)
	// 	deb(vec[i]);

	int ans=0;
	lop(i,0,4){
		if(vec[i]%10 != 0)
			ans += ((vec[i]/10)+1)*10;
		else
			ans += vec[i];
		// deb(i,ans);
	}

	ans += vec[4];

	cout<<ans;
   // printf("Time taken: %.6fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n,m,c,p,q,t,x,d,e,f;
    string s,ss;
    vector<ll>v1;
    deque<ll>dq;
    cin>>n>>m>>c;
    t=x=0;
    for(int i=0;i<m;i++)
    {
        cin>>e;
        v1.push_back(e);
    }
    for(int i=0;i<n;i++)
    {
        x=c;
    vector<ll>v2;
        for(ll j=0;j<m;j++)
        {
            cin>>d;
            //v2.push_back(d);
            x+=v1[j]*d;
        }
//        for(ll j=0;j<m;j++)
//        {
//            x+=v1[i]*v2[i];
//        }
        if(x>0) t++;
        //cout<<x<<endl;
    }

    cout<<t<<endl;
}






Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;

class Program
{
    static void Main()
    {
        SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().Solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";


    void Solve()
    {
        var N = cin.Nextint;
        var G = new HashSet<int>();
        int cnt = 0;
        for (int i = 0; i < N; i++)
        {
            var d = cin.Nextint;
            if (G.Contains(d))
            {
                cnt++;
            }
            else
            {
                G.Add(d);
            }
        }
        if (cnt % 2 == 1)
        {
            cnt++;
        }
        WriteLine(N - cnt);
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] Scan { get { return ReadLine().Split(); } }
    public int[] Scanint { get { return Array.ConvertAll(Scan, int.Parse); } }
    public long[] Scanlong { get { return Array.ConvertAll(Scan, long.Parse); } }
    public double[] Scandouble { get { return Array.ConvertAll(Scan, double.Parse); } }
    public string Next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return Next;
        }
    }
    public int Nextint { get { return int.Parse(Next); } }
    public long Nextlong { get { return long.Parse(Next); } }
    public double Nextdouble { get { return double.Parse(Next); } }
}

Measured memory_bytes: 13784
program answer
  implicit none
  integer(16) :: i, N, ans
  integer(16) :: count(26)
  character(len=100000) :: S
  
  read(*,*) N
  read(*,*) S
  count=0
  do i = 1, N
     count(ichar(S(i:i))-96)=count(ichar(S(i:i))-96)+1
  end do

  ans=1
  do i = 1, 26
     ans=ans*(count(i)+1)
     ans=mod(ans,10**9+7)
  end do
  ans=ans-1
  write(*,*) ans
  stop
 end program answer


Measured memory_bytes: 3048
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t N,A,B;
  cin >> N >> A >> B;
  vector<int64_t> vec(N);
  for(int i=0; i<N; i++){
    cin >> vec.at(i);
  }
  int64_t ans = 0;
  for(int i=0; i<N-1; i++){
    if((vec.at(i+1) - vec.at(i))*A < B){
      ans += (vec.at(i+1) - vec.at(i))*A;
    }
    else{
      ans += B;
    }
  }
  cout << ans << endl;
}

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

typedef long long ll;

vector<int> adj[1010101];

pair<int, int> dfs(int x, int prv)
{
  pair<int, int> ret = {x, 0};
  for(int y : adj[x])
  {
    if(y == prv) continue;

    pair<int, int> t = dfs(y, x);
    if(t.second > ret.second)
      ret = t;
  }

  ret.second++;
  return ret;
}

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

  int n; cin >> n;
  for(int i=0; i<n-1; i++) {
    int x, y; cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }

  pair<int, int> p1 = dfs(1, -1);
  pair<int, int> p2 = dfs(p1.first, -1);

  cout << (p2.second % 3 == 2 ? "Second" : "First")  << endl;

  return 0;
}



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

#define io ios::sync_with_stdio(false)
#define pb push_back
#define pqueue priority_queue
#define fi first
#define se second
#define ls rt<<1
#define rs rt<<1|1
#define sz(x) (int)(x).size()
#define dbg(x) cout<<#x<<" --- "<<x<<endl
#define mst(x,a) memset(x,a,sizeof(x))
#define fin(a) freopen(a,"r",stdin)
#define fout(a) freopen(a,"w",stdout)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b); }
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r; }
const int inf=0x7fffffff;

int main(){
	int x,y,z;cin>>x>>y>>z;
	cout<<((x+y-1)/y)*z<<endl;
	return 0;
}

Measured memory_bytes: 3620
#include <iostream>

using namespace std;

int main(){
    int k,n;
    cin >> k >> n;
    int mayor=0, anterior, actual,ini;

    for(int i = 0; i < n; i++){
        cin >> actual;
        if(i == 0) ini = actual;
        else if(i>=2 &&  mayor < actual-anterior)
                mayor = actual - anterior;

        anterior = actual;
    }
    if(mayor < ini+k - actual) mayor = ini+k-actual;
    cout << k - mayor ;

    return 0;
}

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

using namespace std;

void hawawa(){
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto&& i : a) {
    cin >> i;
  }
  sort(rbegin(a), rend(a));
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (i % 2) {
      ans -= a[i];
    } else {
      ans += a[i];
    }
  }
  cout << ans << "\n";
}

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

Measured memory_bytes: 256
s = input()
a,b = int(s[:2]),int(s[2:])
yymm = False
mmyy = False
if b > 0 and b <= 12:
  yymm = True
if a <= 12 and 0 < a:
  mmyy = True
if yymm and mmyy:
  print("AMBIGUOUS")
elif yymm:
  print("YYMM")
elif mmyy:
  print("MMYY")
else:
  print("NA")

Measured memory_bytes: 9132
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, a[60], b[60], i, cnt=0;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        b[i]=a[i];
    }
    sort(a, a+n);
    for(i=0; i<n;i++)
    {
        if(a[i]!=b[i])
            cnt++;
    }
    if(cnt<=2)
        cout<<"YES";
    else
        cout<<"NO";

}


Measured memory_bytes: 3668
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;

public class Main {

	public static void main(String[] args) {
       
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        ArrayList<Integer> list = new ArrayList<Integer>();
        
        for(int i = 0; i < a; i++){
            list.add(sc.nextInt());
        }
        ArrayList<Integer> list1 = new ArrayList<Integer>(list);
        Collections.sort(list1);
        int max = list1.get(a - 1);
        int second = list1.get(a - 2);
        for(int i = 0; i < a; i++){
            if(list.get(i) == max){
                System.out.println(second);
            }else{
                System.out.println(max);
            }
        }
    }
}


Measured memory_bytes: 92828
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll n;
  cin >> n;
  vector<P> a(n);
  vector<P> b(n);
  rep(i, n) {
    cin >> a[i].fr;
    a[i].sc = i;
  }
  rep(i, n) {
    cin >> b[i].fr;
    b[i].sc = i;
  }

  sort(all(a));
  sort(all(b));

  // Check the sorted state. In each i, a[i] <= b[i] must be satisfied.
  rep(i, n) {
    if (a[i].fr > b[i].fr) {
      cout << "No" << endl;
      return 0;
    }
  }

  // Check if the i exists in which a[i+1] <= b[i].
  for (ll i = 0; i + 1 < n; ++i) {
    if (a[i+1].fr <= b[i].fr) {
      cout << "Yes" << endl;
      return 0;
    }
  }

  // Check the count of cycles. We treat the cycles as the connected components.
  vector<ll> p(n); // p[i] .. The parent of i.
  rep(i, n) {
    p[a[i].sc] = b[i].sc;
  }
  ll ans = 0; // The count of cycles.
  vector<bool> visited(n);
  rep(i, n) {
    if (visited[i]) { continue; }
    ++ans;

    ll x = i;
    do {
      visited[x] = true;
      x = p[x];
    } while (x != i);
  }

  if (ans > 1) { // The are 2 or more cycles.
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 4224
#include<iostream>
#include<math.h>
using namespace std;
 
bool isPrime(int x){
  if(x==2){
    return true;
  }
  if(x<2 || x%2==0){
    return false;
  }
 
  int i=3;
  while(i<=sqrt(x)){
    if(x%i==0){
      return false;
    }
    i = i+2;
  }
 
  return true;
}
 
int main(){
  int n;
  cin >> n;
 
  int N[n];
  int c=0;
  for(int i=0;i<n;i++){
    cin >> N[i];
    if(isPrime(N[i])){
      c++;
    }
  }
  cout << c << endl;
 
  return 0;
}


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

using namespace std;

int sm(const string &s){
    int n=s.length(),buf=1,res=0;
    for(int i=0;i<n;++i){
        if(s[i]>='0' && s[i]<='9'){
            buf=s[i]-'0';
            continue;
        }
        else if(s[i]=='m')res+=1000*buf;
        else if(s[i]=='c')res+=100*buf;
        else if(s[i]=='x')res+=10*buf;
        else if(s[i]=='i')res+=buf;
        buf=1;
    }
    return res;
}

string ms(int n){
    string res;
    int m,c,x,i;
    m=n/1000;
    n-=m*1000;
    c=n/100;
    n-=c*100;
    x=n/10;
    n-=x*10;
    i=n;
    if(m>=1){
        if(m>1)res+='0'+m;
        res+='m';
    }
    if(c>=1){
        if(c>1)res+='0'+c;
        res+='c';
    }
    if(x>=1){
        if(x>1)res+='0'+x;
        res+='x';
    }
    if(i>=1){
        if(i>1)res+='0'+i;
        res+='i';
    }
    return res;
}

int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;++i){
        string s1,s2;
        cin>>s1>>s2;
        cout<<ms(sm(s1)+sm(s2))<<endl;
    }
}

Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long
#define float long double
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define endl '\n'
#define pii pair<int, int>
#define min3(a,b,c) min(a, min(b, c))
#define max3(a,b,c) max(a, max(b, c))
#define all(x) x.begin(), x.end()
#define fill(a,b) memset(a, b, sizeof(a))
#define sz(x) (int)x.size()
#define sp(x) setprecision(x)
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define mex 1000005
int sei[mex],vis[mex];

signed main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

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

    int n; cin>>n;
    int arr[n],gcd=0;
    for(int i=0;i<n;i++){
        cin>>arr[i];
        gcd=__gcd(gcd,arr[i]);
    }
    if(gcd!=1){
        cout<<"not coprime"<<endl;
        return 0;
    }
    for(int i=0;i<mex;i++) sei[i]=i;
    sei[0]=sei[1]=-1;
    for(int i=0;i<mex;i++){
        if(sei[i]==i){
            for(int j=2*i;j<mex;j+=i) sei[j]=i;
        }
    }
    for(int i=0;i<n;i++){
        while(arr[i]!=1){
            int x=sei[arr[i]];
            if(vis[x]==1){
                cout<<"setwise coprime"<<endl;
                return 0;
            }
            vis[x]=1;
            while(arr[i]%x==0) arr[i]/=x;
        }
    }
    cout<<"pairwise coprime"<<endl;
}

Measured memory_bytes: 19828
#include <iostream>

#include <string.h>

using namespace std;

#define MAX_N 100
#define MAX_M 100
#define MAX_D 1000

#define INF 10000000

int main()
{
	int n, m, c = 0;

	int s[MAX_N], t[MAX_M], Answer_s[MAX_D], Answer_t[MAX_D];

	memset(Answer_s, -1, sizeof(Answer_s));
	memset(Answer_t, -1, sizeof(Answer_t));

	while (true)
	{
		cin >> n >> m;

		if (n == 0 && m == 0) { break; }

		int ssum = 0, tsum = 0;

		for (int i = 0; i < n; i++) { cin >> s[i]; ssum += s[i]; }
		for (int i = 0; i < m; i++) { cin >> t[i]; tsum += t[i]; }

		int Answer_sum = INF;

		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < m; j++)
			{
				if (ssum - s[i] + t[j] == tsum - t[j] + s[i])
				{
					if (Answer_sum > s[i] + t[j])
					{
						Answer_sum = s[i] + t[j];

						Answer_s[c] = s[i];
						Answer_t[c] = t[j];
					}
				}
			}
		}

		c++;
	}

	for (int i = 0; i < c; i++)
	{
		if (Answer_s[i] == -1 && Answer_t[i] == -1)
		{
			cout << -1 << endl;
		}
		else
		{
			cout << Answer_s[i] << ' ' << Answer_t[i] << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1168
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>

#define ll long long

using namespace std;


int main()
{
    ll a, b, c, d;

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

    cout << max(c*b, max(max(a*c , a*d), d*b));

    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define pll pair<ll,ll>
#define pb push_back
#define mp(x, y) make_pair((x), (y))
#define F first
#define S second
#define I insert
#define vll vector<ll>
#define vbl vector<bool>
#define vvll vector<vll>
#define vld vector<ld>
#define vb vector<bool>
#define vc vector<char>
#define vpll vector<pll>
#define all(x) (x).begin(), (x).end()

template<class T> ostream& operator<<(ostream &os, vector<T> V){
	os << "[ ";
	for(auto v  : V) os << v << " ";
	return os << " ]";
}
template<class T> ostream& operator<<(ostream &os, set<T> V){
	os << "[ ";
	for(auto v  : V) os << v << " ";
	return os << " ]";
}
template<class T , class R > ostream& operator<<(ostream &os, map<T , R> V){
	os << "[ ";
	for(auto v  : V) os << "(" << v.first << ":" << v.second << ")";
	return os << " ]";
}
template<class T , class R > ostream& operator<<(ostream &os, pair<T , R> V){
	return os << "(" << V.first << "," << V.second << ")";
}

#define cerr cout
#define TRACE
#ifdef TRACE
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ',');
        cerr.write(names, comma - names) << " : " << arg1<<" | ";
        __f(comma+1, args...);
    }
    clock_t clk=clock();
    #define checktime() cout<<"\nTime Elapsed : "<<float(clock()-clk)/CLOCKS_PER_SEC<<endl
#else
    #define trace(...);
    #define checktime();
#endif

const ll Mod = 1e9 + 7;
// const ll Mod = 998244353;
const ll MAXN = 1e5;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout<<fixed<<setprecision(25);

    ll n;cin>>n;
    vll ans(n,0);
    for(ll i=0;i<n-1;i++){
        ll x;cin>>x;
        ans[x-1]++;
    }
    for(ll i=0;i<n;i++){
        cout<<ans[i]<<"\n";
    }
    
    return 0;
}

Measured memory_bytes: 4844
#include<bits/stdc++.h>
    #define int ll
    #define M 1000000007
    #define hell 998244353
    #define big 1e18
    #define pb push_back
    #define pi 3.1415926536
    #define mp make_pair
    #define ub upper_bound
    #define lb lower_bound
    #define mem0(a) memset(a,0,sizeof(a))
    #define memf(a) memset(a,false,sizeof(a))
    #define mem1(a) memset(a,1,sizeof(a))
    #define all(a) a.begin(),a.end()
    #define ll long long
    #define vec vector <int>
    #define pii pair<int,int>
    #define endl "\n"
    #define gcd __gcd
    using namespace std;
    int power(int x, unsigned int y, unsigned int m) 
	{ 
    	if (y == 0) 
        	return 1; 
    	int p = power(x, y/2, m) % m; 
    	p = (p * p) % m; 
  
 	   return (y%2 == 0)? p : (x * p) % m; 
	} 
	int modInverse(int a, int m) 
	{   
    	return power(a, m-2, m);
	}
    signed main()
    {
    	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    	ll t=1;
    	// cin >> t;
    	/*SAARE INPUTS LENA*/
    	/*VARIABLES KI RANGE DEKHLENA*/
    	while(t-->0)
    	{
    		ll a=0,b=0,c=0,d=0;
    		cin>>a>>b>>c>>d;
    		// cout<<ceil(c/b)<<" "<<ceil(a/d);
    		if(ceil(double(c)/b)<=ceil(double(a)/d))
    			cout<<"Yes";
    		else
    			cout<<"No";
    	}
    	return 0;
    }

Measured memory_bytes: 3580
// All Heil Fire Lord Zuko

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

const int N = 2 * 100 * 1000 + 19;

int n, a[N];
bool b[N];

bool isValid(int);

int main() {
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cin >> n;
    for (int i = 1; i < 2 * n; i ++)
        cin >> a[i];
    int down = 1, up = 2 * n;
    while (up - down > 1) {
        int md = (up + down) / 2;
        if (isValid(md))
            down = md;
        else
            up = md;
    }
    cout << down;
    return 0;
}

bool isValid(int x) {
    for (int i = 0; i < 2 * n; i ++)
        b[i] = a[i] >= x;
    for (int i = 1; i < n; i ++) {
        if (b[n - i] == b[n - i + 1])
            return b[n - i];
        if (b[n + i] == b[n + i - 1])
            return b[n + i];
    }
    if (n % 2)
        return b[n];
    else
        return !b[n];
}

/* THINGS TO CHECK !! */

// Runtime ->
// Overflows ->
// Order is ->

/* READ PROBLEM STATEMENT CAREFULLY */



Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
int main(){
  long N,M;cin>>N>>M;
  vector<long>A(N);for(long i=0;i<N;i++)cin>>A[i];
  long s=0;
  for(long a:A)s+=a;
  long c=0;
  for(long a:A)c+=(a*4*M>=s);
  cout<<(c>=M?"Yes":"No");
}

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

#define INF 1145141919

int main()
{
	long long int n,m;
	cin >> n >> m;
	if(n == 1 && m == 1)
	{
		cout << 1 << endl;
	}
	else if(n == 1 || m == 1)
	{
		cout << (n==1?m-2:n-2) << endl;
	}
	else
	{
		cout << (n - 2) * (m - 2) << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  map<int,int> m;
  int n,k;
  cin >> n  >> k;
  rep(i,n) {
    int x;
    R x;
    m[x]++;
  }
  priority_queue<int,vector<int>,greater<int> > que;
  tr(it,m) que.push(it->S);
  int ans=0;
  while(que.size()>k) {
    ans+=que.top();que.pop();
  }
  pr(ans);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 10744
import sys
import time
import math
st = time.perf_counter()
def inpl():
    return list(map(int, input().split()))
# ------------------------------

N = int(input())
n = N%1000
if n != 0:
	print(1000-n)
else:
	print(0)

# ------------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)


Measured memory_bytes: 9104
#include <bits/stdc++.h>
using namespace std;
bool pal(int n,int m,string cad){
  for(int i=n;i<m/2;i++){
    if(cad[i]!=cad[m-i-1]){
      return false;
    }
  }
  return true;
}
int main(){
  string cad;cin>>cad;
  int n = cad.size();
  int m=(n-1)/2;
  int k=(n+3)/2;
  if(pal(0,m,cad)&&pal(k,n,cad)&&pal(0,n,cad)){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
s = list(input())
t = list(input())

s.sort()
t.sort(reverse=True)

for i in range(len(t)):
  if i > len(s)-1:
    print('Yes')
    exit()
  elif s[i] == t[i]:
    continue
  elif s[i] > t[i]:
    print('No')
    exit()
  else:
    print('Yes')
    exit()
if len(t) > len(s):
  print('Yes')
else:
  print('No')
    


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pll = pair<ll,ll>;
using vpii = vector<pii>;
using vpli = vector<pli>;
using vpll = vector<pll>;

#define rep(i, n) for(int i=0;i<(int)n;i++)
#define rep2(i, s, n) for(int i=(s);i<(int)n;i++)
int INF=1e9+7;

string S;

bool judge(int K) {
  if(S.size()>=2*K-1) return true;
  int l=S.size()-K, r=K-1;
  bool flag=true;
  rep2(i,l,r) flag&=S[i]==S[i+1];
  return flag;
}

int main() {
  cin >> S;
  int l=1,r=S.size()+1;
  while(r-l>1) {
    int m=(l+r)/2;
    if(judge(m)) l=m;
    else r=m;
  }
  
  cout << l << endl;
}

Measured memory_bytes: 512
fun main(args: Array<String>) {
    val (A, B) = readInputLine().split(" ").map { it.toInt() }

    val ans = Array(100) { CharArray(100) { '#' } }

    for (i in 50 until 100) {
        ans[i] = CharArray(100) { '.' }
    }

    for (i in 0 until A - 1) {
        ans[i / 50 * 2][(i % 50) * 2] = '.'
    }

    for (i in 0 until B - 1) {
        ans[99 - (i / 50 * 2)][(i % 50) * 2] = '#'
    }

    println("100 100")
    for (a in ans) {
        println(a.joinToString(""))
    }
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 37920
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var nk = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
			int n = nk[0];
			int k = nk[1];
			int[] a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
			Array.Sort(a);

			int ng = -1;
			int ok = n;
			while (ok - ng > 1) {
				int mid = (ng + ok) / 2;
				int temp = a[mid];
				a[mid] = 0;
				if (IsNeed(a, n, k, temp)) {
					ok = mid;
				} else {
					ng = mid;
				}

				a[mid] = temp;
			}

			int ans = ok;
			Console.WriteLine(ans);
		}

		static bool IsNeed(int[] a, int n, int k, int aa)
		{
			var dp = new bool[k];
			dp[0] = true;

			for (int i = 0; i < n; i++) {
				var dst = new bool[k];
				for (int j = 0; j < k; j++) {
					if (dp[j] == false) {
						continue;
					}

					dst[j] = true;
					if (j + a[i] < k) {
						dst[j + a[i]] = true;
					}
				}

				if (a[i] < k) {
					dst[a[i]] = true;
				}

				dp = dst;
			}

			int max = 0;
			for (int i = k - 1; i >= 0; i--) {
				if (dp[i]) {
					max = i;
					break;
				}
			}

			return max + aa >= k;
		}
	}
}

Measured memory_bytes: 19708
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define r0 return 0;
#define f(k,i,n,j) for(ll k=i;k<=n;k=k+j)
#define cin(a) cin>>a;
#define loop int t;cin>>t;while(t--)
#define vi vector<int>
#define vii vector<long long int>
#define SORT(v) sort(v.begin(),v.end());
#define mod (1e9+7)
#define crap ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl "\n"
signed main()
{
    crap;
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    int sum=0;
    for(int i=0;i<n;i++)
    {
        if(i==n-1)
        sum+=a[i]/2;
        else
        sum+=a[i];
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 256
import java.util.*;

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

        for (int i = 0; i < o.length(); i++) {
            System.out.print(o.charAt(i));
            if (i < e.length()) {
                System.out.print(e.charAt(i));
            }
        }
        System.out.print("\n");
    }
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
//tie(a,b,c) = make_tuple(10,9,87);
#define pop_(a) __builtin_popcount((a))
ll keta(ll a){ll r=0;while(a){a/=10;r++;}return r;}



int main(){

  ll N,M;
  cin >> N >> M;
  priority_queue<ll> A;
  ll a;
  FOR(i,0,N){
    cin >> a;
    A.push(a);
  }
  FOR(i,0,M){
    a = A.top();
    A.pop();
    a /= 2;
    A.push(a); 
  }
  ll ans = 0;
  while(A.size()){
    ans += A.top();
    A.pop();
  }
  cout << ans << endl;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
int a, b;
string s, t, c;
int main () {
	cin >> s >> t;
	cin >> a >> b;
	cin >> c;
	if(s == c) {
		a--;
	}
	if(t == c) {
		b--;
	}
	cout << a << " " << b;
}

Measured memory_bytes: 256
#include <cstdio>
#include<iostream>
using namespace std;
int main(){
  int N, A, B; scanf("%d%d%d", &N, &A, &B);
  if(A + B - 1 > N || N > 1LL * A * B){ puts("-1"); return 0; } 
  for(int l = 0, g = N - A, a = 1; a <= A; a++){
    int t =(g > B - 1)? B - 1 : g;
    for(int i = l + t + 1; i > l; i--) 
		printf("%d ", i);
    l += t + 1; g -= t;
  }
   printf("\n");
  return 0;
}


Measured memory_bytes: 2176
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cctype>
#include <climits>
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <memory>
#include <functional>

using namespace std;

#define ALL(a) (a).begin(), (a).end()
#define REP(index, begin, end) for (int (index) = (begin); (index) < (end); (index)++)
#define RE(index, end) REP(index, 0, end)
#define INF INT_MAX / 3
#define D(x) cout << #x << " = " << x << endl;

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

int main()
{
	array<int, 4> a;
	array<int, 2> b;
	int sum;
	RE(i, 4)
	{
		scanf("%d", &a[i]);
	}
	RE(i, 2)
	{
		scanf("%d", &b[i]);
	}
	sort(ALL(a), greater<int>());
	sum = max(b[0], b[1]);
	RE(i, 3)
	{
		sum += a[i];
	}
	printf("%d\n", sum);
	return 0;
}

Measured memory_bytes: 3232
#pragma region cp-helper
#include <bits/stdc++.h>
using namespace std;
#define AC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ll long long
#define ull unsigned long long
#define ii pair<int, int>
#define lll pair<ll, ll>
#define vi vector<int>
#define vvi vector<vi>
#define vl vector<ll>
#define vll vector<lll>
#define vvl vector<vl>
#define vii vector<ii>
#define all(a) a.begin(), a.end()
#define qsort(a) sort(all(a))
#define qsortd(a) sort(all(a), greater<>())
#define qsortf(a, f) sort(all(a), f)
#define pb(n) push_back(n)
#define eb(n) emplace_back(n)
#define pp(a, b) emplace_back(a, b)
#define umap unordered_map
#define uset unordered_set
#define nl '\n'
#define fileio(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout)
#define qmod %mod
#define pls signed
#define give main()
const int mod = 1000000007;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

#pragma endregion

const int N = 200005; 

int n, w, ans;
string a;

pls give {
    AC;
    cin >> n >> a;
    for (int i=0; i<n; i++) {
        if (a[i] == 'W') w++;
    }
    reverse(a.begin(), a.end());
    for (int i=0; i<w; i++) {
        if (a[i] != 'W') ans++;
    }
    cout << ans << nl;
}

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

int main(){
	string str;
    while(getline(cin,str)){
        if(str==".") break;
        stack<char> stk;
        string res = "yes";
        for(int i=0;i<str.size();i++){
            if(str[i]=='(') stk.push('(');
            if(str[i]=='[') stk.push('[');
 
            if(str[i]==')'){
                if(!stk.empty() && stk.top() != '(') res = "no";
                else if(stk.empty()) res = "no";
                else stk.pop();
            }
 
            if(str[i]==']'){
                if(!stk.empty() && stk.top() != '[') res = "no";
                else if(stk.empty()) res = "no";
                else stk.pop();
            }
 
        }
 
        if(!stk.empty()) res = "no";
        cout << res << endl;
    }
}

Measured memory_bytes: 3200
def solve array
  sum = 0
  (array.size - 1).times do |i|
    sum += array[i] * (array.size  - 1 - i)
  end
  sum
end

while (n = $stdin.gets.to_i) != 0 do
  array = Array.new()
  n.times do
    array << $stdin.gets.to_i
  end
  array.sort!
  puts solve(array)
end

Measured memory_bytes: 6276
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int w[100010], v[100010];
ll dp[110][100010];
int main()
{
	int N, W;
	cin >> N >> W;
	for (int i = 0; i < N; i++) {
		cin >> w[i] >> v[i];
	}
	for (int i = 0; i <= W; i++) {
		dp[0][i] = 0;
	}
	ll ans = 0;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j <= W; j++) {
			if (j - w[i] >= 0) {
				dp[i + 1][j] = max(dp[i][j - w[i]] + v[i], dp[i][j]);
			}
			else {
				dp[i + 1][j] = dp[i][j];
			}
			ans = max(ans, dp[i + 1][j]);
		}
	}
	cout << ans << endl;
}

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

using namespace std;

int h[41]; //-20, 20
int R;

bool ok(double t)
{
	for (int i = -R; i < R; i++){
		double ly = 0, ry = 0;
		
		ly = max(ly, -R + t + sqrt(R * R - i * i));
		ry = max(ry, -R + t + sqrt(R * R - (i + 1) * (i + 1)));
		
		if (ly > h[i + 20] + 1e-10 || ry > h[i + 20] + 1e-10){
			return (false);
		}
	}
	
	return (true);
}

int main()
{
	int n;
	
	while (scanf("%d %d", &R, &n) && R){
		memset(h, 0, sizeof(h));
		
		for (int i = 0; i < n; i++){
			int l, r, y;
			scanf("%d %d %d", &l, &r, &y);
			
			for (int j = l; j < r; j++) h[j + 20] = max(h[j + 20], y);
		}
		
		double l = 0, r = 20;
		
		for (int i = 0; i < 100; i++){
			if (ok((l + r) / 2)) l = (l + r) / 2;
			else r = (l + r) / 2;
		}
		
		printf("%.10lf\n", (l + r) / 2);
	}
	
	return (0);
}

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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define ALL(c) (c).begin(), (c).end()
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;}
const int MOD = 1000000007;

int main() {
    vector<vector<int>> c(3, vector<int>(3));

    REP(i, 3) REP(j, 3) cin >> c[i][j];

    if (c[0][0] - c[0][1] == c[1][0] - c[1][1] && c[1][0] - c[1][1] == c[2][0] - c[2][1]
            && c[0][0] - c[0][1] == c[1][0] - c[1][1] && c[1][0] - c[1][1] == c[2][0] - c[2][1]
            && c[0][1] - c[0][2] == c[1][1] - c[1][2] && c[1][1] - c[1][2] == c[2][1] - c[2][2]
            && c[0][1] - c[0][2] == c[1][1] - c[1][2] && c[1][1] - c[1][2] == c[2][1] - c[2][2]
    ){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
s=input()
t=input()
n=len(s)
m=len(t)
for i in range(n-1,-1,-1):
    if i+m-1>=n:
        continue
    j=0
    flag=True
    #print(i,end=' i cur\n')
    while j<m:
        if s[j+i]=='?':
            j+=1
        elif s[j+i]==t[j]:
            j+=1
        else:
            flag=False
            break
    if flag:
     #   print(i,end=' i\n')
        for k in range(i):
            if s[k]=='?':
                print('a',end='')
            else:
                print(s[k],end='')
        print(t,end='')
        for k in range(i+m,n):
            if s[k]=='?':
                print('a',end='')
            else:
                print(s[k],end='')
        print()
        import sys
        sys.exit()
print('UNRESTORABLE')



Measured memory_bytes: 3188
#include <vector>
#include <map>
#include <string>
#include <iostream>
#include <cmath>
#include <random>
#include <cstdlib>
#include <algorithm>
using namespace std;
#define MK make_pair
#define PB push_back
#define VI vector<int>
#define VII vector<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
const int MOD = 1000000007;
int main()
{
	int ANS;
	int N;
	int T;
	VI v;
	cin >> N;
	cin >> T;
	ANS = N*T;
	REP(i,N)
	{
		int time;
		cin >> time;
		v.PB(time);
	}
	REP(i, N - 1)
	{
		if ((v[i + 1] - v[i]) < T)
		{
			ANS -= T - (v[i + 1] - v[i]);
		}
	}
	cout << ANS << endl;
	return 0;
}

Measured memory_bytes: 1400
#include <iostream>
#include <vector>
#include <cmath>
#include <climits>
using namespace std;

#define INF INT_MAX

class RMQ{
public:

  vector<int> rangeMin;
  int n;

  
  RMQ(int size);
  void init(int size);
  void update(int k, int a);
  int find(int a, int b);
  int query(int a, int b, int k, int l, int r);


};


int main(){
  
  int n,l;

  cin >> n >> l;
  RMQ rmq(n);

  for(int i=0; i<n; i++){
    int a; cin >> a;
    rmq.update(i,a);
  }

  cout << rmq.find(0,l-1);
  for(int i=1; i<=n-l; i++){
    cout << " " << rmq.find(i,i+l-1);
  }
  cout << endl;
  
  return 0;
}




//===========================================
//===========================================

RMQ::RMQ(int size){
  init(size);
}
//@end RMQ()



void RMQ::init(int size){
  n=1;
  
  // calc necessary size of array
  while(n < size )n*=2;
  
  rangeMin.resize(2*n-1);
  for(int i=0; i<2*n-1; i++){
    rangeMin[i] = INF;
  }
}
//@end init()


void RMQ::update(int k, int a){
  k += n-1;
  rangeMin[k] = a;
  while( k>0 ){
    k = (k-1)/2;
    rangeMin[k] = min(rangeMin[k*2+1] , rangeMin[k*2+2]);
  }
}
//@end update()



int RMQ::find(int a, int b){
  return query(a, b+1, 0, 0, n);
}
//@end findMin()



int RMQ::query(int a, int b, int k, int l, int r){
  if( r <= a || b <= l )return INF;
  if( a <= l && r <= b )return rangeMin[k];

  int vl = query(a,b, k*2+1, l, (l+r)/2);
  int vr = query(a,b, k*2+2, (l+r)/2, r);
  return min(vr,vl);
}
//@end query()




Measured memory_bytes: 11016
import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);for(int r,i,x,y;(s.nextInt())>0;){s.next();int[][]a=new int[r=s.nextInt()][4];for(x=r;x-->0;)for(i=4;i-->0;)a[x][i]=s.nextInt();for(i=4;i-->1;){final int j=i;Arrays.sort(a,new Comparator<int[]>(){public int compare(int[]a,int[]b){return a[j]-b[j];}});}Map<Integer,BitSet>m=new HashMap<Integer,BitSet>();BitSet b;for(i=0;i<r;m.put(a[i][1],b),i+=2)((b=m.get(a[i][1]))!=null?b:(b=new BitSet())).set(a[i][3],a[i+1][3]);for(r=s.nextInt();r-->0;y=s.nextInt(),System.out.println((b=m.get(s.nextInt()))==null?0:b.get(x,y).cardinality()))x=s.nextInt();}}}

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

int main() {
    string S, T;
    cin >> S >> T;
    int ans = 0;
    for(int i = 0; i < S.size(); ++i) ans += S[i] != T[i];
    cout << ans << '\n';
    return 0;
}


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

char s[100];
int  a,b;

int main(){
	cin>>s+1;
	for(int i = 1; i <= 3; i++){
		if(s[i] == 'A') a++;
		else b++;
	}
	if(a == 3 || b == 3) cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <math.h>
#include <queue>
using namespace std;
typedef long long ll;

int main() {
  int X, Y, Z;
  cin >> X >> Y >> Z;

  cout << Z << " " << X << " " << Y << endl;

  return 0;
}

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

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

using namespace std;

int main()
{

	cin.tie(0);
	ios::sync_with_stdio(false);

	int N,M;
	map<string, int> red, blue;
	cin >> N;
	rep(i, N) {
		string s; cin >> s;
		red[s]++;
	}
	cin >> M;
	rep(i, M) {
		string s; cin >> s;
		blue[s]++;
	}

	int ans = 0;
	for (auto mp : red) {
		string s = mp.first;
		int n = mp.second;
		ans = max(ans, n - blue[s]);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<unordered_set>
#include<unordered_map>
using namespace std;
typedef long long ll;
#define chmax(a,b) a=max(a,b)
#define chmin(a,b) a=min(a,b)
#define all(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod
#define N 200010

int main(){
    ll n,p;
    ll ans=0;
    cin>>n;
    ll mi=1e9;
    rep(i,n){
	cin>>p;
	ans+=mi>p;
	chmin(mi,p);
    }
    cout<<ans<<endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h> 
     
    using namespace std; 
    #define ll long long
    #define ld long double
   ll gcd(ll a,ll b)
   {
    if(b==0)
        return a;
    return gcd(b,a%b);
   }
    int main()
    {
        ll n,d;
        cin >> n >> d;
        ll ans=0;
        for(ll i=0;i<n;i++)
        {
            ll x,y;
            cin >> x >> y;
            x=x*x;
            y=y*y;
            double dis=sqrt(x+y);
            double ck=d;
            if(dis<=ck)
                ans++;
            //cout << ans << "\n";
        }
        cout << ans << "\n";
    }
    

Measured memory_bytes: 3672
#include <bits/stdc++.h>
struct Fast {Fast(){std::cin.tie(0);std::ios::sync_with_stdio(false);}} fast;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define repR(i, n) for(ll i = n; i >= 0; i--)
#define For(i, m, n) for(ll i = m; i < n; i++)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) v.begin(), v.end()

using namespace std;

ll mod = 1e9+7;
inline ll gcd(ll a, ll b){
    ll r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

inline ll lcm(ll x, ll y)
{
    if(x == 0 || y == 0) {
        return -1;
    }
    
    return (x * y / gcd(x, y));
}

inline ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

inline ll nCr(ll n, ll r) {
    if ( r * 2 > n ) r = n - r;
    ll dividend = 1;
    ll divisor  = 1;
    for ( ll i = 1; i <= r; ++i ) {
        dividend *= (n-i+1);
        divisor  *= i;
    }
    return (dividend / divisor);
}

// 因数分解
inline vector<pair<ll, int>>factorize(ll n){
    vector<pair<ll, int>> res;
    for(ll i = 2; i * i <= n; ++i){
        if(n % i) continue;
        res.emplace_back(i, 0);
        while(n % i == 0){
            n /= i;
            res.back().second++;
        }
    }
    if(n != 1) res.emplace_back(n, 1);
    return res;
}

inline bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

//階乗
inline ll factorialMethod(ll k){
    ll sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

inline ll vector_finder(std::vector<ll> vec, ll number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
    if (index != vec.size()) { // 発見できたとき
        return 1;
        
        
    }
    else { // 発見できなかったとき
        return 0;
    }
}

void recursive_comb(ll *indexes, ll s, ll rest, std::function<void(ll *)> f) {
    if (rest == 0) {
        f(indexes);
    } else {
        if (s < 0) return;
        recursive_comb(indexes, s - 1, rest, f);
        indexes[rest - 1] = s;
        recursive_comb(indexes, s - 1, rest - 1, f);
    }
}

void foreach_permutation(int n, std::function<void(int *)> f) {
    int indexes[n];
    for (int i = 0; i < n; i++) indexes[i] = i;
    do {
        f(indexes);
    } while (std::next_permutation(indexes, indexes + n));
}

int main(){
    ll n;
    cin >> n;
    
    if(n % 10 == 3){
        cout << "bon" << endl;
    } else if(n % 10 == 0 || n % 10 == 1 || n % 10 == 6 || n % 10 == 8){
        cout << "pon" << endl;
    } else {
        cout << "hon" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <vector>
using namespace std;
int main(){
	int n;
	vector< vector<int> > a, b;

	int k = 1;
	do{

		cin >> n;
		a.resize(k);
		b.resize(k);

		//cout << a.size() << endl;

		if(n != 0)
		{
			for(int i = 0; i < n; ++i)
			{
				int workA, workB;
				cin >> workA >> workB;
				a[k - 1].push_back(workA);
				//cout << a[k - 1][i] << endl;
				b[k - 1].push_back(workB);
				//cout << a[k - 1][i] << endl;
			}
		}

		k++;
		//cout << "k = " << k << endl;
	}while(n != 0);

	for (int i = 0; i < a.size() - 1; ++i)
	{
		int aRes = 0, bRes = 0;
		for (int j = 0; j < a[i].size(); ++j)
		{
			if(a[i][j] > b[i][j])
			{
				aRes += (a[i][j] + b[i][j]);
			}
			else if(a[i][j] < b[i][j])
			{
				bRes += (a[i][j] + b[i][j]);
			}
			else
			{
				aRes += a[i][j];
				bRes += b[i][j];
			}
		}
		cout << aRes << " " << bRes << endl;
	}

}

Measured memory_bytes: 1352