akhauriyash/Code-Regression huggingface dataset:
#![allow(unused_mut)]
#![allow(non_snake_case)]
#![allow(unused_macros)]
#![allow(unused_variables)]
#![allow(unused_imports)]
#![allow(dead_code)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        S: String,
    }
    let y = S.chars().skip(0).take(4).collect::<String>().parse::<u64>().unwrap();
    let m = S.chars().skip(5).take(2).collect::<String>().parse::<u64>().unwrap();
    let d = S.chars().skip(8).take(2).collect::<String>().parse::<u64>().unwrap();
    if y < 2019 {
        println!("Heisei");
    } else if 2019 < y {
        println!("TBD");
    } else {
        if m < 4 {
            println!("Heisei");
        } else if 4 < m {
            println!("TBD");
        } else {
            if d <= 30 {
                println!("Heisei");
            } else {
                println!("TBD");
            }
        }
    }
}



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

int main() {
  int N, K;
  cin >> N >> K;
  vector<double> P(N);
  for (int i = 0; i < N; i++) cin >> P.at(i);
  for (int i = 0; i < N; i++) {
    P.at(i) = (P.at(i) + 1) / 2.0;
  }
  vector<double> R(N + 1);
  for (int i = 1; i < N + 1; i++) R.at(i) = R.at(i - 1) + P.at(i - 1);
  double ans = 0;
  for (int i = K; i < N + 1; i++) {
    ans = max(ans, R.at(i) - R.at(i - K));
  }
  cout << fixed << setprecision(6) << ans << "\n";
}

Measured memory_bytes: 6492
def isInt(x):
    try:
        float(x)
    except ValueError:
        return False
    else:
        return float(x).is_integer()
    
def main():
    try:
        str = input().split()
    except ValueError:
        return

    ##is int?
    if isInt(str[0]):
        a = int(str[0])
    else:
        return
    if isInt(str[1]):
        b = int(str[1])
    else:
        return
    if isInt(str[2]):
        c = int(str[2])
    else:
        return
    if isInt(str[3]):
        k = int(str[3])
    else:
        return

    ## a, b, c >= 0
    if not(a >= 0 and b >= 0 and c >=0):
        return

    ## 1 <= k <= a+b+c <= 2 * 10 ** 9
    if not(1 <= k and k <= a+b+c and a+b+c <= 2 * 10 ** 9):
        return

    sum = None
    if(k <= a):
        sum = k
        return sum
    else:
        sum = a
        k -= a

    if(k <= b):
        return sum
    else:
        k -= b
        sum -= k
        return sum
        
if __name__ == '__main__':
    sum = main()
    if(isInt(sum)):
        print(sum)


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

using ll = long long;
const int mod = 1e9 + 7;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll cnt[10][10] = {};
    int N;
    cin >> N;
    for (int i = 1; i <= N; i++) {
        string s = to_string(i);
        cnt[s[0] - '0'][s.back() - '0']++;
    }
    ll ans = 0;
    for (int i = 0; i <= 9; i++) {
        for (int j = 0; j <= 9; j++) {
            ans += cnt[i][j] * cnt[j][i];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(void){
	int n, a[20], b[20], c[20];

	cin >> n;
	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];

	int out = 0;
	for(int i = 0; i < n; i++) out += b[i];
	for(int i = 0; i < n - 1 ; i++){
		int cur = a[i], next = a[i + 1];
		if(next - cur == 1) out += c[cur - 1];
	}

	cout << out << '\n';

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <functional>
#include <queue>
#include <utility>
using namespace std;
typedef long long ll;
int main(){
  string s;
  cin >> s;

  bool flag = true;
  while(s.size()){
    if(s.substr(0,7) == "dreamer"){
      if(s[7] == 'a')s = s.substr(5);
      else s = s.substr(7);
    }
    else if(s.substr(0,5) == "dream")s = s.substr(5);
    else if(s.substr(0,6) == "eraser")s = s.substr(6);
    else if(s.substr(0,5) == "erase")s = s.substr(5);
    else{
      flag = false;
      break;
    }
  }

  if(!flag)cout << "NO" << endl;
  else cout << "YES" << endl;
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>
#include<tuple>
#include<stack>


using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef tuple<int, int, int> tpl;
int dx[4] = { 1,0,0,-1 };
int dy[4] = { 0,1,-1,0 };

#define ARRAY_MAX 100005

const int INF = 1e16 + 7;
const int MOD = 1e9 + 7;

int main() {

	ll n;
	cin >> n;
	vector<ll> a(5);
	ll mini = INF;

	ll index = 0;
	ll maxi = 0;
	for (int i = 0; i < 5; i++)
	{
		cin >> a[i];
		maxi = max(maxi, (n - 1) / a[i] + 1);
	}

	cout << maxi + 4 << endl;
	


	return 0;
}


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

#define SZ(a) (int)(a).size()
using ll = long long;
ll mod = 1'000'000'007;

int main() {
    cin.sync_with_stdio(false);
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<int> freq(26, 1);
    for (char c: s) {
        freq[c - 'a']++;
    }
    ll ans = 1;
    for (int x: freq) {
        ans = (ans * x) % mod;
    }
    ans -= 1;
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x)    // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()

int main(int argc, char const *argv[])
{
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    for (ll i = 0; i < k; i++)
    {
        ll d;
        cin >> d;
        for (ll m = 0; m < d; m++)
        {
            ll t;
            cin >> t;
            a[t - 1]++;
        }
    }

    ll ans = 0;
    for (ll i = 0; i < n; i++)
    {
        if (a[i] == 0)
            ans++;
    }

    cout << ans << endl;
}


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

N, Q = map(int, input().split())
S = input()

# そのままカウントしたのでは、O(Q(r-l))の時間がかかる
# Sと同じ長さ(<10^5)の配列ACを作って、Sの添え字に対応するAC数をカウントし、
# AC[r]-AC[l]で差分を取れば求める部分文字列のACはカウントできそう。

# count AC
AC = [0] * N
for i in range(1,N):
    if S[i-1] == "A" and S[i] == "C":
        AC[i] = AC[i-1] + 1
    else:
        AC[i] = AC[i-1]

# answer
for i in range(Q):
    l, r = map(int, input().split())
    print(AC[r-1]-AC[l-1])


Measured memory_bytes: 6060
n,a,b=map(int,input().split())
s=input()

count_ab=0
count_b=0

for i in range(n):
    if s[i]=='c':
        print('No')
    elif s[i]=='a':
        if count_ab<a+b:
            print('Yes')
            count_ab+=1
        else:
            print('No')
    elif s[i]=='b':
            if count_b<b and count_ab<a+b:
                print('Yes')
                count_b+=1
                count_ab+=1
            else:
                print('No')
    else:
        print('No')

Measured memory_bytes: 9348
#ifdef MY_LOCAL
#define MY_NAMESPACE(ns) namespace ns {
#define MY_NAMESPACE_    }
#define MY_DEBUG(s)      s
#else
#define MY_NAMESPACE(ns) 
#define MY_NAMESPACE_    
#define MY_DEBUG(s)      
#endif

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define EPS (1e-7)
#define IINF ((int)1e9)


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

	for (int i = 0; i < 5; i++)
	{
		int x;
		cin >> x;
		if (x == 0)
		{
			cout << i + 1 << "\n";
			return 0;
		}
	}
	return 0;
}
MY_NAMESPACE_

Measured memory_bytes: 3520
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  cin >> a;
  if (a%2 == 0) {
    int t = a/2;
    cout << t*t << endl;
  } else {
    int t = (a-1)/2;
    int u = a-t;
    cout << t*u << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	int a[31]={0,1,2,4};
	repi(i,4,31)
		a[i]=a[i-3]+a[i-2]+a[i-1];
	
	for(int n;cin>>n,n;)
		cout<<a[n]/3650+!!(a[n]%3650)<<endl;
	
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
ll mod = 1000000007;
ll INF = 1000000099;

ll n,m,ans=0;
vector<ll> finddivisor(ll x){//整数xの約数が入ったvectorを返すよ(xを含む)  
    vector<ll> divisor;
    for(ll i=1; (i*i)<=x ;i++)
    {
        if(x%i==0){
            divisor.push_back(i);
            if(i*i!=x){
                divisor.push_back(x/i);
            }//約数はペアを持つことを利用

        }
    }
    sort(divisor.begin(),divisor.end());
    //divisor.push_back(x);
    return divisor;
}

signed main(){
    
    cin>>n>>m;
    vector<ll> v=finddivisor(m);
    for(ll i=0;i < (ll)v.size();i++)
    {
        if(m/v.at(i) >= n){
            ans=max(ans,v.at(i));
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>

#include<cmath>
#include<map>
#include<string>
#include<vector>
#include<algorithm> 

using namespace std;

# define p(s) std::cout << s << endl;
# define printIf(j,s1,s2) std::cout << (j ? s1 : s2) << endl;
# define YES(j) std::cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define rep(n,i) for(i = 0 ; i < n ; i++)

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

    int res=1;
    for(int i=0;i<n;i++){
        res = min(res*2,res+k);
    }
    p(res)
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int binarySearch(int *,int,int);
int main(){
  int i,S[100000],n,q,T,count=0;
  cin>>n;
  for(i=0;i<n;i++)cin>>S[i];
  cin>>q;
  for(i=0;i<q;i++){
    cin>>T;
    if(binarySearch(S,T,n)!=-1)count++;
  }
  cout<<count<<endl;
  return 0;

}

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




Measured memory_bytes: 3460
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m; i<n; i++)
#define co(n) cout << n << endl
using namespace std;
int main(){
  int a, b, n;
  cin >> n;
  co(3*n*n);
  
  
  return 0;
}


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


def solve(K: int, A: int, B: int):
    if A % K == 0: return 'OK'
    if B % K == 0: return 'OK'
    if A % K > B % K: return 'OK'
    if B - A >= K: return 'OK'
    return 'NG'


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    print(solve(K, A, B))

if __name__ == '__main__':
    main()


Measured memory_bytes: 9196
function main(K, N, A) {
  const area = [];

  var c = parseInt(A[0]);

  for (var i = 1; i < N; i++) {
    area.push(parseInt(A[i]) - c);

    c = A[i];
  }

  area.push(K - c + parseInt(A[0]));

  area.sort((a, b) => a - b);

  var res = 0;
  for (var j = 0; j < area.length - 1; j++) {
    res += parseInt(area[j]);
  }

  console.log(res);
}



const input = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n');

const K = parseInt(input[0].split(' ')[0]);
const N = parseInt(input[0].split(' ')[1]);
const A = input[1].split(' ');

main(K, N, A);


Measured memory_bytes: 35952
//#define NDEBUG
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <vector>

namespace n91 {

using i8 = std::int_fast8_t;
using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u8 = std::uint_fast8_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;

constexpr usize operator"" _z(unsigned long long x) noexcept {
  return static_cast<usize>(x);
}

class rep {
  const usize f, l;

public:
  class itr {
    friend rep;
    usize i;
    constexpr itr(const usize x) noexcept : i(x) {}

  public:
    void operator++() noexcept { ++i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  constexpr rep(const usize first, const usize last) noexcept
      : f(first), l(last) {}
  constexpr itr begin() const noexcept { return itr(f); }
  constexpr itr end() const noexcept { return itr(l); }
};
class revrep {
  const usize f, l;

public:
  class itr {
    friend revrep;
    usize i;
    constexpr itr(usize x) noexcept : i(x) {}

  public:
    void operator++() noexcept { --i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  constexpr revrep(usize first, usize last) noexcept : f(--first), l(--last) {}
  constexpr itr begin() const noexcept { return itr(l); }
  constexpr itr end() const noexcept { return itr(f); }
};
template <class T> using vec_alias = std::vector<T>;
template <class T> auto md_vec(const usize n, const T &value) {
  return std::vector<T>(n, value);
}
template <class... Args> auto md_vec(const usize n, Args... args) {
  return std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> constexpr T difference(const T &a, const T &b) {
  return a < b ? b - a : a - b;
}
template <class T> T scan() {
  T ret;
  std::cin >> ret;
  return ret;
}

} // namespace n91

#include <algorithm>
#include <iostream>
#include <string>
#include <utility>

namespace n91 {

void main_() {
  const usize n = scan<usize>();
  double ret = static_cast<double>(0);
  for (const auto i : rep(0_z, n)) {
    ret += static_cast<double>(1) / scan<double>();
  }
  std::cout << static_cast<double>(1) / ret << std::endl;
}

} // namespace n91

int main() {
  n91::main_();
  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);
        long target = sc.nextLong();
        double mon = 100.0d;
        for(int i = 0;;i++){
            if(mon>=target){
                System.out.println(i);
                break;
            }
            mon = mon*1.01d;
            mon = Math.floor(mon);
        }
    }
}

Measured memory_bytes: 35884
n = int(input())

if n%10 == 2 or n%10 == 4 or n%10 == 5 or n%10 == 7 or n%10 == 9:
    print("hon")

elif n%10 == 0 or n%10 == 1 or n%10 == 6 or n%10 == 8:
    print("pon")

else:
    print("bon")

Measured memory_bytes: 9116
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define CLR(array) memset( array, 0, sizeof array )
typedef long long int ll;


int isPrime(int n){
	if( n == 1 )	return 0;
	if( n == 2 )	return 1;
	for( int i = 2; i*i <= n; i++ ){
		if( n % i == 0 )
			return 0;
	}
	return 1;
}

int main(){
	int x; std::cin >> x;

	for( int i = x; ; i++ ){
		if( isPrime(i) ){
			std::cout<< i << std::endl;
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 256
n,a,b = gets.split.map(&:to_i)
items = gets.split.map(&:to_i).sort_by!{|i|-i}

selected = items[0, a]

avg = Rational(selected.reduce(:+), a)
puts "%f" % avg

def comb(x, y)
  Rational(
    ((x-y+1)..x).inject(1, :*),
    (1..y).inject(1, :*)
  ).to_i
end

if selected[0] == selected[-1]
  n = items.count(selected[0])
  r = 0
  (a..[b, n].min).each do|i|
    r += comb(n, i)  
  end
  puts r
else
  r = selected.count(selected[-1])
  n = items.count(selected[-1])
  puts comb(n, r)
end

Measured memory_bytes: 1788
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef pair<int,int> Pint;
typedef pair<ll, ll> P;
//typedef pair<int, pair<int, int>> P;
//typedef tuple<int,int,int> T;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2147483600;//10^9
ll MOD  = 1000000007;
vector<int> dy = {0,0,1,-1};
vector<int> dx = {1,-1,0,0};

int N;
vector<ll> A(200010);

void solve(){
    cin >> N;
    for(int i = 0; i < N; i++) cin >> A[i];
    
    int s = 0, t = 0;
    ll res = 0;
    vector<bool> all(22, 0);
    for(;;){
        while(t < N){
            bool canplus = 1;
            ll x = A[t];
            for(int i = 0; i < 22; i++){
                int y = x % 2;
                x /= 2;
                if(all[i] && y){
                    canplus = 0;
                }
            }
            
            if(canplus){
                x = A[t];
                for(int i = 0; i < 22; i++){
                    int y = x % 2;
                    x /= 2;
                    if(y) all[i] = y;
                }
                t++;
            }else{
                break;
            }
        }
        res += t - s;
        ll x = A[s];
        for(int i = 0; i < 22; i++){
            int y  = x % 2;
            x /= 2;
            if(y) all[i] = 0;
        }
        s++;
        
        if(s > t){
            t = s;
            for(int i = 0; i < 22; i++){
                all[i] = 0;
            }
        }
        if(s == N) break;
    }
    cout << res << endl;
    
}


int main(void){
    solve();
}

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

using namespace std;

int main() {
	int d[4] = {0};	// W, N, E, S
	bool ok = false;
	string S;
	cin >> S;
	for(int i=0;i<S.length();i++) {
		d[S[i]%10%7] = 1;
	}
	if( (d[0] && d[1] && d[2] && d[3]) ||
		(d[0] && !d[1] && d[2] && !d[3]) ||
		(!d[0] && d[1] && !d[2] && d[3]) ) ok = true;
	cout << (ok?"Yes":"No") << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
typedef long long int li;
const ll MAXN=1e3+51;
ll n,m,kk,res,cnt;
string str;
ll x[MAXN][MAXN],prefix[MAXN][MAXN];
inline ll read()
{
    register ll num=0,neg=1;
    register char ch=getchar();
    while(!isdigit(ch)&&ch!='-')
    {
        ch=getchar();
    }
    if(ch=='-')
    {
        neg=-1;
        ch=getchar();
    }
    while(isdigit(ch))
    {
        num=(num<<3)+(num<<1)+(ch-'0');
        ch=getchar();
    }
    return num*neg;
} 
inline ll calc(ll state)
{
	ll cur=1,res=0,flg;
	ll p[105],q[105];
	memset(p,0,sizeof(p)),memset(q,0,sizeof(q));
	for(register int i=1;i<=n;i++)
	{
		q[i]=cur;
		if((state>>(i-1))&1)
		{
			cur++;
		}
	}
	for(register int i=1;i<=m;i++)
	{
		for(register int j=1;j<=n;j++)
		{
			p[q[j]]+=x[j][i];
		}
		flg=1;
		for(register int j=1;j<=cur;j++)
		{
			if(p[j]>kk)
			{
				flg=0;
				break;
			}
		} 
		if(!flg)
		{
			res++,memset(p,0,sizeof(p));
			for(register int j=1;j<=n;j++)
			{
				p[q[j]]+=x[j][i];
			}
			for(register int j=1;j<=cur;j++)
			{
				if(p[j]>kk)
				{
					return 0x3f3f3f3f;
				}
			}
		}
	}
	return res;
}
int main()
{
	n=read(),m=read(),kk=read(),res=0x3f3f3f3f;
	for(register int i=1;i<=n;i++)
	{
		cin>>str;
		for(register int j=1;j<=m;j++)
		{
			x[i][j]=str[j-1]-'0';
		}
	}
	for(register int i=0;i<(1<<(n-1));i++)
	{
		cnt=0;
		for(register int j=1;j<=n-1;j++)
		{
			if((i>>(j-1))&1)
			{
				cnt++;
			}
		}
		res=min(res,calc(i)+cnt);
	}
	printf("%d\n",res);
}

Measured memory_bytes: 2304
using System;
using System.Collections.Generic;
using System.Linq;
class Program{
	static void Main(){
		int[] s=Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
		int n=int.Parse(Console.ReadLine());
		int[][] a=new int[n+2][];
		long d,e;
		double ans=0;
		a[0]=new int[]{s[0],s[1],0};
		a[n+1]=new int[]{s[2],s[3],0};
		double[,] h=new double[n+2,n+2];
		bool[] b=new bool[n+2];
		for(int i=1;i<=n;i++){
			a[i]=Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
			for(int j=i-1;j>=0;j--){
				d=Math.Abs(a[i][0]-a[j][0]);
				e=Math.Abs(a[i][1]-a[j][1]);
				h[i,j]=Math.Sqrt(d*d+e*e)-a[i][2]-a[j][2];
				h[i,j]=Math.Max(h[i,j],0);
				h[j,i]=h[i,j];
			}
		}
		for(int j=n;j>=0;j--){
			d=Math.Abs(a[n+1][0]-a[j][0]);
			e=Math.Abs(a[n+1][1]-a[j][1]);
			h[n+1,j]=Math.Sqrt(d*d+e*e)-a[n+1][2]-a[j][2];
			h[n+1,j]=Math.Max(h[n+1,j],0);
			h[j,n+1]=h[n+1,j];
		}

		b[0]=true;
		for(int j=1;j<=n+1;j++){hea(h[0,j],j);}
		while(he.Count>0){
			int q=(int)he[0][1];
			if(!b[q]){
				b[q]=true;
				if(q==n+1){
					ans=he[0][0];
					break;
				}
				for(int j=1;j<=n+1;j++){
					if(!b[j]){hea(he[0][0]+h[q,j],j);}
				}
			}
			her();
		}
		Console.WriteLine(ans);
	}
	static List<double[]> he=new List<double[]>();
	static void hea(double a,int b){
		he.Add(new double[]{a,b});
		int j=he.Count-1;
		while(he[j][0]<he[(j-1)/2][0]){//
			double v=he[j][0];he[j][0]=he[(j-1)/2][0];he[(j-1)/2][0]=v;
			v=he[j][1];he[j][1]=he[(j-1)/2][1];he[(j-1)/2][1]=v;
			j=(j-1)/2;
		}
	}
	static void her(){
		he[0]=he[he.Count-1];
		he.RemoveAt(he.Count-1);
		int j=0;
		while(true){
			if(j*2+2<he.Count){
				if(he[j*2+1][0]<he[j*2+2][0]){j=j*2+1;}//
				else{j=j*2+2;}
			}
			else if(j*2+1<he.Count){j=j*2+1;}
			else{break;}
			if(he[j][0]>=he[(j-1)/2][0]){break;}//
			double v=he[j][0];he[j][0]=he[(j-1)/2][0];he[(j-1)/2][0]=v;
			v=he[j][1];he[j][1]=he[(j-1)/2][1];he[(j-1)/2][1]=v;
		}
	}
}

Measured memory_bytes: 54200
n,x,y = map(int,input().split())
dists = [0]*(n)
for i in range(1,n+1):
    for j in range(1,i):
        dists[min(abs(i-j),abs(i-x)+1+abs(j-y),abs(j-x)+1+abs(i-y))]+=1
    
for i in range(1,len(dists)):
    print(dists[i])

Measured memory_bytes: 3444
import java.io.*;
import java.util.*;

class Main {

	public static void main(String[] args) throws Exception {
		final Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		NavigableMap<Integer, Integer> h = new TreeMap<>();
		for (int i = 0; i < n; i++) {
			int a = sc.nextInt();
			if (h.isEmpty()) {
				h.put(a, 1);
				continue;
			}
			if (h.firstEntry().getKey() >= a) {
				h.put(a, h.getOrDefault(a, 0) + 1);
				continue;
			}

			int v = h.lowerEntry(a).getValue();
			if (v > 1) {
				h.put(h.lowerEntry(a).getKey(), v - 1);
			} else {
				h.remove(h.lowerEntry(a).getKey());
			}

			if (h.containsKey(a)) {
				h.put(a, h.get(a) + 1);
			} else {
				h.put(a, 1);
			}
		}

		int count = 0;
		for (Map.Entry<Integer, Integer> i : h.entrySet()) {
			count += i.getValue();
		}

		System.out.println(count);
	}
}


Measured memory_bytes: 63656
#include<bits/stdc++.h>
using namespace std;
int c[1<<17],n,m,ac,wa,i,p;
string s;
main(){
	scanf("%d%d",&n,&m);
	while(m--){
		cin>>p>>s;
		if(c[p]==-1)continue;
		if(s=="AC")ac++,wa+=c[p],c[p]=-1;
		else c[p]++;
	}
	printf("%d %d",ac,wa);
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define lli long long int
using namespace std;
#define MOD 1000000007
#define mod 1000000037
#define mod1 998244353
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define INF 2*1e9

int main()
{
    fastio;
    int n,w;
    cin >> n >> w;
    vector<int>we(n),va(n);
    for(int i=0;i<n;i++)
        cin >> we[i] >> va[i];
    lli dp[n+1][w+1];
    for(int i=0;i<=w;i++)
    {
        for(int j=0;j<=n;j++)
        {
            if(i==0 or j==0)
            {
                dp[j][i]=0;
                continue;
            }
            lli t1=0,t2=0;
            if(we[j-1]<=i)
                t1=va[j-1]+dp[j-1][i-we[j-1]];
            t2=dp[j-1][i];
            dp[j][i]=max(t1,t2);
        }
    }
    cout << dp[n][w] << endl;
}

Measured memory_bytes: 79104
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
int N,M;
int A[1000],B[1000],C[1000];
int D[1000],E[1000],F[1000];
bool vis[3010][3010];
int wx[3010][3010],wy[3010][3010];
main()
{
	cin>>N>>M;
	vector<long>X,Y;
	X.push_back((long)-2e9);
	X.push_back(0);
	X.push_back((long)2e9);
	Y.push_back((long)-2e9);
	Y.push_back(0);
	Y.push_back((long)2e9);
	for(int i=0;i<N;i++)
	{
		cin>>A[i]>>B[i]>>C[i];
		X.push_back(A[i]);
		X.push_back(B[i]);
		Y.push_back(C[i]);
	}
	for(int i=0;i<M;i++)
	{
		cin>>D[i]>>E[i]>>F[i];
		X.push_back(D[i]);
		Y.push_back(E[i]);
		Y.push_back(F[i]);
	}
	sort(X.begin(),X.end());
	X.erase(unique(X.begin(),X.end()),X.end());
	sort(Y.begin(),Y.end());
	Y.erase(unique(Y.begin(),Y.end()),Y.end());
	for(int i=0;i<N;i++)
	{
		A[i]=lower_bound(X.begin(),X.end(),A[i])-X.begin();
		B[i]=lower_bound(X.begin(),X.end(),B[i])-X.begin();
		C[i]=lower_bound(Y.begin(),Y.end(),C[i])-Y.begin();
		wx[A[i]][C[i]]++;
		wx[B[i]][C[i]]--;
	}
	for(int i=0;i<M;i++)
	{
		D[i]=lower_bound(X.begin(),X.end(),D[i])-X.begin();
		E[i]=lower_bound(Y.begin(),Y.end(),E[i])-Y.begin();
		F[i]=lower_bound(Y.begin(),Y.end(),F[i])-Y.begin();
		wy[D[i]][E[i]]++;
		wy[D[i]][F[i]]--;
	}
	for(int i=0;i<=X.size();i++)for(int j=0;j<=Y.size();j++)
	{
		wx[i+1][j]+=wx[i][j];
		wy[i][j+1]+=wy[i][j];
	}
	queue<pair<int,int> >P;
	int sx=lower_bound(X.begin(),X.end(),0)-X.begin();
	int sy=lower_bound(Y.begin(),Y.end(),0)-Y.begin();
	for(int x=sx-1;x<=sx;x++)for(int y=sy-1;y<=sy;y++)
	{
		vis[x][y]=true;
		P.push(make_pair(x,y));
	}
	long ans=0;
	while(!P.empty())
	{
		int x=P.front().first,y=P.front().second;
		P.pop();
		if(x==0||y==0||x+1==X.size()||y+1==Y.size())
		{
			cout<<"INF"<<endl;
			return 0;
		}
		ans+=(X[x+1]-X[x])*(Y[y+1]-Y[y]);
		if(!wy[x][y]&&!vis[x-1][y])
		{
			vis[x-1][y]=true;
			P.push(make_pair(x-1,y));
		}
		if(!wx[x][y]&&!vis[x][y-1])
		{
			vis[x][y-1]=true;
			P.push(make_pair(x,y-1));
		}
		if(!wy[x+1][y]&&!vis[x+1][y])
		{
			vis[x+1][y]=true;
			P.push(make_pair(x+1,y));
		}
		if(!wx[x][y+1]&&!vis[x][y+1])
		{
			vis[x][y+1]=true;
			P.push(make_pair(x,y+1));
		}
	}
	cout<<ans<<endl;
}

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

using namespace std;

int inf = 1e9;

vector<pair<int,int> > adj[2502];

vector<int > adj_c[2503];

int vis[2503];
int vis2[2503];

int dis[2502];
void dfs(int s, int p) {
	vis[s]=1;
	for(int node :adj_c[s]){
		if(vis[node]==0)
			dfs(node, s);
	}
}

void dfs2(int s, int p) {

	vis2[s]=1;
	for(auto  p :adj[s]){
		int node = p.first;
		if(vis2[node]==0)
			dfs2(node, s);
	}
}
void bellman(int n){
	dis[1] =0;
	int i;
	for(i=1;i<=n-1;i++) {
		for(int j  = 1 ;j<=n;j++){
			int u  = j;
			if(!vis[u] || !vis2[u])
				continue;
			for(auto p: adj[u]) {
				int v = p.first;
				int d = p.second;
				if(!vis[v] || !vis2[v]) continue;
				if(dis[v] > dis[u] + d)
					dis[v] = dis[u] + d;
			}
		}
	}

	bool isNeg = false;
	for(int j  = 1 ;j<=n;j++){
			int u  = j;
			if(!vis[u] || !vis2[u])
				continue;
			for(auto p: adj[u]) {
				int v = p.first;
				int d = p.second;
				if(!vis[v] || !vis2[v]) continue;
				if(dis[v] > dis[u] + d)
					dis[v] = dis[u] + d, isNeg = true;
			}
		}
	// cout<<"NEGATICE CYCLE: "<<isNeg<<"\n";
	// for(i=1;i<=n;i++)
	// 	cout<<dis[i]<<" ";
	// cout<<"\n";
	// for(i=1;i<=n;i++)
	// 	cout<<vis[i]<<" ";
	// cout<<"\n";
	// for(i=1;i<=n;i++)
	// 	cout<<vis2[i]<<" ";
	// cout<<"\n";
	if(isNeg)
		cout<<-1<<"\n";
	else
		cout<<max(0,-dis[n])<<"\n";

}

void init(int n){
	int i;
	for(i=1;i<=n;i++)
		dis[i]=inf;
}
int main() {
	int n, m, p;
	cin>>n>>m>>p;
	int i;
	for(i=1;i<=m;i++ ){
		int a, b, c;
		cin>>a>>b>>c;
		adj[a].push_back({b, -c + p});
		adj_c[b].push_back(a);
	}
	dfs(n,-1);
	dfs2(1, -1);
	if(vis[1]==	0){
		cout<<0<<"\n";
		return 0;
	}
	init(n);
	bellman(n);


	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
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; }
const int INF = 1e9;
const LL LLINF = 1e16;

map<LL, int> res;

void prime_factor(LL n){
    for(LL i=2; i*i<=n; i++){
        while(n % i == 0) {
            res[i]++;
            n /= i;
        }
    }
    if(n != 1) res[n]++;
}


int main(){
    int n;
    cin >> n;
    rep1(i, n+1) prime_factor(i);
    int n75=0, n25=0, n15=0, n5=0, n3=0;
    repe(i, res){
        // cout << i.first << " " << i.second << endl;
        if(i.second + 1 >= 75) n75++;
        if(i.second + 1 >= 25) n25++;
        if(i.second + 1 >= 15) n15++;
        if(i.second + 1 >= 5) n5++;
        if(i.second + 1 >= 3) n3++;
    }
    int ans = n75;
    ans += n25*(n3-1);
    ans += n15*(n5-1);
    ans += n5*(n5-1)/2*(n3-2);
    cout << ans << endl;


}

Measured memory_bytes: 256
#include <algorithm>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

template <class T>
inline bool chmax(T &a, T b){
    if(a < b){ a = b; return true;}
    return false;
}
template <class T>
inline bool chmin(T &a, T b){
    if(a > b){ a = b; return true;}
    return false;
}

const int INF = 1001001001;

int main()
{
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i, 0, n){
        cin >> h[i];
    }
    vector<int> dp(n+1, INF);
    dp[0] = 0;
    rep(i, 1, n){
        chmin(dp[i], dp[i-1] + abs(h[i] - h[i-1]));
        if(i > 1) chmin(dp[i], dp[i-2] + abs(h[i] - h[i-2]));
    }
    cout << dp[n-1] << endl;
}


Measured memory_bytes: 1024
N = int(input())

ppl = list(input())

buff = []
w = 0
e = ppl[1:].count('E')
for i in range(N):
    if i > 0:
        w += (ppl[i-1] == 'W' and 1 or 0)
    if i > 0:
        e -= (ppl[i] == 'E' and 1 or 0)
    n = w+e
    buff.append(n)

print(min(buff))

Measured memory_bytes: 22976
#include <stdio.h>
#include <string.h>
#include <math.h>

int main(void)
{
	int A=0;
	int ans=0;
	scanf("%d", &A);


	if(400 <= A && A <=599){
		ans = 8;
	}

	if(600 <= A && A <=799){
		ans = 7;
	}

	if(800 <= A && A <=999){
		ans = 6;
	}

	if(1000 <= A && A <=1199){
		ans = 5;
	}

	if(1200 <= A && A <=1399){
		ans = 4;
	}

	if(1400 <= A && A <=1599){
		ans = 3;
	}

	if(1600 <= A && A <=1799){
		 ans = 2;
	}

	if(1800 <= A && A <=1999){
		ans = 1;
	}

	printf("%d",ans);

	return 0;
}


Measured memory_bytes: 2152
#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << "\n"
using namespace std;
using ll = long long;

signed main() {
    IO;
    ll n;
    cin >> n;
    vector<ll> a(n);
    ll xor_val = 0, and_val;
    for(int i = 0; i < n; ++i) {
        cin >> a[i];
        if(i > 1) xor_val ^= a[i];
    }
    if((a[0] + a[1] - xor_val < 0) || (a[0] + a[1] - xor_val) % 2 == 1) {cout << -1; return 0;}
    and_val = (a[0] + a[1] - xor_val) / 2;
    if((and_val & xor_val) != 0) {cout << -1; return 0;}
    
    ll a0 = 0, a1 = 0;
    bool pos = true;
    for(ll i = 45; i >= 0; --i) {
        ll two = 1ll << i;
        if(and_val & two) {
            a0 |= two; a1 |= two;
        }
    }
    for(ll i = 45; i >= 0; --i) {
        ll two = 1ll << i;
        if(xor_val & two) {
            ll new_a0 = a0 | two;
            if(new_a0 < a[0]) a0 = new_a0;
            else a1 |= two;
        }
    }

    if(a0 == 0) pos = false;
    if(a0 > a[0]) pos = false;

    if(!pos) cout << -1;
    else cout << a[0] - a0;
    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define N 100010
#define ll long long
int main()
{
    char a[20];
    char b[20];
    scanf("%s",a);
    scanf("%s",b);
    int flag = 1;
    int j = strlen(a);
    for(int i = 0; i < j; i++){
        if(a[i] != b[i]){
            flag = 0;
        }
    }
    if(flag){
        printf("Yes");
    }
    else{
        printf("No");
    }
    return 0;
}


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

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

    vector<int> a(n);
    for (auto i = 0; i < n; i++) {
        cin >> a[i];
    }

    sort(a.begin(), a.end());
    int ans = 0, num = a[0], count = 1;
    for (auto i = 1; i < n; i++) {
        if(num != a[i]) {
            if(count != num) {
                ans += (count > num) ? count - num : count;
            }
            num = a[i];
            count = 1;
        } else {
            count++;
        }
    }
    if(count != num) {
        ans += (count > num) ? count - num : count;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;

int main(){
    int k, n;
    cin >> k >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    int ans = 1000000;
    rep (i, n) {
        int b, c;
        if (i == 0) {
            b = a[n - 1] - a[i];
            c = a[i] + (k - a[1]);
            ans = min(ans,min(b,c));
            continue;
        }

        if (i == n-1) {
            b = a[n-1] + (k-a[n - 1]);
            c = a[i] - a[0];
            ans = min(ans, min(b,c));
            continue;
        }

        b = k - a[i] + a[i - 1];
        c = a[i] + k - a[i+1];
        ans = min(ans, min(b,c));
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 4040
/*
author : seryu
title : ABC166B_"Trick or Treat"
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(all(x), val), x.end())
typedef long long ll;
typedef pair<int, int> P;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll MOD = 1000000007;
int INF = 1001001001;

void solve()
{
	int n, k;
	cin >> n >> k;
	vector<int> snk(n, 0);
	rep(i, k)
	{
		int d;
		cin >> d;
		rep(j, d)
		{
			int a;
			cin >> a;
			a--;
			snk[a]++;
		}
	}
	int ans = 0;
	rep(i, n)if(snk[i] == 0)ans++;
	cout << ans << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 3668
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <fstream>
#include <set>
#include <stack>
#include <queue>
#include <list>
using namespace std;
typedef long long int64;
typedef vector<int> vec;
typedef vector<int64> vec64;
#define db(x) cout << "> " << #x << ": " << x << "\n";
#define ss cout << " ";
#define ct(x) cout << x;
#define nn cout << "\n";
#define cts(x) cout << x << " ";
#define ctn(x) cout << x << "\n";
#define qr queries();
void solve();
void YN(bool b){if (b){ctn("YES");}else{ctn ("NO");}};
void yn(bool b){if (b){ctn("Yes");}else{ctn ("No");}};
void queries(){int n;cin >> n;while (n--)solve();}
// // // // // // // // // // // // // // // // // // // // // // 
/*                  TEMPLATE - VANILLA                         */
// // // // // // // // // // // // // // // // // // // // // //
int64 q, n;

void solve(){

    return;
}


int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int64 n;
    cin >> n;
    int64 rs = n * (n - 1) / 2;
    ctn(rs);
    return 0;
}


Measured memory_bytes: 3196
#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 a;
  cin >> a;
  int b, c;
  b = a/500;
  a = a-b*500;
  c = a/5;
  cout << b*1000 + c*5 << endl;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	long long n,m=1000;
	cin>>n;
	long long arr[n];
	for(long long i=0; i<n; i++)
	{
		cin>>arr[i];
	}
	long long  s;
	for (ll i=0; i<n-1; i++)
	{
		if (arr[i]>=arr[i+1])
		  continue;
		else
		{
			s=m/arr[i];
			m=m%arr[i];
			m=m+s*arr[i+1];
		}
	}
	cout<<m<<endl;
	return 0;
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
//const ll INF = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
//inline int in() { int x; scanf("%d",&x); return x;}
template<class T = int> inline T in() { T x; cin >> x; return (x);}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

ll mod_pow(ll x, ll n, ll mod=INF) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}

int main () {
  int n, m;
  cin >> n >> m;
  vi s(m), c(m);
  rep(i,m) {
    cin >> s[i] >> c[i];
    s[i]--;
  }
  //showv(s);

  for (int i = (n == 1 ? 0 : mod_pow(10,n-1)); i < mod_pow(10,n); ++i) {
    string k = to_string(i);
    bool ok = true;
    rep(j,m) {
      //show(k);
      if (k[s[j]] != c[j]+'0') ok = false;
    }
    if (ok) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> p(n + 1);
  for (int i = 1; i <= n; ++i)
    cin >> p[i - 1] >> p[i];

  vector< vector<int> > dp(n + 1, vector<int>(n + 1));
  for (int l = 2; l <= n; ++l) {
    for (int i = 1; i <= n - l + 1; ++i) {
      int j = i + l - 1;
      dp[i][j] = 1000000000;
      for (int k = i; k < j; ++k)
        dp[i][j] =
            min(dp[i][j], dp[i][k] + dp[k + 1][j] + p[i - 1] * p[k] * p[j]);
    }
  }

  cout << dp[1][n] << endl;
}


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

int main()
{

	int N;
	cin >> N;
	int arr[N];
	for(int i = 0; i < N; i++) {
		cin >> arr[i];
	}

	sort(arr, arr+N);
	int choices = arr[N/2] - arr[N/2-1];
	cout << choices;
	return 0;
}


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

int main(){
  int H, W;
  cin >> H >> W;
  
  vector<vector<char>> a(H+2, vector<char>(W+2));

  for (int i=0; i<H+2; i++) {
    for (int j=0; j<W+2; j++)
      a.at(i).at(j) = '#';
  }
  for (int i=0; i<H; i++) {
    for (int j=0; j<W; j++)
      cin >> a.at(i+1).at(j+1);
  }
  for (int i=0; i<H+2; i++) {
    for (int j=0; j<W+2; j++) {
      cout << a.at(i).at(j);
    }
    cout << endl;
  }  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

static const int INTINF = (2147483647 >> 1); // 10^9 + 5000
static const ll LLINF = (9223372036854775807 >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;

namespace Kunitaka{
    template<
        typename TYPE,
        std::size_t SIZE
    >
    std::size_t array_length(const TYPE (&array)[SIZE])
    {
        return SIZE;
    }

    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; }
}
using namespace Kunitaka;
namespace Printer{
    void br(){
        cout << endl;
    }

    void loop_cnt(int i){
        cout << "i = " << i << endl;
    }

    void loop_cnt(int i, int j){
        cout << "i = " << i << ", " << "j = " << j << endl;
    }

    template<class T>
    void print(T x){
        cout << x << endl;
    }

    template<class T, class S>
    void print(T x, S y){
        cout << x << "," << y << endl;
    }

    template<class T, class S, class U>
    void print(T x, S y, U z){
        cout << x << "," << y << "," << z << endl;
    }

    template<class T, class S>
    void print(pair<T, S> p){
        cout << p.first << ", " << p.second << endl;
    }

    template<
        typename TYPE,
        std::size_t SIZE
    >
    void print(const TYPE (&array)[SIZE]){
        int lim = array_length(array);
        for(int i=0; i<lim; i++){
            if(i) cout << " ";
            cout << array[i];
        }
        cout << endl;
    }

    template<class S>
    void print(vector<S> v){
        for(int i=0; i<v.size(); i++){
            if(i) cout << " ";
            cout<< v[i];
        }
        cout << endl;
    }

    template<class S>
    void print(vector<vector<S> > vv){
        for(int i=0; i<vv.size(); i++){
            for(int j=0; j<vv[i].size(); j++){
                if(j) cout << " ";
                cout << vv[i][j];
            }
            cout << endl;
        }
    }

    void yesno(bool x){
        if(x) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
};
using namespace Printer;

int main(int argc, const char * argv[]) {
    //提出時、消す----//


    // input
    cout << fixed << setprecision(10);
    ll N; cin >> N;
    ll ans = 0;
    ans += N / 500 * 1000;
    N %= 500;
    ans += N/5 * 5;
    N %= 5;
    print(ans);
    
    
    return 0;
}


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

int main(){
        const int n = 6;
        int dice[n] ;
        string s;
        string haki;
        const int dice_tem[4][6] ={ {2,6,3,4,1,5},{5,1,3,4,6,2},
                                    {4,2,1,6,5,3},{3,2,6,1,5,4}};
        int dice_result[6];
        for(int i = 0; i < n; i++){
                cin  >>dice[i];
        }
        getline(cin ,haki);
        getline(cin,s);
        int s_len = s.length();
        for(int i = 0; i < s_len;i++){
                int dice_flag = -1;
                switch(s[i]){
                case 78: //N
                        dice_flag = 0;
                        break;
                case 83: //S
                        dice_flag = 1;
                        break;
                case 69: //E
                        dice_flag = 2;
                        break;
                case 87: //W
                        dice_flag = 3;
                        break;
                default :
                        break;                
                }
                if(dice_flag == -1)continue;
                for(int i = 0; i < n ;i++){
                        dice_result[i] =
                         dice[dice_tem[dice_flag][i]-1];
                }
                for(int i = 0; i < n; i++)dice[i] = dice_result[i];
        }
        cout << dice[0] << endl;
        return 0;
}


Measured memory_bytes: 3216
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define fo(i,n) for(ll i=0;i<n;i++)
#define fo1(i,n) for(ll i=1;i<=n;i++)
#define loop(i,a,b)for(ll i=a;i<=b;i++)
#define loopr(i,a,b)for(ll i=b;i>=a;i--)
#define vll vector<ll> 
#define vvl vector<vll>
#define pii pair<ll,ll>
#define F first
#define S second
#define endl "\n"
#define M 1000000007
ll max(ll a,ll b){if (a>b) return a; else return b;}

ll po(ll x, ll y){
    if(y==0)
    return 1;
    if(y%2){
        return ((x)*(po(x,y/2)%M)*(po(x,y/2)%M))%M;
    }
   return ((po(x,y/2)%M)*(po(x,y/2)%M))%M;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll t=1;
    //cin>>t;
    while(t--){
        ll n;
        cin>>n;
        if(n>=30)
        cout<<"Yes"<<endl;
        else
        cout<<"No"<<endl;
    }
return 0;
}

Measured memory_bytes: 3648