akhauriyash/Code-Regression huggingface dataset:
/* goes here */
#include<bits/stdc++.h> //1
using namespace std; //2
typedef signed long long ll; //3
#define INF 0x3f3f3f3f //4
vector<pair<long long, long long>> rekkyo; //1
#define int ll //2
bool isvalid (ll i, ll j, ll h, ll w) { //3
    if(i<0 || h<=i || j<0 || w<=j){    //4
        return false; //1
    } return true; //2
} signed main(void){ //3
    int H,W,N;    //4
    cin >> H >> W >> N; //1
    int a[114514],b[114514]; //2
    for (ll i = 0; i < N; i++) { //3
        cin>>a[i]>>b[i];    //4
        for(int j = 0; j < 3; ++j){ //1
            for(int k=0;k<3;++k){ //2
                if (!j && !k) {a[i]--; b[i]--;} //3
                ;    //4
            } //1
        } //2
        for (ll j = -1; j <= +1; j++) { //3
            int c;    //4
            for(ll k = -1; k <= +1; ++k)if(isvalid(a[i] + j - 1, b[i] + k - 1, H, W) && isvalid(a[i] + j + 1, b[i] + k + 1, H, W))rekkyo.emplace_back(a[i] + j, b[i] + k); //1 †悪魔的行為†
        } //2
        if ("POKAIKO" == "RYONAIKO") std::sort( //3
        rekkyo.begin(),rekkyo.end());    //4
    } //1
    int Ans[10]={}; //2
    while (!rekkyo.empty()) { //3
    break;}    //4
    //pair<long long, long long> i, previous; //1
    for(int j=0;j<rekkyo.size();j++){ //2
        ll k; for (k = j; k < rekkyo.size() && rekkyo[k] == rekkyo[j]; k++); //3
    }    //4
    for(auto i : rekkyo){ //1
    } //2
    ll samebegin = 0, sameend; while (samebegin < rekkyo.size()) { //3
        ll samepunch;    //4
    break;}map<pair<long long, long long>, long long> taplis; //1
    for(auto i : rekkyo){ //2
    if (taplis.find(i) == taplis.end()) taplis.insert( //3
        make_pair(i,0));    //4
        ++taplis[i]; //1
    } //2
    Ans[0] = H * W - taplis.size(); //3
    for(pair<pair<long long,long long>,long long> PP:taplis){    //4
        ++Ans[PP.second]; //1
        ; //2
    } Ans[0] = (H - 2) * (W - 2); for (ll viine = 1; viine <= 9; viine++) { //3
        Ans[0]-=Ans[viine];    //4
    } for(auto i : Ans)cout << i << endl; //1
    int Gabriel,Satanichia,Raphiel; //2
    char* ukuku09 = "Ukunichia"; Satanichia = (int)ukuku09; //3
    return 0;    //4
} // 1 end

Measured memory_bytes: 73828
#include <iostream>
#include <string>

using namespace std;

int main(int argc, char* argv[]) {
  string s;
  cin >> s;

  int south = 0;
  int north = 0;
  int east = 0;
  int west = 0;
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == 'S')
      ++south;
    else if (s[i] == 'N')
      ++north;
    else if (s[i] == 'E')
      ++east;
    else if (s[i] == 'W')
      ++west;
  }

  // check north and south
  if (!((south == 0 && north == 0) || (south > 0 && north > 0))) {
    cout << "No" << endl;
    return 0;
  }

  // check east and west
  if (!((east == 0 && west == 0) || (east > 0 && west > 0))) {
    cout << "No" << endl;
    return 0;
  }

  cout << "Yes" << endl;

  return 0;
}

Measured memory_bytes: 256
// C - Dice and Coin
#include <bits/stdc++.h>
using namespace std;

int easy_log2(int n){
	int c, carry = 0;
	for(c=0; n>1; ++c){
		if(n&1) carry = 1;
		n>>=1;
	}
	return c + carry;
}

int main(){
	int N,K; cin>>N>>K;
	double ans = 0;
	for(int n=N; n; --n){
		int c = 1<<easy_log2( (K+n-1)/n );
		if(K<=n*c) ans += 1./N/c;
	}
	printf("%.12f\n",ans);
}

Measured memory_bytes: 256
#include<stdio.h>


int main(void){
  int i,N;
  int maxv=-1000000000;

  scanf("%d",&N);

  int array[N],j,minv;

  for(i=0;i<N;i++){
    scanf("%d",&array[i]);
  }



  
  minv=array[0];
  for(i=1;i<N;i++){
    if(maxv>=array[i]-minv){maxv=maxv;}
    else {maxv=array[i]-minv;}


    if(minv>=array[i]){minv=array[i];}
    else {minv=minv;}
  }

  printf("%d\n",maxv);
  return 0;
}



Measured memory_bytes: 2520
import java.util.Arrays;
import java.util.Scanner;

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

    int N = scanner.nextInt();
    long K = scanner.nextLong();
    int[] a = new int[N];
    for (int i = 0; i < N; i++) a[i] = scanner.nextInt();
    int[] f = new int[N];
    for (int i = 0; i < N; i++) f[i] = scanner.nextInt();

    Arrays.sort(a);
    Arrays.sort(f);

    long[] af = new long[N];
    long right = -1;
    for (int i = 0; i < N; i++) {
      af[i] = (long) f[i] * a[N - i - 1];
      right = Math.max(right, af[i]);
    }

    long left = -1;
    while (right - left > 1) {
      long mid = (left + right) / 2;
      long k = 0;
      for (int i = 0; i < N; i++) {
        if (af[i] > mid) k += (af[i] - mid - 1) / f[i] + 1;
      }
      if (k <= K) {
        right = mid;
      } else {
        left = mid;
      }
    }
    System.out.println(right);
  }
}


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

#define rep(i,N) for(int i=0;i<(int)(N);i++)
#define REP(i,k,N) for(int i=k;i<(int)(N);i++)

#define vi vector<int>
#define pb push_back

void f(int b, int dep, int mt, int mb);


int cnt;
int p,q,a,n;

int main(){

    while(cin >> p >> q >> a >> n,p){
        cnt=0;
        f(1,1,0,1);
        cout << cnt << endl;
    }

    return 0;
}


void f(int b, int dep, int mt, int mb){

    if(p*mb==q*mt)cnt++;
    if(dep>n)return;

    REP(i,b,60000){
        if(mb*i>a)break;
        f(i,dep+1,i*mt+mb,mb*i);
    }
    return;
}


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

int main() {
  int A, B, c, d, e, f, g;
  cin >> A >> B;
  
  int sum = 0;
  
  for (int i = A; i <= B; i++) {
      
    c = A/10000; 
    d = (A-c*10000)/1000; 
    e = (A-c*10000-d*1000)/100; 
    f = (A-c*10000-d*1000-e*100)/10;
    g = A-c*10000-d*1000-e*100-f*10;
  
    if ( c == g && d == f ) {
      sum = sum + 1;
    }
    else {
    }
    A = A+1;
    
  }
  
  cout << sum << endl;
    
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int D = sc.nextInt();
        int N = sc.nextInt();
        long nCount = 0;
        long i = 0;
        while (true) {
            if (i % Math.pow(100,D) == 0 && i % Math.pow(100,D + 1) != 0) {
                if (N == ++nCount) {
                    break;
                }
            }
            i++;
        }
        System.out.println(i);
    }
}


Measured memory_bytes: 21844
# -*- coding: utf-8 -*-

def main():
    S = input().strip()
    Ans = 'Yes'
    for i,Si in enumerate(S):
        if i % 2 == 0:
            if not Si in ['R','U','D']:
                Ans = 'No'
                break
        else:
            if not Si in ['L','U','D']:
                Ans = 'No'
                break
    print(Ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
open System

// prelude
let readStr () = stdin.ReadLine()

let readInt () = stdin.ReadLine() |> int
let readInts () = stdin.ReadLine().Split() |> Array.map int

let pair = function
| [|a; b|] -> (a, b)
| _ -> failwith "owatta"

let triple = function
| [|a; b; c|] -> (a, b, c)
| _ -> failwith "owatta"

let inc n = n + 1
let dec n = n - 1

let inline flip f a b = f b a
let rec fix f = fun x -> (f (fix f)) x

module Option =
  let getOr defaultValue = function
  | Some x -> x
  | None -> defaultValue

module Array =
  let modify (arr: _ []) i f =
    arr.[i] <- f arr.[i]

module Array2D =
  let modify (arr: _ [,]) i j f =
    arr.[i, j] <- f arr.[i, j]

// start
let N = readInt()
let S = readStr().ToCharArray()

let cost =
  let (esum, wsum) =
    let esum=Array.create N 0
    let wsum=Array.create N 0
    for i in 0..(N-1) do
      Array.modify (if S.[i]='E' then esum else wsum) i inc
    for i in 1..(N-1) do
      Array.modify esum i ((+) esum.[i-1])
      Array.modify wsum i ((+) wsum.[i-1])
    esum, wsum
  let sum (arr: _[]) l r = if l>r then 0 else arr.[r] - if l=0 then 0 else arr.[l-1]
  fun i -> (sum wsum 0 (i-1))+(sum esum (i+1) (N-1))

seq { for i in 0..(N-1) -> cost i }
|> Seq.min
|> printfn "%d"

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

int main(){
    int N; cin >> N;
    vector<long long> A(N);
    for(int i= 0; i < N; i++){
        cin >> A[i]; A[i] *= 2;
    }

    long long offset = 0;
    for(int i = 0; i < N; i ++){
        offset = A[i] - offset;
    }
    long long x = offset / 2;

    long long cur = x;
    for(int i = 0; i < N; i++){
        cout << cur << " ";
        cur = A[i] - cur;
    }
    cout << endl;
}

Measured memory_bytes: 2048
import sys
n, m = map(int, input().split())
graph = [[] for _ in range(n)]
for _ in range(m):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    graph[x].append(y)

dp = [-1]*n

def DFS(node):
    ma = -1
    for c_node in graph[node]:
        if dp[c_node]>=0:
            tmp = dp[c_node]
        else:
            tmp = DFS(c_node)
        if tmp > ma:
            ma = tmp
    dp[node] = ma+1
    return ma+1

sys.setrecursionlimit(10**9)

for i in range(n):
    if dp[i]>=0:
        continue
    DFS(i)
print(max(dp))

Measured memory_bytes: 158924
#include <bits/stdc++.h>
#define ALL(a) (a).begin(),(a).end()
#define N_MAX 1000
#define ll long long int
//大文字->小文字 tolower(),逆はtoupper()
using namespace std;

int dig(int N) {//桁数
	int dig = 0;
	while (N) {
		dig++;
		N /= 10;
	}
	return dig;
}

int main() {
	string S; cin >> S;
	string c; c += S[0]; c += S[1];
	string d;d += S[2]; d += S[3];
	int a = stoi(c);
	int b = stoi(d);

	if (a == 0 || a >= 13) {
		if (b >= 1 && b <= 12) { cout << "YYMM" << endl; return 0; }
		else cout << "NA" << endl;
	}
	else {
		if (b == 0 || b >= 13) { cout << "MMYY" << endl; return 0; }
		else { cout << "AMBIGUOUS" << endl; return 0; }
	}


}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#include <bits/stdc++.h>
using namespace std;

#define INIT std::cin.tie(0);std::ios::sync_with_stdio(false);
#define ALL(c) (c).begin(), (c).end()
#define CALL(c) (c).cbegin(), (c).cend()
#define RALL(c) (c).rbegin(), (c).rend()
#define CRALL(c) (c).crbegin(), (c).crend()
#define REP(i, n) for (int i = 0; i < static_cast<int>(n); i++)
#define FOR(i, s, n) for (int i = s; i < static_cast<int>(n); i++)
#define ASC(t) [](t& x, t& y){ return x < y; }
#define DESC(t) [](t& x, t& y){ return x > y; }
#define PSORT(s,p,e) partial_sort((s), next((s), (p)), (e))
#define VIEW(v,t) for_each((v).begin(), (v).end(), [](t& a) { cout << a << " "; }); cout << endl;

#define IN(a, x, b) (a<=x && x<=b)
template<class T> inline T CHMAX(T& x, const T y){return x=(x<y)?y:x;}
template<class T> inline T CHMIN(T& x, const T y){return x=(x>y)?y:x;}
#define OUT(dist) std::cout<<(dist);
#define WS std::cout<<" ";
#define NL std::cout<<"\n"

using PII = pair<int, int>;
using PLL = pair<long long, long long>;
using LL = long long;
using ULL = unsigned long long;
template<class T> using V = vector<T>;
template<class T> using V2 = vector<vector<T>>;
template<class T, int W=255> using A = array<T, W>;
template<class T, int W=255, int H=255> using A2 = array<array<T, W>, W>;



int main(){
    INIT;
    string a, b; cin >> a >> b;
    a += b;
    bool ok = false;
    FOR(i,1,1001) {
        if(i*i == atoi(a.c_str())) ok = true;
    }
    if(ok) cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;

int main() {
    int n;
    cin >> n;
    vector<vector<P>> G(n);
    rep(i, n - 1){
        ll a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        G[a].push_back(make_pair(b, c));
        G[b].push_back(make_pair(a, c));
    }
    int q, k;
    cin >> q >> k;
    k--;

    const ll INF = 1001001001001001001;
    vector<ll> dist(n, INF);
    vector<bool> vis(n, false);
    priority_queue<P, vector<P>, greater<P>> que;
    que.push(make_pair(k, 0));
    dist[k] = 0;
    while(!que.empty()){
        P v = que.top();
        que.pop();
        ll t = v.first;
        ll d = v.second;
        if(vis[t]) continue;
        vis[t] = true;
        dist[t] = d;
        for(P vv : G[t]){
            if(dist[vv.first] <= d + vv.second) continue;
            que.push(make_pair(vv.first, vv.second + d));
        }
    }

    rep(i, q){
        ll x, y;
        cin >> x >> y;
        x--; y--;
        cout << dist[x] + dist[y] << endl;
    }
    
}

Measured memory_bytes: 11120
n = int(input())
arr = []
for i in range(n):
    x,y = list(map(int,input().split()))
    arr.append((x,y))
arr = sorted(arr)
ans = 0
pre = 1e10
for i in range(n):
    ans = max(ans, arr[i][0] + arr[i][1] - pre)
    pre = min(pre, arr[i][0] + arr[i][1])
pre = 1e10
for i in range(n):
    ans = max(ans, arr[i][0] - arr[i][1] - pre)
    pre = min(pre, arr[i][0] - arr[i][1])
print(ans)

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

int gcd(int a, int b) {
    int rest = max(a, b) % min(a, b);
    if (rest == 0) return min(a, b);
    else return gcd(min(a, b), rest);
}

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

    vector<double> vec(n);
    double res = 0;
    for (int i = 0; i < n; i++) {
        cin >> vec[i];
        res += (double) 1 / vec[i];
    }
    printf("%.8f", 1 / res);
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
using namespace std;
#define rep(i,n) for(int i=1;i<=(int)n;i++)
#define Rep(i,n) for(int i=0;i<=(int)(n-1);i++)
typedef long long ll;


int N;
int a[1002],b[1002];


int main(){
    cin>>N;
    rep(i,N) cin>>a[i];
    rep(i,N) cin>>b[i];
    int suma[N+2];
    int sumb[N+2];
    suma[0]=0;
    sumb[0]=0;
    rep(i,N){
        suma[i]=a[i]+suma[i-1];
        sumb[i]=b[i]+sumb[i-1];
    }
    int ans;
    int s;
    int t;
    int ma=0;
    rep(i,N){
        ma=max(ma,suma[i]+sumb[N]-sumb[i-1]);
    }
    cout<<ma<<endl;


    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#define PB push_back
#define ll long long
using namespace std;
template <class T>
inline void rd(T &x) {
	x=0; char c=getchar(); int f=1;
	while(!isdigit(c)) { if(c=='-') f=-1; c=getchar(); }
	while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;
}
const int N=3e5+10;
vector<int> s;
ll xi[N],ti[N];
int li[N],ri[N],n;
int vis[N];
int stk[N],top;
ll ans,L;
int main() {
	rd(n),rd(L);
	ans=n;
	for(int i=1;i<=n;++i) rd(xi[i]);
	for(int i=1;i<=n;++i) rd(ti[i]);
	for(int i=1;i<=n;++i) {
		ans+=ti[i]/(2*L);
		ti[i]%=2*L;
		if(ti[i]==0) ans--,vis[i]=1;
		else {
			li[i]=2*xi[i]>=ti[i];
			ri[i]=2*(L-xi[i])>=ti[i];
			if(!li[i]&&!ri[i]) ti[i]=0,vis[i]=1;
		}
//		printf("%d:(%d,%d) %d\n",i,li[i],ri[i],vis[i]);
	}
	int px=1;
	while(px<n&&!(li[px]==1&&ri[px]==0)) px++;
	int tot=0,top=0;
	for(int i=1;i<px;++i) if(!vis[i]) {
		if(!li[i]) {
			if(top) top--,ans--;
		}
		else top++;
	}
	tot+=top,top=0;
	
	for(int i=n-1;i>=px;--i) if(!vis[i]) {
		if(!ri[i]) {
			if(top) top--,ans--;
		}
		else top++;
	}
	tot+=top;
	ans-=tot>>1;
	if(!ri[n]) ans++;
	printf("%lld",ans*2*L);
	return 0;
}

Measured memory_bytes: 8448
#template
def inputlist(): return [int(j) for j in input().split()]
#template
ans = 0
from collections import Counter
N = int(input())
A = inputlist()
A.sort()
dic = Counter(A)
dp = [1 for _ in range(A[-1]+1)]
for i in range(N):
    if dp[A[i]]:
        j = 2
        while A[i]*j <= A[-1]:
            dp[A[i]*j] = 0
            j +=1
        if dic[A[i]] == 1:
            ans+=1
print(ans)

Measured memory_bytes: 42960
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

int main()
{
	int n;
	string s,ans="",a="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";
	cin>>n;
	cin>>s;
	for(int i=0;i<s.length();i++)
	{
		for(int j=0;j<26;j++)
		{
			if(s[i]==a[j])ans+=a[j+n];
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

int main(){
	int n,s=0,d=0;
  	cin >> n;
  	vector<int> vec(n);
  	for (int i=0;i<n;i++){
    cin >> vec[i];
    }
  	for (int i=0;i<n;i++){
      	for (int j=i+1;j<n;j++){
    		if (vec[i]<=vec[j]) swap (vec[i],vec[j]);
        }
    }
  	for (int i=0;i<n;i+=2){
    	s+=vec[i];
      	d+=vec[i+1];
    }
  cout << s-d <<endl;
}

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

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll x;
	cin >> x;
	for(ll i=-203; i<=203; i++){
		for(ll j=-203; j<=203; j++){
			if(i*i*i*i*i - j*j*j*j*j == x){
				cout << i << " " << j;
				return 0;
			}
		}
	}
}

Measured memory_bytes: 3604
#include <stdio.h>
int main()
{
   int a,b,c[4],i,temp=0;
   scanf("%d %d",&a,&b);
   c[0]=a+b;
   c[1]=a-b;
   c[2]=a*b;
   if(c[0]>c[1]&&c[0]>c[2]){
     printf("%d\n",c[0]);
   }
   else if(c[2]>c[0]&&c[2]>c[1]){
    printf("%d\n",c[2]);
   }
   else{
    printf("%d\n",c[1]);
   }
   return 0;
   }


Measured memory_bytes: 128
function Main(input){
  //パラメータ受け取り
  input = input.split("\n");
  inputStr = input[0].split(" ");
  var N = Number.parseInt(inputStr[0]);
  var K = Number.parseInt(inputStr[1]);
  inputStr = input[1].split(" ");
  var H_arr = inputStr.map( inputStr => parseInt(inputStr));
  
  //解法としてDPを用いる
  var i = 0;	//今たっている場所
  var ans = []; //回答格納用配列
  //ansの配列要素Nの確定と初期化
  for(var i=0 ; i<N ; i++){
    ans.push(0);
  }
  
  //階段の0段目のコストをメモ。値は0
  ans[0] = 0;
  //階段の1段目に進んだ時のコストをメモ
  //ans[1] = Math.abs(H_arr[1]-H_arr[0]); 
  //階段の2段目以降のコストをforループで処理
  for( var i=1 ; i<N ; i++){
    var last = Number.MAX_VALUE
    for(var j=1 ; j<=K ; j++){
      if( i-j < 0){ break; }
      //自分のところ(i段目)にj段前から来た場合の値を格納
      var tmp = ans[i-j]+Math.abs(H_arr[i]-H_arr[i-j]);
      last = Math.min(tmp,last);
    }
    //より小さい値(最小コスト)を回答配列の自分の段に格納
    ans[i] = last;
  }
  //結果表示
  console.log(ans[N-1]);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29748
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

int main()
{
	long long n,a,b;
	cin >> n >> a >> b;
	a-=b;
	vector<long long> h(n);
	long long mx=0;
	for(long long i=0;i<n;i++)
	{
		cin >> h[i];
		if(h[i]>mx)
			mx=h[i];
	}
	long long ng=0;
	long long ok=(mx+b-1)/b+1;

	while(true)
	{
		long long mid=(ok+ng)/2;
		long long cnt=0;
		for(long long i=0;i<n;i++)
		{
			if(h[i]-b*mid>0)
			{
				cnt+=(h[i]-b*mid+a-1)/a;
			}
		}
		if(cnt<=mid)
			ok=mid;
		else
			ng=mid;
		if(ok-ng<=1)break;
	}

	cout << ok << endl;





}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0)
#define scl(n) scanf("%lld", &n)
#define pcl(n) printf("%lld\n", n)
#define pcl1(n) printf("%lld ", n)
#define nln printf("\n")
#define dev(x) cout << #x << " " << x << " ";
#define PTT pair<ll, ll>

map<ll, ll> mp, mp1;
map<ll, ll>::iterator itr;

int main()
{
    ll t, n, x;
    scl(n);
    ll mn = 1e10, d;
    for (ll i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            d = max(i, n / i);
            ll cnt = 0;
            while (d >= 1)
            {
                d /= 10;
                cnt++;
            }
            mn = min(cnt, mn);
        }
    }
    pcl(mn);
    return 0;
}

Measured memory_bytes: 3756
//----------------------------------------------------------------------
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
//----------------------------------------------------------------------

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
const ll INF = 1e60;

int main(void) {
    int n, k;
    cin >> n >> k;
    vector<ll> a(n);
    REP(i,n) cin >> a[i];
    ll ans = INF;
    for(int bit = 0; bit < (1 << n); bit++) {
        vector<int> select;
        for(int i = 0; i < n; ++i) {
            if(bit & (1 << i)) {
                select.push_back(i);
            }
        }
        if((int)select.size()< k) continue;
        vector<ll> tmpa = a;
        ll tmpans = 0;
        for(auto v : select) {
            ll height = tmpa[v];
            ll maxheihgt = 0;
            for(int i = 0; i < v; i++) {
                maxheihgt = max(maxheihgt,tmpa[i]); 
            }
            if(maxheihgt >= height) {
                ll add = maxheihgt - height + 1;
                tmpa[v] += add;
                tmpans += add;
            }
        }
        ans = min(ans,tmpans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const  ll INF = 1e18;
const  ll MOD = 1e9 + 7;
#define all(v) v.begin(), v.end()
#define repi(i,n,init) for(ll i=init;i<(n);i++)
#define repd(i,n,init) for(ll i=(n);i>=init;i--)
#define repm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define repb(bit,n,init) for(ll bit=init;bit<(1<<n);++bit)

int main()
{
    ll A,B,X;
    cin >> A >> B >> X;
    cout << (A+B>=X && A<=X?"YES":"NO") << endl;
    return 0;
}

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

vector<int> s(150);
int top = 0;

void push(int x){
  s[++top] = x;
}

int pop(){
  top--;

  return s[top+1]; 
}

int main()
{
  string x;
  int cnt = 0;
  int a, b;
  
  while(cin >> x) {
    if(x == "+"){
      a = pop();
      b = pop();
      push(a + b);
    }

    else if(x == "-"){
      b = pop();
      a = pop();
      push(a - b);
    }
    
    else if(x == "*"){
      a = pop();
      b = pop();
      push(a * b);
    }
    
    else push(stoi(x));
    
  }

  cout << pop() << endl;

  return 0;

}



Measured memory_bytes: 3192
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define MOD 1000000007
using namespace std;
 
 
int main(int argc, char* argv[])
{
    long n,k;
    scanf("%ld %ld", &n, &k);
    map<long, long> aa;
    long i;
    for(i=0; i<n; i++) {
        long t;
        scanf("%ld", &t);
        aa[t]++;
    }

    if(aa.size()<=k) {
        printf("0\n");
        return 0;
    }

    vector<long> vv;
    long tmp=aa.size()-k;
    auto it=aa.begin();
    for(; it!=aa.end(); ++it) {
        vv.push_back(it->second);
    }
    sort(vv.begin(), vv.end());

    long sum=0;
    for(i=0; i<tmp; i++) {
        sum+=vv[i];
    }

    printf("%ld\n", sum);
 
    return 0;
}


Measured memory_bytes: 14964
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int A,B;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>A>>B;
	int num=0;
	int cur=1;
	while(cur<B) {
		num++;
		cur+=A-1;
	}
	cout<<num<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>


int main(void)
{
	double x1, y1, x2, y2;
	scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);


	printf("%.8f\n", sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)));

	return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

int main(){
    string s;
    cin >> s;

  bool flg = false;
    for (int i=1; i<s.length(); i++){
      if (s[i] == s[i-1]){
        flg = true;
      }
    }
    if(flg){
      cout << "Bad" << endl;
    }else{
      cout << "Good" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define LINY "YES\n"
#define Liny "Yes\n"
#define LINN "NO\n"
#define Linn "No\n"
#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"

ll min(ll x,ll y){return (x<y ? x:y);}
ll max(ll x,ll y){return (x>y ? x:y);}
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a*b /gcd(a,b);}



int main(){
  ll N; cin>>N;
  ll a[5]; CINA(a,5);
  sort(a,a+5);
  ll x = (N-1+a[0])/a[0] + 4;
  cout << x << "\n";
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

Measured memory_bytes: 4420
#include <bits/stdc++.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
//int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
//int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
vi dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
vi dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
const ll MOD = 1000000007;
//const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'


signed main() {
    fio();
    int n;
    cin >> n;
    vi a(n - 1);
    rep (i, n - 1) {
        cin >> a[i];
        a[i]--;
    }

    vi num(n);
    rep (i, n - 1) {
        num[a[i]]++;
    }
    rep (i, n) {
        cout << num[i] << endl;
    }
}

Measured memory_bytes: 6332
const fi='c3.inp';
        fo='c3.out';
var n,d,c,kq,i:longint;
        s,c1,c2:string;
procedure conan;
        begin
                if s[i]='(' then inc(kq);
                if s[i]=')' then dec(kq);
                if kq=-1 then
                        begin
                                inc(d);
                                kq:=0;
                                exit;
                        end;
        end;
procedure ct1;
        begin
                readln(n);
                readln(s);
                kq:=0;d:=0;c:=0;
                for i:=1 to n do conan;
                c:=kq;
                for i:=1 to d do c1:='('+c1;
                c1:=c1+s;
                for i:=1 to c do c1:=c1+')';
        end;


begin
        c1:='';c2:='';
      
                     
                  ct1;

;
       writeln(c1);
   
end.


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

int main(){
	int money = 100000;
	int n;

	cin >> n;
	for(int i=0 ; i<n ; i++){
		money *= 1.05;
		if(money%1000 != 0){
			money += 1000 - (money%1000);
		}
	}
	cout << money << endl;
} 

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <iomanip>
typedef long long ll;
using namespace std;

int main(){
    
	int n, y; cin >> n >> y;
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= (n - i); j++) {
			int kane = i * 10000 + j * 5000 + (n - (i + j)) * 1000;
			if (kane == y) { cout << i << " " << j << " " << n - (i + j) << endl; return 0; }
		}
	}
	cout << "-1 -1 -1" << endl;

	return 0;
}



Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	scanner := makeScanner(1024)
	eGetInt(scanner)
	as := eGetInts(scanner)
	sort.Ints(as)
	alice, bob := 0, 0
	for i := 0; i < len(as); i++ {
		an := as[len(as)-1-i]
		if i%2 == 0 {
			alice += an
		} else {
			bob += an
		}
	}
	fmt.Println(alice - bob)
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}

func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetInt64(r *bufio.Scanner) int64 {
	line := eGetLine(r)
	return eAtoInt64(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetInt64s(r *bufio.Scanner) []int64 {
	fields := eGetFields(r)
	ints := make([]int64, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoInt64(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func eAtoInt64(s string) int64 {
	n, err := strconv.ParseInt(s, 10, 64)
	if err != nil {
		log.Fatal(err)
	}
	return n
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
// #include <atcoder/all>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
// using namespace atcoder;
void Main()
{
    ll n;
    cin >> n;
    vector<ll> A(n), B(n);
    rep(i, n) cin >> A[i];
    rep(i, n) cin >> B[i];

    vector<ll> cntA(n+1);
    vector<ll> cntB(n+1);
    rep(i, n) cntA[A[i]]++;
    rep(i, n) cntB[B[i]]++;

    rep(i, n+1) {
        if (cntA[i] + cntB[i] >= n + 1) {
            put("No");
            return;
        }
    }
    
    vector<ll> C(n+1), D(n+1);
    repi(i, n+1) C[i] = C[i-1] + cntA[i];
    repi(i, n+1) D[i] = D[i-1] + cntB[i];

    ll x = 0;
    repi(i, n+1) x = max(x, C[i] - D[i-1]);

    vector<ll> res(n);
    rep(i, n) res[i] = B[(i + n - x)%n];

    put("Yes");
    rep(i, res.size()) cout << res[i] << (i == res.size() - 1 ? "" : " ");
    cout << endl;    
}
signed main(){ Main();return 0;}

Measured memory_bytes: 14276
N = int(input())
L = list(map(int, list(input().strip())))

cnt = 0
for d1 in range(10):
    for d2 in range(10):
        for d3 in range(10):
            find1 = False
            find2 = False
            for i, n in enumerate(L):
                if not find1 and L[i] == d1:
                    find1 = True
                    continue
                if find1 and not find2 and L[i] == d2:
                    find2 = True
                    continue
                if find1 and find2 and L[i] == d3:
                    cnt += 1
                    break
print(cnt)


Measured memory_bytes: 45020
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
cnt=0
for i in range(N-1):
  cnt += B[A[i]-1] #A[i]を食べることで得られる満足
  if A[i]+1==A[i+1]: #うれしい
    cnt += C[A[i]-1]
cnt += B[A[N-1]-1] #最後の分

print(cnt)


Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main() {
    string s;
    int win_count = 0;

    cin >> s;

    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'o') {
            win_count++;
        }
    }
    
    if (win_count + (15-(int)s.size()) >= 8) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
from collections import Counter

def solve():
    h, w = map(int, input().split())
    wd = dict(Counter(list("".join([input() for _ in range(h)]))))

    g1 = (w % 2) & (h % 2)
    g2 = (w % 2) * h//2 + (h % 2) * w//2
    g4 = h//2 * w//2
    
    for k in wd.keys():
        if (g1 > 0) and wd[k] % 4 == 1 or wd[k] % 4 == 3:
            g1 -= 1
            wd[k] -= 1
        while (g4 > 0) and wd[k] >= 4:
            g4 -= 1
            wd[k] -= 4
        while (g2 > 0) and wd[k] >= 2:
            g2 -= 1
            wd[k] -= 2
            
    print("No" if sum(wd.values()) else "Yes")
    
if __name__=="__main__":
    solve()


Measured memory_bytes: 39280
#include <iostream>

using namespace std;

int main(){
  int n;
  cin >> n;
  int F[50];
  F[0] = F[1] = 1;
  for(int i=2; i<=n; ++i) F[i] = F[i-1] + F[i - 2];

  cout << F[n] << endl;



  return 0;
}



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

int main()
{
    int x;
    cin >> x;
    bool prime[1000002];
    for(int i = 0; i < 1000002; i++) prime[i] = true;
    for(int i = 2; i < 1000002; i++){
        if(prime[i]) for(int j = i * 2; j < 1000002; j += i) prime[j] = false;
    }
    for(int i = x; i < 1000002; i++) if(prime[i]){
        cout << i << endl;
        return 0;
    }
}

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

int main() {
  string S;
  cin >> S;
  
  int count =0; //ビー玉が置かれるマス数の変数
  
  for( int i=0; i<S.size(); i++){
    if (S.at(i)=='1')
      count++;
  }
  
  cout << count << endl;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

int main(void)
{
	int n;

	while (std::cin >> n) {
		std::vector<int> p(n + 1, 0);
		p[0] = p[1] = 1;
		int m = 0;

		for (int i = 1; i <= std::sqrt(n); i++) {
			if (p[i]) continue;
			m++;
			for (int j = i; j <= n; j+=i)
				p[j] = 1;
		}
		std::cout << m + std::count(p.begin(), p.end(), 0) << std::endl;
	}
	return 0;
}


Measured memory_bytes: 5356
#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef pair<int, int> PII;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(v, n) sort(v, v+n)
#define VSORT(v) sort(v.begin(), v.end())
#define REP(i, n) for(ll i = 0;i < 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 FORR(i, m, n) for(ll i = m;i >= n;i--)
#define INF 999999999
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(){
    cin.tie(0);
   	ios::sync_with_stdio(false);
    ll n,s,k;
    cin>>n>>k>>s;
    int which=s+1;
    if(s==1)which=pow(10,9);
    if(s==pow(10,9))which=1;
    REP(i,n){
        if(i<=k-1)cout<<s<<" ";
        else cout<<which<<" ";
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
int main() {
    double a,b,c;
    cin >>a >> b >> c;
    double h = b*sin(c * M_PI /180);
    cout << fixed <<a*h / 2.0 << endl;
    cout << fixed << a+b+sqrt(pow(a-b*cos(c*M_PI/180),2) + pow(h,2))  <<endl;
    cout << fixed << h << endl;
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,sum;
    scanf("%d", &n);
    if(n%1000==0){
        printf("0\n");
    }
    else if(n<1000){
        printf("%d\n", 1000-n);
    }
    else if(n%1000!=0){
        printf("%d\n", 1000-(n%1000));
    }

}


Measured memory_bytes: 3780
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
	int n, m, k; cin >> n >> m >> k;
	ll pre_a[n + 1] = {};
	for (int i = 1; i <= n; i++) {
		int x; cin >> x;
		pre_a[i] = pre_a[i - 1] + x;
	}
	ll pre_b[m + 1] = {};
	for (int i = 1; i <= m; i++) {
		int x; cin >> x;
		pre_b[i] = pre_b[i - 1] + x;
	}
	int ans = 0;
	for (int i = 0; i < n + 1; i++) {
		ll ex = k - pre_a[i];
		if (ex >= 0) {
			int j = upper_bound(pre_b, pre_b + m + 1, ex) - pre_b - 1;
			ans = max(ans, i + j);
		}
	}
	cout << ans << "\n";
}


Measured memory_bytes: 6708
#include <iostream>
#include <string>
#include <algorithm>

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

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

    int n;
    int m;

    int d[200000] = {}, t[200000] = {};

    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> d[i];
    }
    sort(d, d+n);
    int str;
    bool f;
    cin >> m;
    int num=0;
    for(int i =0; i < m; i++){
        cin >> t[i];
    }
    sort(t, t+m);
    for(int i = 0; i < m; i++){
        if(num >= n){
            cout << "NO\n";
            return 0;
        }
        for(int j = num; j < n; j++){
            if(d[j] < t[i]) num++;
            else{
                if(d[j] == t[i]){
                    d[j] = 0;
                    break;
                }else{
                    cout << "NO\n";
                    return 0;
                }
            }
        }
    }
    cout << "YES\n";



   return 0;
}

Measured memory_bytes: 1792
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for i := 0; i < 9; i++ {
		scanner.Scan()
		buf := strings.Split(scanner.Text(), " ")
		name := buf[0]
		am, _ := strconv.Atoi(buf[1])
		pm, _ := strconv.Atoi(buf[2])
		visitor := am + pm
		income := am*200 + pm*300
		fmt.Printf("%s %d %d\n", name, visitor, income)
	}
}


Measured memory_bytes: 1076
/*---------------Go Code GO---------------*/

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

template<typename T>
using Order_Set = tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>;
//(order) Set.order_of_key(); (pointer) Set.find_by_order();

#define     PI              acos(-1.0)
#define     O_O             ios_base::sync_with_stdio(false); cin.tie(NULL)
#define     precision(a)    fixed<<setprecision(a)
#define     endl            '\n'
#define     Flush           cout<<flush
#define     LLMX            0x3fffffffffffffff




int main()
{
    long long i,j,k,l,tst=0,ans=0, csno=0, N,M;

    cin>>l;
    double a = l/3.0;
    a = a*a*a;
    cout<<precision(10)<<a<<endl;



    return 0;
}


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

int main() {
  int num;
  cin >> num;
  int p = 0;
  int w = 0;
  int g = 0;
  int y = 0;
  
  for (int i=0; i<num; i++){
    char s;
    cin >> s;
    if (s == 'P'){
      p += 1;
    }
    if (s == 'W'){
      w += 1;
    }
    if (s == 'G'){
      g += 1;
    }
    if (s == 'Y'){
      y += 1;
    }
  }
  
  if (p !=0 && w !=0 && g !=0 && y !=0){
    cout << "Four" <<endl;
  }
  else{
    cout << "Three" <<endl;
  }
}


Measured memory_bytes: 256
// kartikay26
#include <bits/stdc++.h>
using namespace std;
#define debug(x...) 
#ifdef LOCAL
#include "prettyprint.hpp"
#endif
typedef long long int ll; typedef double db; typedef vector<ll> vi; typedef pair<ll, ll> pii;
#define int ll
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define clr(x) memset(x, 0, sizeof(x))
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
void print(){cout << endl;} void prints(){}
template<typename T> void get(T* x, int n){for (int i = 0; i < n; ++i) { cin >> x[i]; }}
template<typename T> void get(T& x, int n){for (int i = 0; i < n; ++i) { cin >> x[i]; }}
template<typename T, typename... A> void print(T x,A... r){cout << x << " ";print(r...);}
template<typename T, typename... A> void prints(T x,A... r){cout << x << " ";prints(r...);}

const int mod = 1e9+7;
const int N = 1e6+1;

int modexp(int n, int k){
	int res = 1;
	while(k>0){
		if(k&1){
			res *= n; res %= mod;
		}
		n = n*n; n %= mod;
		k /= 2;
	}
	return res;
}

int32_t main(){
	fast_io();

	int n; cin >> n;

	// all digits = 10^n
	// all seq exp 9 = 9^n
	// all seq exp 0 = 9^n
	// ans = 10^n - 2 * 9^n + 8^n

	int ans = modexp(10, n);
	int t = 2 * modexp(9, n);
	t %= mod;
	ans -= t;
	ans += mod;
	ans += modexp(8, n);
	ans %= mod;

	print(ans);

	return 0;
}

Measured memory_bytes: 3648
n, k = map(int, input().split())
a = [[int(x)-1 for x in input().split()]]

for i in range(1, k.bit_length()):
    ith = [a[-1][a[-1][i]] for i in range(n)]
    a.append(ith)

ans = 0

for i in range(k.bit_length()):
    if (k >> i) & 1:
        ans = a[i][ans]

print(ans+1)

Measured memory_bytes: 216552
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 1e6+5;
const int mod = 1e9+7;

double pi = 3.14159265359;

ll n , m;

int main(){
    cin >> n >> m;
    for(int i = 1; i <= m; i++){
        ll x;
        cin >> x;
        n -= x;
    }
    if(n < 0){
        puts("-1");
        return 0;
    }
    cout << n << "\n";
}


Measured memory_bytes: 3636
use std::io::*;
use std::str::FromStr;
use std::collections::BinaryHeap;

fn main() {
    let n: usize = read();
    let m: usize = read();

    let mut ab: Vec<(usize, usize)> = vec![];
    for _ in 0..n {
        let a: usize = read();
        let b: usize = read();
        ab.push((a, b));
    }
    ab.sort();

    let mut heap = BinaryHeap::new();
    let mut j = 0;
    let mut ans = 0;
    for i in 1..m+1 {
        while j < n && i >= ab[j].0 {
            heap.push(ab[j].1);
            j += 1;
        }
        if let Some(p) = heap.pop() {
            ans += p;
        }
    }
    println!("{}", ans);
}

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


Measured memory_bytes: 8444
#include<stdio.h>

int main(){
  int i,j,k;
  int N,M;
  scanf("%d",&N);
  int T[N];
  for(i=0;i<N;i++)
    scanf("%d ",&T[i]);
  scanf("%d",&M);
  int A[M][2];
  for(i=0;i<M;i++)
    scanf("%d %d",&A[i][0],&A[i][1]);
  for(i=0;i<M;i++){
    k=0;
    for(j=0;j<N;j++){
      if(A[i][0]-1 == j)
        k+=A[i][1];
      else
        k+=T[j];
    }
    printf("%d\n",k);
  }
  return 0;
}

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n, a[100];

int main() {
	cin >> n;
	inc(i, n) { cin >> a[i]; }
	
	int s = 0;
	inc(i, n) { s += a[i]; }
	
	pair<int, int> mi = MP(s, -1);
	inc(i, n) { setmin(mi, MP(abs(s - a[i] * n), i)); }
	
	cout << mi.SE << endl;
	
	return 0;
}


Measured memory_bytes: 256
def gcd_core(a, b):
    if b == 0:
        return a
    else:
        return gcd_core(b, a % b)

def gcd(arr):
    g = gcd_core(arr[0], arr[1])
    for i in range(2, len(arr)):
        g = gcd_core(g, arr[i])
    return g

def lcm_core(a,b):
    g = gcd_core(a,b)
    return (a*b)//g

def lcm(arr):
    l = lcm_core(arr[0],arr[1])
    for i in range(2,len(arr)):
        l = lcm_core(l,arr[i])
    return l

N = int(input())
T = [int(input()) for _ in range(N)]
if N==1:
    print(T[0])
else:
    print(lcm(T))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define translow transform(s.begin(),s.end(),s.begin(),::tolower);
#define transup transform(s.begin(),s.end(),s.begin(),::toupper);
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll mod=1e9+7;
 
 
int main() {
				fast
                // #ifndef ONLINE_JUDGE
                // freopen("input.txt","r",stdin);
                // freopen("output.txt","w",stdout);
                // #endif

            double x,ans,part;
            cin>>x;
            part=x/3.0;
            ans=part*part*part;
            cout<<fixed<<setprecision(10)<<ans<<endl;
                return 0;
            }

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

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	double a;
	while(cin >> a,a){
		double x,h; cin >> h;
		x=a;
		double ans=x*x+2*x*sqrt(x/2*x/2+h*h);
		printf("%.8f\n",ans);
	}
}


Measured memory_bytes: 3144