akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
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;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

int getKeta(int n){
    int ret = 0;
    while(n > 0){
        n /= 10;
        ret++;
    }
    return ret;
}

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

    ll ans = 0;
    for(int i = 1; i <= N; i++){
        if(getKeta(i)%2 == 1) ans++;
    }

    pl(ans)

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
    char ar[10];
    gets(ar);
    if(strcmp(ar,"SUN")==0)printf("7\n");
    else if(strcmp(ar,"MON")==0)printf("6\n");
    else if(strcmp(ar,"TUE")==0)printf("5\n");
    else if(strcmp(ar,"WED")==0)printf("4\n");
    else if(strcmp(ar,"THU")==0)printf("3\n");
    else if(strcmp(ar,"FRI")==0)printf("2\n");
    else if(strcmp(ar,"SAT")==0)printf("1\n");
    return 0;
}


Measured memory_bytes: 128
N, K = map(int, input().split())
A = list(map(int, input().split()))
s = set()
ns = []
start = 0
for i in range(N):
    if start in s:
        break
    else:
        s.add(start)
        ns.append(start)
        start = A[start]-1

si = ns.index(start)
if K < si:
    print(ns[K]+1)
else:
    print(ns[(K-si)%(i-si) + si]+1)

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

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

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main(int argc, char const *argv[]) {
    int r,D,x_2000;
    cin >> r >> D >> x_2000;
    REP(i,10)
    {
        x_2000 = r*x_2000 - D;
        cout << x_2000 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

using namespace std;

#define int long long
typedef long long ll;

const ll INF = 1e18;
const int BIG = 1e9;
const int maxN = 100 * 1000 + 9;
const string FILENAME = "sample";

string s;

void read(){
	cin >> s;
}

int ans = 0;
vector<pair<char, int> > stak;

void insertChar(char c){
	int L = stak.size();
	if(L >= 2 && (stak[L - 2].first == 'A') && (stak[L - 1].first == 'B') && (c == 'C')){
		//cerr << "abc\n";
		ans += stak[L - 2].second;
		int cnt = stak[L - 2].second;
		stak.pop_back();
		stak.pop_back();
		
		while(stak.size() && stak.back().first == 'A'){
			ans += stak.back().second;	cnt += stak.back().second;
			stak.pop_back();
		}
		
		//cerr << "insert B 1\n";
		//cerr << "insert C 1\n";
		//cerr << "insert A " << cnt + 1 << '\n';
		stak.push_back(make_pair('B', 1));
		stak.push_back(make_pair('C', 1));
		stak.push_back(make_pair('A', cnt));
		//cerr << "ans = " << ans << '\n';
	} else {
		//cerr << "insert " << c << " 1\n";
		stak.push_back(make_pair(c, 1));
	}
}

void solv(){
	for(int i = 0, L = s.size(); i < L; i++){
		insertChar(s[i]);
	}

	cout << ans << '\n';
}

int32_t main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
#ifdef h4h4
	freopen((FILENAME + ".inp").c_str(), "r", stdin);
	freopen((FILENAME + ".out").c_str(), "w", stdout);
#endif

	read();
	solv();

	return 0;
}


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

int main(){
        int m, d, productDays = 0, d1, d10, i, j;
        cin >> m >> d;
        for(i = 1; i<= m; ++i)
                for(j = 10; j <= d; d10 = j/10, d1 = j%10, ++j)
                        if((d1 >= 2) && (d10 >= 2) && (d10 * d1 == i))
                                ++productDays;
        cout << productDays << endl;
        return 0;
}


Measured memory_bytes: 256
N = gets.strip.to_i
A = gets.split.map(&:to_i)
res = Array.new
res << A.join(' ') + "\n"
for i in 1..(A.length-1)
  key = A[i]
  j = i - 1
  while j >= 0 and A[j] > key
    A[j+1] = A[j]
    j=j-1
  end
  A[j+1] = key
  res << A.join(' ') + "\n"
end
print res.join

Measured memory_bytes: 8820
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <list>

#define pb push_back
#define pk pop_back
#define _for(i,j,k) for(int i = (j); j < k; ++j)

using namespace std;

int judge(char a,char b, char c){
    if(a == b){
        if(a == c) return 0;
        else return 1;
    }
    else{
        if(a == c) return 1;
        else if(b == c) return 1;
        else return 2;
    }

}

int main()
{
    int N;
    string a,b,c;
    cin >> N;
    cin >> a >> b >> c;
    int result = 0;
    for(int i = 0; i < N ;i++){
        result += judge(a[i],b[i],c[i]);
    }
    printf("%d\n",result);
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
//typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000;

int main(){
	int n,a[1010],b[1010],ans=0;
	cin>>n;
	REP(i,n){
		cin>>a[i]>>b[i];
	}
	REP(i,n){
		ans+=b[i]-a[i]+1;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

void main(){
  int i,n,flag=0;
  scanf("%d",&n);
  for(i=0;i<3;i++){
  	if((n%10) == 7) 
      flag=1;
  	else 
      n = n/10;
    if(flag==1)
      break;
  }
  if(flag==1)
    printf("Yes\n");
  else
    printf("No\n");
}

Measured memory_bytes: 1620
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main(int argc, char const *argv[]) {
    int n;
    string num;

    cin>>n;
    for (int i = 0; i < n; ++i) {
        cin>>num;
        string tmp = num;
        sort(begin(tmp), end(tmp), greater<int>());
        sort(begin(num), end(num));
        int max = stoi(tmp);
        int min = stoi(num);
        cout<<max-min<<endl;
    }
    return 0;
}

Measured memory_bytes: 3084
#include<iostream>
#include <string>
#include<algorithm>
#include <vector>

using namespace std;

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if(abs(a-c)<=d || (abs(b-c)<=d && abs(a-b)<=d))cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
class Program{
  static void Main(){
    string[] s = Console.ReadLine().Split(' ');
    int a, b, c;
    a = int.Parse(s[0]);
    b = int.Parse(s[1]);
    c = int.Parse(s[2]);
    int k = int.Parse(Console.ReadLine());
    int[] nums = {a, b, c};
    Array.Sort(nums);
    long ans = nums[0] + nums[1] + (long)Math.Pow(2,k) * nums[2];
    Console.WriteLine(ans);
  }
}


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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
typedef complex<ld> Point;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int MAX_V = 1e5 + 5;
const int MAX_N = 1e5 + 5;
const double PI = acos(-1);

int main() {
    ll n, k;
    cin >> n >> k;
    int ans = 0;
    while (n >= 1) {
        n /= k;
        ans++;
    }
    out(ans);
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var r = input[0];
        var g = input[1];
        var b = input[2];
        var n = input[3];

        var ans = 0;

        for(var i = 0; i <= n; i++)
        {
            if ((r* i) > n)
            {
                break;
            }
            for (var j = 0; j <= n; j++)
            {
                if ((g * j) + (r * i) > n)
                {
                    break;
                }


                if ((n - (r * i + g * j)) % b == 0 )
                {
                    ans++;
                }

                    /*
                for (var k = 0; k <= n; k++)
                {
                    if ((r * i) + (g * j) + (b * k) > n)
                    {
                        break;
                    }

                    if (r * i + g * j + b * k == n)
                    {
                        ans++;
                    } 
                }
                */
            }
        }


        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 11348
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()

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;
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;

int N,K,A[200005];
signed main(){
	cin>>N>>K;
	rep(i,N)cin>>A[i];
	for(int i=K;i<N;i++){
		if(A[i]>A[i-K])cout<<"Yes\n";
		else cout<<"No\n";
	}
}

Measured memory_bytes: 5152
#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>
using namespace std;
namespace adaptor = boost::adaptors;


#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define cy cout << "Yes" << endl
#define cn cout << "No" << endl

typedef long long ll;

void Main(){
   int N,M;
   cin >> N >> M;
  vector<string>A(N), B(M);
  rep(i,N)cin>>A[i];
  rep(i,M)cin>>B[i];
   
  // 探索
  // 0,0 から 0,M-N
  // M-N,0 から M-N,M-N
  int flag = 0;
  rep(j,N-M+1){
     rep(k,N-M+1){
        if(A[j].substr(k,M)==B[0]){
           // check(j,k)
           flag=1;
           rep3(i,1,M-1) {
              if(A[j+i].substr(k,M)!=B[i]){
                 flag=0;
                 break;
              }
           }
           if(flag){
              cy;
              return;
           }
        }
     }  
  }
  cn;
  return;
 }
  
int main(){
 cin.tie(nullptr);
 ios_base::sync_with_stdio(false);
 cout << fixed << setprecision(15);
 Main();
 return 0;
 }


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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;

using ll = long long;
using P = pair<int, int>;

// 素因数を列挙
vector<pair<ll, ll>> enumeratePrimeFactors(ll n) {
  vector<pair<ll, ll>> res;
  for (ll a = 2; a * a <= n; a++) {
    if (n % a != 0) {
      continue;
    }
    ll ex = 0; // 指数
    // 割れるだけ割る
    while (n % a == 0) {
      ++ex;
      n /= a;
    }
    res.emplace_back(a, ex);
  }
  // nが一度も割られなかった場合
  if (n != 1) {
    res.emplace_back(n, 1);
  }
  return res;
}

int main() {
  ll n;
  cin >> n;
  vector<pair<ll, ll>> pfs = enumeratePrimeFactors(n);
  ll res = 0;
  rep(i, pfs.size()) {
    pair<ll, ll> pf = pfs.at(i);
    ll cnt = pf.second;
    for (int j = 1; j <= cnt; j++) {
      if (cnt - j >= 0) {
        res++;
        cnt -= j;
      }
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 3632
N = int(input())
from math import sqrt
def get_divs(n):
  divs = []
  for i in range(1, int(sqrt(n)) + 1):
    if n % i == 0:
      divs.append((i, n // i))
  return divs

divs = get_divs(N)
ans = float('inf')
for x, y in divs:
  ans = min(ans, (x + y - 2))
print(ans)

Measured memory_bytes: 3444
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct {
	char name[104];
	int price;
} item_t;

int item_num;
item_t items[100];

int renkin_num[100];
int renkin_resipe[100][100];

/* syo-zyun */
int qsort_comp(const void* x,const void* y) {
	const item_t* a=(const item_t*)x;
	const item_t* b=(const item_t*)y;
	return strcmp(a->name,b->name);
}

int nibun_tansaku(const char* searchfor) {
	int left,right,mid;
	int cmp;
	left=0;right=item_num-1;
	while(left<=right) {
		mid=(left+right)/2;
		cmp=strcmp(items[mid].name,searchfor);
		if(cmp==0)return mid;
		else if(cmp<0)left=mid+1;
		else right=mid-1;
	}
	return 0;
}

int main(void) {
	int i,j;
	int resipe_num;
	int index;
	int updated;
	int now_price;
	char buffer[104];
	while(1) {
		scanf("%d",&item_num);
		if(item_num==0)break;
		for(i=0;i<item_num;i++) {
			scanf("%s%d",items[i].name,&items[i].price);
			renkin_num[i]=0;
		}
		qsort(items,item_num,sizeof(item_t),qsort_comp);
		scanf("%d",&resipe_num);
		for(i=0;i<resipe_num;i++) {
			scanf("%s",buffer);
			index=nibun_tansaku(buffer);
			scanf("%d",&renkin_num[index]);
			for(j=0;j<renkin_num[index];j++) {
				scanf("%s",buffer);
				renkin_resipe[index][j]=nibun_tansaku(buffer);
			}
		}
		updated=1;
		while(updated) {
			updated=0;
			for(i=0;i<item_num;i++) {
				if(renkin_num[i]>0) {
					now_price=0;
					for(j=0;j<renkin_num[i];j++) {
						now_price+=items[renkin_resipe[i][j]].price;
					}
					if(now_price<items[i].price) {
						items[i].price=now_price;
						updated=1;
					}
				}
			}
		}
		scanf("%s",buffer);
		printf("%d\n",items[nibun_tansaku(buffer)].price);
	}
	return 0;
}

Measured memory_bytes: 0
import sys
arr = list(map(int, input().split()))
a,b,c=arr

if(a==b):
	if(a==c):
		print("No")
		sys.exit()
	else:
		print("Yes")
		sys.exit()
if(b==c):
	if(a==b):
		print("No")
		sys.exit()
	else:
		print("Yes")
		sys.exit()
if(a==c):
	if(a==b):
		print("No")
		sys.exit()
	else:
		print("Yes")
		sys.exit()
else:
	print("No")
	sys.exit()



Measured memory_bytes: 3064
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
	
	int n,ans=0;
	int d,x;
	int a[111];
	cin>>n>>d>>x;
	for(int i=0;i<n;i++){
		cin>>a[i];
		for(int j=1;;j++){
			if(d<j*a[i]+1)break;
			ans++;
		}
		ans+=1;
	}
	cout<<ans+x<<endl;
	/*int n;
	int a[100011],ans=0;
	cin>>n;
	a[0]=0;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n;i++){
		ans+=abs(a[i]-a[i-1]);
		ans+=abs(a[i]);
		ans-=abs(a[i]-);*/
	
	return 0;
}

Measured memory_bytes: 256
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
		ArrayList<String> s = nextCharArray();
		int count = 0;
		for(int i = 0; i < s.size(); i++){
			if(s.get(i).equals("x")){
				count++;
			}
			if(count >= 8){
				myout("NO");
				return;
			}
		}
		myout("YES");
	}
	//Method addition frame start



	//Method addition frame end
}


Measured memory_bytes: 33200
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 1LL << 60;

long power(long a, long b) {
    return b ? power(a*a%MOD, b/2) * (b%2?a:1)%MOD:1;
}

long perm(int N, int K) {
    long x = 1;
    for(int i = 1; i <= K; i++) x = x * (N-i+1) % MOD;
    return x % MOD;
}

long comb(int N,int K) {
    long x = 1, y = 1;
    for(int i = 1; i <= K; i++) {
        x = x * (N-i+1) % MOD;
        y = y * i % MOD;
    }
    return x * power(y, MOD-2) % MOD;
}

bool isprime(int n) {
    if(n < 2) return false;
    for(int i = 2; i*i <= n; ++i) {
        if (n % i ==  0) return false;
    }
    return true;
}

void dfs(const vector<vector<int>> &G, int v, vector<int> &seen) {
    seen[v] = true;

    for(int next_v : G[v]) {
        if(seen[next_v]) continue;
        dfs(G, next_v, seen);
    }
}

void yes() { cout << "Yes" << endl;}
void no() { cout << "No" << endl;}



int main() {
  
  int n, m; cin >> n >> m;
  int tmp, cnt = 0;
  vector<int> a(n);
  
  for(int i = 0; i < n; i++) {
    cin >> tmp;
    a.push_back(tmp);
  }
  
  int sum = accumulate(a.begin(), a.end(), 0);
  
  for(int ai : a) {
    if(ai*4*m >= sum) cnt++;
  }
  

  if(cnt >= m) yes();
  else no();

}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner x = new Scanner(System.in);
		int a = x.nextInt();
		int b = x.nextInt();
		int c = x.nextInt();
		int[] price = {a,b,c,0};
		for (int n = 3 ; n >= 0 ; n--){
		for (int i = 0 ; i < n ; i++){
			if(price[i] > price[i+1]){
				price[3] = price[i];
				price[i] = price[i+1];
				price[i+1] = price[3];
			}
		}
	 }
		System.out.println(price[0]+" " + price[1]+" " + price[2]);	
	}
}

Measured memory_bytes: 17164
#include <bits/stdc++.h>
using namespace std;
const int N = 200010, MP = 20, INF = 0x3f3f3f3f;
int mn[2][N][MP],n,p[N],ln[N],val[2][N],ans[N],cnt;
struct data {
  int l,r,val,sgn;
};
struct cmp {
  bool operator () (const data& a,const data& b) {
    return p[a.val] > p[b.val];
  }
};
priority_queue<data,vector<data>,cmp> q;
int query(int sgn,int l,int r) {
  int len = ln[r - l + 1];
  return val[sgn][mn[sgn][r][len]] < val[sgn][mn[sgn][l + (1 << len) - 1][len]] ? \
    mn[sgn][r][len] : mn[sgn][l + (1 << len) - 1][len];
}
void qpush(int l,int r,int sgn) {
  q.push((data) {l,r,query(sgn,l,r),sgn});
}
int main() {
  scanf("%d",&n);
  for (int i = 1 ; i <= n ; ++ i)
    scanf("%d",&p[i]);
  for (int i = 1 ; i <= n ; ++ i) {
    val[0][i] = val[1][i] = INF;
    val[i&1][i] = p[i];
  }
  for (int k = 0 ; k <= 1 ; ++ k) {
    for (int i = 1 ; i <= n ; ++ i) {
      mn[k][i][0] = i;
      for (int j = 1 ; (1 << j) <= i ; ++ j) {
	mn[k][i][j] = val[k][mn[k][i][j-1]] < val[k][mn[k][i - (1 << j >> 1)][j-1]] ? \
					      mn[k][i][j-1] : mn[k][i - (1 << j >> 1)][j-1];
      }
    }
  }
  for (int i = 2 ; i <= n ; i <<= 1) ln[i] ++;
  for (int i = 2 ; i <= n ; ++ i) ln[i] += ln[i-1];
  qpush(1,n,1);
  for (int i = 1 ; i <= n ; i += 2) {
    data tmp = q.top();
    q.pop();
    ans[++cnt] = p[tmp.val];
    int ne = query(tmp.sgn^1,tmp.val+1,tmp.r);
    ans[++cnt] = p[ne];
    if (tmp.val > tmp.l)
      qpush(tmp.l,tmp.val-1,tmp.sgn);
    if (tmp.val + 1 < ne)
      qpush(tmp.val+1,ne-1,tmp.sgn^1);
    if (ne < tmp.r)
      qpush(ne+1,tmp.r,tmp.sgn);
  }
  for (int i = 1 ; i <= n ; ++ i)
    printf("%d ",ans[i]);
  puts("");
  return 0;
}


Measured memory_bytes: 37364
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<iomanip>
using namespace std;

int main(){
    int n;
    cin>>n;
    int a[n+1],b[n+1],c[n];
    for(int i=1;i<=n;i++)cin>>a[i];
    for(int i=1;i<=n;i++)cin>>b[i];
    for(int i=1;i<=n-1;i++)cin>>c[i];
    int ans=0;
    for(int i=1;i<=n;i++){
        ans+=b[a[i]];
        if(i!=1&&a[i]==a[i-1]+1){
            ans+=c[a[i-1]];
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

int main() {
  int N;
  string S;
  cin >> N >> S;
  string s1 = S.substr(0, N / 2);
  string s2 = S.substr(N / 2);
  if (s1 == s2) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
ll n,a[2][3],i,j,dp[25000005];
ll solve(ll n,ll u,ll v)
{
	ll i,j;
	for(i=0;i<=n;i++)dp[i]=i;
	for(i=1;i<=n;i++)for(j=0;j<3;j++)if(a[v][j]>a[u][j]&&i>=a[u][j])dp[i]=max(dp[i],dp[i-a[u][j]]+a[v][j]);
	return dp[n];
}
int main()
{
	scanf("%lld",&n);
	for(i=0;i<2;i++)for(j=0;j<3;j++)scanf("%lld",&a[i][j]);
	printf("%lld\n",solve(solve(n,0,1),1,0));
	return 0;
} 

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

using namespace std;

constexpr long long MOD = 1e9+7;

long long mod_pow(long long x, long long p) {
  auto t = 1;
  auto u = x;
  while (p) {
    if (p & 1) {
      t = t * u % MOD;
    }
    u = u * u % MOD;
    p>>=1;
  }
  return t;
}

long long mod_div(long long y) {
  return mod_pow(y, MOD-2);
}

long long fact[100001];
long long dfact[100001];

void init() {
  fact[0] = 1;
  for (long long i = 1; i <= 1e5; i++)
    fact[i] = fact[i-1] * i % MOD;
  dfact[100000] = mod_div(fact[100000]);
  for (long long i = 1e5-1; i >= 0; i--) {
    dfact[i] = dfact[i+1] * (i+1) % MOD;
  }
}

long long mod_cmb(long long x, long long y) {
  if (x < 0 or y < 0)
    return 1;
  return fact[x] * dfact[y] % MOD * dfact[x-y] % MOD;
}

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

  int N,K; cin>>N>>K;
  vector<int> A(N); for (auto& a : A) cin>>a;
  sort(A.begin(), A.end());
  vector<long long> CA(N);
  CA[0] = A[0];
  for (int i = 1; i < N; i++) {
    CA[i] = CA[i-1] + A[i];
  }

  init();
  long long ans = 0;
  for (int d = K; d <= N; d++) {
    ans += mod_cmb(d-2, K-2) * ((CA[N-1] - (d>1?CA[d-2]:0) - CA[N-d])%MOD) % MOD;
    ans %= MOD;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 2944
#include<stdio.h>
#include<stdlib.h>
#include<limits.h>
   
   
   
int n,cost;
int A[1001],B[1001];
int L[501],R[502];
   
   
void merge(int left,int mid,int right){
  int i,j,n1=mid-left,n2=right-mid;
  for(i=0;i<n1;i++) L[i]=A[left+i];
  L[n1]=INT_MAX;
  for(i=0;i<n2;i++) R[i]=A[mid+i];
  R[n2]=INT_MAX;
  int l=0,r=0;
  for(i=left;i<right;i++){
    if(L[l]<=R[r]){
      A[i]=L[l];
      l++;
    }
    else{
      A[i]=R[r];
      r++;
    }
  }
}
   
   
void m_sort(int left,int right){
  int mid;
  if( left+1 >= right) return;
  mid=(left+right)/2;
  m_sort(left,mid);
  m_sort(mid,right);
  merge(left,mid,right);
}
   
   
void swap(int a,int b,int *C){
  int swap;
  swap=C[a];
  C[a]=C[b];
  C[b]=swap;
}
   
   
   
   
   
   
     
    
     
   
int main(){
  scanf("%d",&n);
  int i,j;
  int cnt,sum,min,start,x;
  int C[1001]={};
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
    B[i]=A[i];
  }
  m_sort(0,n);
  for(i=0;i<n;i++){
    if(A[i]==B[i]) C[i]=1;
  }
  cost=0;
  for(i=0;i<n;i++){
    if(C[i]!=1){
      C[i]=1;
      cnt=0;
      sum=0;
      min=B[i];
      x=i;
      while(1){
        for(j=0;j<n;j++){
          if(B[x]==A[j]){
            C[j]=1;
            cnt++;
            sum+=B[j];
            if(min > B[j]) min=B[j];
            x=j;
            break;
          }
        }
        if(x==i) break;
      }
      sum-=min;
      if( (cnt -1)*min > (cnt -1)*A[0]+2*(min +A[0])) cost+=sum+(cnt-1)*A[0]+2*(min +A[0]);
      else cost+=sum+(cnt-1)*min;
    }
  }
  printf("%d\n",cost);
  return 0;
}

Measured memory_bytes: 1872
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int z = in.nextInt();
            int w = in.nextInt();
            int[] a = in.nextIntArray(n);

            int[] d = new int[n];
            for (int i = 0; i < n; i++) {
                d[i] = Math.abs(a[i] - a[n - 1]);
            }

            int[] dp1 = new int[n];
            int[] dp2 = new int[n];
            for (int i = n - 2; i >= 0; i--) {
                dp1[i] = d[i];
                dp2[i] = d[i];
                for (int j = i + 1; j < n - 1; j++) {
                    dp1[i] = Math.max(dp1[i], dp2[j]);
                    dp2[i] = Math.min(dp2[i], dp1[j]);
                }
            }

            int ans = Math.abs(w - a[n - 1]);
            for (int i = 0; i < n; i++) {
                ans = Math.max(ans, dp2[i]);
            }
            out.println(ans);
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

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

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

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 25300
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

int saishou[200002], saidai[200002];

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


	int N = getint();
	int A[200001];
	rep1(i, N) A[getint()] = i;

	ll kotae = 0;
	for (int i = N; i > 0; i--) {
		int a = A[i];
		int l = saishou[a - 1];
		int r = saidai[a + 1];
		if (l && r) {
			saidai[l] = r;
			saishou[r] = l;
		}
		else if (l) {
			saidai[l] = a;
			saishou[a] = l;
		}
		else if (r) {
			saishou[r] = a;
			saidai[a] = r;
		}
		else {
			saishou[a] = a;
			saidai[a] = a;
		}
		if (!l) l = a;
		if (!r) r = a;
		kotae += (ll)(a - l + 1) * (r - a + 1) * i;
	}

	printf("%lld", kotae);

	Would you please return 0;
}

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

int N;
int H[100100];

signed main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> N;
    rep(i, N) cin >> H[i];
    H[0]--;
    for (int i=1; i<N; i++) {
        if (H[i-1]>H[i]) {
            cout << "No" << endl;
            exit(0);
        }
        if (H[i-1]<H[i]) H[i]--;
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
    int n, k, c;
    cin >> n >> k >> c;
    string s;
    cin >> s;
    vector<int> a,b;
    int cnt = c;
    rep(i,n){
        if(s[i] == 'o' and cnt >= c){
            a.push_back(i);
            cnt = 0;
        }else{
            cnt++;
        }
    }
    reverse(s.begin(), s.end());
    cnt = c;
    rep(i,n){
        if(s[i] == 'o' and cnt >= c){
            b.push_back(n - 1 - i);
            cnt = 0;
            if(b.size()==k)break;
        }else{
            cnt++;
        }
    }
    reverse(b.begin(), b.end());
    rep(i,k)if(a[i] == b[i]){
        cout << a[i] + 1 << "\n";
    }
}


Measured memory_bytes: 5720
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

N, M, K = rl()
A = rl()
B = rl()

s = 0
for i, b in enumerate(B):
	s += b
	B[i] = s

import bisect

ans = 0
s = 0
j = bisect.bisect_right(B, K)
ans = j
for i, a in enumerate(A):
	s += a
	if s > K:
		break
	j = bisect.bisect_right(B, K-s)
	#print(i, j)
	n = i+1 + j
	ans = max(ans, n)
print(ans)


Measured memory_bytes: 109160
import math

a, b = map(int, input().split())
min1 = a / 0.08
max1 = (a+1) / 0.08
min2 = b / 0.1
max2 = (b+1) / 0.1

if max1 <= min2 or max2 <= min1:
    print('-1')
else:
    print(max(math.ceil(min1), math.ceil(min2)))


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
#define int long long 
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int a;
    cin >> a;
    int s = 0;
    int c = 1;
    while(a){
        a/=2;
        s+= c;
        c*=2;
    }
    cout << s << '\n';
}


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

ALPHABETS = "abcdefghijklmnopqrstuvwxyz"


def solve(S: str):
    for alphabet in ALPHABETS:
        if alphabet not in S:
            print(alphabet)
            return
    print("None")
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<vector>
#define ll long long
#define INF 0x3f3f3f3f
using namespace std;
const int N=1e4+5;
template<class T>inline void read(T &res)
{
char c;T flag=1;
while((c=getchar())<'0'||c>'9')if(c=='-')flag=-1;res=c-'0';
while((c=getchar())>='0'&&c<='9')res=res*10+c-'0';res*=flag;
}
int h,n,w[N],v[N],dp[N];
int main(){
	read(h),read(n);
	for(int i=1;i<=n;i++)read(v[i]),read(w[i]);
	memset(dp,INF,sizeof(dp));
	dp[0]=0;
	for(int i=1;i<=n;i++){
		for(int j=v[i];j<=1e4;j++){
			if(dp[j-v[i]]!=INF)dp[j]=min(dp[j],dp[j-v[i]]+w[i]);
		}
	}
	int ans=INF;
	for(int i=h;i<=1e4;++i)ans=min(ans,dp[i]);
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;

/*
1
4
0011
 */
public class Main{

    public static void main(String[] args) {
        FastScanner fs=new FastScanner();
        int T=1;//fs.nextInt();
        PrintWriter out=new PrintWriter(System.out);
        for (int tt=0; tt<T; tt++) {
            //solve
            int n= fs.nextInt();
            int k=fs.nextInt();
            int [] a=fs.nextArray(n);
            int min=1,max=(int)1e9+7;
            while(min!=max){
                int mid=(min+max)/2;
               if( ispossible(mid,k,a)){
                    max=mid;
               }
               else{
                   min=mid+1;
               }
            }
            System.out.println(min);


        }

    }
    public static boolean ispossible(int sol,int k,int[] a){

        for(int log:a){
            if(log<=sol){continue;}
            k-=(int)Math.ceil(log/sol);
            }
        return k>=0;
    }

    static final Random random=new Random();

    static void ruffleSort(int[] a) {
        int n=a.length;//shuffle, then sort
        for (int i=0; i<n; i++) {
            int oi=random.nextInt(n), temp=a[oi];
            a[oi]=a[i]; a[i]=temp;
        }
        Arrays.sort(a);
    }

    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        String next() {
            while (!st.hasMoreTokens())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
        int[] nextArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }
        long nextLong() {
            return Long.parseLong(next());
        }
    }


}

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

const int mod = 1e9 + 7;
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define ll long long
#define vi vector < int >
#define vll vector < ll >
#define pii pair < int , int >
#define ff first
#define tc \
    int ttt; cin >> ttt;\
    while(ttt --)
#define ss second
#define f(i,a,b) for(int i=a;i<b;i++)
#define rev(i,a,b) for(int i=a;i>=b;i--)
#define nl '\n'
#define all(x) x.begin() , x.end()
#define mne min_element
#define mxe max_element
ll gcd(ll x, ll y) {return y == 0 ? x : gcd(y, x % y);}
int logg(ll x , ll y) {if (x == 0) return -1; return logg(x / y, y) + 1;}
ll poww(ll a, ll b, ll m) {
	if (b == 0) return 1;
	ll ans = 1;
	ans = poww(a, b >> 1, m);
	ans = (ans * ans) % m;
	if (b & 1) ans = (ans * a) % m;
	return ans;
}
// Start of code
const int N = 1e5 + 5;
int height[N];
int dp[N];
int k;

int solve (int n) {

	dp[1] = 0;
	f(i, 2, n + 1) {
		int ming = INT_MAX;
		f(j, 1, min(i, k + 1)) ming = min(ming, abs(height[i] - height[i - j]) + dp[i - j]);
		dp[i] = ming;
	}
	return dp[n];
}

int main() {

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

	int n;
	cin >> n >> k;
	f(i, 1, n + 1) cin >> height[i];
	cout << solve(n) << nl;
}

Measured memory_bytes: 4404
def binexp(a,b):
  res = 1
  while b>0:
    if b&1:
      res *= a
      res%=mod
    a *= a
    a%=mod
    b>>=1
  return res
mod = 1000000007
n = int(input())
if n==1:
  print(0)
elif n==2:
  print(2)
else:
  ans = binexp(10,n)
  ans1 = binexp(9,n)
  ans2 = binexp(8,n)
  print((ans-2*ans1+ans2)%mod)


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

#define FOR(i, l, r) for(ll i = l; i < r; i++)
#define rep(i, N) FOR(i, 0, N)

#define MOD 1000000007
#define INF 1000000000

using ll = long long int;
using namespace std;

typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;

int main() {
    int N; cin >> N;
    vi A(N); rep(i,N) cin >> A[i];
    sort(A.begin(), A.end());

    bool bitmap[1000005];
    rep(i,1000005) bitmap[i] = false;

    int ans = 0;
    int tmp = -1;
    rep(i,N){
        if(A[i] == tmp){
            ans--;
            tmp = -1;
        }
        if(bitmap[A[i]]) continue;
        ans++;
        for(int j = A[i]; j < 1000001; j += A[i]){
            bitmap[j] = true;
        }
        tmp = A[i];
    }


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


Measured memory_bytes: 5016
open System

let R() = Console.ReadLine().Split() |> Array.map int

let f (n: int) (x: int) (y: int): int list =
    let costs = 
        [ for i in 1..n do 
            for j in i+1..n do 
                let r1 = abs (j - i)
                let r2 = abs (x - i) + 1 + abs (j - y) 
                let r3 = abs (y - i) + 1 + abs (j - x)
                min (min r1 r2) r3 ]
        |> List.groupBy id  
        |> List.map (fun (k, xs) -> k, List.length xs)
        |> Map.ofList
    [ for i in 1..n-1 do 
        Map.tryFind i costs 
        |> function
        | Some v -> v 
        | _ -> 0 ]

let N, X, Y = let t = R() in t.[0], t.[1], t.[2]

f N X Y 
|> List.iter (printfn "%i")

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

typedef long long ll;
typedef int64_t i6;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define Sort(x) sort(x.begin(), x.end())
#define Sort_rev(x) sort(x.begin(), x.end(), greater<int>())
#define ALL(v) (v).begin(), (v).end()

//π M_PI
//deg = rad*180/M_PI

int main() {
    ll n, k;
    cin >> n >> k;
    ll h[n];
    std::vector<ll> v;
    rep(i, n) {
        cin >> h[i];
        v.push_back(h[i]);
    }
    Sort(v);
    ll ans = 0;
    rep(i, n-k) {
        ans += v.at(i);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3444
#include <iostream>

using namespace std;

#define OUT(s) cout << s << endl;
#define IN(a) cin >> a;

int main() {
  int N;
  IN(N);
  int sum = 0;
  while (N != 0) {
    int len = std::to_string(N).length();
    if (len % 2 == 1) {
      sum += 1;
    }
    N -= 1;
  }
  OUT(sum);
}

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

int main() {
  ll a, b;
  string sa, sb;
  cin >> a >> b;
  rep(i, b) sa += to_string(a);
  rep(i, a) sb += to_string(b);
  cout << (sa < sb ? sa : sb) << endl;
  return 0;
}


Measured memory_bytes: 3660
import collections
n, k, q = map(int, input().split())
a = [0 for _ in range(q)]
for i in range(q):
    a[i] = int(input())
c = collections.Counter(a)
for i in range(1, n + 1):
    if k > q - c[i]:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 12012
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int k;
string s;
int main() {
    IOS; cin >> k >> s;
    if((int)s.length()<=k) cout << s;
    else cout << s.substr(0, k) << "...";
    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#define LL long long;
using namespace std;
int sum[100001];
 int main()
 {  int n;
    while(scanf("%d",&n)!=EOF)
    {int a;
     memset(sum,0,sizeof(sum));
     for(int i=1;i<=n;i++)
     {scanf("%d",&a);
      sum[a+1]++;
      sum[a-1]++;
      sum[a]++;
	 }
	 sort(sum,sum+100001);
	 printf("%d\n",sum[100000]);
	}return 0;
 }

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
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 (b<a) { a=b; return 1; } return 0; }
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long int ll;
typedef long double ld;
const ll INF=(1LL<<62);
const ld pi=acosl((ld)-1);
const ll mod = 1000000007;
// const ll mod = 1234567;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
#define endn "\n"
#define TO_STRING(VariableName) # VariableName

template <typename T>ostream &operator<<(ostream &out,const vector<T> &v) {rep(i,(int)v.size()-1)cout<<v[i]<<" ";cout<<v[(int)v.size()-1];return out;}
template <typename T1, typename T2>ostream &operator<<(ostream &out, const map<T1, T2> &p) {out << "(" << p.first << ", " << p.second << ")";return out;}
template <typename T1, typename T2>ostream &operator<<(ostream &out, const pair<T1, T2> &p){out << "(" << p.first << ", " << p.second << ")";return out;}
template<class T>void debag(const T &obj){cout<<obj<<endl;}

bool solve(){
    string s;ll k;cin>>k>>s;
    if(s.size()>k){
        s=string(s.begin(),s.begin()+k);
        s+="...";
    }
    
    
    cout<<s<<endl;
    return false;   
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout<<fixed<<setprecision(30);
    solve();
}


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

int main() {
	int n;
	cin >> n;
	int k=0;
	for(int i=1;i<=n;i++)
	{
		int d = i,c = 0;
		while(d > 0)
		{
			c++;
			d /= 10;
		}
		if(c % 2 == 1)
		{
			k++;
		}
	}
	cout << k << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <stdio.h>
#include <map>
#include <string>
#include <math.h>
#include <vector>
#include <cstdlib>
#include <queue>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

using namespace std;

int main()
{
    int N;
    map<string,int> mp;
    cin >> N;

    REP(i,N){
        string col;
        cin >> col;
        mp[col]++;
    }

    if(mp.size()==4){
        cout << "Four" << endl;
    } else {
        cout << "Three" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
import heapq

def solve(N: int, A: "List[int]"):
    A1 = max(A)
    A2 = heapq.nlargest(2, A)[-1]
    
    for i in range(0, N):
        if A[i] == A1:
            print(A2)
        else:
            print(A1)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 12544