akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long int
#define mp make_pair
#define F first
#define S second
#define pb push_back
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define all(a) a.begin(),a.end()
#define Nmax 1000005
#define INF 1000000000
#define MOD 1000000007
 
using namespace std;

 ll mod=1e9+7;
 
ll expo(ll base,ll exponent,ll mod){
    ll ans=1;
    while(exponent!=0){
        if(exponent&1) ans=(1LL*ans*base)%mod;
        base=(1LL*base*base)%mod;
        exponent>>=1;
    }
    return ans%mod;
}

ll expo2(ll base,ll exponent)
{
	ll ans=1;
	while(exponent!=0)
	{
		if(exponent & 1) ans=(1LL*ans*base);
		base=(1LL*base*base);
		exponent>>=1;
	}
	return ans;
}

vector<bool>  prime(90000002,true);
void Sieve() 
{ 
   
    for (int p=2; p*p<=90000001; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=90000001; i += p) 
                prime[i] = false; 
        } 
    } 
}


int main()
{
    
    // #ifndef ONLINE_JUDGE
    //     freopen ("data.in","r",stdin);
    //     freopen ("E.out","w",stdout);
    // #endif
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    // Sieve();
    int tests=1;
    // cin>>tests;
    while(tests--)
    {	
    	string s,t;
    	cin>>s>>t;
    	ll n=s.length(),m=t.length();
    	ll ans=n;
    	for(ll i=0;i<n-m+1;i++)
    	{
    		ll cur=0;
    		string v=s.substr(i,m);
    		for(ll j=0;j<m;j++)
    		{
    			if(t[j]!=v[j]) cur++;
    		}
    		ans=min(ans,cur);
    	}
    	cout<<ans;
    }
    	return 0;
    
}

Measured memory_bytes: 14128
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function root(uf::Array{Int,1},x)
	s=x
	while uf[s]!=s
		s=uf[s]
	end
	s
end
function same(uf::Array{Int,1},x,y)
	root(uf,x)==root(uf,y)?true:false
end
function unite(uf::Array{Int,1},x,y)
	l = root(uf,x)
	r = root(uf,y)
	if l < r
		uf[r] = l
	elseif l > r
		uf[l] = r
	end
end

function evalma(st::Array{Int,1},ll,rr)
	r = 0
	while 2^r<length(st)
		r += 1
	end
	r -= 1
	hd = 2^r-1
	sl = hd+ll
	sr = hd+rr
	v = max(st[sl],st[sr])
	for i in r:-1:0
		if sr>>i-sl>>i>1
			if (sl>>i)%2==0
				v=max(v,st[sl>>i+1])
			end
			if (sr>>i)%2==1
				v = max(v,st[sr>>i-1])
			end
		end
	end
	v
end

function evalmi(st::Array{Int,1},ll,rr)
	r = 0
	while 2^r<length(st)
		r += 1
	end
	r -= 1
	hd = 2^r-1
	sl = hd+ll
	sr = hd+rr
	v = min(st[sl],st[sr])
	for i in r:-1:0
		if sr>>i-sl>>i>1
			if (sl>>i)%2==0
				v=min(v,st[sl>>i+1])
			end
			if (sr>>i)%2==1
				v = min(v,st[sr>>i-1])
			end
		end
	end
	v
end


function main()
	n,k = readline() |> split |> parseMap
	p = readline() |> split |> parseMap
	ve = zeros(Int,n)
	for i in 2:n
		ve[i] = ve[i-1]
		if p[i]<p[i-1]
			ve[i] += 1
		end
	end
	r = 0
	while 2^r<=n
		r += 1
	end
	hd = 2^r-1
	stma = zeros(Int,2^(r+1))
	stmi = 200000*ones(Int,2^(r+1))
	for i in 1:n
		for j in 0:r
			stma[(hd+i)>>j] = max(stma[(hd+i)>>j],p[i])
			stmi[(hd+i)>>j] = min(stmi[(hd+i)>>j],p[i])
		end
	end
	uf = Int[i for i in 1:n-k+2]
	f = 1
	if ve[k] == 0
		f = 0
		unite(uf,1,n-k+2)
	end
	for i in 2:n-k+1
		if ve[i+k-1]-ve[i]==0
			f = 0
			unite(uf,i,n-k+2)
		else
			ma = evalma(stma,i,i+k-2)
			mi = evalmi(stmi,i,i+k-2)
			if p[i-1]<mi&&p[i+k-1]>ma
				unite(uf,i,i-1)
			end
		end
	end
	println(length(Set(uf))-f)
end

main()


Measured memory_bytes: 148068
local function str2tbl(s)
    -- limit of #s is approximately 999959
    local t = {string.byte(s, 1, #s)}
    local char = string.char
    for i=1, #t do
        t[i] = char(t[i])
    end
    return t
end
local S = str2tbl(io.read("l"))
local function solve()
    if #S == 1 then
        return 1
    elseif #S == 2 then
        return S[1] == S[2] and 1 or 2
    end
    local function strategy1()
        local p = S[1]
        local count = 1
        local i = 2
        while i <= #S do
            if S[i] == p then
                if i + 1 <= #S then
                    count = count + 1
                    p = p .. S[i]
                    i = i + 2
                else
                    return count
                end
            else
                count = count + 1
                p = S[i]
                i = i + 1
            end
        end
        return count
    end
    return strategy1()
end
print(solve())

Measured memory_bytes: 7468
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = (1LL << 31) - 1;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3

int T[20100];
int n, m, t;

int main() {
	cin >> n >> m >> t;
	rep(i, n) {
		int tt;
		cin >> tt;
		T[tt - m]++;
		T[tt + m]--;
	}
	rep(i, t) {
		T[i + 1] += T[i];
	}
	int ans = 0;
	rep(i, t) {
		//cout << i << " " << T[i] << endl;
		ans += (T[i] == 0);
	}
	cout << ans << endl;
}

Measured memory_bytes: 3116
#include <stdio.h>
#include <math.h>

int main(void){
  int i;
  int n, k;
  int m;//pointを何倍するとk以上になるか
  int mul;//ポイントを2^n倍した物
  double kakuritu=0;//確率

  scanf("%d %d", &n, &k);

  for(i=1; i<=n; i++){
    //ココでのiは最初の得点の値になる
    m=0;
    mul=i;
    while(k>mul){
      m++;
      mul*=2;
    }
    // printf("i=%d (1/n)*pow(1/2,m)=%lf\n", i,(1./n)*pow(1./2,m));
    // printf("1/n=%lf pow(1/2,m)=%lf\n", 1./n, pow(1./2, m));
    // printf("i=%d n=%d m=%d\n", i, n, m);
    kakuritu+=pow(1./2,m);//最後に1/nする
    // printf("kakuritu=%lf\n", kakuritu);
  }
  printf("%.12lf\n", (1./n)*kakuritu);

  return 0;
}


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

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <bitset>
#include <array>
#include <deque>
#include <queue>
#include <map>
#include <set>
#include <numeric>
#define all(x) (x).begin(),(x).end()

const int MOD = 1e9 + 7;

void solve(){

}
int main(){
    int N,A,B,C;
    cin >> N >> A >> B >> C;
    vector<int> L(N);
    for (int i = 0; i < N; ++i) {
        cin >> L[i];
    }

    int ans = INT_MAX;
    int size = pow(4, N);
    for (int i = 0; i < size; ++i) {
        vector<int> a,b,c;
        int t = i;
        for (int k = 0; k < N; ++k) {
            int idx = t % 4;
            t /= 4;
            if (idx == 0) { a.push_back(L[k]); }
            if (idx == 1) { b.push_back(L[k]); }
            if (idx == 2) { c.push_back(L[k]); }
        }

        int sum_t = 0;
        if (a.empty() || b.empty() || c.empty()) {
            continue;
        }
        sum_t += (10 * (a.size() - 1));
        sum_t += (10 * (b.size() - 1));
        sum_t += (10 * (c.size() - 1));

        int suma = accumulate(all(a),0);
        int sumb = accumulate(all(b),0);
        int sumc = accumulate(all(c),0);

        sum_t += (abs(suma - A) + abs(sumb - B) + abs(sumc - C));
        ans = min(ans, sum_t);
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 256
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
#import bisect
a,b=input().split()
a=int(a)
ans=math.floor(((a*int(b[0]))*100+(a*int(b[2]))*10+(a*int(b[3])))//100)
print(ans)

Measured memory_bytes: 77484
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
	string s;
	cin >> s;
	int n = s.size();
	vector<int> left(n+1), right(n+1);
	int cnt = 0;
	left[0] = 0, right[n] = 0;
	rep(i,n){
		if(s[i] == '<') cnt++;
		else cnt = 0;
		left[i+1] = cnt;
	}
	cnt = 0;
	for(int i = n-1; i >= 0; i--){
		if(s[i] == '>') cnt++;
		else cnt = 0;
		right[i] = cnt;
	}
	ll ans = 0;
	rep(i,n+1) ans += max(left[i], right[i]);
	cout << ans << endl;
    return 0;
}

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


int main() {
  long double a,b,x;
  long double ans=0;
  cin >> a >> b >> x;
  if(a*a*b/2 <= x){			//hanbun yori ooi
    long double aki = a*a*b - x;
    ans = atan(2*aki/(a*a*a))*(180.0/M_PI);
  } else {
    ans = atan(a*b*b/x/2)*(180.0/M_PI);
  }
  cout << fixed << setprecision(10) << ans << endl;
  return 0;
}

Measured memory_bytes: 256
from collections import deque

N, M = map(int, input().split())
dic = {i:[] for i in range(1,N+1)}

for _ in range(M):
  l, r, d = map(int, input().split())
  dic[l].append((r,d))
  dic[r].append((l,-d))

memo = [0]*(N+1)
h = deque([])

for i in range(1,N+1):
  if memo[i] > 0:
    continue
  h.append((i,0))
  while h:
    t = h.popleft()
    for u in dic[t[0]]:
      if u[0] == t[1]:
        continue
      if memo[u[0]] == 0:
        memo[u[0]] = memo[t[0]] + u[1]
        h.append((u[0],t[0]))
      else:
        if memo[u[0]] - memo[t[0]] != u[1]:
          print('No')
          exit()
          
print('Yes')

Measured memory_bytes: 107776
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <numeric>
#include <set>
#include <boost/math/constants/constants.hpp>
#include <boost/math/common_factor_rt.hpp>

using namespace std;
#define ll long long
#define rep(i, n) for(int i = 0;i < n;i++)
#define FOR(i, n, m) for(int i=n; i<m; ++i)

int main(){
  ll A, B;
  cin >> A >> B;
  
  ll ans=0;
  while(B>1){
    B-=(A-1);
    ans++;
  }
  cout << ans << endl;

}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();

    token.parse().ok().expect("failed to parse token")
}
fn main() {

    let a: [u32; 32] = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51];
    let i: usize = read();
    println!("{}", a[i-1]);
}


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

typedef long long lli;

int n;
lli v[100000], sum[300030];

int func(int root, int pos){
  int lb = pos, ub = root + n;
  lli suma = sum[pos] - sum[root];
  while(ub - lb > 1){
    int mid = (lb + ub) / 2;
    if(sum[mid] - sum[pos] >=  suma) ub = mid;
    else lb = mid;    
  }
  return ub;
}

void solve(){
  lli ans = 0;

  sum[0] = 0;
  for(int i=1;i<n*3+9;i++) sum[i] = sum[i-1] + v[(i+n-1)%n];

  for(int i=0;i<n;i++){
    int lb = i, ub = i + n - 1, maxmid = -1;
    //cout << "*" << endl;
    while(ub - lb > 1){
      int mid = (lb + ub) / 2;
      int res = func(i, mid);
      //cout << "mid = " << mid << ", res = " << res << ", sum[i+n] - sum[res] = " << sum[i+n] - sum[res] << ", sum[mid] - sum[i] = " << sum[mid] - sum[i] << endl;
      if(res == i + n || sum[i+n] - sum[res] < sum[mid] - sum[i]) {
        ub = mid;
      }
      else {
        lb = mid;
        maxmid = max(maxmid,mid);
      }
    }
    //cout << endl;
    //cout << i << ' ' << ub << ' ' << sum[ub] - sum[i] << endl;
    if(maxmid != -1) ans = max(ans, sum[maxmid] - sum[i]);
    //if(ub != i + n - 1) ans = max(ans, sum[ub] - sum[i]);
  }

  cout << ans << endl;
}

int main(){
  while(cin >> n){
    for(int i=0;i<n;i++) cin >> v[i];
    solve();
  }
}

Measured memory_bytes: 4288
N,M,X,Y=[int(i) for i in input().split()]

x = [X]
y = [Y]

x+=[int(i) for i in input().split()]
y+=[int(i) for i in input().split()]

if max(x) < min(y):
    ans='No War'
else:
    ans='War'
    
print(ans)

Measured memory_bytes: 3064
x,n=map(int,input().split())
if n>0:
  p=list(map(int,input().split()))
  a=0
  while 1 :
    if x-a not in p:
      print(x-a)
      break
    elif x+a not in p:
      print(x+a)
      break
    a+=1
else:
  print(x)

Measured memory_bytes: 9120
def main():
    n,m=map(int,input().split())
    a=list(map(lambda x:int(x)*-1,input().split()))
    
    import heapq
    heapq.heapify(a)
    
    for i in range(m):
        x=heapq.heappop(a)
        heapq.heappush(a,(x+1)//2)
    
    print(sum(a)*-1)

if __name__=="__main__":
    main()

Measured memory_bytes: 14228
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>

typedef long double ld;
typedef long long ll;

using namespace std;

#define MAXN (1 << 17)

vector<int> a[MAXN];
vector<int> b[MAXN];

int color;

int v[MAXN];
int n, m1, m2;

int cnt[MAXN];

void dfs(int cur) {
	v[cur] = color;
	for (int i = 0; i < a[cur].size(); i++) {
		int nnext = a[cur][i];
		if (!v[nnext]) {
			dfs(nnext);
		}
	}
}

int main() {
	int t1, t2;
	cin >> n >> m1 >> m2;
	for (int i = 0; i < m1; i++) {
		cin >> t1 >> t2;
		t1--;
		t2--;
		a[t1].push_back(t2);
		a[t2].push_back(t1);
	}
	for (int i = 0; i < m2; i++) {
		cin >> t1 >> t2;
		t1--;
		t2--;
		b[t1].push_back(t2);
		b[t2].push_back(t1);
	}

	for (int i = 0; i < n; i++) {
		if (!v[i]) {
			color++;
			dfs(i);
		}
	}

	for (int i = 0; i < n; i++) {
		cnt[v[i]]++;
	}

	for (int i = 0; i < n; i++) {
		int ret = cnt[v[i]] - 1 - a[i].size();
		for (int j = 0; j < b[i].size(); j++) {
			int nnext = b[i][j];
			if (v[nnext] == v[i]) {
				ret--;
			}
		}
		cout << ret << " ";
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 16152
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(void) {
	ll n;
	cin >> n;
	if (n % 2 != 0||n<10) {
		cout << 0;
		return 0;
	}
	ll ans = 0;
	for (ll i = 10; i <= n; i *= 5/*初期設定の段階で2はもうあるので*5しても10の倍数になる*/) {
		ans += n / i;
	}
	cout << ans;
}

Measured memory_bytes: 256
#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() {
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i+=2) {
        int now = 0;
        for (int j = 1; j <= i; j++) {
            if (i%j==0) now++;
        }
        if (now == 8) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <cstdio>
#include <vector>
#include <complex>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <stack>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <cassert>

using namespace std;

typedef long long ll;
typedef ll li;
typedef pair<int,int> PInt;
#define EPS (1e-10L)
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define REP(i,m,n) for(int i=m; i<=(int)(n); ++i)
#define F first
#define S second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SZ(a) (int)((a).size())
#define ALL(a) a.begin(),a.end()
#define FOR(it,a) for(__typeof(a.begin())it=a.begin();it!=a.end();++it)
int dx[]={0,1,0,-1,1,1,-1,-1};
int dy[]={1,0,-1,0,-1,1,1,-1};

int dp[2][1<<16];
int main() {
  int R, C;
  cin >> R >> C;
  string A[130];
  rep(i, R) cin >> A[i];
  int cur = 0, next = 1;
  memset(dp, -1, sizeof(dp));
  dp[cur][0] = 0;
  rep(i, R) rep(j, C) {
    //    rep(k, 1<<C) dp[next][k] = 0;
    memset(dp + next, -1, sizeof(dp[0]));
    rep(k, 1<<C) if (dp[cur][k] != -1) {
      int score = 0;
      int ak = k & ~(1<<j);
      dp[next][ak] = max(dp[next][ak], dp[cur][k] + score);

      char c = A[i][__builtin_popcount(k&((1<<j)-1))];
      if (i > 0 && (k>>j&1) && (A[i-1][SZ(A[i-1]) - __builtin_popcount(k>>j)] == c)) score++;
      if (j > 0 && (k>>(j-1)&1) && (A[i][__builtin_popcount(k&((1<<j)-1))-1] == c)) score++;
      ak = k | 1<<j;
      dp[next][ak] = max(dp[next][ak], dp[cur][k] + score);
    }
    swap(cur, next);
    if (j+1 == C) {
      rep(k, 1<<C) if (__builtin_popcount(k) != SZ(A[i])) dp[cur][k] = -1;
    }
  }

  int ans = 0;
  rep(k, 1<<C)
    ans = max(ans, dp[cur][k]);
  cout << ans * 2 << endl;


}

Measured memory_bytes: 1736
import java.util.*

fun main() {
    val sc = Scanner(System.`in`)
    var n = sc.nextLong()
    val base = 'a'.toInt() - 1

    val result = mutableListOf<Char>()
    while (true) {
        if (n <= 0) break
        var diff = (n % 26L).toInt()
        val is26 = diff == 0
        if (is26) {
            diff = 26
        }
        val char = (diff + base).toChar()
        result.add(char)

        n /= 26L
        if (is26) {
            n -= 1
        }
    }

    result.asReversed().forEach { print(it) }
}

Measured memory_bytes: 37396
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define RFOR(i,a,b) for(int i=(b-1); i>=(a); i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
using ll = long long;
using P = pair<int, int>;
using D = double;
using LD = long double;
const int mod = 1e9+7;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int main(){
    int h,n; cin >> h >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int sum = 0;
    rep(i,n) sum += a[i];
    if(sum >= h) cout << "Yes" << endl;
    else cout << "No" << endl;

}


Measured memory_bytes: 640
#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() {
    int n;
    cin >> n;
    for(int i = 1; i <= 9; i++) {
        for(int j = 1; j <= 9; j++) {
            if(n == i * j) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}


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

int main ()
{

	int N, K, x[100], i, l;

	l = 0;

	cin >> N >> K;
	for (i = 0 ; i < N ; i++)
	{
		cin >> x[i];
		if ( x[i]<K-x[i] )
			l += x[i]*2;
		else
			l += (K-x[i])*2;
	}
	cout << l << endl;

	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.math.*;

public class Main {

	public static void main(String[] args)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		String[] str1 = br.readLine().split(" ");
		int n = Integer.parseInt(str1[0]);
		int k = Integer.parseInt(str1[1]);
		String[] str2 = br.readLine().split(" ");
		BitSet b = new BitSet(10);
		for(int i = 0; i < k; i++){
			int a = Integer.parseInt(str2[i]);
			b.set(a);
		}
		while(true){
			boolean like = true;
			String str = n+"";
			int l = str.length();
			for(int i = 0; i < l; i++){
				char c = str.charAt(i);
				if(b.get(c-48)){
					like = false;
					break;
				}
			}
			if(like)
				break;
			n++;
		}

		sb.append(n);
		System.out.print(sb);
	}
}

Measured memory_bytes: 17108
from sys import stdin
N,M=[int(x) for x in stdin.readline().rstrip().split()]
A=[(int(x),1) for x in stdin.readline().rstrip().split()]
data=[]
for i in range(M):
    r,q=[int(x) for x in stdin.readline().rstrip().split()]
    A.append((q,r))
ans=0
cnt=0
for j in reversed(sorted(A)):
    cnt+=j[1]
    ans+=(j[0]*j[1])
    if cnt > N:
        ans = ans-(j[0]*(cnt-N))
        break
print(ans)

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

int main(){
  int n; cin >> n;
  string s,t; cin >> s >> t;
  int s_len = 0, t_len = 0;
  for(int i = 0; i < 2 * n; i++){
    if(i % 2 == 0){
      cout << s.at(s_len);
      s_len++;
    }
    else{
      cout << t.at(t_len);
      t_len++;
    }
  }     
  
}

Measured memory_bytes: 3572
#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() {
  int N, W;
  cin >> N >> W;
  vector<vector<ll>> wv(N, vector<ll>(2, 0));
  rep(i, N) rep(j, 2) cin >> wv[i][j];

  vector<vector<ll>> dp(N+1, vector<ll>(100100));

  rep(i, N) {
    for(int sumW = 0; sumW <= W; sumW++) {
      if (wv[i][0] <= sumW) {
        dp[i+1][sumW] = max(dp[i][sumW-wv[i][0]] + wv[i][1], dp[i][sumW]);
      } else {
        dp[i+1][sumW] = dp[i][sumW];
      }
    }
  }

  cout << dp[N][W] << endl;
  return 0;
}


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

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

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

int main(){
  int64_t A,B,gc=1;
  int t;
  cin >> A >> B;
  if(B>A){
    t = A;
    A = B;
    B = t;
  }
  int64_t x = A*B;
  int64_t r = A%B;
  while(r!=0){
    A = B;
    B = r;
    r = A%B;
  }
  cout << x/B << endl;
}

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

#define INF 2000000000
#define WH 0
#define GR 1
#define BK 2

int main() {
    int n;
    cin >> n;
    vector<pair<int, int>> adj[10000];
    for (int i = 0; i < n; i++) {
        int u, k;
        cin >> u >> k;
        for (int j = 0; j < k; j++) {
            int v, c;
            cin >> v >> c;
            adj[u].push_back(make_pair(v, c));
        }
    }

    int color[10000] = {};
    int d[10000];
    for (int i = 0; i < n; i++) {
        d[i] = INF;
    }

    int p[10000];
    for (int i = 0; i < n; i++) {
        p[i] = -1;
    }

    priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> PQ;  // (cost, unit)


    d[0] = 0;
    PQ.push(make_pair(0, 0));

    while (PQ.empty() == false) {
        pair<int, int> q = PQ.top(); PQ.pop();
        int u = q.second;

        if (d[u] < q.first) {
            continue;
        }

        color[u] = BK;

        for (int j = 0; j < adj[u].size(); j++) {
            int v = adj[u][j].first;
            int c = adj[u][j].second;
            if (color[v] != BK) {
                if (d[u] + c < d[v]) {
                    d[v] = d[u] + c;
                    PQ.push(make_pair(d[v], v));
                    p[v] = u;
                }
            }
        }
    }

    for (int i = 0; i < n; i++) {
        cout << i << " " << d[i] << endl;
    }

    return 0;

}



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

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define X first
#define Y second
#define pb push_back
#define make_unique(x) sort(all(x)), x.resize(unique(all(x)) - x.begin())
#define int long long

const LL mod = 1e9 + 7;


template<class T>
istream& operator >> (istream& in, vector<T>& v){ for (auto &x : v) { in >> x; } return in; }

template<class T, class U>
istream& operator >> (istream& in, pair<T, U> & v){ in >> v.X >> v.Y;return in; }

template<class T, class U>
ostream& operator << (ostream& out, pair<T, U> & v){ out << v.X << " " << v.Y;return out; }

void chkmax(int &a, int b) {
    a = max(a, b);
    return;
}

void chkmin(int &a, int b) {
    a = min(a, b);
    return;
}

LL ppow (LL x, LL s) {
    if (!s) return 1;
    if (!(s - 1)) return x % mod;
    if (s % 2) return (x * ppow (x, s - 1)) % mod;
    LL b = ppow (x, s / 2);
    return (b * b) % mod;
}

main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    //freopen("ILUXA.in", "r", stdin);
    int n;
    cin >> n;
    int MAXN = 2e5;

    vector<int> res(MAXN, 1);

    for (int i = 2;i < MAXN;i++) {
        if (res[i]) {
            if (i >= n) {
                cout << i;
                return 0;
            }
            for (int j = i*i;j < MAXN;j += i) {
                res[j] = 0;
            }
        }
    }

    return 0;
}


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

#ifdef DEBUG
#include "../include/debug.hpp"
#else
#define debug(...) 42
#define rdfile(...) 42
#endif

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    // rdfile("_input.txt");

    int v[3];
    for (int i=0; i<3; ++i) cin >> v[i];
    sort(v, v+3);

    cout << v[2]-v[0] << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n,m;
		n = sc.nextInt();
		m = sc.nextInt();

		boolean ans = false;

		if((n - m) == 1) ans = true;
		if((m - n) == 1) ans = true;
		if((n - m) == 0) ans = true;
		if(ans) System.out.println("Yay!");
		else
			System.out.println(":(");
	}

}


Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned int u32;
typedef pair<int, int> p;
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 Inf = (1<<30);
ll inf = (1LL<<60);
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main() {
	int n;
	cin >> n;
	int i;
	map<int, int, greater<int>> mp;
	for (i = 0; i < n; i++) {
		int a;
		cin >> a;
		mp[a]++;
	}
	ll f = 0;
	ll s = 0;
	for (auto c : mp) {
		if (c.second >= 4) {
			if (f == 0) f = s = c.first;
			else if (s == 0) s = c.first;
		}
		else if (c.second >= 2) {
			if (f == 0) f = c.first;
			else if (s == 0) s = c.first;
		}
	}
	ll ans = f * s;
	cout << ans; // int型に収まらない
	return 0;
}

Measured memory_bytes: 4992
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll mod=1e9+7;
const int inf=1<<30;

ll dp[310][310];
ll dp2[310][310];

int main(){
  int n,m,l; cin >> n >> m >> l;
  rep(i,n)rep(j,n) dp[i][j]=inf;
  rep(i,n) dp[i][i]=0;
  rep(i,m){
    int a,b,c;
    cin >> a >> b >> c; a--; b--;
    //if(c<=l){
      dp[a][b]=c;
      dp[b][a]=c;
    //}
  }
  rep(k,n)rep(i,n)rep(j,n) chmin(dp[i][j],dp[i][k]+dp[k][j]);
  //以下dp2
  rep(i,n)rep(j,n) dp2[i][j]=inf;
  rep(i,n) dp2[i][i]=0;
  rep(i,n)rep(j,n) if(dp[i][j]<=l) dp2[i][j]=1;
  rep(k,n)rep(i,n)rep(j,n) chmin(dp2[i][j],dp2[i][k]+dp2[k][j]);
  int q; cin >> q;
  vector<ll> ans(q);
  rep(i,q){
    int s,t; cin >> s >> t; s--; t--;
    ans[i]=dp2[s][t]==inf?-1:dp2[s][t]-1;
  }
  rep(i,q){
    cout << ans[i] << endl;
  }
}


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
using namespace std;

int main() {
    ll n, tmp;
    cin >> n;
    vector<ll> a(n+5), b(n+5), c(n + 10, 0);
    rep(i, n) {
        cin >> tmp;
        tmp--;
                a[i] = tmp;
        b[i] = tmp;
        c[tmp]++;
    }

    ll ans = 0;
    rep(i, n) ans += c[i] * (c[i] - 1) / 2;

    rep(i, n) {
        ll r = a[i];
        cout << ans - c[r] * (c[r] - 1) / 2 + (c[r] - 1) * (c[r] - 2) / 2 << endl;
    }

    return 0;
}

Measured memory_bytes: 7296
#include <algorithm>
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define double long double
#define rep(i,n) for(ll i=0;i<n;++i)
#define Rep(i,n) for(ll i=1;i<=n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
#define prique priority_queue<ll>
#define ALL(a)  (a).begin(),(a).end()
const int mod = 1000000007;
const int mod2 = 998244353;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
long nCr(int n, int r) {
	int ans = 1;
	for (ll i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
struct union_find {
	int par[200010], size_[200010];
	void init(int x) {
		rep(i, x) { par[i] = i; size_[i] = 1; }
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (size_[x] < size_[y]) {
			par[x] = y;
			size_[y] += size_[x];
		}
		else {
			par[y] = x;
			size_[x] += size_[y];
		}
	}
};

int a[100010],l[100010],r[100010];
signed main() {
	int n;
	cin >> n;
	Rep(i, n) {
		cin >> a[i];
	}
	Rep(i, n) {
		l[i] = gcd(l[i - 1], a[i]);
	}
	for(int i=n;i>=1;--i) {
		r[i] = gcd(r[i + 1], a[i]);
	}
	int m = 0;
	Rep(i, n) {
		m = max(m, gcd(l[i - 1], r[i + 1]));
	}
	cout << m << endl;
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
#define double long double
#define int long long
#define mii map<int,int>
#define pii pair<int,int>
#define low lower_bound
#define upp upper_bound
#define mod 1000000007 //10^9+7
#define inf (int)50000000000000000 //5･10^16
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define vsort(vec) sort(all(vec))
#define vrever(vec) reverse(all(vec));
#define vunsort(vec) vsort(vec); vrever(vec);
#define bisea binary_search
#define cend cout<<endl;
#define F first
#define S second
using namespace std;
int n,m;
int g[10][10];
signed main() {
  cin>>n>>m;
  rep(i,m) {
    int a,b;
    cin>>a>>b;
    a--;
    b--;
    g[a][b]=1;
    g[b][a]=1;
  }
  vector<int>vec;
  rep(i,n-1) {
    vec.push_back(i+1);
  }
  int cnt=0;
  bool can=true;
  can=true;
  if(g[0][vec[0]]==0) can=false;
  rep(i,n-2) {
    if(g[vec[i]][vec[i+1]]==0) {
      can=false;
    }
  }
  if(can) cnt++;
  while(next_permutation(all(vec))) {
    can=true;
    if(g[0][vec[0]]==0) can=false;
    rep(i,n-2) {
      if(g[vec[i]][vec[i+1]]==0) {
        can=false;
      }
    }
    if(can) cnt++;
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>
#define pq priority_queue
#define mp make_pair
#define cauto const auto &

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

#define clr(ar, val) memset(ar, val, sizeof(ar))

template <class T> bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

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

using namespace std;

typedef long long int64;
typedef long long lint;
typedef long long lli;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;

const int iinf = 1 << 29;
const long long linf = 1ll << 61;

int main() {
    int n;
    cin >> n;
    char a[n], b[n], c[n];
    scanf("%s", a);
    scanf("%s", b);
    scanf("%s", c);

    int ans=0;

    REP(i,n){
        if(a[i]==b[i] || a[i]==c[i] || c[i]==b[i]){
            if(a[i]==b[i] && b[i] == c[i]){
                continue;
            }
            ans+=1;
            continue;
        }
        ans+=2;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=3e5+7;
const int maxm=19;
typedef long long ll;
typedef pair<string,int> psi;
vector<int> v[maxm];
map<psi,int> mp;
int n,m;
int main()
{
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		int k;scanf("%d",&k);
		for(int j=0;j<k;j++)
		{
			int tmp;
			scanf("%d",&tmp);
			v[tmp-1].push_back(i);
		}
	}
	vector<int> mm(m+1);
	for(int i=0;i<m;i++) scanf("%d",&mm[i]);
	int cnt=0;
	for(int i=0;i<=((1ll<<n)-1);i++)
	{
		vector<int> x(m+1);
		for(int j=0;j<n;j++)
		{
			if(i&(1<<j))
			{
				for(auto u:v[j]) x[u]++;
			}
		}
		int flag=1;
		for(int j=0;j<m;j++)
		{
			//cout<<i<<" "<<mm[j]<<" "<<x[j]<<endl;
			if(mm[j]%2!=x[j]%2)
			{
				flag=0;break;
			}
		}
		if(flag) cnt++;
	}
	cout<<cnt<<endl;
}

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

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

    set<string> ss;
    for(int i=0,l=1;i<K;i++,l++) {
        for(int j=i;j<s.size();j++) {
            ss.insert(s.substr(j-l+1,l));
        }
    }
//    ss.sort(ss.begin(), ss.end());
    set<string>::iterator it = ss.begin();
    for(int i= 1;i<K;i++) {
        it++;
    }
    cout << *it << endl;

    return 0;
}


Measured memory_bytes: 1664
#include <cmath>
  #include <array>
  #include <iostream>
  #include <string>

  #if defined(__GNUC__) && !defined(__clang__)
  #  pragma GCC optimize("Ofast")
  #  pragma GCC target("sse4.2", "tune=native")
  #endif


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

    std::array<int, 5> antennas;
    for (auto&& e : antennas) {
      std::cin >> e;
    }
    int k;
    std::cin >> k;

    for (std::size_t i = 0; i < antennas.size(); i++) {
      for (int j = i; j < antennas.size(); j++) {
        if (std::abs(antennas[i] - antennas[j]) > k) {
          std::cout << ":(" << std::endl;
          return 0;
        }
      }
    }
    std::cout << "Yay!" << std::endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	cnt := 0
	a := make([]int, n+1)
	for i := 1; i <= n; i++ {
		fmt.Scan(&a[i])
		if a[i] % 2 == 1 && i % 2 == 1 {
			cnt++
		}
	}

	fmt.Println(cnt)

}



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

int main(){
	int a, b, i, mi, mx;
	cin >> a >> b;
	
	mi = min(a, b);
	mx = max(a, b);
	
	for(i=mi; i<=mx; i++){
		if(abs(a - i) == abs(b - i)){
			cout << i << endl ;
			return 0;
		}
	}
	cout << "IMPOSSIBLE" << endl ;
}


Measured memory_bytes: 3592
n=int(input())
#N = []
#N.append(int(input()))
n0 = int(input())
nm1, nm2 = n0, 0
Ind1, Ind2 = [0], []

i = 1
while i < n:
    n0 = int(input())
    if n0 > nm1: # nm1,2, Ind1,2更新
        nm2 = nm1
        nm1 = n0
        Ind2 = Ind1
        Ind1 = [i]
    elif n0 == nm1:#Ind1追加
        Ind1.append(i)
    elif n0 > nm2: # nm2, Ind2更新
        nm2 = n0
        Ind2 = [i]
    elif n0 == nm2: # Ind2追加
        Ind2.append(i)
    i += 1
if len(Ind1) >= 2: #すべてのiに対しnm1を返す
    ans = (str(nm1) + '\n') * n
else: #
    i0 = Ind1[0]
    ans = (str(nm1) + '\n') * i0
    ans += str(nm2) + '\n'
    ans += (str(nm1) + '\n') * (n-1-i0)
print(ans)

Measured memory_bytes: 15144
import java.util.*;

public class Main{

    void solve(){
        Scanner sc = new Scanner(System.in);

        int[] w = {125,140,160};

        while(true){
            int n = sc.nextInt();
            if(n==-1) break;

            int ans = 1150;
            n -= 10;
            if(n<0) n = 0;
            for(int i=0; i<2; i++){
                if(n>=10){
                    ans += 10*w[i];
                    n -= 10;
                }else{
                    ans += w[i]*n;
                    n = 0;
                    break;
                }
            }
            ans += n*w[2];

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

    public static void main(String[] args){
        new Main().solve();
    }
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,k;
  cin >> n >> k;
  int rod[60];
  for (int i=0; i<n; i++) {
    cin >> rod[i];
  }
  sort(rod,rod+n,greater<int>());
  int a=0;
  for (int i=0; i<k; i++) {
    a += rod[i];
  }
  cout << a << endl;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
  int A, B, C;
  cin >> A >> B >> C;
  if (A <= C && C <= B) cout << "Yes" << endl;
  else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int MAX_N = 1e3 + 5;

char ans [MAX_N][MAX_N];

void puth (int r, int c, char v) {
  ans[r][c] = v;
  ans[r][c + 1] = v;
}

void putv (int r, int c, char v) {
  ans[r][c] = v;
  ans[r + 1][c] = v;
}

void solve_2 (int n) {
  for (int i = 0; i < n; i += 2) {
    puth(i, i, 'a');
    puth(i + 1, i, 'b');
  }

  for (int i = 0; i < n; i += 2) {
    putv(i, (i + 2) % n, 'c');
    putv(i, (i + 3) % n, 'd');
  }
}

void solve_3 (int l, int r) {
  puth(l, l, 'a');
  putv(l, l + 2, 'b');
  putv(l + 1, l, 'c');
  puth(l + 2, l + 1, 'd');
}

void solve_5 () {
  puth(0, 0, 'a');
  puth(0, 2, 'b');
  putv(0, 4, 'c');
  putv(1, 0, 'd');
  puth(1, 1, 'e');
  putv(2, 2, 'f');
  puth(2, 3, 'g');
  puth(4, 0, 'h');
  putv(3, 3, 'i');
  putv(3, 4, 'j');
}

void solve_7 (int l, int r) {
  puth(l, l, 'a');
  putv(l, l + 2, 'b');
  putv(l + 1, l, 'c');
  puth(l + 2, l + 1, 'd');
  puth(l + 6, l, 'e');
  puth(l + 5, l + 2, 'f');
  puth(l + 6, l + 3, 'g');
  puth(l + 6, l + 5, 'h');
  putv(l + 4, l + 4, 'i');
  putv(l + 4, l + 5, 'j');
  puth(l + 3, l + 3, 'k');
  putv(l + 2, l + 5, 'l');
  putv(l, l + 6, 'm');
  putv(l + 3, l + 6, 'n');
}

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

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      ans[i][j] = '.';
    }
  }

  if (n == 2) {
    cout << -1 << endl;
    return 0;
  }
  if (n == 5) {
    solve_5();
  } else if (n % 2 == 0) {
    solve_2(n);
  } else if (n % 3 == 0) {
    for (int i = 0; i < n; i += 3) {
      solve_3(i, i + 3);
    }
  } else if (n >= 7) {
    solve_2(n - 7);
    solve_7(n - 7, n);
  } else {
    cout << -1 << endl;
    return 0;
  }

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cout << ans[i][j];
    }
    cout << '\n';
  }
}


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

using namespace std;

string naming(string s, int k)
{
    int len = s.length();
    string res = "";
    bool flag = true; //?????????
    for (int i = 0; i < len; i++)
    {
        if (flag)
            res += s[i];
        if (s[i] == 'a' || s[i] == 'i' || s[i] == 'u' || s[i] == 'e' || s[i] == 'o')
            flag = true;
        else
            flag = false;
    }
    string memo = "";
    for (int i = 0; i < k; i++)
        memo += res[i];
    if ((int)res.length() < k)
        return res;
    else
        return memo;
}

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

    while (true)
    {
        int n;
        cin >> n;
        if (n == 0)
            break;
        int ma = -1;
        string ports[n];
        for (int i = 0; i < n; i++)
        {
            cin >> ports[i];
            ma = max((int)ports[i].length(), ma);
        }
        bool flag = false;
        for (int k = 1; k <= ma; k++)
        {
            set<string> st;
            bool judge = true;
            for (int i = 0; i < n; i++)
            {
                string kouho = naming(ports[i], k);
                //cout <<kouho<<endl;
                if (st.find(kouho) != st.end())
                {
                    judge = false;
                    break;
                }
                st.insert(kouho);
            }
            if (judge)
            {
                cout << k << endl;
                flag = true;
                break;
            }
        }
        if (!flag)
            cout << -1 << endl;
    }
}


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

const int MOD=1e9+7;

long long dp[100100][4]={};

int main(){
    string s; cin >> s;
    int N=s.size();
    dp[0][0]=1;
    for(int i=0;i<N;i++){
        for(int j=0;j<4;j++){
            if(s[i]=='?'){
                dp[i+1][j]+=dp[i][j]*3%MOD;
            }else{
                dp[i+1][j]+=dp[i][j]%MOD;
            }
        }
        if(s[i]=='A'||s[i]=='?'){
            dp[i+1][1]+=dp[i][0]%MOD;
        }
        if(s[i]=='B'||s[i]=='?'){
            dp[i+1][2]+=dp[i][1]%MOD;
        }
        if(s[i]=='C'||s[i]=='?'){
            dp[i+1][3]+=dp[i][2]%MOD;
        }
    }
    cout << dp[N][3]%MOD << endl;
}

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

using pii = pair<int, int>;
using vi = vector<int>;
using ll = long long;

int main() {
    int d;
    while(cin >> d, d) {
        int n, m;
        cin >> n >> m;
        vector<int> v(2 * n);
        v[0] = 0, v[1] = d;
        for(int i = 1; i < n; ++i) {
            cin >> v[i * 2];
            v[i * 2 + 1] = v[i * 2] + d;
        }
        sort(begin(v), end(v));
        int res = 0;
        for(int i = 0; i < m; ++i) {
            int k; cin >> k;
            auto it = lower_bound(begin(v), end(v), k);
            auto it2 = lower_bound(begin(v), end(v), k + d) - 1;
            res += min(abs(*it - k), abs(k + d - *it2));
        }
        cout << res << endl;
    }
}


Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define fastt ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pll pair<ll,ll>
const ll INF=1e9;
const ll MOD=1e9+7;
//--------------------------------------------------//
ll dp[1001][1001];
char mat[1001][1001];
int main()
{
	ll r,c,i,j;
	cin>>r>>c;
	for(i=0;i<r;i++)
		scanf("%s",mat[i]);

	for(i=1;i<r;i++)
	{
		if(mat[0][i]=='.')
			dp[0][i]=1;
		else
			break;
	}
	for(i=1;i<c;i++)
	{
		if(mat[i][0]=='.')
			dp[i][0]=1;
		else
			break;
	}
	for(i=1;i<r;i++)
	{
		for(j=1;j<c;j++)
		{
			if(mat[i-1][j]=='.')
				dp[i][j]+=dp[i-1][j];
			if(mat[i][j-1]=='.')
				dp[i][j]+=dp[i][j-1];
			dp[i][j]=dp[i][j]%MOD;
		}
	}
	cout<<dp[r-1][c-1]<<"\n";
}

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

int main(){
    int N, M, C;
    cin >> N >> M >> C;
    int A_list[30][30];
    int B_list[30];
    for(int i=0; i<M; i++){
        cin >> B_list[i];
    }
    for(int i=0; i<N; i++){
        for(int j=0; j<M; j++){
            cin >> A_list[i][j];
        }
    }
    int cnt = 0;
    for(int i=0; i<N; i++){
        int score = C;
        for(int j=0; j<M; j++){
            score += A_list[i][j]*B_list[j];
        }
        if(score > 0){
            cnt++;
        }
    }
    cout << cnt;
    return EXIT_SUCCESS;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = int64_t;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define all(v)    begin(v), end(v)
#define in        []{lint n; cin>>n; return n;}()

template< typename Monoid >
struct SegmentTree {
  using F = function< Monoid(Monoid, Monoid) >;

  int sz;
  vector< Monoid > seg;

  const F f;
  const Monoid M1;

  SegmentTree(int n, const F f, const Monoid &M1) : f(f), M1(M1) {
    sz = 1;
    while(sz < n) sz <<= 1;
    seg.assign(2 * sz, M1);
  }

  void set(int k, const Monoid &x) {
    seg[k + sz] = x;
  }

  void build() {
    for(int k = sz - 1; k > 0; k--) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }

  void update(int k, const Monoid &x) {
    k += sz;
    seg[k] = x;
    while(k >>= 1) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }

  Monoid query(int a, int b) {
    Monoid L = M1, R = M1;
    for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
      if(a & 1) L = f(L, seg[a++]);
      if(b & 1) R = f(seg[--b], R);
    }
    return f(L, R);
  }

  Monoid operator[](const int &k) const {
    return seg[k + sz];
  }
};

int MAX( int x, int y ) {
    return max(x,y);
}

int main(){ cin.tie(0); ios::sync_with_stdio(false);
    int N = in;
    int z = 0;
    SegmentTree<int> s( N,
        MAX,
        z );

    rep(i, N){
        int a;
        cin >> a;
        s.set(i, a);
    }

    s.build();

    rep( i, N-1 ) {
        cout << max(s.query(0,i), s.query(i+1,N)) << "\n";
    }

    cout << s.query(0,N-1) << "\n";
}


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

int n;
deque<int> dq;

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        int q, y, x; cin >> q >> y;
        if (q == 0) cin >> x;
        
        if (q == 0) {
            if (y == 0) dq.push_front(x);
            else dq.push_back(x);
        }
        else if (q == 1) cout << dq[y] << endl;
        else {
            if (y == 0) dq.pop_front();
            else dq.pop_back();
        }
    }
    
    return 0;
}


Measured memory_bytes: 4504
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#include <atcoder/all>
#define InfL 2000000000
#define InfLL 4000000000000000000LL
#define mod 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef double db;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<db> vd;

int main() {
	int N, Q;
	cin >> N >> Q;
	fenwick_tree<ll> fw(N);
	rep(i, N) {
		ll a;
		cin >> a;
		fw.add(i, a);
	}
	rep(q, Q) {
		int type;
		cin >> type;
		if (type == 0) {
			int p;
			ll x;
			cin >> p >> x;
			fw.add(p, x);
		}
		else {
			int l, r;
			cin >> l >> r;
			ll ans = fw.sum(l, r);
			cout << ans << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 8204