akhauriyash/Code-Regression huggingface dataset:
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    def f(n):
        a = str(n)
        l = len(a)
        dp = [[[0]*2 for i in range(2)] for j in range(l+1)]
        dp[0][0][0] = 1
        for i in range(l):
            ni = i+1
            for j in range(2):
                x = 9 if j else int(a[i])
                for k in range(2):
                    for d in range(x+1):
                        nj = j|(d < int(a[i]))
                        nk = k|(d in (4,9))
                        dp[ni][nj][nk] += dp[i][j][k]
        return dp[l][0][1]+dp[l][1][1]

    a,b = LI()
    print(f(b)-f(a-1))
    return

#B
def B():
    D = I()
    n = list(map(int, input()))
    l = len(n)
    dp = [[[0]*2 for i in range(D)] for j in range(l+1)]
    dp[0][0][0] = 1
    for i in range(l):
        ni = i+1
        for j in range(D):
            for k in range(2):
                x = 9 if k else int(n[i])
                for d in range(x+1):
                    nj = (j+d)%D
                    nk = k|(d < int(n[i]))
                    dp[ni][nj][nk] += dp[i][j][k]
                    dp[ni][nj][nk] %= mod
    print((dp[l][0][0]+dp[l][0][1]-1)%mod)
    return

#C
def C():
    n = list(map(int, input()))
    l = len(n)
    dp = [[[0]*2 for j in range(l+1)] for i in range(l+1)]
    dp[0][0][0] = 1
    for i in range(l):
        ni = i+1
        for j in range(l):
            for k in range(2):
                x = 9 if k else n[i]
                for d in range(x+1):
                    nj = j+(d == 1)
                    nk = k|(d < n[i])
                    dp[ni][nj][nk] += dp[i][j][k]
    ans = 0
    for i in range(l+1):
        ans += i*sum(dp[l][i])
    print(ans)
    return

#D
def D():
    n = list(map(int, input()))
    l = len(n)
    D = I()
    dp = [[[0]*2 for i in range(D)] for i in range(l+1)]
    dp[0][0][0] = 1
    for i in range(l):
        for j in range(D):
            for k in range(2):
                x = 9 if k else n[i]
                for d in range(x+1):
                    ni = i+1
                    nj = (j+d)%D
                    nk = k|(d<n[i])
                    dp[ni][nj][nk] += dp[i][j][k]
                    dp[ni][nj][nk] %= mod
    print((sum(dp[l][0])-1)%mod)
    return

#E
def E():

    return

#F
def F():

    return

#G
def G():

    return

#H
def H():

    return

#I
def I_():

    return

#J
def J():

    return

#K
def K():

    return

#Solve
if __name__ == "__main__":
    D()


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

double abs(double d){
  if(d<0) return -d;
  else    return d;
}

int main(void){

  int n;
  std::vector<int> a;
  std::cin >> n;
  for(int i=0; i<n; i++){
    int temp;
    std::cin >> temp;
    a.push_back(temp);
  }

  double average = std::accumulate(a.begin(), a.end(), 0.0) / a.size();

  std::vector<double> diff;
  for(int i=0; i<n; i++){
    diff.push_back(abs(average-a[i]));
  }

  double smallest = diff[0];
  int idx = 0;
  for(int i=1; i<n; i++){
    if(smallest>diff[i]){
      smallest = diff[i];
      idx = i;
    }
  }
  std::cout << idx << std::endl;

  return 0;
}








Measured memory_bytes: 256
# D - Dice in Line
from itertools import accumulate


def main():
    N, K, *P = map(int, open(0).read().split())
    # cumsum[i] = cumulative sum of expected values in [0, i]
    cumsum = tuple(accumulate([0] + [i * (1 + i) / (2 * i) for i in P]))
    ans = max(right - left for left, right in zip(cumsum, cumsum[K:]))
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 26288
using System;
using System.Text;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;

class Solve
{
	const int mod = 1000000007;
	static void Main(string[] args)
	{
		var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
		int N = input[0];
		int M = input[1];

		long[,] st = new long[N, 2];
		long[,] pt = new long[M, 2];
        for(var i = 0; i < N; i++)
		{
			var stin = Console.ReadLine().Split().Select(int.Parse).ToArray();
			st[i, 0] = stin[0];
			st[i, 1] = stin[1];
		}
        for(var i = 0; i < M; i++)
		{
			var ptin = Console.ReadLine().Split().Select(int.Parse).ToArray();
			pt[i, 0] = ptin[0];
			pt[i, 1] = ptin[1];
		}
		int[] ans = new int[N];
        for(var i = 0; i < N; i++)
		{
			int index = -1;
			long dis = 0;
            for(var j = 0; j < M; j++)
			{
				long d = Math.Abs(st[i, 0] - pt[j, 0]) + Math.Abs(st[i, 1] - pt[j, 1]);
				if (j == 0 || d < dis)
				{
					dis = d;
					index = j + 1;
				}
				
			}
			ans[i] = index;
		}

        for(var i = 0; i < N; i++)
		{
			Console.WriteLine(ans[i]);
		}

	}
}


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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

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

  CIN(N, x);

  if (x == 1 || x == 2 * N - 1) {
    OK(false);
  } else {
    OK(true);
    deque< int > ans;
    ans.push_back(x - 1);
    ans.push_back(x);
    ans.push_back(x + 1);

    int cnt = 0;
    FOR(i, 1, 2 * N) {
      if (x - 1 <= i && i <= x + 1) {
	continue;
      }
      if (cnt < N - 2) {
	cnt++;
	ans.push_front(i);
      } else {
	ans.push_back(i);
      }
    }
    EACH(ai, ans) {
      cout << ai << endl;
    }
  }
  

  return 0;
}



Measured memory_bytes: 2304
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   main.cpp                                           :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: monoue <marvin@student.42.fr>              +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/22 12:30:15 by monoue            #+#    #+#             */
/*   Updated: 2020/04/24 10:40:18 by monoue           ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include <bits/stdc++.h>
// #include <boost/multi_array.hpp>
// #include <boost/optional.hpp>
// #include <boost/range/irange.hpp>
// #include <boost/range/algorithm.hpp>
// #include <boost/range/adaptors.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// #include <boost/algorithm/string/classification.hpp> // is_any_of
// #include <boost/algorithm/string/split.hpp>
// #include <boost/algorithm/string/join.hpp>
// #include <boost/algorithm/string/replace.hpp>
// #include <boost/math/tools/minima.hpp>

#define MOD 1e9+7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n); i >= 0; --i)

// namespace adaptor = boost::adaptors;
using namespace std;
// using boost::math::tools::brent_find_minima;
// using boost::irange;
// using boost::algorithm::join;
// using boost::algorithm::split;
// using boost::algorithm::replace_all;
// using boost::multiprecision::cpp_int;
using ll = long long;
using P = pair<int, int>;

// TOP
void	Main()
{
	ll	n;
	cin >> n;

	vector<ll>	V(n + 2);
	V.at(0) = 0;
	V.at(n + 1) = 0;
	rep(i, n)
		cin >> V.at(i + 1);

	ll	total;
	total = 0;
	ll	before;
	before = 0;
	for (int i = 1; i < n + 2; i++)
	{
		total += abs(V.at(i) - before);
		before = V.at(i);
	}

	for (int i = 1; i < n + 1; i++)
	{
		if (V.at(i) < V.at(i - 1) && V.at(i) < V.at(i + 1))
		{
			cout << total - 2 * (min(V.at(i - 1), V.at(i + 1)) - V.at(i)) << endl;
		}
		else if (V.at(i) > V.at(i - 1) && V.at(i) > V.at(i + 1))
		{
			cout << total - 2 * (V.at(i) - max(V.at(i - 1), V.at(i + 1))) << endl;
		}
		else
			cout << total << endl;
	}
}
// END

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


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

int main(){
  int h,w,a,b,i,j;
  cin >> h >> w >> a >> b;
  for(i=0;i<h;i++){
    if(i<b){
      for(j=0;j<w;j++){
        if(j<a){
          cout << 1;
        }else{
          cout << 0;
        }
      }
      cout << endl;
    }else{
      for(j=0;j<w;j++){
        if(j<a){
          cout << 0;
        }else{
          cout << 1;
        }
      }
      cout << endl;
    }
  }
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1000000007;
int main(){
  string s;
  cin >> s;
  int n=s.size();
  vector<vector<ll>> dp(n+1,vector<ll>(13));
  dp[0][0]=1;
  for(int i=0;i<n;i++){
    int c;
    if(s[i]=='?'){
      c=-1;
    }
    else{
      c=s[i]-'0';
    }
    for(int j=0;j<10;j++){
      if(c!=-1&&c!=j){
        continue;
      }
      for(int k=0;k<13;k++){
        dp[i+1][(k*10+j)%13]+=dp[i][k];
      }
    }
    for(int j=0;j<13;j++){
      dp[i+1][j]%=mod;
    }
  }
  cout << dp[n][5] << endl;
}

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

int main(void) {
  int N;
  cin >> N;
  priority_queue<int> que;
  rep(i, N) {
    int A;
    cin >> A;
    que.push(A);
  }

  int64_t X = 0;
  int64_t Y = 0;
  int prev = 0;
  int phase = 0;
  while (!que.empty()) {
    if (prev == que.top()) {
      if (phase == 1) {
        Y = (int64_t)que.top();
        break;
      } else {
        X = (int64_t)que.top();
        que.pop();
        phase = 1;
        prev = 0;
      }
    } else {
      prev = que.top();
      que.pop();
    }
  }
  cout << X * Y << endl;
  return 0;
}

Measured memory_bytes: 892
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int n, k, a, u; vector<int>p, d, e;
int main() {
	while (true) {
		cin >> n >> k; if (n == 0 || k == 0)break; u = 0; p.clear(); d.clear(); e.clear();
		for (int i = 0; i < k; i++) { cin >> a; if (a == 0)u++; else p.push_back(a); }
		sort(p.begin(), p.end()); int t = 1, maxn = 1;
		if (u == 0) {
			for (int i = 1; i <= p.size(); i++) {
				if (i == p.size() || p[i] - p[i - 1] != 1) { d.push_back(t); t = 1; }
				else { t++; }
				maxn = max(maxn, t);
			}
			cout << maxn << endl;
		}
		else {
			for (int i = 1; i <= p.size(); i++) {
				if (i == p.size() || p[i] - p[i - 1] != 1) {
					if (i != p.size() && p[i] - p[i - 1] == 2) { e.push_back(d.size()); }
					d.push_back(t); t = 1;
				}
				else { t++; }
				maxn = max(maxn, t + 1);
			}
			for (int i = 0; i < e.size(); i++) {
				maxn = max(maxn, d[e[i]] + d[e[i] + 1] + 1);
			}
			cout << maxn << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3476
#include <bits/stdc++.h>
using namespace std;
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast;


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

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

int n;
llt a,ans,now;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a;
		if(i==1) now=a;
		else
		{
			if(a>now) now=a;
			else ans+=now-a;
		}
	}
	cout<<ans;
}


Measured memory_bytes: 3652
#include <stdio.h>
#include <math.h>
main(){
  int a,c1,c2=0,i,j,n[10000];
  scanf("%d",&a);
  for(i = 0; i < a; i++){
    scanf("%d",&n[i]);
  }
  for(i = 0; i < a; i++){
    c1 = 0;
    for(j = 2; j <= sqrt(n[i]); j++){
      if(n[i]%j == 0) c1++;
    }
    if(c1 == 0) c2++;
  }
  printf("%d\n",c2);
  return 0;
}

Measured memory_bytes: 632
def gcd(a,b):
    if b==0:
        return a
    return (gcd(b,a%b))
def lcm(a,b):
    return a*b//gcd(a,b)
n=int(input())
t=[int(input()) for i in range(n)]
if n==1:
    print(t[0])
    exit()
ans=1
for i in t:
    ans=lcm(ans,i)
print(int(ans))

Measured memory_bytes: 3064
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
    int ans = 0;
    int tmp;
	int bng[3][3] = {};
	REP(i, 3) REP(j, 3) cin >> bng[i][j];
	int n;
	cin >> n;
	vector<int> a(n);
	bool ana[3][3] ={};
	REP(i, n) {
		cin >> a[i];
		REP(k, 3) REP(j, 3) if(a[i] == bng[k][j]) ana[k][j] = true;
	}
	bool tf = false;
	if(ana[0][0] && ana[0][1] && ana[0][2]) tf = true;
	if(ana[1][0] && ana[1][1] && ana[1][2]) tf = true;
	if(ana[2][0] && ana[2][1] && ana[2][2]) tf = true;
	if(ana[0][0] && ana[1][0] && ana[2][0]) tf = true;
	if(ana[0][1] && ana[1][1] && ana[2][1]) tf = true;
	if(ana[0][2] && ana[1][2] && ana[2][2]) tf = true;
	if(ana[0][0] && ana[1][1] && ana[2][2]) tf = true;
	if(ana[2][0] && ana[1][1] && ana[0][2]) tf = true;
	if (tf) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	
 //   cout << ans << endl;
}

Measured memory_bytes: 256
//package code;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 *
 * @author Milo
 */
public class Main {
    
    static FastReader in = new FastReader();
    public static void main(String[] args) {
        int t = 1; //in.nextInt();
        while (t-- > 0)
            solve();
    }
 
    public static void solve() {
        String s = in.next();
        String t = in.next();
        if(s.equals(t.substring(0, t.length() - 1))){
            System.out.println("Yes"); 
        }else{
            System.out.println("No");
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;
 
        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
 
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int nextInt() {
            return Integer.parseInt(next());
        }
 
        long nextLong() {
            return Long.parseLong(next());
        }
 
        double nextDouble() {
            return Double.parseDouble(next());
        }
 
        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
 
    public static int max(int a, int b) {
        return a > b ? a : b;
    }
 
    public static int min(int a, int b) {
        return a < b ? a : b;
    }
 
    public static int gcd(int a, int b) {
        return b == 0 ? a : gcd(b, (a % b));
    }
}


Measured memory_bytes: 32768
#include <stdio.h>

int main() {
  int a, b;
  while(1){
    scanf("%d%d", &a, &b);
    if(a == 0 && b == 0) break;
    if(a > b)printf("%d %d\n", b, a);
    else printf("%d %d\n", a, b);
  }

  return 0;
}


Measured memory_bytes: 2140
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb emplace_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
#define dupli(a) a.erase(unique(all(a)),a.end())
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vvvvi=vector<vvvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const ll INF=1001001001;
const ll mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*modpow(a,b-1)%mod;ll k=modpow(a,b/2);return k*k%mod;}

int main(){
    ll k;cin>>k;
    string s;cin>>s;
    if(s.size()<=k)out(s);
    else{
        string t;
        rep(i,k)t+=s[i];
        rep(i,3)t+='.';
        out(t);
    }
}

Measured memory_bytes: 3632
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <algorithm>

using namespace std;

enum NodeType { R, I, L };
enum RightLeft { Right, Left };

int main() {
	int n;
	scanf("%d", &n);

	int **A = new int*[2];
	A[0] = new int[n];
	A[1] = new int[n];
	int lengthA = 0;
	int lengthA_ = 0;
	int zeroOne = 0;
	int oneZero = 1;

	int **children = new int*[n];
	int *parent = new int[n];
	RightLeft *rightLeft = new RightLeft[n];
	int *degree = new int[n];
	int *depth = new int[n];
	int *height = new int[n];
	NodeType *type = new NodeType[n];

	for (int i = 0; i < n; ++i) {
		children[i] = new int[2];
		parent[i] = -1;
		degree[i] = 0;
		height[i] = 0;
		depth[i] = -1;
	}

	for (int i = 0; i < n; ++i) {
		int id;
		scanf("%d", &id);
		int leftChild, rightChild;
		scanf("%d%d", &leftChild, &rightChild);
		children[id][0] = leftChild;
		children[id][1] = rightChild;
		if (leftChild == -1 && rightChild == -1) {
			type[id] = L;
			A[zeroOne][lengthA++] = id;
		}
		else {
			type[id] = I;
			if (leftChild != -1) {
				parent[leftChild] = id;
				rightLeft[leftChild] = Left;
				++degree[id];
			}
			if (rightChild != -1) {
				parent[rightChild] = id;
				rightLeft[rightChild] = Right;
				++degree[id];
			}
		}
	}

	//find root
	int root;
	for (int i = 0; i < n; ++i) {
		if (parent[i] == -1) {
			root = i;
			break;
		}
	}
	type[root] = R;



	//find depth
	int *queue = new int[n];
	int front = 0, rear = 0;
	int node = root;
	queue[rear++] = node;
	depth[node] = 0;
	int maxDepth = 0;
	while (front != rear) {
		node = queue[front++];
		int leftChild = children[node][0];
		int rightChild = children[node][1];
		int childDepth = depth[node] + 1;
		if (leftChild != -1) {
			depth[leftChild] = childDepth;
			queue[rear++] = leftChild;
			maxDepth = max(maxDepth, childDepth);
		}
		if (rightChild != -1) {
			depth[rightChild] = childDepth;
			queue[rear++] = rightChild;
			maxDepth = max(maxDepth, childDepth);
		}


	}

	//find height
	int parentNode = -1;
	while (maxDepth--) {
		for (int i = 0; i < lengthA; ++i) {
			int childNode = A[zeroOne][i];
			parentNode = parent[childNode];
			height[parentNode] = max(height[childNode] + 1, height[parentNode]);
			if (parentNode == root) {
				;
			}
			else {
				A[oneZero][lengthA_++] = parentNode;
			}
			
		}

		int temp = zeroOne;
		zeroOne = oneZero;
		oneZero = temp;
		lengthA = lengthA_;
		lengthA_ = 0;
	}
	


	//print
	for (int i = 0; i < n; ++i) {
		printf("node %d: parent = %d, sibling = ", i, parent[i]);
		if (parent[i] == -1) {
			printf("-1");
		}
		else if (rightLeft[i] == Left) {
			printf("%d", children[parent[i]][1]);
		}else{
			printf("%d", children[parent[i]][0]);
		}
		printf(", degree = %d, depth = %d, height = %d, ", degree[i], depth[i], height[i]);
		if (type[i] == R) {
			printf("root\n");
		}
		else if (type[i] == I) {
			printf("internal node\n");
		}
		else {
			printf("leaf\n");
		}

	}


	delete[] A[0];
	delete[] A[1];
	delete[] A;
	delete[] parent;
	delete[] rightLeft;
	delete[] degree;
	delete[] depth;
	delete[] height;
	delete[] type;
	for (int i = 0; i < n; ++i) {
		delete[] children[i];
	}
	delete[] children;
	delete[] queue;

	return 0;
}

Measured memory_bytes: 1044
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = list(input())
u = [False] * n

res = 0
for i in range(n):
    if t[i] == 'r':
        if i - k >= 0 and t[i-k] == 'r' and u[i-k]:
            continue
        u[i] = True
        res += p
    elif t[i] == 's':
        if i - k >= 0 and t[i-k] == 's' and u[i-k]:
            continue
        u[i] = True
        res += r
    else:
        if i - k >= 0 and t[i-k] == 'p' and u[i-k]:
            continue
        u[i] = True
        res += s

print(res)

Measured memory_bytes: 50288
#include <bits/stdc++.h>
using namespace std;
 int main(){
   string s;
   cin>>s;
   if(s=="hi"||s=="hihi"||s=="hihihi"||s=="hihihihi"||s=="hihihihihi"){
     cout<<"Yes"<<endl;
   }else cout<<"No"<<endl;
 }

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

using namespace std;

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define P(p) cout<<(p)<<endl;
#define PP(p) cout<<(p)<<" ";
#define pb push_back
#define mp make_pair
#define INF 1e18

typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef pair<int, int> pi;
//int dy[8]={1,1,1,0,-1,-1,-1,0};
//int dx[8]={-1,0,1,1,1,0,-1,-1};
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};

int N,M;
vi a,b;
/*
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>N;
    vi t,x,y;
    t.resize(N+1);
    x.resize(N+1);
    y.resize(N+1);
    rep(i,N){
        cin>>t[i]>>x[i]>>y[i];
    }
    return 0;
}*/
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string A,B;
    cin>>A>>B;
    string C =A+B;

    int num=stoi(C);
    //P(num)
    rep(i,1001){
        if(num ==i*i) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
struct pr{int y,x,cost;};

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int h,w; cin>>h>>w;
	vector<string>s(h); for(auto&i:s)cin>>i;
	vector<vector<int>>mp(h,vector<int>(w,1e9));
	vector<int>yw={0,-1,0,1},xw={1,0,-1,0};
	queue<pr>q; q.push({0,0,0});
	while(q.size()){
		pr rec=q.front(); q.pop();
		int y=rec.y,x=rec.x,cost=rec.cost;
		for(int i=0;i<4;++i){
			int yy=y+yw.at(i),xx=x+xw.at(i);
			if(yy>=0&&yy<h&&xx>=0&&xx<w&&s.at(yy).at(xx)=='.'&&mp.at(yy).at(xx)>cost+1){
				mp.at(yy).at(xx)=cost+1;
				q.push({yy,xx,cost+1});
			}
		}
	}
	int cnt=-1;
	for(auto&i:s)cnt+=count(i.begin(),i.end(),'.');
	int mn=mp.at(h-1).at(w-1);
	cout<<(mn!=1e9?cnt-mn:-1)<<"\n"s;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
ans = [-1 for i in range(N)]
valid = True
for i in range(M):
    s, c = map(int, input().split())
    if ans[s - 1] < 0:
        ans[s - 1] = c
    elif ans[s - 1] != c:
        valid = False
     
if not valid:
    print(-1)
else:
    if N == 1:
        if ans[0] < 0:
            print(0)
        else:
            print(ans[0])
    else:
        if ans[0] == 0:
            print(-1)
        else:
            if ans[0] < 0:
                ans[0] = 1
            for i in range(1, N):
                if ans[i] < 0:
                    ans[i] = 0
            print("".join(map(str, ans)))
        
        

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


using namespace std;

#define ll long long
#define mk make_pair
#define pb push_back
#define ff first
#define sc second
#define all(x) x.begin(), x.end()
#define sz(x) (x).size()

ll gcd(ll a, ll b);

ll sum(int n);

void go(){
   int n,x;cin>>n>>x;
   int b=0;
   int ans=1;
   while(n--){
      int l;cin>>l;
      if(b+l>x){
         break;
      }
      b+=l;
      ans++;
   }
   cout << ans;
}
int main(){
   
   ios_base::sync_with_stdio(0);
   cin.tie(0);
   cout.tie(0);

   go();

   return 0;
}

ll gcd(ll a, ll b){     
   if(b == 0) return a;
   
   return gcd(b, a % b);
}

ll sum(int n){                
   if(n == 0){
      return n;
   }else{
      return sum(n/10) + n%10;
   }
}


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

int main(){
  vector<int> vec(3);
  for (int i; i < 3; i++){
    cin >> vec.at(i);
  }
  
  sort(vec.begin(), vec.end());
  cout << vec.at(0) + vec.at(1) << endl;
  return 0;
}

Measured memory_bytes: 256
package main
import "fmt"
func main() {
  var k,t,m,a int
  fmt.Scan(&k,&t)
  for i:=0;i<t;i++ {
    fmt.Scan(&a)
    if m < a { m = a }
  }
  if m > k-m+1 {
    fmt.Println(2*m-k-1)
  } else {
    fmt.Println(0)
  }
}

Measured memory_bytes: 512
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Iterator;
import java.util.Collections;
import java.util.Comparator;

class Main{
        public static void main(String args[]){
                Scanner scan = new Scanner(System.in);
                int N = scan.nextInt();
                int A = scan.nextInt();
                int B = N % 500;
                if(B<=A)System.out.println("Yes");
                if(B>A)System.out.println("No");
        }
}


Measured memory_bytes: 24276
from math import gcd
a, b, c, d = map(int, input().split())
lcm = c*d//gcd(c, d)
cc = b//c - (a//c - (a%c==0))
cd = b//d - (a//d - (a%d==0))
clcm = b//lcm - (a//lcm - (a%lcm==0))
print(b-a+1 - (cc + cd - clcm))


Measured memory_bytes: 62140
private fun readLn() = readLine()!!
private fun readInt() = readLn().toInt()
private fun readStrings() = readLn().split(" ")
private fun readInts() = readStrings().map(String::toInt)
private fun readStrings2() = readLn().split("").filter { it.isNotEmpty() }
private fun readInts2() = readStrings2().map(String::toInt)
private fun initArray(n:Int, v:String) = Array(n) { v }
private fun initIntArray(n:Int, v:Int) = IntArray(n) { v }

fun main(args: Array<String>) {
    val str = readLn().replace("?", "D")
    val d = str.split("").filter { it == "D" }.size
    val pd = str.replace("PD", "E").split("").filter { it == "E" }.size

    println(str)
}

Measured memory_bytes: 79812
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
#define PP pair<P,int>
#define T tuple<int,int,int> 
using namespace std;

ll ni(ll a,ll b){
    if(b==0) return 1;
    else if(b%2==0) return ni(a,b/2)*ni(a,b/2);
    else return ni(a,b-1)*a;
}

int main(){
    int n; cin >> n;
    map<int,int> p;
    for(int i=2; i<=n; i++){
        int now=i;
        for(int j=2; j<=n; j++){
            while(now%j==0){
                p[j]++;
                now/=j;
            }
        }
    }
    int num4=0;
    int num2=0;
    int num24=0;
    int num14=0;
    int num74=0;
    for(auto x : p){
        if(x.second>=4) num4++;
        if(x.second>=2) num2++;
        if(x.second>=14) num14++;
        if(x.second>=24) num24++;
        if(x.second>=74) num74++;
    }
    int ans=(num4*(num4-1)/2)*(num2-2);
    ans+=num14*(num4-1);
    ans+=num24*(num2-1);
    ans+=num74;
    cout << ans << endl;
    return 0;
}


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

#define ll long long
#define INF 1e9
#define fi first
#define se second

typedef vector <int> vi;
typedef pair <int, int> ii;


int main() {
    string s, t;
    cin >> s >> t;
    int n = s.size(), m = t.size();

    int dp[n+1][m+1];
    memset(dp, 0, sizeof(dp));

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            dp[i][j] = max(dp[i][j], dp[i-1][j]);
            dp[i][j] = max(dp[i][j], dp[i][j-1]);
            if (s[i-1] == t[j-1]) dp[i][j] = max(dp[i][j], dp[i-1][j-1]+1);
        }
    }

    // for (int i = 0; i <= n; i++) {
    //     for (int j = 0; j <= m; j++) {
    //         cout << dp[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    string res = "";
    for (int i = n, j = m; i > 0 || j > 0; i--, j--) {
        while (i > 0 && j > 0) {
            if(dp[i-1][j] == dp[i][j]) i--;
            else if(dp[i][j-1] == dp[i][j]) j--;
            else break;
        }
        if (i == 0 || j == 0) break;
        // cout << i << " " << j << endl;
        if (s[i-1] == t[j-1]) res += s[i-1];
    }
    reverse(res.begin(), res.end());

    // cout << dp[n][m] << endl;
    cout << res << endl;
}


Measured memory_bytes: 35456
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using pii  = pair<int,int>;
#define rep(i,n) for(auto i=0; i<(n); i++)
#define rep2(i,x,n) for(auto i=x; i<(n); i++)
#define MOD 1000000007
#define INF 1e+9
#define MAX_V 10

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 double PI = 3.141593;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}    //最大公約数
ll lcm(ll a,ll b) {return a * b / gcd(a, b);}   //最小公倍数
ll combination(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;
}



int main() {

    ll t1, t2, a1, a2, b1, b2;
    cin >> t1 >> t2 >> a1 >> a2 >> b1 >> b2;

    ll P,Q,S,T;

    P = (a1 - b1) * t1;
    Q = (a2 - b2) * t2;
    if(P>0){
        P *= -1;
        Q *= -1;
    }

    if (P+Q<0)
        cout << 0 << endl;
    else if (P+Q==0)
        cout << "infinity" << endl;
    
    else{
        S = -P/(P+Q);
        T = (-P) % (P + Q);
        if(T!=0)
            cout<<S * 2 + 1<<endl;
        else
        {
            cout << S * 2 << endl;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using ll = long long;
using namespace std;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

char a;
int main(){
    string str = "";
    rep(i,3) rep(j,3){ cin >> a; if(i==j) str += a;}
    pr(str);
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
 
using namespace std;
 
#define PB push_back
#define MP make_pairA
#define REP(i,n) for(int i=0;i<(n);i++)
int main()
{
    int a,b;
    cin>>a>>b;
    if(a<b)swap(a,b);
    if(a==b){
        cout<<a+b<<endl;
    }else{
        cout<<a+a-1<<endl;
    }
}

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

int main(){
    long long INF = std::numeric_limits<long long>::max();
    long long a;
    cin>>a;
    long long ans=INF;
    for(long long i = 1; a/i>=i; i++){
        if((a/i)*i==a){
            ans = min(ans, a/i+i-2);
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n + 1];
        int[] b = new int[n];

        for (int i = 0; i < n + 1; i++) {
            a[i] = scanner.nextInt();
        }

        for (int i = 0; i < n; i++) {
            b[i] = scanner.nextInt();
        }

        long totalDefeated = 0;

        for (int i = 0; i < n; i++) {
            if (b[i] > a[i]) {
                totalDefeated += a[i];
                b[i] -= a[i];
                totalDefeated += Math.min(b[i], a[i + 1]);
                a[i + 1] = Math.max(0, a[i + 1] - b[i]);
            } else {
                totalDefeated += b[i];
            }
        }

        System.out.println(totalDefeated);

    }
}

Measured memory_bytes: 65064
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
 
dic = {"A":A,"B":B,"C":C,"D":D,"E":E}
 
arr1 = []
arr2 = []
res = 0
 
for k,v in dic.items():
    if v % 10 != 0:
        arr1.append((int(v / 10) + 1 ) * 10 - v)
    res += v
    
if len(arr1) > 0:
    fraction = sum(arr1)     
    for i in arr1:
        arr2.append(fraction - i)

    print(res + min(arr2))
else:
    print(res)

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

using namespace std;

#define FOE(i, s, t) for (int i = s; i <= t; i++)
#define FOR(i, s, t) for (int i = s; i < t; i++)
#define FOD(i, s, t) for (int i = s; i >= t; i--)

#define LL long long
#define mp make_pair
#define pb push_back

string s, t;

int main() {
	cin >> s >> t;
	
	for (int i = 0; i < s.length(); i++) if (s[i] != t[i]) {
		puts("No");
		
		return 0;	
	}
	
	puts("Yes");
}

Measured memory_bytes: 3636
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, d=DVSR): return pow(x, d - 2, d)
def DIV(x, y, d=DVSR): return (x * INV(y, d)) % d
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())


N=II()
T,A=LI()
INL=LI()

res = float(INTMAX)
name = 0
for i, h in enumerate(INL,1):
    if abs(A - (T - h*0.006)) < res:
        res = abs(A - (T - h*0.006))
        name = i

print(name)

Measured memory_bytes: 3064
// https://atcoder.jp/contests/abc100/tasks/abc100_c

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

ll N, a, tc = 0;

int main()
{
  cin >> N;
  REP(i, N)
  {
    cin >> a;
    while (a % 2 == 0)
    {
      tc++;
      a /= 2;
    }
  }

  cout << tc << '\n';

  return 0;
}


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

int main(){
    long double a,b,c;
    cin >>a>>b>>c;

    long double eps=1.0E-14;
    if (sqrtl(a)+sqrtl(b)+eps>=sqrtl(c)) {
        cout << "No";
    }
    else {
        cout << "Yes";
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int R;
  cin>>R;
  if(R<1200){
    cout<<"ABC"<<endl;
  }
  else if(1200<=R && R<2800){
    cout<<"ARC"<<endl;
  }
  else{
    cout<<"AGC"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3

n = int(input())
T = []

for i in range(n):
    a, b = map(int, input().split())
    T.append( (a-b, a+b) )

T.sort(key=lambda x: x[1])

ans = 1
cur = T[0]

for k, v in enumerate(T):
    if k == 0: continue
    if v[0] >= cur[1]:
        ans += 1
        cur = v

print(ans)


Measured memory_bytes: 18252
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <deque>
#include <stack>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

bool Debug;

const int mod = 1e9+7;
const int MAXN = 1e5+7;

#define xx first
#define yy second
#define pb push_back
#define mp make_pair
#define iter iterator
#define sqr(a) ((a)*(a))
#define abs(a) ((a)>0?(a):(-(a)))
#define max(a, b) ((a)>(b)?(a):(b))
#define min(a, b) ((a)<(b)?(a):(b))
#define mset(a, b) memset(a, b, sizeof(a))
#define mcpy(a, b) memcpy(a, b, sizeof(a))
#define lop(i,a,b) for(int i = (a); i <= (b); ++i)
#define dlop(i,a,b) for(int i = (a); i >= (b); --i)
#define debu(...) if (Debug) fprintf(stderr, __VA_ARGS__)
#define debug(x) if (Debug) cerr << "" #x " = " << x << endl
#define ergo(a) for(auto it = a.begin(); it != a.end(); ++it)

template<typename T> T gcd(T a, T b) {while(T t = a % b) a = b, b = t; return b;}
template<typename T> T Pow(T a, T b, T mod) {T ret = 1; for( ; b; b >>= 1) {if (b & 1) ret = ret * 1ull * a % mod; a = a * 1ull * a % mod;} return ret%mod;}
template<typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template<typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template<typename T> void amod(T &x, T y) {x += y; if (x >= mod) x -= mod;}
template<typename T> void smod(T &x, T y) {x -= y; if (x < 0) x += mod;}

typedef long long ll; 
typedef long double ld;
typedef unsigned int uint;
typedef pair<int,int> pii;
typedef unsigned long long ull;

int a, b;

int main() {
  #ifdef LOCAL_DEBUG
    Debug = 1;
    freopen("data.in", "r", stdin);
  #endif
  cin >> a >> b;
  if (a + b == 15) return puts("+"), 0;
  else if (a * b == 15) return puts("*"), 0;
  return puts("x"), 0;
}

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

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

#define m0(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
#define rep(i, n) for(int i = 0; i < (n); i++)
#define asort(x) sort(all(x));
#define dsort(x, t) sort(x.begin(), x.end(), greater<t>());
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define MINS(m, s) m.insert(mp(s, 1));
#define MFIN(m, s) m.find(s) != m.end()
#define mp make_pair
#define pb push_back
#define INF (1 << 29)
const int mod = 1000000007;

int main() {
    string str, sign;
    cin >> str;

    int n = str.size() - 1;
    for(int bit = 0; bit < (1 << n); bit++) {
        int sum = str[0] - '0';
        for(int i = 0; i <= n; i++) {
            if(bit & (1 << i)) {
                sign[i] = '+';
            } else {
                sign[i] = '-';
            }
        }
        for(int i = 0; i < 3; i++) {
            if(sign[i] == '+') {
                sum += str[i + 1] - '0';
            } else {
                sum -= str[i + 1] - '0';
            }
        }
        if(sum == 7) {
            for(int i = 0; i < 3; i++) {
                if(i == 0) {
                    cout << str[i];
                }
                cout << sign[i] << str[i + 1];
            }
            cout << "=7" << endl;
            exit(0);
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>

using namespace std;

int main() {
    int n, k, q, a;
    scanf("%d%d%d", &n, &k, &q);
    vector<int> d(n + 1);
    for (int i = 0; i < q; ++i) scanf("%d", &a), ++d.at(a);
    for (int i = 1; i <= n; ++i) printf("%s\n", q - d.at(i) < k ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
#define int long long
#define endl '\n'
using namespace std;
 
typedef long long ll;
#define db(x) cerr << #x << ": " << x << '\n';
#define read(a) int a; cin >> a;
#define reads(s) string s; cin >> s;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define readarr(a, n) int a[(n) + 1] = {}; FOR(i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}

#define print(a) cout << a << endl;
#define printarr(a, n) FOR (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) FOR (i, 1, n) {FOR (j, 1, m) cout << a[i][j] << " "; cout << endl;}
#define all(v) v.begin(), v.end()
#define sz(v) (int)(v.size())
#define rz(v, n) v.resize((n) + 1);
#define ld long double
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define vpi vector <pi>
#define vvi vector <vi>
#define setprec cout << fixed << showpoint << setprecision(20);
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll N = 2e5 + 1;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	readb(m, d);
    int cnt = 0;
    FOR (i, 1, m)
    {
        FOR (j, 22, d)
        {
            int x = j % 10;
            int y = (j - x)/10;
            if (x >= 2 && y >= 2 && x*y == i) cnt++;
        }
    }
	
	print(cnt);
}



















Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long x,y,a,b,c,n,i,r,mod,ans;
  ans=1;
  cin>>x>>y;
  a = x*2/3 - y/3;
  b = y*2/3 - x/3;
  if(a<0 or b<0 or (x*2-y)%3){cout<<0;return 0;}
  for(i=a+1;i<=a+b;i++){
    mod=1000000007;
    ans=ans*i%mod;
    c=i-a;r=1;n=mod-2;
    while(n>0){
      if(n&1) r=r*c%mod;
      c=c*c%mod;
      n>>=1;
    }
    ans = ans*r%mod;
  }
  cout<<ans;
}

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

int main()
{
    string S;
    cin >> S;
    int count = 0;
    if (S == "RRS" || S == "SRR")
    {
        count = 2;
    }
    else if (S == "RSR" || S == "SRS" || S == "SSR" || S == "RSS")
    {
        count = 1;
    }
    else if (S == "RRR")
    {
        count = 3;
    }
    cout << count << endl;
}

Measured memory_bytes: 3592
import sys,math,collections
N = int(input())
s = []
ans = 0
for i in range(N):
    li_tmp = list(input())
    li_tmp.sort()
    st = "".join(li_tmp)
    s.append(st)
cnt = collections.Counter(s)
for i in cnt.values():
    if i != 1:
        ans += i*(i-1)//2
print(ans)

Measured memory_bytes: 19844
#include <bits/stdc++.h>
#ifdef _DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for(int (i) = (n)-1; (i) >= 0; --i)
#define all(x) (x).begin(), (x).end()
#define FI first
#define SE second
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
  if(a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
  if(a > b) {
    a = b;
    return true;
  }
  return false;
}



int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  int n, x;
  while(true) {
    cin >> n >> x;
    if(n == 0 && x == 0) break;
    int ans = 0;
    REP(i,1,n+1) REP(j,i+1,n+1) REP(k,j+1,n+1) {
      if(i+j+k == x) ans++;
    }
    cout << ans << '\n';
  }
  return 0;
}


Measured memory_bytes: 3180
// D - Islands War
#include <bits/stdc++.h>
using namespace std;
int V[100000+1];

int in(){int x;scanf("%d",&x);return x;}

int main(){
	int N=in(), M=in();
	while(M--){
		int l=in(), r=in();
		V[r] = max(V[r], l);
	}
	int ans = 0, R = 1;
	for(int r=1; r<=N; ++r) if(V[r]>=R) R=r, ans++;
	cout<< ans <<endl;
}

Measured memory_bytes: 640
def spaceinput():
    return list(map(int,input().split(" ")))


def search_right(l):
    global res,N,h
    minv=h[l]
    for j in range(l,N):

        if h[j]==0:
            minv=np.min(h[l:j])

            h[l:j]-=minv
#            print(h,l,j,minv,h[l:j])
            res+=minv
            return
        elif j==N-1:

            minv=np.min(h[l:N])
            h[l:N]-=minv
            res+=minv
            return





import numpy as np
N=int(input())
h=np.array(spaceinput())
res=0

while sum(h)>0:
    #print(h)
    for i in range(N):
        if h[i]>0:
            search_right(i)
            break

#print("res")
print(res)


Measured memory_bytes: 12472
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
typedef long long ll;
typedef pair<int,int> pii;

int main(){
    string t;
    cin>>t;
    
    rep(i,t.size()){
        if(t[i]=='?'){
            t[i]='D';
        }
    }
    cout<<t<<endl;

    return 0;
}

Measured memory_bytes: 3748
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod=1000000007;
const int MAXN=100010, LOG=20;

ll n, m, k, u, v, x, y, t, a, b, ans, start;
ll A[MAXN], B[MAXN];

int Solve(int L, int R){
	if (start<A[L]){
		ans+=A[R]-start;
		return R;
	}
	if (A[R]<start){
		ans+=start-A[L];
		return L;
	}
	if (B[L]>=B[R]){
		B[L]+=B[R];
		ans+=A[R]-A[Solve(L, R-1)];
		return R;
	}
	B[R]+=B[L];
	ans+=A[Solve(L+1, R)]-A[L];
	return L;
}

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin>>n>>start;
	for (int i=1; i<=n; i++) cin>>A[i]>>B[i];
	Solve(1, n);
	cout<<ans<<"\n";
	
	return 0;
}


Measured memory_bytes: 9080