akhauriyash/Code-Regression huggingface dataset:
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<VI> VVI;//例: VVI dp(10, vector<int>(10, INF);
typedef priority_queue<int, vector<int>, less<int> > QUE_int;
const int INF = 2 * pow(10, 9) + 1;//+1しないとREになるかも(out of rangeになるんかな?? )

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

ll max(ll a, ll b) { return (a > b) ? a : b; }
ll min(ll a, ll b) { return (a < b) ? a : b; }

////////////////////////////////////////////////////////////////

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = pow(10, 9) + 7;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x = 0) :x((x%mod + mod) % mod) {}
	mint operator-() const { return mint(-x); }
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
	vector<mint> fact, ifact;
	combination(int n) :fact(n + 1), ifact(n + 1) {
		assert(n < mod);
		fact[0] = 1;
		for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
		ifact[n] = fact[n].inv();
		for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
	}
	mint operator()(int n, int k) {
		if (k < 0 || k > n) return 0;
		return fact[n] * ifact[k] * ifact[n - k];
	}
};

template <typename TYPE>
void print_vec(const vector<TYPE>& v){
	for(int i=0; i<v.size(); i++){
		cout << v[i] << " ";
	}
	cout << endl;
}

////////////////////////////////////////////////////////////////

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


	ll ans = 0;
	for(int i=1; i<=N; i++){
		if(i % 3 != 0){
			if(i % 5 != 0) ans += i;
		}

	}

	cout << ans << endl;
}


Measured memory_bytes: 3600
using System;

namespace ABC098C
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var S = Console.ReadLine();

            var W = new int[N];
            var E = new int[N];
            var wCount = 0;
            var eCount = 0;
            for (var i = 0; i < N; i++)
            {
                W[i] = wCount;
                if (S[i] == 'W')
                {
                    wCount++;
                }

                var j = N - i - 1;
                E[j] = eCount;
                if (S[j] == 'E')
                {
                    eCount++;
                }
            }

            var min = int.MaxValue;
            for (var i = 0; i < N; i++)
            {
                min = Math.Min(min, W[i] + E[i]);
            }
            Console.WriteLine(min);
        }
    }
}


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

using namespace std;

#define rep(i , n) for(int i=0 ; i<n ; i++)
#define rep1(i , n) for(int i=1 ; i<=n ; i++)

typedef long long int ll;

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

	int n;
	cin >> n;
	int arr[50];

	rep(i , n)
		cin >> arr[i];

    int count = 0;
	rep(i , n)
	{
		if(arr[i] != i+1)
		{
		    for(int j=i+1 ; j<n ; j++)
		    {
		        if(arr[j] == i+1)
		        {
		            count++;
		            swap(arr[i] , arr[j]);
		            break;
		        }
		    }
		}
	}
	if(count <= 1)	cout << "YES";
	else
		cout << "NO";
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N = 4005;
const int mod = 998244353;

int n, k;
int c[N][N], pw[N];

int C(int x, int y) {
	if (x < y || y < 0) return 0;
	return c[x][y];
}

int calc(int x, int y) {
//	cout << x <<' ' << y << endl;
	return C(x + y - 1, y - 1); 
}

int get(int x, int n, int k) {
	int cnt = 0, num = 0;
	long long res = 0;
	cnt = max(0, x / 2 - max(0, x - 1 - k));
	num = cnt * 2;
//	cout << cnt << endl;
	for (int i = 0; i <= cnt; ++i) {
		int tmp = 1LL * C(cnt, i) * pw[i] % mod;
		res += 1LL * tmp * calc(n - i, k - num + i) % mod;
		//	cout << tmp << ' ' << res << endl;
	}
	return res % mod;
}

int main() {
	c[0][0] = 1;
	for (int i = 1; i < N; ++i) {
		c[i][0] = 1;
		for (int j = 1; j <= i; ++j) {
			c[i][j] = c[i - 1][j] + c[i - 1][j - 1];
			if (c[i][j] >= mod) c[i][j] -= mod;
		}
	}
	pw[0] = 1;
	for (int i = 1; i < N; ++i) {
		pw[i] = pw[i - 1] * 2;
		if (pw[i] >= mod) pw[i] -= mod;
	}
	cin >> k >> n;
	for (int i = 2; i <= 2 * k; ++i) {
		long long res = 0;
		if (i & 1) res += get(i, n, k);
		else res += get(i - 1, n, k - 1) + get(i - 1, n - 1, k - 1);
		if (res >= mod) res -= mod;
		cout << res << endl;
	}
	return 0;
}


Measured memory_bytes: 61440
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long int n;
  cin>>n;
  map<int,int> mp;
  long long int a[n];
  for(long long int i=0;i<n;i++)
  {
    cin>>a[i];
    mp[a[i]]=a[i];
  }
  if(mp.size()==(sizeof(a)/sizeof(a[0])))
  {
    cout<<"YES"<<endl;
  }
  else
  {
    cout<<"NO"<<endl;
  }
  return 0;
}

Measured memory_bytes: 11136
#include <iostream>

using namespace std;

char map[20][20];
int bx[]={0,0,0,0,0,0,-3,-2,-1,1,2,3},by[]={-3,-2,-1,1,2,3,0,0,0,0,0,0};

void bom(int x,int y)
{
  int a,b;
  map[x][y]='0';
  for(int i=0;i<12;i++)
    {
      //cout<<x+bx[i]<<" "<<y+by[i]<<endl;
      if(x+bx[i]>=0 &&y+by[i]>=0 &&x+bx[i]<8 &&y+by[i]<8 &&map[x+bx[i]][y+by[i]]=='1')
	{
	  //  cout<<"bom"<<x+bx[i]<<" "<<y+by[i]<<endl;
	  bom(x+bx[i],y+by[i]);
	}
    }
}

int main()
{
  int n;
  cin>>n;
  for(int c=1;n>=c;c++)
    {
      int x,y;
      for(int i=0;i<8;i++)
	for(int j=0;j<8;j++)
	  cin>>map[i][j];
      cin>>x>>y;
      bom(y-1,x-1);
      cout<<"Data "<<c<<":"<<endl;
      for(int i=0;i<8;i++)
	{
	  for(int j=0;j<8;j++)
	    cout<<map[i][j];
	  cout<<endl;
	}
    }

}

Measured memory_bytes: 1160
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
int n,a[400010],l,r,mid,ans;
bool _get(int x){ return !(x<=mid);}
bool check()
{
    for (int i=1;i<=n-1;i++)
    {
        if (_get(a[n+i-1])==_get(a[n+i])) return _get(a[n+i]);
        if (_get(a[n-i+1])==_get(a[n-i])) return _get(a[n-i+1]);
    }
    return _get(a[1]);
}
int main()
{
    scanf("%d",&n);
    for (int i=1;i<=2*n-1;i++) scanf("%d",&a[i]);
    l=1;r=2*n-1;
    while (l<=r)
    {
        mid=(l+r)/2;
        if (!check()) r=mid-1,ans=mid;else l=mid+1;
    }
    cout<<ans;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
const int M=1e5+10;
struct node{
    int l,r;
}t[M];
bool cmp(node A,node B){
    if(A.r<B.r)return 1;
    else if(A.r==B.r)return A.l>B.l;
    else return 0;
}
int main(){
	int n;cin>>n;
    for(int j=1;j<=n;++j){
    	int st,ed;
    	scanf("%d%d",&st,&ed);
    	t[j].l=st-ed;
    	t[j].r=st+ed;
    }
    sort(t+1,t+n+1,cmp);
    int lastr=-1e9; 
    int ans=0;
    for(int j=1;j<=n;++j){
        if(t[j].l>=lastr){
            lastr=t[j].r;
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <utility>
#include <random>
#include <chrono>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

using namespace std;

using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using PIL = pair<int, LL>;
using PLL = pair<LL, LL>;
// const int mod = 1e9 + 7;

inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
}

inline void print_vector(vector<int> &A){
    for (auto&& x : A){
        cout << x << " ";
    }
    cout << endl;
}

inline void solve() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    int turn = 1;

    while (a > 0 && c > 0) {
        if (turn % 2 == 1) {
            c -= b;
        } else {
            a -= d;
        }
        turn += 1;
    }

    if (a <= 0) cout << "No" << endl;
    else cout << "Yes" << endl;
}

int main() {
    // freopen("input.txt", "r", stdin);
    quickread();
    int t = 1;
    // cin >> t;

    for (int _ = 0; _ < t; _++) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
 
int main() {
  int n,m;
  cin >> n >> m;

  vector<int> inputs;
  int _num;
  cin >> _num;
  for(int j = 0; j < _num; ++j)
  { 
    int a;
    cin >> a;
    inputs.push_back(a);
  }
  
  for(int i = 1; i < n; ++i)
  {
    int num;
    cin >> num;

    vector<int> tmp;
    for(int j = 0; j < num; ++j)
  	{ 
    	int a;
    	cin >> a;
    	tmp.push_back(a);
  	}
    for(auto it = inputs.begin(); it != inputs.end();)
    {
      auto _it = find(tmp.begin(), tmp.end(), *it);
      if(_it == tmp.end())
      {
        it = inputs.erase(it);
        continue;
      }
      ++it;
    }
  }
  
  cout << static_cast<int>(inputs.size()) << endl;
}

Measured memory_bytes: 256
data=list(map(int,input().split()))

for i in range(len(data)-1):
    for j in range(len(data)-1,i,-1):
        if data[j]<data[j-1]:
            data[i],data[j]=data[j],data[i]

print(f"{data[0]} {data[1]} {data[2]}")


Measured memory_bytes: 5612
s = input()
ans = 1000
for i in range(len(s)-2):
    if ans > abs(753 - int(s[i] + s[i + 1] + s[i + 2])):
        ans = abs(753 - int(s[i] + s[i + 1] + s[i + 2]))
print(ans)

Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <queue>
#include <stack>

using namespace std;

int main(){
  long N,a;
  vector<long> b;
  cin >> N;
  for(int i=0;i<N;++i){
    cin >> a;
    b.push_back(a);
  }


  if(N%2==0){
      for(int i=N-1;i>=0;i -= 2){
        cout << b[i] << ' ';
      }
      for(int i=0;i<N-1;i += 2){
        cout << b[i] << ' ';
      }
  }else{
      for(int i=N-1;i>=0;i -= 2){
        cout << b[i] << ' ';
      }
      for(int i=1;i<N-1;i += 2){
        cout << b[i] << ' ';
      }
  }
  cout << endl;
}

Measured memory_bytes: 3824
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;

const string YES = "Possible";
const string NO = "Impossible";
ll H, W; 
vector<string> S;
vector<vll> checked;
vll dx{0, 1}, dy{1, 0};

void dfs(ll x, ll y){
    if(checked[x][y])
        return;
    checked[x][y] = 1;
    REP(k, 2){
        ll xto = x + dx[k], yto = y + dy[k];
        if( xto < H && yto < W && !checked[xto][yto] && S[x][y] =='#')
            dfs(xto, yto);
    }
    return;

}

int main(){
    cin >> H >> W;
    S.resize(H);
    REP(i, H){
        cin >> S[i];
    }
    checked.resize(H);
    REP(i, H){
        checked[i].resize(W);
        fill(ALL(checked[i]), 0);
    }
    ll cnt = 0;
    REP(i, H){
        REP(j, W){
            if(S[i][j] =='#')
                cnt++;
        }
    }
    dfs(0, 0);
    if(checked[H-1][W-1] &&(cnt == (H+W-1)))
        cout << YES << endl;
    else
        cout<<NO << endl;
    return 0;
}


Measured memory_bytes: 256
H=int(input())+1
A=[0]+list(map(int,input().split()))
def h(i):
 l=2*i;r,g=l+1,[i,l][l<H and A[i]<A[l]]
 if r<H and A[g]<A[r]:g=r
 if g>i:A[i],A[g]=A[g],A[i];h(g)
for i in range(H//2,0,-1):h(i)
print(' '+' '.join(map(str,A[1:])))


Measured memory_bytes: 64176
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define all(a) (a).begin(), (a).end()
 
int main() {
  int N;
  cin >> N;
  int K;
  cin >> K;
  string S;
  cin >> S;
  S[K -1] = S[K - 1] + 0x20;
  cout << S << endl;
}

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

int main()
{
    int X,N;
    cin>>X>>N;
    if(N==0)
        cout<<X;
    else{
    map<int,int> mp;
    for(int i=0;i<N;i++)
    {
        int a;
        cin>>a;
        mp[a]=1;
    }
    int a=-1;int j=0;
    while(a==-1)
    {
        int k=0;
        if(mp.find(X-j)==mp.end())
            {a=X-j;k=1;}
        if(mp.find(X+j)==mp.end())
            {if(k==1)
              a=min(X+j,X-j);
            else
                a=X+j;
            }
        j++;
    }
    cout<<a;}
    return 0;
}


Measured memory_bytes: 3604
it = lambda: list(map(int, input().strip().split()))


def solve():
    n = int(input())
    F = [0] * n
    S = [0] * n
    for i in range(n):
        a, b = it()
        F[i] = a
        S[i] = b
    
    cnt = 0
    for i in range(n):
        if F[i] == S[i]:
            cnt += 1
            if cnt == 3:
                return 'Yes'
        else:
            cnt = 0
    return 'No'


if __name__ == '__main__':
    print(solve())

Measured memory_bytes: 9192
#include <utility>
#include <iostream>
#include <algorithm>

using namespace std;

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

	cin >> a >> b >> c;

	if (a > b) swap(a, b);
	if (a > c) swap(a, c);
	if (b > c) swap(b, c);

	cout << a << ' ' << b << ' ' << c << endl;

	return 0;
}

Measured memory_bytes: 1160
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int h = scanner.nextInt();
			int w = scanner.nextInt();
			if ((h | w) == 0)
				break;
			StringBuilder b = new StringBuilder();
			for (int i = 0; i < h; i++)
				b.append(scanner.next());
			Deque<Point> deque = new ArrayDeque<Main.Point>();
			deque.push(new Point(b.toString(), 1));
			int ans = -1;
			Set<String> set = new HashSet<String>();
			loop:
			while (!deque.isEmpty()) {
				Point p = deque.poll();
				String g = p.g;
				int d = p.d;
				if (set.contains(g))
					continue;
				set.add(g);
				int a = g.indexOf('@');
				int y = a / w;
				int x = a % w;
				for (int i = 0; i < 4; i++) {
					int sy = y + dy[i];
					int sx = x + dx[i];
					int aa = sy * w + sx;
					char c = g.charAt(aa);
					if (c == '#' || c == 'w')
						continue;
					if (c == 'E') {
						ans = d;
						break loop;
					}
					if (c == '.') {
						char[] tmp = g.toCharArray();
						tmp[a] = '.';
						tmp[aa] = '@';
						deque.offer(new Point(String.valueOf(tmp), d + 1));
					}
					if (c == 'c') {
						char[] tmp = g.toCharArray();
						tmp[aa] = '.';
						while (true) {
							int ny = sy + dy[i];
							int nx = sx + dx[i];
							char nc = tmp[ny * w + nx];
							if (nc == '#' || nc == 'c') {
								tmp[sy * w + sx] = 'c';
								break;
							}
							if (nc == 'w') {
								tmp[ny * w + nx] = '.';
								break;
							}
							sy = ny;
							sx = nx;
						}
						deque.offer(new Point(String.valueOf(tmp), d));
					}
				}

			}
			System.out.println(ans);
		}
	}

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

	class Point {
		String g;
		int d;

		public Point(String g, int d) {
			super();
			this.g = g;
			this.d = d;
		}

		@Override
		public String toString() {
			return "Point [g=" + g + ", d=" + d + "]";
		}

	}
}

Measured memory_bytes: 114952
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count=0;
		for(int i=0;i<5;i++) {
			count=sc.nextInt();
			if(count==0) {
				System.out.println(i+1);
				System.exit(0);
			}
		}
		
		sc.close();
	}
}


Measured memory_bytes: 35916
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int P =1e9+7;
const int N = 410;
inline void add(int &x,int y){
	x+=y;
	if(x>=P)  x-=P;
}
int f[N][N][N],a[N],b[N],n,p1[N],p2[N],sum[N][N],g[N][N*2],h[N*2];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",a+i);
	for(int i =1;i<=n;i++) p1[a[i]] = i;
	for(int i =1;i<=n;i++)scanf("%d",b+i);
	for(int i =1;i<=n;i++) p2[b[i]] = i;
	f[0][0][0] =1;
	for(int i = 1;i<=n;i++) sum[0][i] = i;
	for(int i = 1;i<=n;i++){
		sum[i][0] = i;
		for(int k = 0;k<=n*2;k++) h[k] = 0;
		for(int j =1;j<=n;j++){
			sum[i][j] = sum[i-1][j]+(p2[a[i]]>j);
			for(int k = 0;k<=n;k++) add(h[sum[i-1][j-1]+k],f[i-1][j-1][k]);
			//if(j==1) for(int k =0;k<=n;k++) if(f[i-1][j-1][k]>0) {
			//	printf("YYY %d %d %d %d\n",i-1,j-1,k,f[i-1][j-1][k]);
			//}
			for(int k = 0;k<=2*n;k++) add(g[j-1][k],h[k]);
			//if(i==1 && g[0][6]>0) puts("YYY");
			if(p2[a[i]]>j && p1[b[j]]>i)
				for(int k = 1;k<=n;k++){
					add(f[i][j][k],1ll*k*g[j-1][sum[i][j]+k-3]%P);
				}
		}
	}
//	cout<<f[3][3][3]<<endl;
	int ans = 0;
	for(int i = 1;i<=n;i++) for(int j =1;j<=n;j++) for(int k = 1;k<=n;k++){
	
		if(n-k==sum[i][j]) {
			add(ans,1ll*f[i][j][k]%P);
		//	cout<<i<<' '<<j<<' '<<k<<' '<<f[i][j][k]<<endl;
		}
		
	}
	//cout<<ans<<endl;
	for(int i = 3;i<=n;i+=3) ans = 1ll*ans*(i-1)*(i-2)%P;
	printf("%d\n",ans);
	return 0;       
}
/*
9
9 2 7 3 1 6 8 4 5
1 4 7 9 2 5 8 6 3

9
4 7 2 9 6 3 5 1 8
6 5 1 8 3 7 2 9 4

9
9 7 6 8 1 2 4 3 5
1 6 7 2 4 9 5 8 3

9
1 2 3 4 5 6 7 8 9
9 8 7 6 5 4 3 2 1

6
1 2 3 4 5 6
6 5 4 3 2 1

*/

Measured memory_bytes: 264320
#include <iostream>
#include <vector>
#include <sstream>	// require stringstream 
#include <cctype>	// require tolower, toupper
//#include <fstream>	// require freopen

using namespace std;

int main()
{
//	cut here before submit 
//	freopen ("testcase.camelcase", "r", stdin );
	string str, s;
	char type;
	int i;

	while (cin >> str >> type && type != 'X' ){
		char curr_type = 'X';
		if (str.find ('_') != string::npos ){
			curr_type = 'D';
		}else{
			str[0] = toupper(str[0] );
		} // end if
		vector <string> word;

		if (curr_type == 'D'){
			while (str.find('_') != string::npos ){
				str = str.replace (str.find('_'), 1, " " );
			} // end while
			stringstream ss (str );
			s = "";
			while (ss >> s ){
				s[0] = toupper(s[0] );
				word.push_back(s);
			} // end while
		}else{
			s = "";
			s += str[0];
			for (i = 1; i < str.length(); ++i ){
				if (toupper(str[i] ) != str[i] ){
					s += str[i];
				}else{
					word.push_back(s);
					s = "";
					s += str[i];
				} // end if
			} // end for
			word.push_back (s );
		} // end if

		string res = "";

		switch (type ){
			case 'D':
				for (i = 0; i < word.size(); ++i ){
					s = word[i];
					s[0] = tolower(s[0]);
					res += s;
					if (i != word.size() - 1 ){
						res += '_';
					} // end if
				} // end for
				break;
			case 'U':
				for (i = 0; i < word.size(); ++i ){
					res += word[i];
				} // end for
				break;
			case 'L':
				for (i = 0; i < word.size(); ++i ){
					s = word[i];
					s[0] = (i == 0 ? tolower(s[0]) : toupper(s[0]) );
					res += s;
				} // end for
				break;
		} // end switch

		cout << res << endl;			
	} // end loop
		
	return 0;
}

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

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


    int cnt = 0;
    for(int i=0; i < (int)s.size() - 1; i++){
        if(s[i+1] != s[i]) cnt++;
    }

    cout << cnt << endl;
    return 0;
}


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

using namespace std;

int main(){
	int n;
	cin>>n;
	vector<int> a(n);
	vector<int> b(n);
	vector<int> c(n);
	int prev;
	int sum = 0;
	for(int i = 0; i<n;i++){
		cin>>a[i];
		}
	for(int i = 0; i<n;i++){
		cin>>b[i];
		}
	for(int i = 0; i<n-1;i++){
		cin>>c[i];
		}	
		prev = a[0];	
	for(int i = 0; i<n;i++){
		sum += b[a[i]-1];
		}
	for(int i = 0; i<n-1; i++){
		if(a[i+1] - a[i] ==1) sum+= c[a[i]-1];
		}	
	cout<<sum;	
	return 0;
	}


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

using LL = long long;

int N;
vector<LL> A;

LL dfs(int pre, int nex, int b) {
  static vector<vector<vector<LL>>> memo(N, vector<vector<LL>>(N, vector<LL>(2, -1)));
  pre = (pre + N) % N;
  nex %= N;
  if(pre == nex) return b ? A[pre] : 0;
  if(~memo[pre][nex][b]) return memo[pre][nex][b];
  if(b) {
    memo[pre][nex][b] = max(A[pre] + dfs(pre-1, nex, !b), A[nex] + dfs(pre, nex+1, !b));
  } else  {
    if(A[pre] > A[nex]) memo[pre][nex][b] = dfs(pre-1, nex, !b);
    else                memo[pre][nex][b] = dfs(pre, nex+1, !b);
  }
  return memo[pre][nex][b];
}

int main() {
  cin >> N;
  A.resize(N);
  for(auto& i: A) cin >> i;

  LL ans = 0;
  for(int i = 0; i < N; ++i) ans = max(ans, A[i] + dfs(i-1, i+1, 0));
  cout << ans << endl;
}

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

#define int long long

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

  if ( c-a-b >= 0 && 4*a*b < (c-a-b)*(c-a-b) ) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  
  return 0;
}


Measured memory_bytes: 3568
#include "bits/stdc++.h"
using namespace std;
string S;
bool ok(string t)
{
	for(int i=0;i<t.size();i++)
	{
		if(t[i]!='A'&&t[i]!='C'&&t[i]!='G'&&t[i]!='T')
		{
			return false;
		}
	}
	return true;
}
int main()
{
	cin>>S;
	int ans=0;
	for(int len=0;len<=S.size();len++)
	{
		for(int i=0;i<=S.size()-len;i++)
		{
			string t=S.substr(i,len); 
			if(ok(t))
			{
				ans=max(ans,len);
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}
/*
ACGTAGCTAAAACCCGTAGTC
Output:21

POPPOPOPOPOHHHHHQQQWQ
Output:0
*/

Measured memory_bytes: 256
#include<stdio.h>

int A[1000000], n;

int binarySearch(int key) {
    int left = 0, right = n, mid;
    while (left < right) {
        mid = (left + right) / 2;
        if (key == A[mid])return 1;
        if (key > A[mid])left = mid + 1;
        else if (key < A[mid])right = mid;
    }
    return 0;
}

int main() {
    int i, q, k, sum = 0;
    
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%d", &A[i]);
    }
    scanf("%d", &q);
    for (i = 0; i < q; i++) {
        scanf("%d", &k);
        if (binarySearch(k))sum++;
    }
    printf("%d\n", sum);
    return 0;
}

Measured memory_bytes: 2096
def main() -> None:
    v = str(input())
    m = int(v)
    base = 753
    for i in range(len(v) - 2):
        res = abs(base - int(v[i:i+3]))
        m = res if m > res else m

    print(m)


if __name__ == '__main__':
    main()


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

string solve() {
    int h, w, n, sr, sc;
    string s, t;
    cin >> h >> w >> n >> sr >> sc >> s >> t;

    unordered_map<char, int> max_value;
    max_value['U'] = sr;
    max_value['D'] = sr;
    max_value['L'] = sc;
    max_value['R'] = sc;

    for (int i = 0; i < n; i++) {
        switch (s[i]) {
        case 'U':
            max_value[s[i]]--;
            if (max_value[s[i]] < 1)
                return "NO";
            if (max_value['D'] == 1)
                max_value['D']++;
            break;
        case 'D':
            max_value[s[i]]++;
            if (max_value[s[i]] > h)
                return "NO";
            if (max_value['U'] == h)
                max_value['U']--;
            break;
        case 'L':
            max_value[s[i]]--;
            if (max_value[s[i]] < 1)
                return "NO";
            if (max_value['R'] == 1)
                max_value['R']++;
            break;
        case 'R':
            max_value[s[i]]++;
            if (max_value[s[i]] > w)
                return "NO";
            if (max_value['L'] == w)
                max_value['L']--;
            break;
        }

        switch (t[i]) {
        case 'U':
            max_value['D'] = max(1, max_value['D'] - 1);
            break;
        case 'D':
            max_value['U'] = min(h, max_value['U'] + 1);
            break;
        case 'L':
            max_value['R'] = max(1, max_value['R'] - 1);
            break;
        case 'R':
            max_value['L'] = min(w, max_value['L'] + 1);
            break;
        }
    }

    return "YES";
}

int main() {
    cout << solve() << endl;
    return 0;
}



Measured memory_bytes: 776
from sys import exit

N = int(input())
H = list(map(int, input().split()))

for i in range(N - 2, 0, -1):
    if H[i] <= H[i + 1]:
        continue
    H[i] -= 1
    if H[i] > H[i + 1]:
        print('No')
        exit()
print('Yes')


Measured memory_bytes: 14396
#include<iostream>
#include<cstring>

using namespace std;

int X, Y;
int status[17][18];	//status[x][y]
int memo[17][18];
int i, j;
int count;

int check(int x, int y);

int main(){

	while(1){

		count = 0;

		cin >> X >> Y;

		if(X == 0 && Y == 0){break;}

		else{

			//フィールドの入力
			//i行目について( 1 <= i <= Y+2 )
			for(i = 1; i <= Y+2; i++){
				//j文字目について( 0 <= j <= X+1)
				for(j = 0; j <= X+1; j++){

					//Y+1, Y+2列目に移動できるようにする。
					if(i > Y){
						status[j][i] = 0;
					}
					//両サイドには障害物を敷き詰める。
					else if(j == 0 || j == X+1){
						status[j][i] = 1;
					}
					else{
						cin >> status[j][i];
					}
				}
			}

/*//フィールド出力
			for(i = 1; i <= Y+2; i++){
				for(j = 0; j <= X+1; j++){
					cout << status[j][i];
				}
				cout << endl;
			}
*/

			for(i = 1; i <= X; i++){
				memset(memo, 0, sizeof(memo));
				count += check(i, 1);
			}

			cout << count << endl;
		}
	}

	return 0;
}


int  check(int x, int y){

//	cout << "x:" << x << "y:" << y << " : "<< status[x][y] << endl;

	//関数のメモが残っているならメモを返す
	if(memo[x][y] > 0){return memo[x][y];}

	//status[x][y]の次でゴール
	if(status[x][y] == 1){return 0;}
	if(status[x][y] == 0 && y == Y){return 1;}
	if(status[x][y] == 2 && (y == Y-1 || y == Y)){return 1;}

	//それ以外
	else{
		//ジャンプ台
		if(status[x][y] == 2){
			memo[x][y] += check(x, y+2);
		}
		//平地
		else{
			if(status[x-1][y+1] == 0){
				memo[x][y] += check(x-1, y+1);
			}
			if(status[x][y+1] == 0 || status[x][y+1] == 2){
				memo[x][y] += check(x, y+1);
			}
			if(status[x+1][y+1] == 0){
				memo[x][y] += check(x+1, y+1);
			}
		}

		return memo[x][y];
	}
}

Measured memory_bytes: 1160
K = int(input())
l = [1,2,3,4,5,6,7,8,9]
#while K>0:
#    if len(l) > K:
#        print(l[K-1])
#        break
#    else:
#        K -= len(l)
#        newl = []
#        for i in l:
#            if i%10 == 0:
#                newl.append(10*i)
#                newl.append(10*i + 1)
#                newl.append(10*i + 8)
#                newl.append(10*i + 9)
#            else:
#                newl.append(10*i + i%10 - 1)
#                newl.append(10*i + i%10 )
#                newl.append(10*i + i%10 + 1)
#        l = newl
for i in range(K):
    a = l[i]
    b = a%10
    for j in [b-1, b, b+1]:
        if j<0 or j>9:
            continue
        else:
            l.append(10*a + j)
print(l[K-1])


Measured memory_bytes: 16276
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    ll ans=0;
    int t = 1;
    REP(i,n){
        t=t<<1;
    }
    vvint sw(m,vint(n,0));
    vint p(m,0);
    REP(i,m){
        int k;
        cin >> k;
        REP(j,k){
            int s;
            cin >> s;
            s--;
            sw[i][s]=1;
        }
    }
    REP(i,m){
        cin >> p[i];
    }
    vint bits(10);
    REP(i,t){
        int tmp=i;
        REP(j,10){
            bits[j]=(int)(tmp&1);
            tmp>>=1;
        }
        bool f = true;
        REP(j,m){
            int x=0;
            REP(k,n){
                x+=bits[k]*sw[j][k];
            }
            if(x%2==p[j]){
                
            }else{
                f=false;
                break;
            }
        }
        if(f){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
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 max = 0;
        int min = Integer.MAX_VALUE;
        
        for(int i = 0; i < N; i++){
            int A = sc.nextInt();
            max = Math.max(max, A);
            min = Math.min(min, A);
        }
        
        System.out.println( max - min );
        
    }
}


Measured memory_bytes: 23632
N, M, X = map(int, input().split())

A = list(map(int, input().split()))

big_A = list(filter(lambda x: x > X, A))#xより大きい成分だけ取り出す
len_min_A = len(A) - len(big_A)

if len(big_A) < len_min_A:
    print(len(big_A))
else:
    print(len_min_A)



Measured memory_bytes: 2940
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        //値を取得
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int N = sc.nextInt();
        int[] A = new int[N];   //必殺技
        for (int i = 0; i < N; ++i){
            A[i] = sc.nextInt();
        }
        
        int HP = H;  //残り体力
        
        for (int i = 0; i < N; ++i){
            HP -= A[i];
            
            if(HP <= 0){
                System.out.println("Yes");
                System.exit(0);
            }
        }

        System.out.println("No");
    }
    
}

Measured memory_bytes: 59420
n,k=map(int,input().split())
a = list(map(int,input().split()))
f = list(map(int,input().split()))

a.sort()
f.sort(reverse=True)

r = max(a)* max(f)
l = -1

while r-l >1:
    c = (r+l) //2
    ans=0
    for j in range(n):
        ans += max(a[j]- c // f[j] , 0)
    if ans <= k:
        r = c
    else:
        l = c

print(r)




Measured memory_bytes: 119500
/*
          , -- 、
        /;;;;;;', 　　　
        i二二二i
      , ' 　    ヽ ???
     i　ﾉﾉﾉﾉﾉﾍ .', 　　
     〉ﾘi' ﾟ ヮﾟﾉﾚく　 WAyon..........
  ○⊂}〈lﾄ--ｲl〉{つ● 　　
      ,ｒ/ー i-ヽヽ 　　　
     ｀｀i_ﾗi_ﾗ
*/

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
const int INF=(int)1e12;
const int mod=(int)1e9+7;
#define all(a) (a).begin(),(a).end()
typedef vector<vector<int>> graph;

#define pb push_back

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

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



signed main () {
    string s,t;cin >>s>>t;
    int n=0;
    rep(i,s.size()){
        if(s[i]!=t[i])n++;
    }
    cout <<n<<endl;
}




Measured memory_bytes: 3916
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fo for(int i=0;i<n;i++)
#define clear cin.clear();cin.ignore(numeric_limits<streamsize>::max(), '\n');
#define loopSolve int t; cin>>t; while(t--){solve();}
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

//INT_MAX         2,147,483,647                       <10^10
//U_INT_MAX       4,294,967,295                       <10^10
//LONG_LONG_MAX   9,223,372,036,854,775,807           <10^18
//U_LONG_LONG_MAX 18,446,744,073,709,551,615          <10^18
//ll power(int a, int b){
//    return (ll)(pow(a,b)+0.5);
//}

vector<int> gV(int n){
    vector<int> v(n);
    fo { cin>>v[i];  }
    return v;
}

int* gA(int n){
    int* arr = new int[n];
    fo cin>>arr[i];
    return arr;
}

void solve(){
    int n,k;cin>>n>>k;
    ll* score = new ll[n];
    fo{
        cin>>score[i];
    }

    bool* dp = new bool[n-k];
    for(int i=0;i<n-k;i++)
        dp[i]=1;

    for(int i=k;i<n;i++){
        if(score[i]<=score[i-k]){
            dp[i-k]=false;
        }
    }

    for(int i=0;i<n-k;i++){
        cout<<(dp[i]?"Yes":"No")<<endl;
    }

}


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

    solve();
    //loopSolve;

	return 0;
}


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

int main()
{
  string S;
  int Q;
  cin >> S >> Q;
  bool reversed = false;
  for (int i = 0; i < Q; i++) {
    int t;
    cin >> t;
    if (t == 1) {
      // reverse(S.begin(), S.end());
      reversed = !reversed;
    } else {
      int f;
      string p;
      cin >> f >> p;
      if (reversed) {
        if (f == 1)
        {
          S.append(p);
        }
        else
        {
          S.insert(0, p);
        }
      } else {
        if (f == 1)
        {
          S.insert(0, p);
        }
        else
        {
          S.append(p);
        }
      }
    }
  }
  if (reversed) {
    reverse(S.begin(), S.end());
  }
  cout << S << endl;
}

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

int main() {
    int h, w;
    long long int m = 1e9 + 7;
    cin >> h >> w;
    vector<vector<char>> g(h, vector<char>(w));
    vector<vector<int>> mem(h, vector<int>(w, 0));
    for(int i = 0; i < h; i++) {
        for(int j = 0; j < w; j++) {
            cin >> g[i][j];
        }
    }
    for(int i = 0; i < h; i++) {
        if(g[i][0] == '.') {
            mem[i][0] = 1;
        }else {
            break;
        }
    }
    for(int j = 1; j < w; j++) {
        if(g[0][j] == '.') {
            mem[0][j] = 1;
        }else{
            break;
        }
    }

    for(int i = 1; i < h; i++) {
        for(int j = 1; j < w; j++) {
            if(g[i][j] == '.') {
                mem[i][j] = (mem[i-1][j]%m + mem[i][j-1]%m) % m;
            }
            else {
                mem[i][j] = 0;
            }
        }
    }

    // for(int i = 0; i < h; i++) {
    //     for(int j = 0; j < w; j++) {
    //         cout <<mem[i][j] <<" ";
    //     }
    //     cout <<endl;
    // }

    cout <<mem[h-1][w-1];
    return 0;
}

Measured memory_bytes: 8436
#include <iostream>
#include <set>
#include <algorithm>
using namespace std;

int main(){
    long long i,n,a,b[200010],ans=0;
    set<long long> s;
    cin >> n;
    for(i=1;i<=n;i++){
        cin >> a;
        b[a] = i;
    }
    s.insert(0);
    s.insert(n+1);
    for(i=1;i<=n;i++){
        auto x = s.upper_bound(b[i]);
        auto y = x--;
        ans += i*(*x-b[i])*(b[i]-*(y));
        s.insert(b[i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 11136
#include<cstdio>
using namespace std;
int main(){
  int flag=0,x;
  char s[5];
  scanf("%s",s);
  for(int i=0;i<3;i++){
    if(s[i]==s[i+1]){
      flag=1;
    }
  }
  if(flag){
    printf("Bad\n");
  }
  else{
    printf("Good\n");
  }
}


Measured memory_bytes: 128
/*
    AUTHOR:hruday pabbisetty
    NIT ROURKElA
    MALDGPXXQL6F9LR
*/
#include <bits/stdc++.h>
#include <tr1/unordered_map>
using namespace std;
#define opt ios_base::sync_with_stdio(0)
#define lli long long int
#define ulli unsigned long long int
#define I int
#define S string
#define D double
#define rep(i,a,b) for(i=a;i<b;i++)
#define repr(i,a,b) for(i=a;i>b;i--)
#define in(n) scanf("%lld",&n)
#define in2(a,b) scanf("%lld %lld",&a,&b)
#define in3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define out(n) printf("%lld\n",n)
#define inu(a) scanf("%lld",&a)
#define outu(a) printf("%llu",a)
#define ins(s) scanf("%s",&s)
#define outs(s) printf("%s",s)
#define nl printf("\n")
#define mod 1000000007
#define inf 100000000000000
typedef long long       ll;
typedef pair<lli,lli>  plli;
typedef vector<lli>     vlli;
typedef vector<ulli>    vulli;
typedef vector<ll>      vll;
typedef vector<string>  vs;
typedef vector<plli>     vplli;
#define MM(a,x)  memset(a,x,sizeof(a));
#define ALL(x)   (x).begin(), (x).end()
#define P(x)       cerr<<"{"#x<<" = "<<(x)<<"}"<<endl;
#define P2(x,y)       cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<"}"<<endl;
#define P3(x,y,z)  cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<", "#z" = "<<(z)<<"}"<<endl;
#define P4(x,y,z,w)cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<", "#z" = "<<(z)<<", "#w" = "<<(w)<<"}"<<endl;
#define PP(x,i)     cerr<<"{"#x"["<<i<<"] = "<<x[i]<<"}"<<endl;
#define TM(a,b)     cerr<<"{"#a" -> "#b": "<<1000*(b-a)/CLOCKS_PER_SEC<<"ms}\n";
#define UN(v)    sort(ALL(v)), v.resize(unique(ALL(v))-v.begin())
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define sz() size()
//#define nl cout<<"\n"
#define MX1 100005
#define MX2 1000005
#define sqr(a) a*a*a
#define bs binary_search
#define lb lower_bound
#define ub upper_bound

lli power(lli a,lli b)
    {
    lli value;
    if(b==0)
        {
        return 1;
    }
    else if(b%2==0)
        {
        value=power(a,b/2)%mod;
        return(value*value)%mod;
    }
    else
        {
        value=power(a,b/2)%mod;
        return ((a*value)%mod*(value))%mod;
    }
}
int main()
{
      /*  #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        #endif*/
    opt;
    lli n,m,k;
    cin>>n>>m>>k;
    lli flag=0;
    lli i,j;
    rep(i,0,1+n)
    {
        rep(j,0,1+m)
        {
            if(m*i+n*j-2*i*j==k)
            {
                flag=1;
                break;
            }
        }
    }
    if(flag)
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
}



Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k,q;
    cin >> n >> k >> q;
    vint ans(n,0);
    REP(i,q){
        int a;
        cin >> a;
        a--;
        ans[a]++;
    }
    REP(i,n){
        if(q-ans[i]>=k){
            cout << "No\n";
        }else{
            cout << "Yes\n";
        }
    }

    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

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

        int N = sc.nextInt();
        int[] a = new int[N];
        int[] b = new int[N];
        int[] c = new int[N];
        for(int i=0; i<N; i++) {
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
            c[i] = sc.nextInt();
        }

        int[][] dp = new int[3][N];
        dp[0][0] = a[0];
        dp[1][0] = b[0];
        dp[2][0] = c[0];

        for(int i=1; i<N; i++) {
            dp[0][i] = Math.max(dp[1][i-1]+a[i], dp[2][i-1]+a[i]);
            dp[1][i] = Math.max(dp[2][i-1]+b[i], dp[0][i-1]+b[i]);
            dp[2][i] = Math.max(dp[0][i-1]+c[i], dp[1][i-1]+c[i]);
        }


        System.out.println(Math.max(Math.max(dp[0][N-1], dp[1][N-1]), dp[2][N-1]));
    }
}

Measured memory_bytes: 94188
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#include <cstring>

#define ll long long
#define scani(x) scanf("%i", &x)
#define scanll(x) scanf("%I64d", &x)
#define scanfl(x) scanf("%f", &x)
#define scanch(x) scanf("%c", &x)
#define scans(x) scanf("%s", x);
#define printi(x) printf("%i", x);
#define printll(x) printf("%I64d", x);
#define printfl(x) printf("%f", x);
#define printch(x) printf("%c", x);
#define prints(x) printf("%s", x);
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define INFI (1 << 29)
#define INFL (1LL << 62)
#define sz(x) int(x.size())
#define fi first
#define se second
#define forn(i, n) for(ll i = 0; i < n; i++)
#define for1(i, n) for(ll i = 1; i <= n; i++)
#define ford(i, n) for(ll i = (n - 1); i >= 0; i--)
#define fori(i, n) for(ll i = n; i >= 1; i--)
#define fore(i, l, r) for(ll i = l; i <= r; i++)

using namespace std;

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

    ll a, b;

    cin >> a >> b;

    if(a < b)
    {
        cout << 0 << endl;
    }
    else
        cout << 10 << endl;

    return 0;
}


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

using namespace std;
typedef long long LL;
static long long INF = (1LL<<62);
const LL P = 1000000007LL;

LL dp[100002] = {0};
int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	LL N; cin >> N;
	vector<LL> A;
	map<LL, vector<int>> M;
	for(int i=0; i<N; i++){
		LL a; cin >> a;
		A.push_back(a);
		M[a].push_back(i);
		if(M[a].size() > 3){
			printf("0\n"); return 0;
		}
	}

	if(A[0] != 0){
		printf("0\n"); return 0;
	}

	if(N == 1){
		printf("3\n"); return 0;
	}
	if(N == 2){
		if(A[1] == 0){
			printf("6\n");
		}
		else if(A[1] == 1){
			printf("3\n");
		}
		return 0;
	}

	// N>=3
	if(A[0] == 0 && A[1] == 0 && A[2] == 0) dp[2] = 6;
	if(A[0] == 0 && A[1] == 0 && A[2] == 1) dp[2] = 12;
	if(A[0] == 0 && A[1] == 0 && A[2] == 2) dp[2] = 0;
	if(A[0] == 0 && A[1] == 1 && A[2] == 0) dp[2] = 6;
	if(A[0] == 0 && A[1] == 1 && A[2] == 1) dp[2] = 0;
	if(A[0] == 0 && A[1] == 1 && A[2] == 2) dp[2] = 3;

	if(N == 3){
		printf("%lld\n", dp[2]); return 0;
	}

	for(int i=3; i<N; i++){
		if(A[i] == 0){
			if(A[i-1] == i-1){
				dp[i] = 2*dp[i-1];
				dp[i] %= P;
			}
			else{
				dp[i] = dp[i-1];
				dp[i] %= P;
			}
		}
		else{
			if(M.count(A[i]-1) == 0){
				printf("0\n"); return 0;
			}
			int s = 0, t = 0;
			for(int j=0; j<M[A[i]-1].size(); j++){
				if(M[A[i]-1][j] < i) s++;
			}
			for(int j=0; j<M[A[i]].size(); j++){
				if(M[A[i]][j] < i) t++;
			}
			if(s - t <= 0 || s > 3 || t > 2){
				printf("0\n"); return 0;
			}
			dp[i] = (s-t)*dp[i-1];
			dp[i] %= P;
		}
		dp[i] %= P;
		if(dp[i] < 0) dp[i] += P;
	}
	printf("%lld\n", dp[N-1]);
	return 0;
}


Measured memory_bytes: 15812
#include<stdio.h>

int main(){
	char s[26]={'a' , 'b' , 'c' , 'd' , 'e' , 'f' , 'g' , 'h' , 'i' , 'j' , 'k' , 'l' , 'm' , 'n' , 'o' , 'p' , 'q' , 'r' , 's' , 't' , 'u' , 'v' , 'w' , 'x' , 'y' , 'z'};
	char l[26]={'A' , 'B' , 'C' , 'D' , 'E' , 'F' , 'G' , 'H' , 'I' , 'J' , 'K' , 'L' , 'M' , 'N' , 'O' , 'P' , 'Q' , 'R' , 'S' , 'T' , 'U' , 'V' , 'W' , 'X' , 'Y' , 'Z'};
	char str[1000];
	int c,i,j;
	
	for(c=0;;c++){
		scanf("%c",&str[c]);
		if(str[c]=='\n')break;
	}
	
	for(i=0;i<c;i++){
		for(j=0;j<26;j++){
			if(str[i]==s[j]){
				str[i]=l[j];
			}
		}
		printf("%c",str[i]);
	}
	
	printf("\n");
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
char* F(char *b,int n,FILE *f){char *r=fgets(b,n,f);if(!r)return NULL;b[strlen(b)-1]=0;return r;}
char Q[29999],*q[9],L[29999];
n;D(old_indent,depth){
	int indent=0;
	if(!F(L,sizeof(L),stdin))puts("no such property"),exit(0);
	for(;L[indent]==' ';indent++);
	if(old_indent>=indent)puts("no such property"),exit(0);
	char *name=strtok(L+indent,":"),*value=name+strlen(name)+1;
	if(!strcmp(name,q[depth])){
		if(depth==n-1)
			if(*value)printf("string \"%s\"\n",value+1),exit(0);
			else puts("object"),exit(0);
		D(indent,depth+1);
	}
	D(old_indent,depth);
}
main(){F(Q,sizeof(Q),stdin);q[0]=strtok(Q+1,".");for(n=1;;n++)if(!(q[n]=strtok(NULL,".")))break;D(-1,0);}

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

#define x first
#define y second
#define y1 Y1
#define y2 Y2
#define mp make_pair
#define pb push_back

using namespace std;

typedef long long LL;
typedef pair<int, int> pii;

template <typename T> inline int Chkmax (T &a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> inline int Chkmin (T &a, T b) { return a > b ? a = b, 1 : 0; }

inline void proc_status()
{
	ifstream t ("/proc/self/status");
	cerr << string (istreambuf_iterator <char> (t), istreambuf_iterator <char> ()) <<endl;
}

inline int read ()
{
	int sum = 0, fl = 1; char ch = getchar();
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') fl = -1;
	for (; isdigit(ch); ch = getchar()) sum = (sum << 3) + (sum << 1) + ch - '0';
	return sum * fl;
}

const int Maxn =  3e6 + 100;

int N, A[Maxn];

inline int check (int x, int k) { return A[x] > k; }

inline int Check (int x)
{
	for (int i = 0; i < N - 1; ++i)
	{
		if ((!check(N - i, x) && !check(N - i - 1, x)) || (!check(N + i, x) && !check(N + i + 1, x))) return 0;
		if ((check(N - i, x) && check(N - i - 1, x)) || (check(N + i, x) && check(N + i + 1, x))) return 1;
	}
	return A[1] > x;
}

inline void Solve ()
{
	int l = 1, r = 2 * N - 1, ans = 0;
	while (l <= r)
	{
		int mid = l + r >> 1;
		if (Check(mid)) l = mid + 1, ans = mid;
		else r = mid - 1;
	}
	cout<<ans + 1<<endl;
}

inline void Input ()
{
	N = read();
	for (int i = 1; i <= 2 * N - 1; ++i) A[i] = read();
}

int main()
{
	Input();
	Solve();
	return 0;
}


Measured memory_bytes: 1024