akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")

#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <string_view>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout(a) cout << fixed << setprecision((int)(a))

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ll MOD2   = 998244353;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define eb emplace_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (n); ++(i))
#define reps(i, n)      for(int i = 1; (i) <= (n); ++(i))
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; --(i))
#define repbit(bit, n)  for(int bit = 0; (bit) < (1 << (n)); ++(bit))
#define ifbit(bit, i)   if((bit) & (1 << (i)))
#define CtoI(c)         int((c)) - int('0')
#define ItoC(c)         char((c) + '0')

//functions=============
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    string s; cin >> s;
    char c[10];

    string t;
    rep(i, (int)s.size()){
        if(s[i] == '0' || s[i] == '1') t += s[i];
        else if(t.size()) t.pop_back();
    }

    cout << t << endl;

return 0;
}


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



int main() {
	

	string s;
	
	cin >> s;
	
	if (s[2] == s[3] && s[4] == s[5])
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;

	}


	


	return 0;
}




Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main {
	static final int N=100005;
	static int a[]=new int[10005];
	static int map[][]=new int[105][105];
	public static void main(String[] args){
		InputReader in = new InputReader(System.in);
	    PrintWriter out = new PrintWriter(System.out);
	    int h=in.nextInt(),w=in.nextInt();
	    int n=in.nextInt();int x=0,y=0;
	    for(int i=1;i<=n;i++){
	    	a[i]=in.nextInt();
	    }
	    map[0][0]=1;a[1]--;
	    int cnt=1;
	    while(cnt<=n&&a[n]>0) {
	    		while(y+1<w&&map[x][y+1]==0) {
	    			if(a[cnt]==0) cnt++;
	    			map[x][++y]=cnt;
	    			a[cnt]--;
	    		}
	    		while(x+1<h&&map[x+1][y]==0) {
	    			if(a[cnt]==0) cnt++;
	    			map[++x][y]=cnt;
	    			a[cnt]--;
	    		}
	    		while(y-1>=0&&map[x][y-1]==0) {
	    			if(a[cnt]==0) cnt++;
	    			map[x][--y]=cnt;
	    			a[cnt]--;
	    		}
	    		while(x-1>=0&&map[x-1][y]==0) {
	    			if(a[cnt]==0) cnt++;
	    			map[--x][y]=cnt;
	    			a[cnt]--;
	    		}
	    }
	    for(int i=0;i<h;i++) {
	    	for(int j=0;j<w;j++) {
	    		if(j!=0) out.print(" ");
	    		out.print(map[i][j]);
	    	}
	    	out.println();
	    }
	    out.flush();
	}
	static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;
        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }
        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public int nextInt() {
            return Integer.parseInt(next());
        }
    }
}

Measured memory_bytes: 23252
#include<bits/stdc++.h>
using namespace std;
int main()
{
 int n;
 cin>>n;
 if(n>1000)
 {
     if(n%1000!=0)
      n=n%1000;
      else
      {
          cout<<0;
          return 0;
      }

 }
 int c=1000-n;
 cout<<c;
    return 0;
}




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

int main(){
    char S[4];
    cin >> S;
    if(S[0]!=S[1]){
        if(S[0]!=S[2] && S[0]!=S[3]){
            cout << "No" << endl;
        }
        else if(S[0]==S[2]){
            if(S[1]!=S[3]){
                cout << "No" <<endl;
            }
            if(S[1]==S[3]){
                cout << "Yes" << endl;
            }
        }
        else if(S[0]==S[3]){
            if(S[1]!=S[2]){
                cout << "No" <<endl;
            }
            if(S[1]==S[2]){
                cout << "Yes" << endl;
            }
        }
    }
    else if(S[1]!=S[2]){
        if(S[2]!=S[3]){
            cout << "No" << endl;
        }
        else{
            cout << "Yes" << endl;
        }
    }
    else{
       cout << "No" << endl; 
    }
    

}

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

const int MAX = 500;

pair<int, int> last(int W, int H, pair<int, int> now) {
	if ((now.second & 1) == 0) {
		if (now.first < W) return make_pair(now.first + 1, now.second);
	} else {
		if (now.first > 1) return make_pair(now.first - 1, now.second);
	}
	return make_pair(now.first, now.second - 1);
}

pair<int, int> next(int W, int H, pair<int, int> now) {
	if ((now.second & 1) == 0) { // 左側方面に向かってるよ
		if (now.first > 1) return make_pair(now.first - 1, now.second);
	} else {
		if (now.first < W) return make_pair(now.first + 1, now.second);
	}
	if (now.second < H) return make_pair(now.first, now.second + 1);
	return make_pair(-1, -1); // 存在しない
}
int main() {
	int H, W, a[MAX][MAX];
	cin >> H >> W;
	for (int i = 0;i < H;++ i) for (int j = 0;j < W;++ j) cin >> a[i][j];
	queue<pair<pair<int, int>, pair<int, int> > > ans;
	bool lastOdd = false;
	for (pair<int, int> now = make_pair(1, 1);now.first >= 0;now = next(W, H, now)) {
		if (lastOdd) ans.push(make_pair(last(W, H, now), now));
		if ((a[now.second - 1][now.first - 1] & 1) != 0) lastOdd = !lastOdd; // 奇数
	}
	cout << ans.size() << endl;
	for (;!ans.empty();ans.pop()) cout << ans.front().first.second << " " << ans.front().first.first << " " << ans.front().second.second << " " << ans.front().second.first << endl;
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

まず、この操作で最大化を行う為には、奇数枚のコインが置かれているマスのコインを他の奇数枚のコインが置かれているマスに移動させる必要がある
ところで、この操作はどれだけ行えるか？
また、隣接したマスが全て偶数ならどうするのか？
まず、隣接したマスが偶数の時
1 2 1
これは左側の2個を右側にスライドさせると0 2 2になるので、可能
つまり、途中経路の偶数はあまり考慮しなくても良い
じゃあこれは？
2 1 2
1 2 1
2 1 2
このように十字にクロスした場合は、スライド操作が面倒ではある
さて、これを解決するにはどうすれば良いか？
まず、数字を連続した列にしたいので次のような順番で調べることにする
1 2 3 4
8 7 6 5
9 ...
この規則上で、若い番号に奇数を見つけたらその順に辿っていけば良い
ね、簡単でしょ？
*/

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

int main()
{
    int N; cin >> N;
    auto adjacency_list = vector<vector<int>>(N);
    for (auto i = 0; i < N-1; i++)
    {
        int a, b; cin >> a >> b;
        a--; b--;

        adjacency_list[a].push_back(b);
        adjacency_list[b].push_back(a);
    }

    struct State { int vertex, mark; };
    const auto compare = [](const State a, const State b) { return a.mark < b.mark; };
    auto queue = priority_queue<State, vector<State>, decltype(compare)>(compare);

    auto seen = vector<bool>(N);
    auto marks = vector<int>(N);
    int K; cin >> K;
    for (auto i = 0; i < K; i++)
    {
        int v, m; cin >> v >> m;
        v--;

        seen[v] = true;
        marks[v] = m;
        for (const auto w : adjacency_list[v])
            queue.push({w, m-1});
    }

    while (!queue.empty())
    {
        const auto s = queue.top(); queue.pop();
        if (!seen[s.vertex])
        {
            seen[s.vertex] = true;
            marks[s.vertex] = s.mark;
            for (const auto w : adjacency_list[s.vertex])
                queue.push({w, s.mark-1});
        }
    }

    auto ok = true;
    for (auto v = 0; v < N; v++)
        for (auto w : adjacency_list[v])
            ok &= abs(marks[v]-marks[w]) == 1;

    if (ok)
    {
        cout << "Yes" << "\n";
        for (const auto x : marks) cout << x << "\n";
    }
    else cout << "No" << "\n";
}



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

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n)  FOR(i, 0, n)
#define ASC(c) sort((c).begin(), (c).end())
#define DESC(c) sort((c).begin(), (c).end(), greater<int>())

#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
    int n; cin >> n;
    FOR(i, 1, 10) {
        if (n <= 111 * i) { 
            cout << 111 * i << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 888
#ifdef Prateek
  #include "Prateek.h"
#else
  #include <bits/stdc++.h>
  using namespace std;
  #define debug(...) 42
#endif
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
const int MOD = 1e9+7, N = 1e5 + 10; 

inline int add(int a, int b, int mod = MOD) {
  a += b; return a >= mod ? a - mod : a;
}
inline int sub(int a, int b, int mod = MOD) {
  a -= b; return a < 0 ? a + mod : a;
}
inline int mul(int a, int b, int mod = MOD) {
  return int((long long) a * b % mod);
}
inline int power(int base, long long ex, int mod = MOD) {
  int res = 1;
  for (; ex > 0; ex >>= 1) {
    if (ex & 1) res = mul(res, base, mod);
    base = mul(base, base, mod);
  }
  return res;
}
inline int inv(int a, int mod = MOD) {
  return power(a, mod - 2, mod);
}
inline int mdiv(int a, int b, int mod = MOD) {
  return mul(a, power(b, mod - 2,  mod));
}
inline void adds(int &a, int b, int mod = MOD) {
  a += b; if (a >= mod) a -= mod;
}
inline void subs(int &a, int b, int mod = MOD) {
  a -= b; if (a < 0) a += mod;
}
inline void muls(int &a, int b, int mod = MOD) {
  a = int((long long) a * b % mod);
}
inline void mdivs(int &a, int b, int mod = MOD) {
  a = mdiv(a, b, mod);
}
vector<int> fact,ifact;
void prep_fact(int mx = 1e6 + 40) {
  fact.assign(mx,0);
  ifact.assign(mx,0);
  fact[0] = 1;
  for (int i = 1; i < mx; ++i) fact[i] = mul(i, fact[i - 1]);
  ifact[mx - 1] = inv(fact[mx - 1]);
  for (int i = mx - 1; i > 0; --i) ifact[i - 1] = mul(i, ifact[i]);
}
inline int ncr(int n, int r) {
  if (n < r || r < 0 || n < 0) return 0;
  return mul(fact[n], mul(ifact[n - r], ifact[r]));
}

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   prep_fact();
   int n;
   cin >> n;
   if(n == 1){
      cout << 0 << '\n';
      return 0;
   }
   int ans = power(10,n);
   subs(ans,power(8,n));
   for(int i = 1; i <= n; ++i){
      subs(ans,mul(ncr(n,i),power(8,n-i)));
      subs(ans,mul(ncr(n,i),power(8,n-i)));
   }
   cout << ans << '\n';
   return 0;
}

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

int main(){
	int n, c;
	for(; cin >> n, n; ){
		vector<int> v;
		v.push_back(0);
		for( int i = 1; i <= n; ++i ){
			cin >> c;
			if( v.size() % 2 != c ){
				v.back() = i;
			}
			else{
				if( i % 2 ){
					v.push_back(i);
				}
				else{
					v.pop_back();
					if( v.empty() ){
						v.push_back(0);
						v.push_back(i);
					}
					else{
						v.back() = i;
					}
				}
			}
		}

		n = v.front();
		for( int i = 2; i < v.size(); i += 2 ){
			n += v[i] - v[i-1];
		}
		cout << n << endl;
	}
}

Measured memory_bytes: 0
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int main()
{
  int a,s;
  cin>>a>>s;
  if(a*500>=s)std::cout << "Yes" << std::endl;
  else std::cout << "No" << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <string>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
using namespace std;

#define REP(i,p,n) for(ll i=p;i<ll(n);++i)
#define rep(i,n) REP(i,0,n)

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

int main()
{
    ll K, A, B;
    cin >> K >> A >> B;

    const auto a = (A - 1) / K;
    const auto b = B / K;

    cout << (a != b ? "OK" : "NG") << endl;

    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=203,INF=1<<30;

int V,cmp[MAX];
vector<int> G[MAX],rG[MAX],vs;//vsがトポソの逆順になってる
bool used[MAX];

void add_edge(int from,int to){
    G[from].push_back(to);
    rG[to].push_back(from);
}

void DFS(int v){
    used[v]=1;
    for(int i=0;i<G[v].size();i++){
        if(used[G[v][i]]==0) DFS(G[v][i]);
    }
    vs.push_back(v);
}

void rDFS(int v,int k){
    used[v]=1;
    cmp[v]=k;
    for(int i=0;i<rG[v].size();i++){
        if(used[rG[v][i]]==0) rDFS(rG[v][i],k);
    }
}

int scc(){
    memset(used,0,sizeof(used));
    vs.clear();
    for(int v=0;v<V;v++){
        if(used[v]==0) DFS(v);
    }
    
    memset(used,0,sizeof(used));
    int k=0;
    for(int i=vs.size()-1;i>=0;i--){
        if(used[vs[i]]==0) rDFS(vs[i],k++);
    }
    return k;
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int M,N;
    cin>>M>>N;
    V=M;
    
    bool ok=true;
    
    vector<vector<int>> S(M,vector<int>(2*N));
    
    for(int i=0;i<M;i++){
        for(int j=N;j<2*N;j++) S[i][j]=100;
        int k;cin>>k;
        for(int j=0;j<k;j++){
            int a,c;string b;cin>>a>>b>>c;
            a--;
            if(b[0]=='>'){
                S[i][a]=max(S[i][a],c);
            }else{
                S[i][a+N]=min(S[i][a+N],c);
            }
        }
        
        for(int j=0;j<N;j++){
            if(S[i][j]==0||S[i][j+N]==0) continue;
            
            if(S[i][j]>S[i][j+N]) ok=false;
        }
    }
    
    for(int i=0;i<M;i++){
        for(int j=i+1;j<M;j++){
            for(int k=0;k<N;k++){
                int le1=0,ri1=100,le2=0,ri2=100;
                le1=max(le1,S[i][k]);
                ri1=min(ri1,S[i][k+N]);
                
                le2=max(le2,S[j][k]);
                ri2=min(ri2,S[j][k+N]);
                
                if(ri1<le2) add_edge(i,j);
                if(ri2<le1) add_edge(j,i);
                
                //cout<<i<<" "<<j<<" "<<k<<" "<<le1<<" "<<ri1<<" "<<le2<<" "<<ri2<<endl;
            }
        }
    }
    
    int k=scc();
    
    if(k==M&&ok) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
    
}




Measured memory_bytes: 4928
#include <stdio.h>
const int MAX_V = 1000000; // 100????????§?´???°??¨?????????
int main() {
    int i, k,a,sum=0;
    int prime[MAX_V+1]; // 1????´???°???0????´???°??§?????? 
    int pcount[MAX_V+1];
    
    for(i = 2; i <= MAX_V; i++) {
        prime[i] = 1; // 2??\????´???°??¨??????
    } 
    for(i = 2; i*i <= MAX_V; i++) {
        if(prime[i]) {
            for(k = 2 * i; k <= MAX_V; k += i) {
                prime[k] = 0; // ?´???°2?????\????????°?´???°??§?????? 
            }
            
        } 
        
    }
    prime[0]=0;
    prime[1]=0;
    pcount[0]=0;
    pcount[1]=0;
    for(i=2;i<MAX_V;i++){
        if(prime[i]){
            sum++;
        }
        pcount[i]=sum;
    }
    while(scanf("%d",&a) != EOF){
        
        printf("%d\n",pcount[a]);
    } 

    return 0; 
    
}

Measured memory_bytes: 9612
#include<bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef pair<int,int>P;
int dp[501][10001];
int main(void){
	int m,n;
	int dng[10001];
	P box[501];
	int rsk[100001];
	int i,j;
	int sum=0;
	cin>>m>>n;
	for(i=0;i<m;i++)	cin>>dng[i];
	for(i=0;i<n;i++){
		cin>>box[i].F>>box[i].S;
		sum+=box[i].F;
	}
	sort(dng,dng+m,greater<int>());
	rsk[0]=0;
	for(i=1;i<=m;i++){
		rsk[i]=rsk[i-1]+dng[i-1];
	}
	
	for(i=0;i<=n;i++){
		for(j=0;j<=10000;j++){
			dp[i][j]=INT_MAX;
		}
	}
	dp[0][0]=0;
	for(i=0;i<n;i++){
		for(j=0;j<=m;j++){
			dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
			if(j+box[i].F<=m){
				if(dp[i][j]!=INT_MAX)	dp[i+1][j+box[i].F]=min(dp[i+1][j+box[i].F],dp[i][j]+box[i].S);
			}
			else{
				if(dp[i][j]!=INT_MAX)	dp[i+1][m]=min(dp[i+1][m],dp[i][j]+box[i].S);
			}
		}
	}
	// for(i=0;i<=n;i++){
		// for(j=0;j<=m;j++){
			// if(dp[i][j]!=INT_MAX)	cout<<dp[i][j]<<" ";
		// }
		// cout<<endl;
	// }
	
	int MAX=-1;
	for(j=0;j<=m;j++){
		// cout<<j<<endl;
		// cout<<dp[n][j]<<endl;
		if(dp[n][j]!=INT_MAX){
			MAX=max(MAX,rsk[j]-dp[n][j]);
		}
	}
	cout<<MAX<<endl;
	return 0;
}


Measured memory_bytes: 22816
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func intMin(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}

func intAbs(x int) int {
	return int(math.Abs(float64(x)))
}

func main() {
	sc.Split(bufio.ScanWords)

	INF := int(math.Pow10(11))
	A, B, Q := scanInt(), scanInt(), scanInt()
	S, T, X := make([]int, A+2), make([]int, B+2), make([]int, Q)

	S[0], S[A+1] = -INF, INF
	for i := 1; i <= A; i++ {
		S[i] = scanInt()
	}
	T[0], T[B+1] = -INF, INF
	for i := 1; i <= B; i++ {
		T[i] = scanInt()
	}
	for i := 0; i < Q; i++ {
		X[i] = scanInt()
	}

	for _, x := range X {
		s := sort.Search(len(S), func(i int) bool { return S[i] >= x })
		t := sort.Search(len(T), func(i int) bool { return T[i] >= x })

		ans := 4 * INF
		ans = intMin(ans, intAbs(x-S[s])+intAbs(S[s]-T[t]))
		ans = intMin(ans, intAbs(x-S[s])+intAbs(S[s]-T[t-1]))
		ans = intMin(ans, intAbs(x-S[s-1])+intAbs(S[s-1]-T[t]))
		ans = intMin(ans, intAbs(x-S[s-1])+intAbs(S[s-1]-T[t-1]))
		ans = intMin(ans, intAbs(x-T[t])+intAbs(T[t]-S[s]))
		ans = intMin(ans, intAbs(x-T[t])+intAbs(T[t]-S[s-1]))
		ans = intMin(ans, intAbs(x-T[t-1])+intAbs(T[t-1]-S[s]))
		ans = intMin(ans, intAbs(x-T[t-1])+intAbs(T[t-1]-S[s-1]))

		fmt.Println(ans)
	}
}


Measured memory_bytes: 7424
#include <stdio.h>
int main()
{
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if(a==1&&b==1&&c==0||a==0&&b==0&&c==1){
printf("Open\n");
}
else{
printf("Close\n");
}
return 0;
}

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

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {

            string S = Console.ReadLine();
            int A = S.Length;
            int i;

            for (i = 0; i <= (A-1); i++ )
            {
                Console.Write('x');
            }
        }
    }
}

Measured memory_bytes: 11092
#include<iostream>
#include<vector>
using namespace std;
int main(){
    long n,x,s,ans=0;cin>>n>>x;
    vector<long>a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=1;i<n;i++){
        if(a[i-1]+a[i]>x){
            s=a[i-1]+a[i]-x;
            ans+=s;
            if(a[i]>=s)a[i]-=s;
            else a[i-1]-=s-a[i],a[i]=0;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

void change(int& i1, int& i2){
  int tmp = i1;
  i1 = i2;
  i2 = tmp;
}

int main(){
  int a, b, c;
  cin >> a; cin >> b; cin >> c;
  if (a > b)
    change(a, b);
  if (a > c)
    change(a, c);
  if (b > c)
    change(b, c);
  cout << a << " " << b << " " << c << endl;
  return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
#define debug(x) std::cerr << #x << " = " << (x) << std::endl
typedef long long LL;
const int MAXN = 1e5+17;
int a[MAXN],b[MAXN];
map<int,int > mp;
int main(int argc ,char const *argv[])
{
	#ifdef noob
	freopen("Input.txt","r",stdin);freopen("Output.txt","w",stdout);
	#endif		
	int n,ans=0;
	cin>>n;
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
		b[i]=a[i];
	}
	sort(b, b+n);
	for (int i = 0; i < n; ++i)
	{
		mp[b[i]] = i+1;
	}
	for (int i = 0; i < n; ++i)
	{
		if(abs(i+1-mp[a[i]])&1) ans++;
	}
	cout<<ans/2+(ans&1)<<endl;
	return 0;	
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
 
#define rp(i, k, n) for (int i = k; i < n; i++)
using ll = long long;
using ld = double;

template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7ll;
const double PI=3.14159265358979323846;


int main() {
    int n; cin >> n;
    map<int, ll> loc;
    rp(i, 0, n) {
        int p; cin >> p; loc[p] = (ll)i;
    }
    ll res = 0;
    multiset<ll> past = {-1, -1, n, n};
    for(int i = n; i>= 1; i--) {
        auto itr = past.lower_bound(loc[i]);
        ll r1 = *itr;
        ll r2 = *(++itr);
        itr--;
        ll l1 = *(--itr);
        ll l2 = *(--itr);
        res += i*((r2-r1)*(loc[i]-l1) + (l1-l2)*(r1-loc[i]));
        past.insert(loc[i]);
        // printf("l2 = %d l1 = %d now = %d r1 = %d r2 = %d \n", l2, l1, loc[i], r1, r2);
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 14452
#include <stdio.h>
#define REP(i,n) for(int i=0; i< int(n); (i)++)
int main()
{
    int n,k,tmp,x=0;
    scanf("%d %d",&n,&k);
    REP(i,n)
    {
        scanf("%d",&tmp);
        if(2*tmp < 2*(k-tmp))
        {
            x += 2*tmp;
        }
        else
        {
            x += 2*(k-tmp);
        }
    }
    printf("%d\n",x);
    return 0;
}

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> positions(N);
    for (int i = 0; i < N; i++)
    {
        cin >> positions.at(i);
    }
    ll answer = 1e12;
    for (int i = 1; i <= 100; i++)
    {
        ll tempAnswer = 0;
        for (int position : positions)
        {
            tempAnswer += (i - position) * (i - position);
        }
        answer = min(answer, tempAnswer);
    }
    cout << answer << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<numeric>
#include<cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#define ll long long int
#define CON 100010
const long long mod=1e9+7;
const int INF=1001001001;
const int inf=100000;
//const ll inf=1e9+7;
//const ll ful=1e18;
using namespace std;
//namespace mp = boost::multiprecision;
int main() 
{
	int x,n;
	cin>>x>>n;
	vector<int> p(n);
	for(int i=0;i<n;i++)
	{
		cin>>p[i];
	}
	//答え
	int ans=inf;
	//直前の最小値
	int pre=inf;
	bool flag=true;
	for(int i=-1;i<=101;i++)
	{
		flag=true;
		for(int j=0;j<n;j++)
		{
			if(i==p[j]) flag=false;
		}
		if(flag)
		{
			if(pre==abs(x-i)&&ans==i)
			{
				ans=min(ans,i);
			}
			else if(pre>abs(x-i))
			{
				ans=i;
				pre=abs(x-i);
			}
			
		}
	}
	if(n==0) cout<<x<<endl;
	else cout<<ans<<endl;
	return 0;
}



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

int main()
{
    int a, b, c;
    int x, y, z;
    
    cin >> a >> b >> c;
    
    x = a + b;
    y = a + c;
    z = b + c;
    
    if((x <= y) && (x <= z)) {
        cout << x << "\n";
    } else if((y <= x) && (y <= z)) {
        cout << y << "\n";
    } else {
        cout << z << "\n";
    }

    return 0;
}

Measured memory_bytes: 256
import sys, math, collections, heapq, itertools
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while a % b > 0: a, b = b, a % b
    return b
  
def solve():
    file = sys.stdin.readline #single: int(file()), line: map(int, file().split())
    INF = 10 ** 25
    mod = 7 + 10 ** 9

    N = int(file())
    edge = [[] for i in range(N)]
    for i in range(N-1):
        a, b = map(int, file().split())
        edge[a-1].append(b-1)
        edge[b-1].append(a-1)
    c = [int(i) for i in file().split()]
    c.sort(reverse = True)

    que = collections.deque()
    last = 0
    forward = [-1] * N
    que.append((0, 0))
    while que:
        now, dist = que.popleft()
        if forward[now] == -1:
            forward[now] = dist
            last = now
            for e in edge[now]:
                if forward[e] == -1: que.append((e, dist + 1))
    backward = [-1] * N
    que.append(last)
    count = 0
    while que:
        now = que.popleft()
        if backward[now] == -1:
            backward[now] = c[count]
            count += 1
            last = now
            for e in edge[now]:
                if backward[e] == -1: que.append(e)

    total = 0
    que.append((last, backward[last]))
    visited = [False] * N
    while que:
        now, weight = que.popleft()
        if visited[now] == False:
            visited[now] = True
            for e in edge[now]:
                if visited[e] == False:
                    total += min(weight, backward[e])
                    que.append((e, backward[e]))

    print(total)
    print(" ".join(map(str, backward)))

    return 0
  
if __name__ == "__main__":
    solve()

Measured memory_bytes: 6752
program main
	implicit none
    character::s
    read(*,*)s
    if(s=='S')then
    	write(*,*) 'Cloudy'
    else if(s=='R')then
    	write(*,*) 'Sunny'
    else
    	write(*,*) 'Rainy'
    end if
    stop
end program main


Measured memory_bytes: 2860
import numpy as np
import itertools as it
N = int(input())
pos = []
for n in range(N):
    pos.append(tuple([int(x) for x in input().split()]))
per = list(it.permutations(pos))

distance = 0
for p in range(len(per)):
    for n in range(len(per[p])-1):
        distance += np.sqrt((per[p][n][0]-per[p][n+1][0])**2 + (per[p][n][1]-per[p][n+1][1])**2)
distance = distance / len(per)

print(distance)


Measured memory_bytes: 18768
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
    ll N;
    cin >> N;
    ll ans[N];
    ll a,i;
    for(i=0;i<N;i++){
        ans[i]=0;
    }
    for(i=0;i<N-1;i++){
        cin >> a;
        ans[a-1]+=1;
    }
    for(i=0;i<N;i++){
        cout << ans[i] <<endl;
    }
    return 0;
}


Measured memory_bytes: 4756
#include <stdio.h>
#include <stdlib.h>

int main(void){
    long long int n, i, j, zero=0, one=0;
//    scanf("%lld", &n);
    char s[100005];
    scanf("%s", s);
    for(i=0; 1; i++){
        if(s[i] == '0') zero++;
        else if(s[i] == '1') one++;
        else break;
    }
    if(zero>one) printf("%lld", 2*one);
    else printf("%lld", 2*zero);
}

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

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

    
    LL n,m;
    cin>>n>>m;
    cout<<(n*(n-1))/2+(m*(m-1))/2<<endl;
}

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

int main()
{
   /// BISMILLAHIR RAHMANIR RAHIM




	int n;
	cin >> n;
	ll ans = 1;
	vector<ll> a(n);


	for (int i = 0;i < n;i++) {
		cin >> a[i];
		if (a[i] == 0) {
			cout << 0 << endl;
			return 0;
		}

	}
	for (int i = 0;i < n;i++) {



		//cout << GD(ans) + GD(a[i]) << endl;
		ans = ans * a[i];
	}
	if (ans <= 1000000000000000000 && ans > 0) {
		cout << ans << endl;
	}
	else cout << -1 << endl;
	return 0;


    /// ALHAMDULILLAH
}


Measured memory_bytes: 4060
#include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using L64 = int64_t;

/* {x,y}という表現で格納される[x^y] */
inline vector<pair<L64, int>> prime_factorize(L64 N) {
  vector<pair<L64, int>> res;
  for (int a = 2; a * a <= N; ++a) {
    if (N % a != 0) {
      continue;
    }
    int ex = 0;
    while (N % a == 0) {
      ex++;
      N /= a;
    }
    res.push_back({a, ex});
  }
  if (N != 1) res.push_back({N, 1});
  return res;
}

int main(void) {
  int N, K;
  string S;
  cin >> N >> K >> S;
  if (S[K - 1] == 'A')
    S[K - 1] = 'a';
  else if (S[K - 1] == 'B')
    S[K - 1] = 'b';
  else if (S[K - 1] == 'C')
    S[K - 1] = 'c';
  cout << S;
  return 0;
}

Measured memory_bytes: 3584
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner kbs = new Scanner(System.in);
		String S = kbs.next();
		String string = "";
		for(int i = 0; i < S.length(); i++) {
			string += "x";
		}
		System.out.printf("%s", string);
		kbs.close();
	}

}


Measured memory_bytes: 23508
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)

typedef vector<int> vi;

int main()
{
	while (1)
	{
		int N, A, B, C, X;
		cin >> N >> A >> B >> C >> X;
		if (N == 0) return 0;

		vi Y(N); rep(i, 0, N) cin >> Y[i];

		int y = 0;
		int ans = -1;
		rep(i, 0, 10001)
		{
			if(i != 0) X = (A * X + B) % C;
			if (Y[y] == X) y++;
			if (y == N)
			{
				ans = i;
				break;
			}
		}

		cout << ans << endl;
	}
}

Measured memory_bytes: 3000
object Main {
  def main(args: Array[String]): Unit = {
    val Array( semesters_num, k ) = scala.io.StdIn.readLine.split( " " ).map{ _.toInt }
    val scores                    = scala.io.StdIn.readLine.split( " " ).map{ _.toInt }

    ( k until semesters_num ).foreach{ i =>
      if( scores( i ) > scores( i - k ) ) println( "Yes" )
      else                                    println( "No" )
    }
  }
}

Measured memory_bytes: 86680
(def parse-input
  (fn [s]
    (mapv #(Integer/parseInt %) (clojure.string/split s #" "))))

(def res
  (fn [[h a]]
    (+ (quot h a)
       (if (zero? (rem h a)) 0 1))))

(def hn (parse-input (read-line)))
(def as (parse-input (read-line)))

(println
 (if (<= (first hn) (apply + as))
   "Yes"
   "No"))


Measured memory_bytes: 69460
/*
* @Author: kabbo
* @Date:   2020-05-11 19:46:15
* @Last Modified by:   kabbo
* @Last Modified time: 2020-05-11 19:56:23
*/
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define endl '\n'
#define ull unsigned long long
#define ll long long
const int mod = 1e9 + 7;
using u64 = uint64_t;
using u128 = __uint128_t;
const int mx = 1e5;
vector<int>adj[mx + 10];
int dp[mx + 10];
int dfs(int src) {
	if (dp[src] != -1)
		return dp[src];
	bool leaf = 1;
	int res = 0;
	for (auto& child : adj[src]) {
		leaf = 0;
		res = max(res, dfs(child));
	}
	return dp[src] = leaf ? 0 : 1 + res;
}
void solve() {
	int n, m;
	cin >> n >> m;
	for (int i(0); i < m; ++i) {
		int u, v;
		cin >> u >> v;
		adj[u].emplace_back(v);
	}
	memset(dp, -1, sizeof(dp));
	int ans = 0;
	for (int i(1); i <= n; ++i) {
		ans = max(ans, dfs(i));
	}
	cout << ans << endl;

}
int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	/*int t;
	cin >> t;
	for (int i(1); i <= t; ++i) {
		printf("Case %d: ", i);*/
	solve();
	//}
#ifndef LOCAL_DEFINE
	cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
#endif
	return 0;
}

Measured memory_bytes: 8192
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        
        if( K == 0 ) {
            System.out.println( (long) N * N );
            return;
        }

        long ans = 0;
        for(int b = 1; b <= N; b++ ) {
            long x = Math.max( (long)(N / b) * (b-K), 0);
            long y = Math.max(N % b - K + 1, 0);
            
            if( b <= K && ( x > 0 ) ) {
                throw new Exception("Error!!");
            }
            
            ans += x + y;
        }
        
        System.out.println(ans);
    }
}


Measured memory_bytes: 35808
N, B = map(int, input().split())
R = N-B
mod = pow(10, 9)+7
ans = [0]*(B+1)
Bn = B-1
Rn = R+1
if R+1 < B:
    Br = B-R-1
    Bbunshi = 1
    Bbunbo = 1
    for i in range(Br):
        Bbunshi = (Bbunshi*(Bn-i)) % mod
        Bbunbo = (Bbunbo*(i+1)) % mod
    Rbunshi = 1
    Rbunbo = 1
    Rr = 1
    Bn -= Br
    Br += 1
    ans[R+1] = (Bbunshi*pow(Bbunbo, -1, mod)) % mod
elif R+1 > B:
    Rr = R-B+1
    Rbunshi = 1
    Rbunbo = 1
    for i in range(Rr):
        Rbunshi = (Rbunshi*(Rn-i)) % mod
        Rbunbo = (Rbunbo*(i+1)) % mod
    Bbunshi = 1
    Bbunbo = 1
    Br = 1
    Rn -= Rr
    Rr += 1
    ans[B] = (Rbunshi*pow(Rbunbo, -1, mod)) % mod

else:
    Br = 1
    Bbunshi = 1
    Bbunbo = 1
    Rr = 1
    Rbunshi = 1
    Rbunbo = 1
    ans[B] = 1

n = min(R+1, B)
for i in range(n-1, 0, -1):
    Bbunshi = (Bbunshi*Bn) % mod
    Bbunbo = (Bbunbo*Br) % mod
    Rbunshi = (Rbunshi*Rn) % mod
    Rbunbo = (Rbunbo*Rr) % mod
    ans[i] = ((Bbunshi*pow(Bbunbo, -1, mod)) *
              (Rbunshi*pow(Rbunbo, -1, mod))) % mod
    Bn -= 1
    Rn -= 1
    Br += 1
    Rr += 1


for i in range(1, B+1):
    print(ans[i])


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define Abs(x)((x) < 0 ? (x) * -1 : (x))

#define rep(x, y) for ((x) = 0; (x) < (y); (x)++)
#define repin(x, y) for ((x) = 0; (x) <= (y); (x)++)
#define nep(x, y) for ((x) = (y) - 1; 0 <= (x); (x)--)
#define nepi(x, y, z) for ((x) = (y) - 1; (z) <= (x); (x)--)
#define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++)
#define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++)
#define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z))
#define repis(x, y, z, s) for ((x) = (z); (x) < (y); (x) += (s))
#define repit(x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define nepit(x) for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++)

#define All(x) (x).begin(),(x).end()

#define Mem0(x) memset(x, 0, sizeof(x))
#define Mem1(x) memset(x, -1, sizeof(x))

#define Unique(v) v.resize(unique(All(v)) - v.begin())

#define peq(p0, p1)(p0.first == p1.first && p0.second == p1.second)

#define End '\n'
#define Out(x) cout<<(x)<<End
#define OutP(p, sep, end) cout<<p.first<<sep<<p.second<<end

template<typename T> inline bool Max(T &x, const T &y) { return x < y ? x = y, 1 : 0; }
template<typename T> inline bool Min(T &x, const T &y) { return x > y ? x = y, 1 : 0; }
template<typename T> using V = vector<T>;
template<typename T> using VV = V<V<T> >;

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define lb std::lower_bound
#define ub std::upper_bound

#define lbi(v, x) lb(All(v), (x))-v.begin()
#define ubi(v, x) ub(All(v), (x))-v.begin()

static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;

#define LOCAL 0

int main()
{
#if LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
#endif

    cin.tie(0);
    ios::sync_with_stdio(false);
	//std::cout.precision(18);

    string a, b, c;

	cin >> a >> b >> c;

	if (a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0]) Out("YES");
	else Out("NO");
	
	return 0;
}


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

class main
{
    static void Main(string[] args)
    {
        string[] read = Console.ReadLine().Split(' ');
		int N = int.Parse(read[0]);

		decimal[] A = new decimal[N];
		decimal[] B = new decimal[N];
		decimal ans = 0;

		string[] read2 = Console.ReadLine().Split(' ');
		for(int i = 0;i < N; i++)
		{
			A[i] = decimal.Parse(read2[i]);
		}


		B[0] = A[0];

		for(int i = 1;i < N;i++)
		{
			B[i] = B[i - 1] + A[i];
		}
		
		for(int i = 1;i < N; i++)
		{
			ans += B[i - 1] * A[i];
		}

		
		Console.WriteLine(mod(ans));
	}

	static decimal mod(decimal A)
	{
		return A % (decimal)(Math.Pow(10,9) + 7);
	}
}



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

signed main() {
    int sum=0,ma=0;
    for(int i=0;i<5;i++) {
        int a;
        cin>>a;
        if (a%10)ma= max(ma,10-a%10);
        sum+=(a+9)/10*10;
    }
	cout<<sum-ma;
  return 0;
  
}

Measured memory_bytes: 256
import sys
line = sys.stdin.readline

n = int(line())
a = list(map(int, line().split()))
a.sort(reverse=True)
summ = 0
h = 0
for i in range(len(a)):
    summ += 1
    if i and a[i] != a[i-1]:
        summ = 1
    if summ == 2:
        if h:
            print(a[i] * h)
            sys.exit()
        else:
            h = a[i]
    if summ == 4:
        print(a[i] * a[i])
        sys.exit()
print(0)

Measured memory_bytes: 14552
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;

#ifdef BTK
#include<dvector.h>
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww{cww(){
    CIN_ONLY{
        ios::sync_with_stdio(false);cin.tie(0);
    }
}}star;
#define DEBUG if(0)
#endif

#define fin "\n"
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l,T r)
{bool a=l>r;if(a)l=r;return a;}
template <typename T>inline bool chmax(T &l,T r)
{bool a=l<r;if(a)l=r;return a;}
template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}

const string ok="Yes";
const string ng="No";

typedef vector<int> V;
typedef vector<V> VV;

int main(){
    string s;
    cin>>s;
    cout<<s.substr(0,s.size()-8)<<endl;
    return 0;
}


Measured memory_bytes: 256
a, b = gets.split.map(&:to_i)

min = (a / 0.08).floor
max = (100 / 0.08).floor

p = min

min.upto(max) do
  break if (p * 0.08).floor == a && (p * 0.10).floor == b

  p += 1
end

if p > max
  puts -1
else
  puts p
end


Measured memory_bytes: 3836
package main

import (
//	"bufio"
	"fmt"
//	"os"
)

func main() {
//	stdin := bufio.NewScanner(os.Stdin)
//	stdin.Scan()
//	text := stdin.Text()
    var text string
    fmt.Scan(&text)
/*
	var E0, E1, O0, O1 int
	for i, t := range text {
		if i%2 == 0 {
			if t == '0' {
				E0++
			} else {
				E1++
			}
		} else {
			if t == '0' {
				O0++
			} else {
				O1++
			}
		}
	}
	fmt.Println(min(E0+O1, E1+O0))
*/
	
	ret1 := 0
	/* 0101 */
	for i, t := range text {
	    if i % 2 == 0 {
	        if t != '0' {
	            ret1++
	        }
	    }else {
	        if t != '1' {
	            ret1++
	        }
	    }
	}
	ret2 := 0
	/* 1010 */
	for i, t := range text {
	    if i % 2 == 0 {
	        if t != '1' {
	            ret2++
	        }
	    }else {
	        if t != '0' {
	            ret2++
	        }
	    }
	}
	fmt.Println(min(ret1,ret2))
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}


Measured memory_bytes: 1280
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
void *wmem;
char memarr[96000000];
template<class T> inline void walloc1d(T **arr, int x, void **mem = &wmem){
  static int skip[16] = {0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
  (*mem) = (void*)( ((char*)(*mem)) + skip[((unsigned long long)(*mem)) & 15] );
  (*arr)=(T*)(*mem);
  (*mem)=((*arr)+x);
}
template<class T1> void sortA_L(int N, T1 a[], void *mem = wmem){
  sort(a, a+N);
}
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int N;
int K;
int A[5000];
int main(){
  wmem = memarr;
  int res;
  bitset<5001> dp;
  rd(N);
  rd(K);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=(0);Lj4PdHRW<(N);Lj4PdHRW++){
      rd(A[Lj4PdHRW]);
    }
  }
  sortA_L(N,A);
  while(N && A[N-1] >= K){
    N--;
  }
  int KL2GvlyY;
  int Q5VJL1cS;
  int e98WHCEY;
  KL2GvlyY = 0;
  Q5VJL1cS = N;
  while(KL2GvlyY < Q5VJL1cS){
    int i;
    if((KL2GvlyY + Q5VJL1cS)%2==0){
      e98WHCEY = (KL2GvlyY + Q5VJL1cS) / 2;
    }
    else{
      e98WHCEY = (KL2GvlyY + Q5VJL1cS + 1) / 2;
    }
    dp.reset();
    dp[0] = true;
    for(i=(0);i<(N);i++){
      if(i!=e98WHCEY-1){
        dp |= (dp << A[i]);
      }
    }
    for(i=(K-A[e98WHCEY-1]);i<(K);i++){
      if(dp[i]){
        break;
      }
    }
    if(i==K){
      KL2GvlyY = e98WHCEY;
    }
    else{
      Q5VJL1cS = e98WHCEY - 1;
    }
  }
  res =Q5VJL1cS;
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190925-1

// --- original code ---
// int N, K, A[5000];
// {
//   int res;
//   bitset<5001> dp;
//   rd(N,K,A(N));
//   sortA(N,A);
//   while(N && A[N-1] >= K) N--;
//   res = bsearch_max[int,x,0,N][
//     dp.reset();
//     dp[0] = true;
//     rep(i,N) if(i!=x-1) dp |= (dp << A[i]);
//     rep(i,K-A[x-1],K) if(dp[i]) break;
//   ](i==K);
//   wt(res);
// }


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

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

	for(string s; getline(cin, s) && s != "END OF INPUT";) {
		string ans = "";
		int prev = 0;
		for(unsigned i = 0; i < s.size(); ++i) {
			if(s[i] == ' ') {
				ans += i - prev + '0';
				prev = i + 1;
			}
		}
		ans += s.size() - prev + '0';
		cout << ans << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1184
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;

static const double eps = 10e-8;

class mycmp{
public:
	bool operator()(const P p1, const P p2){
		if(p1.first < p2.first) return true;
		else if(p1.second < p2.second) return true;
		else false;
	}
};

int main(){
	int n;

	while(~scanf("%d",&n)){
		if(n==0) break;
		vector<P> dolls;

		for(int i=0;i<n;i++){
			int h,r;
			scanf("%d %d",&h,&r);
			dolls.push_back(P(h,r));
		}

		int m;
		scanf("%d",&m);
		for(int i=0;i<m;i++){
			int h,r;
			scanf("%d %d",&h,&r);
			dolls.push_back(P(h,r));
		}


		sort(dolls.begin(),dolls.end());

		int* dp = new int[n+m];
		memset(dp,0,sizeof(dp));
		for(int i=0;i<n+m;i++) dp[i] = 1;

		for(int i=0;i<dolls.size();i++){
			for(int j=0;j<dolls.size();j++){
				if(dolls[j].first < dolls[i].first
					&& dolls[j].second < dolls[i].second){
						dp[i] = max(dp[i],dp[j] + 1);
				}
			}
		}

		cout << dp[dolls.size()-1] << endl;
		delete[] dp;
	}
}

Measured memory_bytes: 3140
N = int(input())
SP = []
for _ in range(N):
    a = input().split()
    a.append(_+1)
    SP.append(a)


sorted_items = sorted(
  SP,
  key = lambda x: (x[0], -int(x[1]))
)

for s in sorted_items:
    print(s[2])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

signed main(){
	int n;
	string s,t;
	cin >> s >> t;
	n = s.length();
	for(int i = 0;i < n;i++){
		bool flag = true;
		for(int j = 0;j < n;j++){
			if(s[j] != t[(i + j) % n]) flag = false;
		}
		if(flag){
			Yes();
			return 0;
		}
	}
	No();
	return 0;
}

Measured memory_bytes: 256
N,K = map(int,input().split())
A = []
count = 0
for i in range(K):
    d = int(input())
    B = [int(i) for i in input().split()]
    for i in range(d):
        A.append(B[i])
for i in range(1,N+1):
    if not i in A:
        count += 1
print(count)


Measured memory_bytes: 9312
#include <cstdio>

int a,b,c,d,p;

int min(int x,int y){
	if(x>y)return y;
	return x;
}

int main(void){
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	scanf("%d",&p);
	int na=a*p;
	int nb=b;
	if(p>c){
		nb+=d*(p-c);
	}
	printf("%d\n",min(na,nb));
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, a[125];
	cin>>n;
	REP(i, n){
		cin>>a[i];
	}
	int ans=1<<30;
	FOR(i, -100, 101){
		int tmp=0;
		REP(j, n){
			tmp+=(i-a[j])*(i-a[j]);
		}
		ans=min(ans, tmp);
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
    #define int ll
	#define pb push_back
    #define ll long long
    using namespace std;
    int power(int x, unsigned int y, unsigned int m) 
	{ 
    	if (y == 0) 
        	return 1; 
    	int p = power(x, y/2, m) % m; 
    	p = (p * p) % m; 
  
 	   return (y%2 == 0)? p : (x * p) % m; 
	} 
	int modInverse(int a, int m) 
	{   
    	return power(a, m-2, m);
	}
    signed main()
    {
    	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    	ll t=1;
    	// cout<<1;
    	// cin >> t;
    	/*SAARE INPUTS LENA*/
    	/*VARIABLES KI RANGE DEKHLENA*/
    	while(t-->0)
    	{
    		ll n=0,k=0;
    		cin>>n>>k;
    		vector <int> v(200010);
    		int visit[200010];
    		ll a=0;
    		for (int i = 0; i < n; ++i)
    		{
    			cin>>a;
    			// cout<<1;
    			v[i+1]=(a);
    		}
    		for (int i = 0; i <=n; ++i)
    		{
    			visit[i]=0;
    		}
    		// for (int i = 1; i <=n; ++i)
    		// {
    		// 	cout<<v[i]<<" ";
    		// }
    		// cout<<endl;
    		visit[1]=1;
    		queue<int> q;
    		q.push(1);
    		int cnt=0,loop=0;
    		int c[200010];
    		vector <int> ans;
    		while(!q.empty())
    		{
    			int x=q.front();
    			q.pop();
    			// cout<<x<<endl;
    			cnt++;
    			c[x]=cnt;
    			ans.pb(x);
    			if(visit[v[x]]==1)
    			{
    				loop=cnt-c[v[x]]+1;
    			}
    			else
    			{	q.push(v[x]); visit[v[x]]=1;}
    		}

    		int f=k;
    		if(f>cnt-1)
    		f=(k-(cnt-loop))%loop+(cnt-loop)+1;
    		else
    		{
    			cout<<ans[f];
    			return 0;

    		}
    		// for (int i = 0; i < ans.size(); ++i)
    		// {
    		// 	cout<<ans[i]<<" ";
    		// }
    		// cout<<endl;
    		// cout<<cnt<<" "<<loop<<" "<<f<<endl;
    		cout<<ans[f-1];
    	}
    	return 0;
    }

Measured memory_bytes: 10020