akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<vector<ll>> Matrix;

const char wall = '#';
vector<vector<char>> fields;
vector<vector<bool>> used;
vector<vector<ll>> dist;
const int dx[4] = {0, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0};

vector<ll> A;
// vectorのリサイズ
// A.resize(N);

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a*b/gcd(a, b);}

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

  ll n;
  cin >> n;
  vector<ll> a(n);
  //vector<ll> total(n+1, 0);
  rep(i, n) {
    cin >> a[i];
    //total[i+1] = total[i] + a[i];
  }
  //vector<ll> hoge = total;
  ll sum = 0;
  ll ans = 0;
  rep(i, n) {
    sum += a[i];
    if (i % 2 == 0 && sum <= 0) {
      sum -= a[i];
      ll tmp = 1-sum;
      ans += abs(tmp-a[i]);
      //cout << i << ": " << a[i] << ", " << tmp << ", " << ans << endl;
      sum += tmp;
    } else if (i % 2 == 1 && sum >= 0) {
      sum -= a[i];
      ll tmp = -1-sum;
      ans += abs(tmp-a[i]);
      //cout << i << ": " << a[i] << ", " << tmp << ", " << ans << endl;
      sum += tmp;
    }
  }
  ll ans2 = 0;
  sum = 0;
  rep(i, n) {
    sum += a[i];
    if (i % 2 == 0 && sum >= 0) {
      sum -= a[i];
      ll tmp = -1-sum;
      ans2 += abs(tmp-a[i]);
      sum += tmp;
    } else if (i % 2 == 1 && sum <= 0) {
      sum -= a[i];
      ll tmp = 1-sum;
      ans2 += abs(tmp-a[i]);
      sum += tmp;
    }
  }
  cout << min(ans, ans2) << endl;
  return 0;
}


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

int main()
{
    int a,b,c,d;
    int i,j,k;
    int x,y,z;
    char A,B,C;
    int h;

    while(scanf("%1d%1d%1d%1d",&a,&b,&c,&d)!=EOF)
    {
        getchar();

        for(h=0,i=0;i<2;++i)
        {
            if(i==0)
            {
                x=a+b;
                A='+';
            }
            else
            {
                x=a-b;
                A='-';
            }
            for(j=0;j<2;++j)
            {
                if(j==0)
                {
                    y=x+c;
                    B='+';
                }
                else
                {
                    y=x-c;
                    B='-';
                }
                for(k=0;k<2;++k)
                {
                    if(k==0)
                    {
                        z=y+d;
                        C='+';
                    }
                    else
                    {
                        z=y-d;
                        C='-';
                    }
                    if(z==7)
                    {
                        printf("%d%c%d%c%d%c%d=7\n",a,A,b,B,c,C,d);
                        h=1;break;
                    }
                }
                if(h==1) break;
            }
            if(h==1) break;
        }
    }
}


Measured memory_bytes: 128
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_M = 50;
const int MAX_K = 300;
const int INF = 1 << 30;

/* typedef */

typedef vector<int> vi;

/* global variables */

int n, m;
vi nbrs[MAX_M];
int cache[MAX_M][MAX_M][MAX_K];

/* subroutines */

int rec(int k, int a, int b) {
  if (k >= MAX_K) return INF;
  if (a == b) return (cache[a][b][k] = k);
  if (cache[a][b][k] >= 0) return cache[a][b][k];

  int ans;
  
  // Aaron
  if (! (k & 1)) {
    ans = 0;
    vi& nbra = nbrs[a];
    for (vi::iterator vit = nbra.begin(); vit != nbra.end(); vit++) {
      int c = rec(k + 1, *vit, b);
      if (ans < c) ans = c;
    }
  }
  // Bruce
  else {
    ans = INF;
    vi& nbrb = nbrs[b];
    for (vi::iterator vit = nbrb.begin(); vit != nbrb.end(); vit++) {
      int c = rec(k + 1, a, *vit);
      if (ans > c) ans = c;
    }
  }

  return (cache[a][b][k] = ans);
}

/* main */

int main() {
  cin >> n;
  while (n--) {
    cin >> m;

    for (int i = 0; i < m; i++) {
      nbrs[i].clear();
      for (int j = 0; j < m; j++) {
	int on;
	cin >> on;
	if (on || i == j) nbrs[i].push_back(j);
      }
    }

    int ai, bi;
    cin >> ai >> bi;
    
    memset(cache, -1, sizeof(cache));

    int ans = rec(0, ai, bi);
    if (ans >= INF) cout << "infinity" << endl;
    else cout << (ans / 2) << endl;
  }

  return 0;
}

Measured memory_bytes: 4188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	int N;
	cin >> N;
	vector<ll> cnt(100001);
	ll sum = 0;
	for (int i = 0; i < N; ++ i) {
		int x;
		cin >> x;
		++ cnt[x];
		sum += x;
	}
	int Q;
	cin >> Q;
	for (int i = 0; i < Q; ++ i) {
		int bi, ci;
		cin >> bi >> ci;
		sum += cnt[bi] * (ci-bi);
		cnt[ci] += cnt[bi];
		cnt[bi] = 0;
		cout << sum << endl;
	}
}


Measured memory_bytes: 4044
#include <iostream>

using namespace std;

int main() {
  int N;
  cin >> N;
  int fX = [](int i) {
    int ret{};
    while (i) {
      ret += i % 10;
      i /= 10;
    }
    return ret;
  }(N);

  cout << (N % fX ? "No" : "Yes") << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
long long n,m,h;
int main()
{
    cin>>n>>m;
    h=min(n,m/2);
    m=m-n*2;n=0;
    m=max(m,n);
    cout<<h+m/4<<endl;
    return 0;
} 


Measured memory_bytes: 256
use std::io;
use std::cmp;


fn main() {
    let (n, k) = {
        let i = read::<usize>();
        (i[0], i[1])
    };
    let vn = read::<isize>();
    let mut ans: isize = 0;
    let time = cmp::min(n, k) + 1;
    for l in 1..time { for r in 0..(time - l) {
        let mut score = vn[0..l].iter().sum::<isize>() + vn[(n - r)..n].iter().sum::<isize>();
        let mut arr = Vec::from(&vn[0..l]);
        arr.extend_from_slice(&vn[(n - r)..n]);
        arr.sort();
        let dis = k - l - r;
        for i in 0..cmp::min(dis, arr.len()) {
            if arr[i] < 0 { score -= arr[i]; }
        }
        ans = cmp::max(ans, score);
    }}
    println!("{}", ans);
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 4352
# -*- coding: utf-8 -*-
"""
Created on Tue May 14 10:45:22 2019

@author: avina
"""

N = int(input())
L = list(map(int, input().strip().split()))
dp = [[0,0] for i in range(N+1)]
dp[0][1] = -1e7
for i in range(N):
    dp[i+1][0] = max(dp[i][0] + L[i], dp[i][1] - L[i])
    dp[i+1][1] = max(dp[i][1] + L[i], dp[i][0] - L[i])

print(dp[N][0])

Measured memory_bytes: 25576
#include<bits/stdc++.h>
#define ll long long
using namespace std;
void qmax(int &x,int y) {if (x<y) x=y;}
void qmin(int &x,int y) {if (x>y) x=y;}
inline int read()
{
	char s;
	int k=0,base=1;
	while((s=getchar())!='-'&&s!=EOF&&!(isdigit(s)));
	if(s==EOF)exit(0);
	if(s=='-')base=-1,s=getchar();
	while(isdigit(s)){k=k*10+(s^'0');s=getchar();}
	return k*base;
}
inline void write(int x)
{
	static char cnt,num[15];cnt=0;
	if (!x)
	{
		putchar('0');
		return;
	}
	for (;x;x/=10) num[++cnt]=x%10;
	for (;cnt;putchar(num[cnt--]+48));
}
int n,m;
long long s;
int main()
{
#ifdef ylx
	freopen("arc91a.in","r",stdin);
	freopen("arc91a.out","w",stdout);
#endif
	n=read();m=read();
	if (m<=n) swap(n,m);
	if (n==1&&m==1)
	{
		printf("1");
		return 0;
	}
	if (n==1)
	{
		s=m-2;
		printf("%d",s);
		return 0;
	}

	if (n>=2)
	{
		s=(ll)(n-2)*(m-2);
	}
	cout<<s;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;

    vector<long long>A(N);
    for(int i=0;i<N;++i)cin>>A[i];

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

    for(int i=1;i<=N;++i){
       if(A[i]==A[i-1]){
       cout<<"NO"<<endl;
       return 0;
       }
    }
    cout<<"YES"<<endl;
}

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

#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) s >> x;
  return s;
}
inline void Yes(bool f=true){cout<<(f?"Yes":"No")<<endl;}
inline void YES(bool f=true){cout<<(f?"YES":"NO")<<endl;}

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);

    int N, K;
    cin >> N >> K;
    
    cout << (N%K==0?0:1) << endl;
}


Measured memory_bytes: 256
a, b, c = list(map(int,input().split()))
be_c =[]
ans = 0
for i in range(b):
    be_c.append(i*a)
for i in range(b):
    if be_c[i] != 0:
        if be_c[i] % b == c:
            print('YES')
            ans = 1
            break
        else:
            pass
    else:
        pass
if ans == 0:
    print('NO')

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

typedef long long ll;

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

    int n,ans=0;
    cin >> n;
    vector<int> a(n),b(n),c(n-1);
    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];
    ans += b[a[0]-1];
    for(int i=1;i<n;i++){
        ans += b[a[i]-1];
        if(a[i-1]+1==a[i]) ans += c[a[i-1]-1];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int main()
{
    ft
    int i,j,n,s;
    double x,l,r,t,a,m,mn=2e17;
    cin>>n>>t>>a;
    for(i=0;i<n;i++)
    {
        cin>>x;
        m=t-x*.006;
        m=abs(a-m);
        if(m<mn)
        {
            mn=m;
            s=i+1;
        }
    }
    cout<<s<<"\n";
    return 0;
}

Measured memory_bytes: 256
/* --- <O(nlgn),O(1)> --- */

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

#define fi first
#define se second

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

const int MAXN = 100005;
const int LOGN = 20;

int H[MAXN];        // index of node i in dfs path
ii path[MAXN<<1];
vi adjList[MAXN];

ii ST[LOGN][MAXN<<1];

void build(int n) {
    int h = ceil(log2(n+1));

    for (int i = 0; i < n; i++) ST[0][i] = path[i];
    for (int i = 1; i < h; i++)
        for (int j = 0; j + (1<<i) <= n; j++)
        ST[i][j] = min(ST[i-1][j], ST[i-1][j+(1<<(i-1))]);
}

int RMQ(int l, int r) {     // range [l,r)
    int p = 31 - __builtin_clz(r-l);
    return min(ST[p][l],ST[p][r-(1<<p)]).se;
}

int cnt = 0;
void dfs(int node = 0, int depth = 0){
    H[node] = cnt;

    path[cnt++] = ii(depth,node);
    for (int i = 0; i < adjList[node].size(); i++) {
        dfs(adjList[node][i],depth+1);

        path[cnt++] = ii(depth,node);
    }
}

int N, Q;

int main(){

    scanf("%d",&N);
    for (int u = 0, M; u < N; u++) {
        scanf("%d",&M);
        for (int i = 0, v; i < M; i++) {
            scanf("%d",&v);
            
            adjList[u].push_back(v);
        }
    }

    // rooted at 0
    dfs();
    build(cnt);

    scanf("%d",&Q);
    for (int i = 0, u, v, l, r; i < Q; i++){
        scanf("%d%d",&u,&v);

        l = H[u], r = H[v]; if (l > r) swap(l,r);

        printf("%d\n",RMQ(l,r+1));
    }

    return 0;
}

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

struct S{
  int d,p;
};
bool operator<(S a,S b){
  return a.p<b.p;
}
int n,m;
vector<S> dp;

void init(){
  dp.clear();
}

bool input(){
  cin>>n>>m;
  if(n==0&&m==0)return false;
  for(int i=0;i<n;i++){
    int a,b;
    cin>>a>>b;
    dp.push_back((S){a,b});
  }
  return true;
}

int solve(){
  sort(dp.rbegin(),dp.rend());
  int ans = 0;
  for(auto i:dp){
    if(m<i.d){
      ans += (i.d - m) * i.p;
      m = 0;
    }else{
      m -= i.d;
    }
  }
  return ans;
}

int main(){
  while(init(),input()){
    cout<<solve()<<endl;
  }
}

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

using namespace std;

string s, t;

int main(void)
{
	cin >> s >> t;
	string ss = s + s;
	for(int i = 0; i < s.size(); i++){
		if(ss.substr(i, s.size()) == t){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

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

using namespace std;

#define pb push_back
#define endl '\n'
#define all(x) (x).begin(),(x).end()
#define ff first
#define ss second
#define sz(x) (int)(x).size()
#define f(n) for(int i=0;i<n;++i)
#define f2(n) for(int j=0;j<n;++j)
#define f3(n) for(int k=0;k<n;++k)
#define F(i,x,n,y) for(i=x;i<n;i+=y)
#define FR(i,x,n,y) for(i=x;i>=n;i-=y)
#define fi(i) for(i=0;i<n;++i)
#define fa(x,y) for(auto x:y)

//Warsaw debug template
#define LOCAL
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
    enable_if<sizeof dud<c>(0) x 1,debug&>::type operator<<(c i){
sim > struct rge {c b,e;};
sim > rge<c> range(c i, c j) {return rge<c>{i,j};}
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug{
#ifdef LOCAL
~debug() {cerr<<endl; }
eni(!=) cerr<< boolalpha << i; ris;}
eni(==) ris <<range(begin(i),end(i)); }
sim, class b dor(pair<b,c> d){
ris<<"("<<d.first<<","<<d.second<<")";
}
sim dor(rge<c> d){
    *this << "[";
    for(auto it=d.b;it!=d.e;++it)
        *this <<"," +(it==d.b)<< *it;
    ris<<"]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) "["<<#__VA_ARGS__":"<<(__VA_ARGS__)<<"]"
//End of debug template        
    

typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long ll;


int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int d,g;
    cin>>d>>g;
    int c[110],p[110];
    f(d){
        cin>>p[i]>>c[i];
    }
    int mask;
    ll mn=1E18;
    F(mask,0,1<<d,1){
        ll res=0;
        ll cnt=0;
        f(d){
            if((1<<i)&mask){
                res+=(i+1)*100*p[i]+c[i];
                cnt+=p[i];
            }
        }
        if(res>=g){
            mn=min(cnt,mn);
            continue;
        }
        int j;
        FR(j,d-1,0,1){
            if((1<<j)&mask) continue;
            ll tmp=g-res;
            int x=tmp/((j+1)*100);
            x+=(tmp%((j+1)*100)==0?0:1);
            if(x>p[j]-1){
                res+=(p[j]-1)*100*(j+1);
                cnt+=p[j]-1;
                continue;
            }
            cnt+=x;
            mn=min(mn,cnt);
            break;
        }
    }
    cout<<mn<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>

using namespace std;

int main()
{
  double w,h,x,y;
  cin>>w>>h>>x>>y;
  double mx,my;
  mx=w/2.0;
  my=h/2.0;
  if(mx==x&&my==y)
  {
      printf("%lf ",w*h/2.0);
      printf("1\n");
  }
  else
    printf("%lf 0\n",w*h/2.0);
    return 0;
}


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

#define len(x)  (int((x).size()))
#define append push_back
#define pp make_pair
#define ff(a, b)    for (int a = 0; a < int(b); ++a)
#define kk(n)    ff(k, n)
#define xx(n)    ff(x, n)
#define yy(n)    ff(y, n)
#define ii(n)    ff(i, n)
#define fff(a, b, c) for (int a = int(b); a < int(c); ++a)
#define kkk(a, b) fff(k, a, b)
#define xxx(a, b) fff(x, a, b)
#define yyy(a, b) fff(y, a, b)
#define iii(a, b) fff(i, a, b)
#define bb begin()
#define ee end()
#define uu first
#define vv second
#define all(x)  (x).bb, (x).ee
#define ite(v)   decltype((v).bb)
#define fe(i, v) for(ite(v) i = (v).bb; i != (v).ee; ++i)
#define err(...)    { fprintf(stderr, __VA_ARGS__); fflush(stderr); }
#define zz(array, byte)   memset(array, byte, sizeof(array));

using LL = long long;
using DD = long double;
using pii = pair<int, int>;


const LL  INFLL  = 0x7f7f7f7f7f7f7f7fLL;
const int INFint = 0x7f7f7f7f;  //Works with memset(..).
   




int main() {
    ios_base::sync_with_stdio(false);     cin.tie(NULL);
    //cout << '\n';     //Avoid flushing with endl.
    cout.precision(16);


    int n;
    cin >> n;
    vector<LL> aa(n);
    ii (n)
        cin >> aa[i];

    LL rr = INFLL;
    for (int sign = -1; sign <= +1; sign += 2) {
        LL sum = 0;
        LL here = 0;
        ii (n) {
            sum += sign*aa[i];
            LL delta = 0;
            if ((i % 2) == 0) {
                if (sum <= 0) {
                    delta = 1 - sum;
                }
            } else {
                if (sum >= 0) {
                    delta = -(sum + 1);
                }
            }
            sum += delta;
            here += abs(delta);
        }

        rr = min(rr, here);
    }

    cout << rr << '\n';
    

    return 0;
}



Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;

// GNU C Compiler
//template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }


/*
--------------------------------------------

	type

--------------------------------------------
*/
using LL = long long;
using ULL = unsigned long long;
//using pair<T1, T2> = p12;

/*
--------------------------------------------

	container

--------------------------------------------
*/
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())

/*
--------------------------------------------

	repetition

--------------------------------------------
*/
#define REP(n) for(int i=0; i<n; i++)
#define REPj(n) for(int j=0; j<n; j++)
#define REPinit(a,n) for(int i=a; i<n; i++)
#define REPinitj(a,n) for(int j=a; j<n; j++)

//algorithm
//#define SORT(c) sort((c).begin(),(c).end())

/*
--------------------------------------------

	constant

--------------------------------------------
*/
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

/*

	Optimizer

*/
//#pragma GCC optimize("Ofast")


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

	ULL X;
	cin >> X;

	bool flag = false;

	if(X == 2) {
		cout << 2 << endl;
	}
	else {
		for (ULL i = X; i < 10000000000; i++)
		{
			flag = false;
			ULL limit = (ULL)sqrt((float)i) + 1;
			// cout << "debug -> " << i << endl;
			
			for (ULL j = 2; j <= limit; j++)
			{
				// cout << '\t' << (i % j) << endl;
				if((i % j) == 0) {
					flag = true;
					break;
				}
			}
			
			if(!flag){
				cout << i << endl;
				break;
			}		
		}
	}
	
	return 0;
}


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

const int maxn(1e5 + 5);

int n, a[maxn];
vector <int> son[maxn];

inline void Add(int u, int v) {
    son[u].push_back(v), son[v].push_back(u);
}

bool Dfs(int u, int ff) {
	for (auto v : son[u])
		if (v != ff && a[v] < a[u] && !Dfs(v, u)) return 1;
	return 0;
}

int main() {
    int i, u, v;
    scanf("%d", &n);
    for (i = 1; i <= n; ++i) scanf("%d", &a[i]);
    for (i = 1; i < n; ++i) scanf("%d%d", &u, &v), Add(u, v);
	for (i = 1; i <= n; ++i) if (Dfs(i, 0)) printf("%d ", i);
    return 0;
}

Measured memory_bytes: 2688
use proconio::{fastout, input};
use std::io::*;
use std::str::FromStr;

use std::cmp::{max, min};

fn main() {
    input! {
        n: usize,
        x: usize,
        t: usize,
    }
    println!("{}", (n / x + min(1, n % x)) * t);
}


Measured memory_bytes: 2084
// https://atcoder.jp/contests/abc049/tasks/arc065_a

function main(arg) {
  const S = arg.trim();
  
  const s = S.replace(/dreameraser|dreamerase|dreamer|dream|eraser|erase/g, '');
  if (s == '') {
    console.log('YES');
  } else {
    console.log('NO');
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 29712
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

h,w = inpl()
n = inp()
a = inpl()
q = deque(a)
tmp = q.popleft()
cnt = 1
res = [[0 for i in range(w)] for j in range(h)]
for y in range(h):
    for x in range(w):
        if y%2:
            x = w - x - 1
        if tmp == 0:
            tmp = q.popleft()
            cnt += 1
        res[y][x] = cnt
        tmp -= 1
for y in range(h):
    for x in range(w):
        print(res[y][x])

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

int main() {
  int s, a, b;
  cin >> s;
  a = s / 100;
  b = s % 100;
  if (0<a && a <=12 && 0<b && b <=12) cout << "AMBIGUOUS" << endl;
  else if (0<a && a <=12) cout << "MMYY" << endl;
  else if (0<b && b <=12) cout << "YYMM" << endl;
  else cout << "NA" << endl;
}


Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase

/*
cout<<fixed<<setprecision(20);
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=1000000007;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}

int main(void) {
	cin.tie(0);
	llint i,x,j,n,wa=0,ans=0;cin>>n;
	vector<llint>B(n);
	for(i=0;i<n;i++){cin>>x;B[i]=-x;}
	for(i=0;i<n;i++){cin>>x;B[i]+=x;wa+=B[i];}
	SO(B);
	if(wa>0){cout<<-1<<endl;return 0;}
	wa=0;
	for(i=0;i<n;i++){if(B[i]>0){wa+=B[i];ans++;}}
	//cerr<<wa<<endl;
	for(i=0;i<n;i++){
		if(wa<=0){break;}
		wa+=B[i];ans++;
		
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <array>
#include <cassert>
#include <optional>
#include <utility>
#include <vector>
#include <atcoder/all>

template <class InputIterator>
std::ostream& range_output(std::ostream& os_arg, InputIterator first_arg, InputIterator last_arg){ if(first_arg != last_arg){ do{ os_arg << *(first_arg++); if(first_arg == last_arg) break; os_arg << ' '; } while(true); }  return os_arg; }
template <class Tp> std::ostream& operator << (std::ostream& os_arg, const std::vector<Tp>& arr_arg){ return range_output(os_arg, arr_arg.cbegin(), arr_arg.cend()); }
template <class Tp, std::size_t Size> std::ostream& operator << (std::ostream& os_arg, const std::array<Tp, Size>& arr_arg){ return range_output(os_arg, arr_arg.cbegin(), arr_arg.cend()); }
template <class S, class T> std::ostream& operator << (std::ostream& os_arg, const std::pair<S, T>& pair_arg){ return os_arg << '(' << pair_arg.first << ", " << pair_arg.second << ')'; }

#ifndef ONLINE_JUDGE
    template <typename Head> void dump_out(Head head_arg){ std::cerr << head_arg << '\n'; }
    template <typename Head, typename... Tail>
    void dump_out(Head head_arg, Tail... tail_args){ std::cerr << head_arg << ", "; dump_out(tail_args...); }
    #define dump(...) do { std::cerr << "[in line " << __LINE__ << "] " << #__VA_ARGS__ << " : "; dump_out(__VA_ARGS__); } while(false)
#else
    #define dump(...) (void(0))
#endif

int max_i(int x, int y){
    return (x < y) ? y : x;
}
int id(void){ return 0; }

using st_t = atcoder::segtree<int, max_i, id>;


int main(void){
    std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); 
    std::cout << std::fixed << std::setprecision(16);

    int n, k; std::cin >> n >> k;
    std::vector<int> A(n); for(auto& itr : A) std::cin >> itr;
    st_t D(300010);
    const int M = 300001;
    for(int i = 0; i < n; ++i){
        int l = A[i] - k, r = A[i] + k + 1;
        if(l < 0) l = 0; if(r > M) r = M;
        const int v = D.prod(l, r) + 1;
        if(D.get(A[i]) < v) D.set(A[i], v);
    }
    const int res = D.all_prod();
    std::cout << res << '\n';

    return 0;
}

Measured memory_bytes: 9832
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <memory>
#include <initializer_list>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
typedef long long int ll;
using namespace std;

int main(){
	int n; cin >>n;
	vector<int> s(n);
	cinf(n,s);
	vector<int> v,u;
	int cnt10=0;
	int ans=0;
	for(int i=0;i<n;i++){
		ans+=s[i];
		if(s[i]%10==0){
			cnt10++;
			v.push_back(s[i]);
		}
		else u.push_back(s[i]);
	}
	if(cnt10==n){
		cout << 0 << endl;
	 	return 0;
	}
	if(ans%10!=0){
		cout << ans <<endl;
		return 0;
	}
	sort(u.begin(),u.end());
	ans-=u[0];
	cout << ans << endl;
}

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

n,Q=map(int,input().split())
b_num = 2**(n-1).bit_length()
mx = 10**9
segl=[mx]*2*b_num 

def update( k, x):
    k += b_num-1
    segl[k] = x
    while k+1:
        k = (k-1)//2
        segl[k] = min(segl[k*2+1],segl[k*2+2])
    
if __name__ == '__main__':
    xs = []
    for i in range(n):
        s,t,x=map(int,input().split())
        xs += [(s-x-0.4,True,x,i), (t-x-0.5,False,x,i)]
    for _ in range(Q):
        xs.append((int(input()),2))
    xs.sort(key=lambda x:x[0])
    for x in xs:
        if x[1]==2:
            print(segl[0] if segl[0]!= mx else -1)
            continue
        update(x[3], x[2] if x[1] else mx)


Measured memory_bytes: 120028
#include<iostream>
#include<math.h>
#include<numeric>
#include<cmath>
using namespace std;
#define int long long

int gcd(int x, int y)
{
    int r;

    if(x == 0 || y == 0)  // 引数チェック
    {
        fprintf(stderr, "引数エラーです。\n");
        return 0;
    }

    // ユーグリッドの互除法
    while((r = x % y) != 0) // yで割り切れるまでループ
    {
        x = y;
        y = r;
    }
    return y;
}

// 最大公約数を求める関数
int lcm(int x, int y)
{
    if(x == 0 || y == 0)  // 引数チェック
    {
        fprintf(stderr, "引数エラーです。\n");
        return 0;
    }

    return (x * y / gcd(x, y));
}
signed main()
{
  int n,m,l;
  bool x=true;
  cin >> n >> m;
  string s,t;
  cin>>s>>t;
  int a,b;
  a=n/gcd(n,m);
  b=m/gcd(n,m);
  for(int k=0;k<gcd(n,m);k++)
    if(s[a*k]!=t[b*k])
      x=false;

  if(x)
  cout << lcm(n,m)<<endl;
  else
  cout <<-1;
  //cout << a <<b<<endl;
  return 0;
}


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

namespace ABC066A
{
	class Program
	{
		static void Main(string[] args)
		{
			int a, b, c,s;
			string[] word = Console.ReadLine().Split(' ');
			a = int.Parse(word[0]);
			b = int.Parse(word[1]);
			c = int.Parse(word[2]);
            //最大値を求める
			int m = a;
			if (b > m) m = b;
			if (c > m) m = c;
			//最大値を除く金額の和
			s = a + b + c - m;


			Console.WriteLine(s);
			//Console.ReadKey();
		}
	}
}

Measured memory_bytes: 27428
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;

int main(){

  int L,A,B,C,D,day[2];

  cin >> L >> A >> B >> C >> D;
  day[0] = A/C;
  if(day[0]*C != A){
    day[0]++;
  }
  day[1] = B/D;
  if(day[1]*D != B){
    day[1]++;
  }
  sort(day,day+2);
  
  cout << L-day[1] << endl;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
struct UnionFind {
    vector<ll> par;
    UnionFind(ll n) :par(n, -1) { }
    void init(ll n) { par.assign(n, -1); }
    ll root(ll x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    bool connect(ll x, ll y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (x > y) swap(x, y);
        par[y] += par[x];
        par[x] = y;
        return true;
    }
};

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<vector<ll> > v(n);
    ll a, b;
    for(int i=1;i<n;i++){
    	cin >> a >> b;
    	a--;b--;
    	v[a].pb(b);
    	v[b].pb(a);
    }
    ll ans = 0;
    ll now = 0;
    UnionFind uf(n);
    for(int i=0;i<n;i++){
    	ll ma = -1;
    	now += (i+1);
    	for(auto& j: v[i]){
    		if(j < i){
    			//ma = max(ma, uf.root(j));
    			//uf.connect(j, i);
    			now -= (j+1);
    		}
    	}
        //now += i - ma;
        ans += now;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 17412
#include<bits/stdc++.h>
#define MOD 1e9+7
using namespace std;
#define  pp push_back
#define  po pop_back
#define  mp make_pair
#define clr(a) memset(a,0,sizeof(a))
#define neg(a) memset(a,-1,sizeof(a))
#define fas(a) memset(a,false,sizeof(a))
#define debug(x) cout<<#x<<": "<<x<<endl
#define debug1(x) cout<<#x<<": "<<x<<" "
#define rev(x) reverse(x.begin(), x.end())
#define int long long 
#define F first
#define S second
//int a[2000];
void printvector(std::vector<int> v){  for (int i = 0; i < v.size(); ++i){cout<<v[i]<<" ";}cout<<""<<endl;}
void printarray(int a[],int n){for (int i = 0; i < n; ++i){cout<<a[i]<<" ";}cout<<""<<endl;}
 
 

 

void  solve()
{
  int n;cin>>n;
  int a[n];
  for(int i=0;i<n;i++){cin>>a[i];a[i]--;};
  map<int,int> m;
  int next[n];
  for(int i=n-1;i>=0;i--)
  {
      if(m.find(a[i])!=m.end())
      {
        next[i]=m[a[i]];
      }
      else
      {
         next[i]=n;
      }
      m[a[i]]=i;
  }

  // printarray(a,n);
  // printarray(next,n); 

  int mod=MOD;
  int no[n];
  for(int i=n-1;i>=0;i--)
  {
      if(i==n-1)
      {
         no[i]=1;
      }
      else
      {
        no[i]=no[i+1];
        int x=next[i];
        if(x!=i+1&&x!=n)
        {
           no[i]+=no[x];no[i]%=mod;
        }
      }
  }
  
  // printarray(a,n);
  // printarray(no,n);

  cout<<no[0]<<endl;





}




 int32_t main() 
{

  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
    
   solve();

return 0;

}

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

def solve(A, B):
    X = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1]
    if(X.index(A)>X.index(B)):
        print("Alice")
    elif(X.index(A)<X.index(B)):
        print("Bob")
    else:
        print("Draw")
        
if __name__ == '__main__':
    A, B = map(int, input().split())

    solve(A, B)

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

int main(void)
{
    int A, B;
    cin >> A >> B;

    for (int i = 1; i <= 1250; i++)
    {
        if (int(i * 0.08) == A && int(i * 0.1) == B)
        {
            cout << i << endl;
            return 0;
        }
    }

    cout << -1;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, a[102] = {}, b = 0, c = 0;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i], b += a[i];
    b = round(1.0 * b / n);
    for (int i = 0; i < n; i++) c += (a[i] - b) * (a[i] - b);
    cout << c << '\n';
}


Measured memory_bytes: 256
def calc(N, s):
    abc = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    d = {abc[i]: i for i in range(len(abc))}
    t = [abc[(d[c] + N) % 26] for c in s]
    return ''.join(t)


N = int(input())
s = input()
print(calc(N, s))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define vb vector<bool>
#define pii pair<int,int>
#define mii map<int,int>
#define all(c)  c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define tr(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define inf (long long) 1e18
#define F first
#define S second
#define SZ(x) ((int)(x).size())
//#define rep(i,n)  for(int i=0;i<n;i++)
//#define repd(i,n) for(int i=n-1;i>=0;i--)
//#define rep1(i,n) for(int i=1;i<=n;i++)
const int N = 1e9 + 7;
 
int pow(int x, int y) { int res = 1; while (y > 0) { if (y & 1) res = ((res) * (x)); res %= N; y = y >> 1; x = ((x) * (x)); } return res; }
int powm(int x, int y, int p)  {  int res = 1; x = x % p; while (y > 0) {if (y & 1) res = (res * x) % p; y = y >> 1; x = (x * x) % p;}   return res; }
 
 int min2(int x,int y)
 {
     if(x<=y)
     return x;
     else 
     return y;
 }
 ll CD(long long n) 
{ 
    int count = 0; 
    while (n != 0) { 
        n = n / 10; 
        ++count; 
    } 
    return count; 
} 
void compute()
{
    // ll k;
    // cin>>k;
    // if(k%2==0)
    // {
    //     cout<<"-1";
    // }
    // else
    // {
    //     // char s[100];
    //     // cin>>s;

    //     int i=7;
    //     ll cd=CD(k);
    //     for(ll j=0;j<cd;j++)
    //     {
    //          i=i*10+7;

    //     }
        

    //     ll t=cd,ans,fnl,p=1;
    //     while(p)
    //     {
    //         if(i>=k)
    //         {
    //             ans=i%k;
    //             if(ans==0)
    //             {
    //                 fnl=t;
    //                 p=0;
    //                 break;

    //             }
                
    //         }
    //        // i=7;
    //         i=i*10+7;
    //         t++;
    //     }
    //     ll yar=CD(i);
    //     //  cout<<yar<<" "<<i;
    //     cout<<yar;
    // }
  int n;
  cin>>n;
    string s;
    cin>>s;
    int ans=0;
   // int k=s.size();
    int cntr=0,cntw=0;
    for(int i=0;i<n;i++)
    {
        if(s[i]=='R')
        cntr++;
        else
        {
            cntw++;
        }
        
    }
    for(int i=0;i<cntr;i++)
    {
        if(s[i]=='W')
        ans++;
    }
    cout<<ans;

 
} 
 
int main()
{
#ifdef debug
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("log.txt", "w", stderr);
#endif
 //   int t;
   // scanf("%d", &t);
    //while (t--)
    //{
        compute();
   // } //end while
#ifdef debug
    fprintf(stdout, "\nTIME: %.3lf sec\n", (double)clock() / (CLOCKS_PER_SEC));
#endif
    return 0;
} //end main*

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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define REPRl(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < (int)n; i++)
#define FORl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define ALL(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}


int main() {
  int n;cin>>n;
  vector<int> w(n);
  int wt=0;
  REP(i,n) {
    int wi;cin>>wi;
    wt+=wi;
    w[i]=wi;
  }
  int s1=0;
  int ans;
  REP(i,n) {
    s1+=w[i];
    if(s1*2>wt){
      int s2=wt-s1;
      int s1b=s1-w[i];
      int s2b=s2+w[i];
      ans=min(s1-s2,s2b-s1b);
      break;
    }
  }
  cout << ans << endl;
}


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
using P = pair<int, int>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, -1, 0, 1};
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}
struct edge {
  ll to, cost;
};

int main() {
  int D; cin >> D;
  vector<int> c(26); REP(i, 26) cin >> c[i];
  vector<vector<int>> s(D, vector<int>(26));
  REP(i, D) {
    REP(k, 26) {
      cin >> s[i][k];
    }
  }
  REP(i, D) {
    cout << (i % 26) + 1 << endl;
  }
}

Measured memory_bytes: 3676
//AUTHOR: RAVAN_2070
//PUNE INSTITUTE OF COMPUTER TECHNOLOGY
//Atcoder Educational DP
//N-Slimes
/*
    I ♥ CLARICE STARLING

    EXPLAINATION BELOW->
    Dp  
    Consider testcase
    3
    1 2 3
    Approach1  1 2 3==> 3 3==>6  3 + 6=9
    Approach2  1 2 3==>1 5==>6   5 + 6=11
    
    At the end of each approach we get 6 so lets think out reverse
           6(can be formed by)
           /   or   \
          /          \
    interval[0..1]+    interval[0..0]+
     interval[2..2]     interval[1..2]
    and further so on
    
    From this we can say that same intervals can occur again in the recursion tree
    Hence we can observe Overlapping subproblems
    hence Dp.
   
*/
//Iterative Solution
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(x) x.begin(),x.end()
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define MOD7 1000000007
const ll INF=(ll)1e18+5;
void solve()
{
   int n,i,j,k,interval;cin>>n;
   int A[n];
   ll ps[n+1];ps[0]=0;
   ll dp[n][n];
   fo(i,0,n)
   fo(j,0,n)dp[i][j]=INF;
   fo(i,0,n){cin>>A[i];dp[i][i]=0;ps[i+1]=ps[i]+A[i];}
   
   for(interval=1;interval<=n-1;interval++)
   {
       i=0;j=interval;
       while(j<n)
       {
          
          for(k=i;k<j;k++)dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j]+(ps[j+1]-ps[i]));
          i++;j++;
       }
   }
   cout<<dp[0][n-1]<<"\n";
}
int main()
{
   fastio
   solve();
  return 0;
}



Measured memory_bytes: 1536
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
using ll = long long;

typedef long long ll;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define INF 999999999

int N;
ll b[300],ans=0;

int main(){
  scanf("%d",&N);
  REP(i,N-1){scanf("%lld",&b[i]);}
  ans=b[0];
  FOR(i,0,N-2){ans+=min(b[i],b[i+1]);}
  ans+=b[N-2];
  printf("%lld\n",ans);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
int a[10];
bool check(int x) {
	while(x) {
		int q = x%10;
		if (a[q]==1) return false;
		x/=10;
	}
	return true;
}
int main() {
	IO
	int n, k;
	cin>>n>>k;
	for (int i=0;i<k;++i) {
		int x;
		cin>>x;
		a[x]=1;
	}
	while(1) {
		if(check(n)) {
			cout<<n<<endl;
			break;
		}
		++n;
	}
	return 0;
}

Measured memory_bytes: 256
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
from math import sqrt, pi
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

N = getN()
P = getArray(N)

Q = [0] * N
for i in range(N):
    Q[P[i] - 1] = i

cnt = 1
ans = 0
for i in range(N - 1):
    if Q[i] < Q[i + 1]:
        cnt += 1
    else:
        ans = max(ans, cnt)
        cnt = 1
ans = max(ans, cnt)
print(N - ans)

Measured memory_bytes: 93452
import java.util.Scanner;

/**
* 円周率はフィールドMath.PIで保持されている。
* 累乗計算を行うメソッドはMath.pow(double a, double b) a*b回
* %.10f →浮動小数点を10桁まで表示
*/
public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		double r = sc.nextDouble();

//  自作　失敗		
//		System.out.printf("%f %f%n", (double)r*r*3.14, (double)2 * 3.14 * r);
 		System.out.printf("%f %f%n", r*r*Math.PI, r*2*Math.PI);
	}

}


Measured memory_bytes: 28124
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

    s=str(input())
    if s in ['AKIHABARA','AKIHABAR','AKIHABRA','AKIHABR','AKIHBARA','AKIHBARA','AKIHBRA','AKIHBR','KIHABARA','KIHABAR','KIHABRA','KIHABR','KIHBARA','KIHBAR','KIHBRA','KIHBR']:
        print('YES')
    else:
        print('NO')

resolve()


Measured memory_bytes: 38512
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define pb push_back
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m,x;
	cin>>n>>m>>x;
	int a[n][m];
	int c[n];
	for(int i = 0; i<n; i++)
	{
		cin>>c[i];
		for(int j = 0; j<m; j++)
			cin>>a[i][j];
	}
	ll cost1 = -1, cost2 = -1;
	for(ll i = 1; i<(1LL<<n); i++)
	{
		bitset<45> b(i);
		ll ans[m] = {0},cost = 0;
		for(int j = 0; j<n; j++)
		{
			if(b[j])
			{
				for(int k = 0; k<m; k++)
					ans[k] += a[j][k];
				cost += c[j];
			}
		}
		for(int j = 0; j<m; j++)
		{
			if(ans[j]<x)
				cost = -1;
		}
		if((cost<cost2 && cost!=-1) || cost2==-1)
			 cost2 = cost;
	}
	cout<<cost2<<endl;
	return 0;
}

Measured memory_bytes: 3620
s = input()
t = input()
s_len = len(s)
t_len = len(t)
ans = float("inf")

def dif_string(a, b, len):
    count = 0
    for i in range(len):
        if a[i] != b[i]:
            count += 1
    return count


for i in range(s_len - t_len + 1):
    ans = min(ans, dif_string(s[i:i+t_len], t, t_len))
print(ans)

Measured memory_bytes: 9060
n,d = map(int,input().split())
ls = [list(map(int,input().split())) for _ in range(n)]
k = 0
for i in range(n):
    a = (ls[i][0]**2+ls[i][1]**2)**(1/2)
    if a <= d:
        k += 1
print(k)

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

using namespace std;

using ll = long long;

const ll MOD = 1000000007;

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

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    string s; cin >> s;
    if(s == "Sunny"){
        cout << "Cloudy" << endl;
    }else if(s == "Cloudy"){
        cout << "Rainy" << endl;
    }else{
        cout << "Sunny" << endl;
    }
}

Measured memory_bytes: 256
def fn(x):
    return [x[0], int(x[1])]

N, q = map(int, input().split())
name_time = list(map(fn, [ input().split() for n in range(N) ]))
sec = 0; finish =[];

while True:
    if len(name_time) == 0:
        break
    elif name_time[0][1] > q:
        sec += q
        name_time[0][1] -= q
        name_time.append(name_time.pop(0))
    else:
        sec += name_time[0][1]
        finish.append([name_time.pop(0)[0],sec])
for f in finish:
    print(*f)



Measured memory_bytes: 21000
import sys
import math

sys.setrecursionlimit(10**6)
readline = sys.stdin.readline

floor = math.floor

def f(x):
    global A, B
    return floor(A*x/B) - A*floor(x/B)

def l(x):
    global A, B
    return floor(A*x/B)

def r(x):
    global A, B
    return A*floor(x/B)

def main():
    global A, B
    A, B, N = map(int, readline().split())
    #for i in range(0, 100):
    #    print('i:{}, l:{}, r:{}, f(i)={}'.format(i, l(i), r(i), f(i)))
    if B == 1:
        ans = 0
    elif N >= B:
        x = B - 1
        ans = f(x)
    else:
        x = N
        ans = f(x)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9088
#include <iostream>
#include <vector>

using namespace std;

template<typename T>
class RangeUpdateQuery {
public:
    explicit RangeUpdateQuery(int n, T def) : N(calcN_(n)) {
        mVal.assign(2*N+1, make_pair(-1, def));
    }
    void update(int l, int r, T value, int ts){
        l = max(0, l);
        r = min(N, r);
        int offset = N;
        while(offset > 0){
            if(l >= r) break;
            if(l&1){ mVal[offset+l-1].first = ts; mVal[offset+l-1].second = value; l++; }
            if(r&1){ mVal[offset+r-2].first = ts; mVal[offset+r-2].second = value; }
            l /= 2;
            r /= 2;
            offset /= 2;
        }
    }
    T get(int idx){
        int i = N + idx - 1;
        auto res = mVal[i];
        while(i > 0){
            i = (i-1)/2;
            res = max(mVal[i], res);
        }
        return res.second;
    }
private:
    int calcN_(int n){
        int res = 1;
        while(res < n) res *= 2;
        return res;
    }
    const int N;
    vector<pair<int,T>> mVal;
};

int main(){
    int n, q;
    while(cin >> n >> q){
        const int INF = 0x7FFFFFFF;
        RangeUpdateQuery<int> ruq(n, INF);
        for(int i=0;i<q;i++){
            int c; cin >> c;
            if(c == 0){
                int s, t, x; cin >> s >> t >> x;
                ruq.update(s, t+1, x, i);
            } else {
                int p; cin >> p;
                cout << ruq.get(p) << endl;
            }
        }
    }
}



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

typedef vector <int> vi;
typedef pair< int , int > pii;
#define endl "\n"
#define sd(val) scanf("%d",&val)
#define ss(val) scanf("%s",&val)
#define sl(val) scanf("%lld",&val)
#define debug(val) printf("check%d\n",val)
#define all(v) v.begin(),v.end()
#define PB push_back
#define MP make_pair
#define FF first
#define SS second
#define ll long long
#define MOD 1000000007
#define clr(val) memset(val,0,sizeof(val))
#define what_is(x) cerr << #x << " is " << x << endl;
#define OJ \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

#define PI 3.14159265358979323846264338327950L


int main()
{
	FIO;
	int a, b, h, m, ah = 0, am = 0, angle = 0;
	float ans = 0;

	cin >> a >> b >> h >> m;

	/*if (h % 3 == 0 && m == 0) {
		ans = sqrt((a * a) + (b * b));
		printf("%.12f\n", ans );
		return 0;
	} else {
		//ah = (h * 360) / 12 + ( m * 360) / (12 * 60);
		//am = ( m * 360) / (60);
		//angle = ;
		//if (angle > 180)
		//	angle = 360 - angle ;

		ans = sqrt(((a * a) + (b * b)) - ( 2 * a * b * (cos(abs(30 * h - 5.5 * m)))));
		printf("%.20f\n", ans );
		return 0;

	}*/
	double pi = acos(-1.0);
	double ax = a * cos(2 * pi * (h * 60 + m) / 720);
	double ay = a * sin(2 * pi * (h * 60 + m) / 720);
	double bx = b * cos(2 * pi * m / 60);
	double by = b * sin(2 * pi * m / 60);

	printf("%.151f\n", hypot(ax - bx, ay - by) );
	return 0;
}

Measured memory_bytes: 4124