akhauriyash/Code-Regression huggingface dataset:
#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,B,C,X,Y; cin >> A >> B >> C >> X >> Y;
    int piza = 0;

    if(A+B > 2 * C) {
        if(X >= Y) {
            piza += 2 * Y * C;
            if(A > 2 * C) {
                //cout << "reach pt0" << endl;
                piza += 2 * (X - Y) * C;
            } else {
                piza += A * (X - Y); 
                //cout << "reach pt1" << endl;
            }
        } else {
            piza += 2 * X * C;
            if(B > 2 * C) {
                piza += 2 * (Y - X) * C;
                //cout << "reach pt2" << endl;
            } else {
                piza += B * (Y - X);
                //cout << "reach pt3" << endl;
            }
        }
    } else {
        if(X >= Y) {
            piza += A * Y + B * Y;
            if(A > 2 * C) {
                piza += 2 * C * (X - Y);
                //cout << "reach pt4" << endl;
            } else {
                piza += A * (X - Y);
                //cout << "reach pt5" << endl;
            }
        } else {
            piza += A * X + B * X;
            if(B > 2 * C) {
                piza += 2 * C * (Y - X);
                //cout << "reach pt6" << endl;
            } else {
                piza += B * (Y - X);
                //cout << "reach pt7" << endl;
            }
        }
    }
    cout << piza << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cmath>
using namespace std;
 
typedef long long ll;


int main(){
	int n;
	cin >> n;
	vector<ll> v(n);
	
	for(int i=0;i<n;++i){
		cin >> v[i];
		if(i >0 &&  v[i-1] < v[i]){
			v[i]--;
		}
	}
	
	bool f = true;
	
	for(int i=1;i<n;++i){
//		cout << v[i] << " ";
		if(v[i-1] > v[i]){
			f = false;
			break;
		}
	}
	
	if(f) cout << "Yes" <<endl;
	else cout << "No" <<endl;
	
	return 0;
}



Measured memory_bytes: 1152
/// Rustで競技プログラミングの入力をスッキリ記述するマクロ
///
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
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")
    };
}

#[inline]
#[allow(dead_code)]
fn gcd(mut m: u64, mut n: u64) -> u64 {
    if m < n {
        std::mem::swap(&mut m, &mut n);
    }

    loop {
        let k = m % n;
        if k == 0 {
            return n;
        }

        m = n;
        n = k;
    }
}

#[inline]
#[allow(dead_code)]
fn lcm(m: u64, n: u64) -> u64 {
    m / gcd(m, n) * n
}

macro_rules! eprint(
    ($($arg:tt)*) => { {
        use std::io::Write;
        let r = write!(&mut ::std::io::stderr(), $($arg)*);
        r.expect("failed printing to stderr");
    } }
);

macro_rules! eprintln(
    ($($arg:tt)*) => { {
        use std::io::Write;
        let r = writeln!(&mut ::std::io::stderr(), $($arg)*);
        r.expect("failed printing to stderr");
    } }
);

macro_rules! dbg {
    ($val:expr) => {
        // Use of `match` here is intentional because it affects the lifetimes
        // of temporaries - https://stackoverflow.com/a/48732525/1063961
        match $val {
            tmp => {
                eprintln!(
                    "[{}:{}] {} = {:#?}",
                    file!(),
                    line!(),
                    stringify!($val),
                    &tmp
                );
                tmp
            }
        }
    };
}

fn main() {
    input! {
        n: chars,
    }

    let answer = n.iter().filter(|&&c| c == '2').count();
    println!("{}", answer);
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

#define YES(n) cout << (n?"YES":"NO")<<endl;
#define Yes(n) cout << (n?"Yes":"No")<<endl;

int main() {
    int a, b;
    cin >> a >> b;
    if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0)cout << "Possible" << endl;
    else cout << "Impossible" << endl;
}

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

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

    int ans = 0;
    int len = S.length() - 1;
    for (int i = 0; i <= len / 2; i++) {
        if (S[i] != S[len - i]) {
            ans++;
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>

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

int main()
{
    int a,b;
    cin>>a>>b;
    for(int i=1;i<4;i++)
    {
        if(i!=a && i!=b)
        {
            cout<<i<<endl;
            return 0;
        }
    } 
    return 0;
}

Measured memory_bytes: 256
function Main(input) {
  input = input.split("\n");
  var S = input[0].split("");
  var dp = new Array(S.length+1);
  var mod = Math.pow(10,9)+7;
  for(var i=0;i<dp.length;i++){
    var sub = new Array(13).fill(0);
    dp[i]=sub;
  }
  dp[0][0]=1;
  for(var i=1;i<dp.length;i++){
    for(var j=0;j<13;j++){
      if(dp[i-1][j]!=0){
        if(S[i-1]=="?"){
          for(var k=0;k<10;k++){
            dp[i][(parseInt(j*10)+k)%13]=(dp[i][(parseInt(j*10)+k)%13]+(dp[i-1][j])%mod)%mod;
          }
        }else{
          dp[i][(parseInt(j*10)+parseInt(S[i-1]))%13]=(dp[i][(parseInt(j*10)+parseInt(S[i-1]))%13]+(dp[i-1][j])%mod)%mod;
        }
      }
    }
  }
  var ans = dp[dp.length-1][5];

  console.log('%s', ans);
  return ans;
}

function debug(n){
  var input = document.getElementById("input"+n).value;
  var ans=Main(input);
  var result="WA";
  if(ans==document.getElementById("output"+n).value.split("\n")[0]){
    result="AC";
  }
  document.getElementById("result"+n).innerHTML=result;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 53040
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef double db; //
typedef string str; //
//
typedef pair<int,int> pi;
typedef pair<ll,ll> pl; //
typedef pair<db,db> pd; //
//
typedef vector<int> vi; 
typedef vector<ll> vl; //
typedef vector<db> vd; //
typedef vector<str> vs; //
typedef vector<pi> vpi;
typedef vector<pl> vpl; //
typedef vector<pd> vpd; //
 
typedef tree<pi, null_type, less<pi>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
 
#define mp make_pair
#define f first
#define s second
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend() //
#define rsz resize
#define ins insert //
#define ft front() //
#define bk back()
#define pf push_front //
#define pb push_back
#define eb emplace_back //
#define lb lower_bound //
#define ub upper_bound //
 
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)
 
const int MOD = 1e9+7; // 998244353;
const int MX = 2e5+5; //
const ll INF = 1e18; //
const ld PI = acos((ld)-1);
const int xd[4] = {1,0,-1,0}, yd[4] = {0,1,0,-1}; //
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count()); //
//
template<class T> bool ckmin(T& a, const T& b) { 
	return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { //
	return a < b ? a = b, 1 : 0; } //
constexpr int pct(int x) { return __builtin_popcount(x); } //
constexpr int bits(int x) { return 31-__builtin_clz(x); } // floor(log2(x)) //
constexpr int cdiv(int a, int b) { return a/b+!(a<0||a%b == 0); } // division of a by b rounded up, assumes b > 0 //
// IGNORE
int fstTrue(function<bool(int)> f, int lo, int hi) {
	hi ++; assert(lo <= hi); // assuming f is increasing
	while (lo < hi) { // find first index such that f is true 
		int mid = (lo+hi)/2; 
		f(mid) ? hi = mid : lo = mid+1; 
	} 
	return lo;
}
template<class T> void remDup(vector<T>& v) { 
	sort(all(v)); v.erase(unique(all(v)),end(v)); }
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
 
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
// IGNORE
//
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int K;
	cin >> K;
	if(K % 2 == 0 || K % 5 == 0){
		cout << -1 << endl;
		return 0;
	}
	ll num = 7 % K;
	int idx = 1;
	while(num){
		num = (10 * num + 7) % K;
		idx++;
	}
	cout << idx << endl;
}


Measured memory_bytes: 3664
import bisect

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

ans = ''
if abs(max(As)) >= abs(min(As)):
    for i in range(1, N):
        while As[i - 1] - As[i] > 0:
            Bs = [(As[i], i) for i in range(N)]
            Bs.sort()

            key = (As[i - 1] - As[i], 0)
            iB = bisect.bisect_left(Bs, key)

            if iB >= N: iB = N - 1
            As[i] += Bs[iB][0]

            ans += str(Bs[iB][1] + 1) + ' ' + str(i + 1) + '\n'

else:
    for i in range(N - 1)[::-1]:
        while As[i] - As[i + 1] > 0:
            Bs = [(As[i], i) for i in range(N)]
            Bs.sort()

            key = (-(As[i] - As[i + 1]), 0)
            iB = bisect.bisect_right(Bs, key) - 1

            if iB < 0: iB = 0
            As[i] += Bs[iB][0]

            ans += str(Bs[iB][1] + 1) + ' ' + str(i + 1) + '\n'

print(ans.count('\n'))
print(ans, end='')


Measured memory_bytes: 3064
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
	public static void main(String[] arg) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int d = sc.nextInt();
		int x = sc.nextInt();
		int a[] = new int[n];

		IntStream.range(0, n).forEach(i -> a[i] = sc.nextInt());

		int sum = x;
		for (int i = 0; i < n; i++) {
			if ((d % a[i]) == 0) {
				sum += (d / a[i]);
			} else {
				sum += (d / a[i]) + 1;
			}
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 28884
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<cassert>
 
using namespace std;
 
#define sz(x) (int)(x.size())
#define fr(i, a, b) for(int i=a;i<b;++i)
#define fdr(i, a, b) for(int i=b-1;i>=a;--i)
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
 
/////////////////
 
int const N = 55;
int n, p, a[N];
ll d[N][2];
 
void solve(){
	cin >> n >> p;
	fr(i, 0, n){
		cin >> a[i];
		a[i] %= 2;
	}
	d[0][0] = 1;
	fr(i, 0, n){
		fr(j, 0, 2) d[i+1][j] += d[i][j];
		fr(j, 0, 2) d[i+1][(a[i] + j) % 2] += d[i][j];
	}
	ll ans = d[n][p];
	cout << ans << endl;
}
 
int main(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
 
	solve();
 
 
	return 0;
}

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

#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

typedef long long ll;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s, t;
  cin >> s >> t;
  int n = (int) s.size(), m = (int) t.size();
  int ans = (int) 2e9;
  for (int i = 0; i + m - 1 < n; i++) {
    int cnt = 0;
    for (int j = 0; j < m; j++) {
      cnt += (s[i + j] != t[j]);
    }
    ans = min(ans, cnt);
  }
  cout << ans << '\n';
  return 0;
}


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

int main() {
    string s; cin >> s;
    string s1 = s;
    string rs1 = s;
    reverse(rs1.begin(), rs1.end());
    string s2 = s.substr(0, (s.size()-1)/2);
    string rs2 = s2;
    reverse(rs2.begin(), rs2.end());
    string s3 = s.substr((s.size()+3)/2-1);
    string rs3 = s3;
    reverse(rs3.begin(), rs3.end());
    if (s1 == rs1 && s2 == rs2 && s3 == rs3) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
// sort(a.begin(), a.end(), std::greater<int>());

/*
std::vector<std::string> split(const std::string &input, char delimiter)
{
    std::istringstream stream(input);

    std::string field;
    std::vector<std::string> result;
    while (std::getline(stream, field, delimiter))
    {
        result.push_back(field);
    }
    return result;
}
*/
/*
int dfs(int foo, int timer)
{
    //foo is node number
    if (finds[foo].first != -1)
        return timer;
    finds[foo].first = ++timer;
    int result = timer;
    if (data[foo].size() != 0)
    {
        rep(i, data[foo].size())
        {
            result = dfs(data[foo][i], result);
        }
    }
    finds[foo].second = ++result;
    return result;
}
*/
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    a+=b;
    c+=d;
    if(a<c){
        cout<<"Right"<<endl;
    }
    else if(c<a){
        cout<<"Left"<<endl;
    }else{
        cout<<"Balanced"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

constexpr ll INF = (ll)1e18;

int main(void){
    int N; cin >> N;
    ll res = 1LL;
    vector<ll> A(N);
    for (int i = 0; i < N; ++i){
        cin >> A[i];
        if (A[i] == 0){
            cout << 0 << endl;
            return 0;
        }
    }
    for (int i = 0; i < N; ++i){
        if (res > INF / A[i]){
            cout << -1 << endl;
            return 0;
        }
        res *= A[i];
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 4052
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm>
#include <numeric>  // std::accumulate(m.begin(), m.end(), 0LL);
#include <functional>
#include <cassert>
#include <cctype>  // std::islower(), std::isupper(), std::tolower, std::toupper
#include <iomanip> // std::std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

typedef long long ll;

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

  int ans = 0;
  for(int i=0; i<N; i++) {
    int l, r; std::cin >> l >> r;
    ans += r-l+1;
  }
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
b = [int(x) for x in input().split()]
ans = [0 for x in range(n)]

ans[n-1] = b[n-2]
ans[0] = b[0]
for i in range(1,n-1) :
  j = n - 1 - i
  ans[j] = min(b[j],b[j-1])
  
print(sum(ans))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <atcoder/string>
using namespace std;
using namespace atcoder;
int main(){
  string S;
  cin >> S;
  vector<int> sa = suffix_array(S);
  vector<int> lcp = lcp_array(S, sa);
  int N = S.size();
  long long ans = (long long) N * (N + 1) / 2;
  for (int i = 0; i < N - 1; i++){
    ans -= lcp[i];
  }
  cout << ans << endl;
}

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

int main()
{
    int N;
    long Y;
    cin >> N;
    cin >> Y;
    for (int i = N; i >= 0; i--)
    {
        int x = i;
        for (int j = N - i; j >= 0; j--)
        {
            int y = j;
            int z = N - i - j;
            if (10000 * x + 5000 * y + 1000 * z == Y)
            {
                cout << x << " " << y << " " << z << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
}

Measured memory_bytes: 384
n = int(input())
hn = [int(i) for i in input().split()]
max_cnt, cnt = 0, 0
for i in range(1, n):
    if hn[i - 1] - hn[i] >= 0:
        cnt += 1
    else:
        cnt = 0
    if max_cnt < cnt:
        max_cnt = cnt        
print(max_cnt)

Measured memory_bytes: 14252
#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> pll;
typedef pair<int,int> pii;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  int n; cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  vector<ll> s(n+1);
  rep(i,n){
    s[i+1]=s[i]+a[i];
  }
  map<ll,ll> mp;
  rep(i,n+1){
    mp[s[i]]++;
  }
  ll ans=0;
  for(auto c:mp){
    ans+=c.second*(c.second-1)/2;
  }
  cout << ans << endl;
  
}

Measured memory_bytes: 15104
#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T &x) {
    int f = 0;
    cerr << '{';
    for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}
#ifdef LOCAL
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif

#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)

typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll A, B;
    cin >> A >> B;
    if (A >= 13) {
        cout << B << endl;
    } else if (A >= 6) {
        cout << B / 2 << endl;
    } else {
        cout << 0 << endl;
    }

    return 0;
}


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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

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

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

int m,n;

int a[128];
int memo[1<<11][1<<11];

int rec(int mask,int yes,int depth){
	int& ret=memo[mask][yes];
	if(ret>=0) return ret;

	ret=m;
	vi cur;
	rep(i,n){
		bool ok=true;
		rep(j,m) if(mask&(1<<j)) if( (yes&(1<<j))!=(a[i]&(1<<j)) ) ok=false;
		if(ok) cur.pb(a[i]);
	}

	if(cur.size()<=1) return ret=depth;

	rep(i,m){
		if(mask&(1<<i)) continue;
		int nmask=mask|(1<<i);
		int nyes=yes|(1<<i);
		int nno=yes;
		int cur=max(rec(nmask,nyes,depth+1),rec(nmask,nno,depth+1));
		ret=min(ret,cur);
	}
	return ret;
}

int main(void){
	while(cin >> m >> n,m){
		rep(i,n){
			string in;
			cin >> in;
			a[i]=0;
			rep(j,m) a[i]=(a[i]<<1)|(in[j]-'0');
		}
		clr(memo,-1);
		cout << rec(0,0,0) << endl;
	}
	return 0;
}

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


long long int getAns(int a,int n){
  if(a % 2 == 0){
    long long int k1 = n / a;
    long long int k2 = (n + (a / 2)) / a;
    return (k1 * k1 * k1) + (k2 * k2 * k2);
  }
  else{
    long long int k = n / a;
    return (k * k * k);
  }
}

int main(){
  long long int N;
  int K;
  cin >> N >> K;

  cout << getAns(K, N) << endl;
  return 0;
}

Measured memory_bytes: 256
// Problem : C - Make a Rectangle
// Contest : AtCoder Regular Contest 081
// URL : https://atcoder.jp/contests/arc081/tasks/arc081_a
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define size(x) (int)x.size()

const int N = 1e6 + 1, mod = 1e9 + 7, inf = 2e9;

int n;
vector<int> v;
map<int, int> cnt;

int main() { cin.tie(0)->sync_with_stdio(0);
	cin >> n;
	for (int i = 1, x; i <= n; i++) {
		cin >> x;
		cnt[x]++;
	}
	for (auto x : cnt) {
		if (x.second >= 4) {
			v.push_back(x.first);
		}
		if (x.second >= 2) {
			v.push_back(x.first);
		}
	}
	if (size(v) < 2) return cout << 0, 0;
	sort(v.begin(), v.end());
	cout << 1ll * v[size(v) - 2] * v.back();
}


Measured memory_bytes: 4992
/**
 * File    : D.cpp
 * Author  : Kazune Takahashi
 * Created : 2018-4-14 21:15:37
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int N;
int a[100010];

int main()
{
  cin >> N;
  for (auto i = 0; i < N; i++)
  {
    cin >> a[i];
  }
  int n = *max_element(a, a + N);
  int k = n+1;
  for (auto i = 0; i < N; i++)
  {
    if (n > a[i] && abs(n/2-a[i]) < abs(n/2-k)) {
      k = a[i];
    }
  }
  cout << n << " " << k << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    #define FAST ios_base::sync_with_stdio(false);cin.tie(0);
    const double EPS = 1e-9;
    const double PI = acos(-1);
    const int knightDir[8][2] = {{-2,-1},{-2,1},{-1,2},{1,2},{2,-1},{2,1},{-1,-2},{1,-2}};
    //const int dx[]={0,0,0,1,1,1,-1,-1,-1};
    //const int dy[]={-1,0,1,-1,0,1,-1,0,1};
    const int dx[] = {0 , 1 , 0 , -1};
    const int dy[] = {1 , 0 , -1 , 0};
    //#define MOD         1000000007LL
    #define MAX         1005
    const ll MOD = 1000000000 + 7;

    bool vis[MAX][MAX];
    int cost[MAX][MAX];
    string maze[MAX];
    int w , h ,cx , cy , fx , fy;
    bool isSafe(int x , int y)
    {
        if(x < 0 || x >= w || y < 0 || y >= h)return false;
        else return true;
    }
    int main()
    {
        FAST
        int t;
        t = 1;

        while(t--)
        {

           cin >> w >> h;
           cin >> cx >> cy;
           cx-- , cy--;
           cin >> fx >> fy;
           fx--,fy--;

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

           memset(cost , -1 , sizeof cost);

           deque<pair <int , int > > q;
           q.push_front({cx , cy});
           cost[cx][cy] = 0;

           while(!q.empty())
           {

               pair <int, int> t = q.front();
               q.pop_front();

               if(vis[t.first][t.second])
               {
                   continue;
               }
               vis[t.first][t.second] = 1;

               for(int i = 0 ; i < 4 ; i++)
               {
                   int nx = t.first + dx[i];
                   int ny = t.second + dy[i];

                   if(!isSafe(nx , ny))continue;
                   if(maze[nx][ny] == '#')continue;

                   if(cost[nx][ny] == -1 || cost[t.first][t.second] < cost[nx][ny])
                   {
                       cost[nx][ny] = cost[t.first][t.second];
                       q.push_front({nx , ny});
                   }

               }

               for(int i = -2 ; i < 3 ; i++)
               {
                   for(int j = -2 ; j < 3 ; j++)
                   {
                       int nx = t.first + i;
                       int ny = t.second + j;

                       if(!isSafe(nx , ny))continue;
                       if(maze[nx][ny] == '#')continue;

                       if(cost[nx][ny] == -1 || cost[t.first][t.second] + 1 < cost[nx][ny])
                   {
                       cost[nx][ny] = cost[t.first][t.second] + 1;
                       q.push_back({nx , ny});
                   }

                   }
               }

           }

           cout << cost[fx][fy] << endl;
        }
    }



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

#define ll long long int
#define db double
#define fl float
#define endl '\n'

#define mod (ll)(1000000007)
#define mod1 (ll)998242353
#define mod2 (ll)998244353
#define PI 3.1415926535897932384626433832795

#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp(x,y) make_pair(x,y)
#define pb push_back
#define pob pop_back

#define Sort(v) sort(v.begin(),v.end())
#define Sortd(v) sort(v.begin(),v.end(),greater<>())

#define f(i,n) for(int i=0;i<n;i++)
#define f1(i,n) for(int i=1;i<n;i++)
#define rf(i,n) for(int i=n-1;i>=0;--i)
#define rf1(i,n) for(int i=n-1;i>=1;--i)
#define rep(i,a,b) for(int i=a;i<b;++i)
#define repn(i,a,b) for(int i=a;i<=b;++i)

#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<vi> vvi;
typedef priority_queue<int> pqi;
typedef priority_queue<ll> pql;

//nC2
ll C2(ll n){
    ll ans= max(((n*(n-1))/2),(ll)0);
    return ans;
}
//square
ll sq(ll n){
    return n*n;
}

//GCD
ll gcd(ll a,ll b){
    if(a<b){
        swap(a,b);
    }
    if(b==0){
        return a;
    }    
    else{
        return gcd(b,a%b);
    }
}

//sort pair by second values
bool sortsec(const pair<ll,ll> &a, const pair<ll,ll> &b){ 
    return (a.second < b.second); 
}


//Binary Exponentiation
ll BinExp(ll a, ll b, ll m){
    a%=m;
    ll res =1;
    while(b>0){
        if(b&1){
            res = (res * a)%m;
        }
        a=(a*a)%m;
        b>>=1;
    }
    return res;
}


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

    int n;
    cin>>n;
    int d1[n],d2[n];

    f(i,n)cin>>d1[i]>>d2[i];
    //f(i,n)cin>>d2[i];

    
    bool f=0;
    f(i,n-2){
        if(d1[i]==d2[i] && d1[i+1]==d2[i+1] && d1[i+2]==d2[i+2]){
            cout<<"Yes"<<endl;
            f=1;
            break;
        }
    }
    if(!f)cout<<"No"<<endl;
    

    


    return 0;
}



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

int main() {
  int N;
  cin >> N;
  int a = 0;
  int n = N;
  
  for(int i = 0; i<9; i++){
    a = a + (n%10);
    n /= 10;
  }
  
  if(N%a == 0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}
    


Measured memory_bytes: 256
from itertools import groupby

s = input()
g = groupby(s)

res = []
for k, v in g:
    res.append((k, str(len(list(v)))))

result = [int(x[1]) for x in res if x[0] == "R"]

ans = 0
if len(result) != 0:
    ans = max(result)

print(ans)

Measured memory_bytes: 9180
if __name__ == "__main__":
    n, k = map(int, input().split())
    x = list(map(int, input().split()))

    x.sort()
    xmin = x[0]
    xmax = x[k-1]

    ans = 0
    if xmin < 0 and xmax >= 0:
        ans = min([abs(xmin), abs(xmax)]) * 2 + max([abs(xmin), abs(xmax)])
    else:
        ans = max([abs(xmin), abs(xmax)])

    for i in range(n - k + 1):
        xmin = x[i]
        xmax = x[i + k - 1]
        if xmin < 0 and xmax >= 0:
            tmp = min([abs(xmin), abs(xmax)]) * 2 + max([abs(xmin), abs(xmax)])
        else:
            tmp = max([abs(xmin), abs(xmax)])
        if tmp < ans:
            ans = tmp

    print(ans)


Measured memory_bytes: 14780
package main

import "fmt"

func main() {
	// Code for B - Choose Integers
	var A, B, C int
	fmt.Scanf("%d %d %d", &A, &B, &C)

	//fmt.Println(A, B, C)
	var flag int = 0
	for i := 1; i <= 100; i++ {
		temp := (i * A) % B
		//fmt.Println(A)
		if temp == C {
			flag = 1
		}
	}
	if flag == 1 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


Measured memory_bytes: 1832
#include<bits/stdc++.h>
#define lson l, mid, i<<1
#define rson mid+1, r, i<<1|1
#define PII pair<int, int>
using namespace std;
typedef long long LL;
//const int MOD = 1e9+7;
const auto INF  = 0x3f3f3f3f;
const int N = 2e5+5;

int a[N], b[N*2];

int main() {
    int n;
    scanf("%d", &n);
    for(int i=1; i<=n; i++)
        scanf("%d", &a[i]);
    int L = N-5, R = N-5;
    b[L] = a[1];
    for(int i=2; i<=n; i++) {
        if(i%2 == 0) {
            b[--L] = a[i];
        } else
            b[++R] = a[i];
    }
    if(n%2==0) {
        for(int i=L; i<=R; i++)
            printf("%d%c", b[i], i==R ? '\n' : ' ');
    } else {
        for(int i=R; i>=L; i--)
            printf("%d%c", b[i], i==L ? '\n' : ' ');
    }
}


Measured memory_bytes: 3712
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef unsigned long long ull;
using namespace std;

const int MAX_ROW = 100005;
const int MAX_COL = 61;
struct BitMatrix {
    int H, W;
    bitset<MAX_COL> val[MAX_ROW];
    BitMatrix(int m, int n) : H(m), W(n) {}
    inline bitset<MAX_COL> & operator [] (int i) { return val[i]; }
};
int GaussJordan(BitMatrix &A, bool is_extended = false) {
    int rank = 0;
    for (int col = A.W - 1; col >= 0; col--) {
        if (is_extended && col == A.W - 1) break; // 拡大係数行列。この場合、最後の列は掃き出さない
        int pivot = -1;
        for (int row = rank; row < A.H; row++) if (A[row][col]) { pivot = row; break; }
        if (pivot == -1) continue;
        swap(A[pivot], A[rank]);
        for (int row = 0; row < A.H; row++) if (row != rank && A[row][col]) A[row] ^= A[rank];
        rank++;
    }
    return rank;
}

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

    int n;
    cin >> n;

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

    BitMatrix A(n, MAX_COL);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < MAX_COL; j++) {
            if (!(total & (1LL << j)) && (a[i] & (1LL << j))) {
                A[i][j] = 1;
            }
        }
    }

    int rank = GaussJordan(A);

    ull blue = 0;
    for (int i = 0; i < rank; i++) {
        blue = max(blue, blue ^ A[i].to_ullong());
    }

    cout << blue + (total ^ blue) << "\n";
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<map>
#include<queue>
#include<set>

using namespace std;
typedef pair<int,int> PII;
typedef long long ll;

int main(){
  long long ans[20];
	ans[0] = 1;
	for(int i=1;i<20;i++){
		ans[i] = ans[i-1] * 3 + 1;
	}
	int n;
	while(cin>>n){
		if(n%2==1){
			if(n==1) cout<<1<<endl;
			else	cout<<ans[(n-2)/2]*4+1<<endl;
		}
		else{
			cout<<ans[(n-2)/2]*2<<endl;
		}
	}
  return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){
	int m,n;
	long long ans;
	scanf("%d %d",&n,&m);
	ans = 100*n + 1800*m;
	for(int i=0;i<m;i++) ans *= 2;

	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 128
n = int(input())
s = list(input())
if n % 2 == 1:
  print("No")
else:
  half_s1 = "".join(s[0:n//2])
  half_s2 = "".join(s[n//2:n])
  if half_s1 == half_s2:
    print("Yes")
  else:
    print("No")

Measured memory_bytes: 38256
#pragma target("avx")
#pragma optimize("O3")
#include<bits/stdc++.h>
using ll = int_fast64_t;

#define REP(i,b,e) for(ll i=b; i<e; i++)
#define ALL(vec) vec.begin(),vec.end()

const int MOD = 1e9+7;
const ll INF = 1e18;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int d;
ll c[26], s[370][26], last[370][26], t[370];


ll calc(){
        ll score = 0;
        REP(i, 1, d+1){
                REP(j, 0, 26){
                        if(j==t[i]-1){
                                score += s[i][j];
                                last[i][j] = i;
                        }else last[i][j] = last[i-1][j];
                        score -= c[j] * (i - last[i][j]);
                }
        }
        return score;
};

int main(){
        scanf("%d", &d);
        REP(i, 0, 26) scanf("%ld", &c[i]);
        REP(i, 1, d+1) REP(j, 0, 26) scanf("%ld", &s[i][j]);
        REP(i, 1, d+1) t[i] = 0;
        REP(i, 0, 1+d) REP(j, 0, 26) last[i][j] = 0;

        ll score = calc();

        ll limit = 0;
        while(true){
                REP(i, 1, d+1) REP(j, 0, 26) {
                        ll prev = t[i];
                        t[i] = j;
                        ll newscore = calc();
                        if(newscore > score) score = newscore;
                        else t[i] = prev;
                        if(limit++ > 200000){
                                REP(i, 1, d+1) printf("%ld\n", t[i]);
                                return 0;
                        }
                }
        }
        return 0;
}


Measured memory_bytes: 3988
/**
 *    author:  tourist
 *    created: 27.11.2019 07:34:28       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long total = accumulate(a.begin(), a.end(), 0LL);
  int ans = 0;
  long long p10 = 1;
  while (p10 <= total) {
    vector<long long> f(1, 0);
    for (long long x : a) {
      int sz = (int) f.size();
      f.resize(2 * sz);
      for (int i = 0; i < sz; i++) {
        f[i + sz] = (f[i] + x) % (10 * p10);
      }
      sort(f.begin(), f.end());
      int new_sz = 0;
      for (int i = 0; i < 2 * sz; i++) {
        if (i > 0 && i < 2 * sz - 1 && f[i + 1] - f[new_sz - 1] <= p10) {
          continue;
        }
        f[new_sz++] = f[i];
      }
      f.resize(new_sz);
    }
    ans += (int) (f.back() / p10);
    p10 *= 10;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <set>
using namespace std;
typedef pair<int, int> Pii;
int main() {
  int N, Q;
  cin >> N >> Q;
  static int memo[1000001];
  set<Pii> st;
  
  for(int q=0; q<Q; q++) {
    int a, v; cin >> a >> v;
    st.erase(Pii(-memo[a], a));
    memo[a] += v;
    st.insert(Pii(-memo[a], a));
    cout << st.begin()->second << ' ' << -st.begin()->first << endl;
  }
  
  return 0;
}

Measured memory_bytes: 9552
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>

using namespace std;
template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}

#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define REV(v) reverse(v.begin(),v.end())
#define SRTV(v) sort(v.begin(),v.end())
#define SRTAG(a,n) sort(a,a+n,greater<>())
#define MOD 1000000007

typedef long long ll;
typedef tuple<int,int,bool> Tb;

int atcoder(){
    //入力
    string a,b;
    cin >> a >> b;
    //処理
    //出力
    if(a==b) cout << "H" << ENT;
    else cout << "D" << ENT;
    return 0;
}

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


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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, a, b) for (int (i) = (a); (i) <= (b); (i)++)
#define ROF(i, a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define REP(i, n) FOR(i, 0, (n)-1)
#define sqr(x) ((x) * (x))
#define all(x) (x).begin(), (x).end()
#define reset(x, y) memset(x, y, sizeof(x))
#define uni(x) (x).erase(unique(all(x)), (x).end());
#define BUG(x) cerr << #x << " = " << (x) << endl
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define _1 first
#define _2 second
#define chkmin(a, b) a = min(a, b)
#define chkmax(a, b) a = max(a, b)

const int maxn = 212345;

int n, q;
char s[maxn];
pii op[maxn];

int main() {
  scanf("%d%d%s", &n, &q, s + 1);
  FOR(i, 1, q) {
    char a[5], b[5];
    scanf("%s%s", a, b);
    op[i] = {a[0] - 'A', b[0] == 'L' ? -1 : 1};
  }
  int lo = 1, hi = n;
  while (lo < hi) {
    int mi = lo + hi + 1 >> 1, p = mi;
    FOR(i, 1, q) {
      if (s[p] - 'A' == op[i]._1) p += op[i]._2;
      if (p < 1 || p > n) break;
    }
    if (p < 1) lo = mi;
    else hi = mi - 1;
  }
  if (lo == 1) {
    int p = 1;
    FOR(i, 1, q) {
      if (s[p] - 'A' == op[i]._1) p += op[i]._2;
      if (p < 1 || p > n) break;
    }
    if (p >= 1) lo--;
  }
  int ans = n - lo;
  lo = 1, hi = n;
  while (lo < hi) {
    int mi = lo + hi >> 1, p = mi;
    FOR(i, 1, q) {
      if (s[p] - 'A' == op[i]._1) p += op[i]._2;
      if (p < 1 || p > n) break;
    }
    if (p > n) hi = mi;
    else lo = mi + 1;
  }
  if (lo == n) {
    int p = n;
    FOR(i, 1, q) {
      if (s[p] - 'A' == op[i]._1) p += op[i]._2;
      if (p < 1 || p > n) break;
    }
    if (p <= n) lo++;
  }
  ans -= n - lo + 1;
  printf("%d", ans);
}


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

int main(){
	char b;
	int count;
	int max = 0;
	bool flag = false;

	while(cin >> b){
		if((b == 'A') || (b == 'T') || (b == 'G') || (b == 'C')){
			if(flag){
				++count;
			}else{
				flag = true;
				count = 1;
			}
		}else{
			count = 0;
		}

		if(count > max){
			max = count;
		}
	}

	cout << max << endl;

	return 0;
}

Measured memory_bytes: 256
int main(void) {
	int n;
	scanf("%d", &n);
	judge3(n);
	return 0;
}

void judge3(int n) {
	int i = 1, x;
	do {
		x = i;
		if (i % 3 == 0) { //3の倍数
			printf(" %d", i);
		}
		else { //3の倍数ではない
			do {
				if (x % 10 == 3) { //下一桁が3
					printf(" %d", i);
					x = 0;
				}
				else{ //2桁目以降に3があるか確認
					x /= 10;
					if (x % 10 == 3) { //下一桁が3
						printf(" %d", i);
						x = 0;
					}
				}
			} while (x);
		}
		i++;
	} while (i <= n);
	printf("\n");
}


Measured memory_bytes: 2040
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
 size_t strlen(const char *s);
#define rep(i,n) for(long long int i=0;i<n;i++)
#define sz(x) ((int)(x).size())

using namespace std;
struct ToUpper {
    char operator()(char c) { return toupper(c); }
};
struct ToLower {
    char operator()(char c) { return tolower(c); }
};
const int N=200010;
const int P=1000000007;
using ll = long long;

//絶対値
int ze(int a, int b){
	if(a>b){
		return a-b;
	}else{
		return b-a;
	}
}
//小さい方
long long int min(long long int a,long long int b){
	if(a>b){
		return b;
	}else{
		return a;
	}
}
//大きい方
long long int max(long long int a,long long int b){
	if(a>b){
		return a;
	}else{
		return b;
	}
}
// a^n mod 
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod 
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

//mod掛け算
long long mt(long long a, long long b, long long mod){
	return (a*b)%mod;
}

//メモ

/*
	memset(b, '\0', sizeof(b));
初期化*/

/*
	char s[N];
	strlen(s)
*/

/*
	if(  <  )puts("Yes");
	else puts("No");
*/

/*文字列比較
if(strcmp(name[i],s)==0)
*/

/*
	graph[a].push_back(b);//graph[a][i番目に入れた]==b
	graph[j].size()	//forで回すときとか

*/

/*添字1がa個、2がb個
  vector<vector<ll>> map(a,vector<ll>(b));
*/

int main(){
  ll x;
  cin>>x;
  	if(  x>=30  )puts("Yes");
	else puts("No");
}
    

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1000000007LL;
const int INF = LLONG_MAX;

signed main(){
    
    int n, m; cin >> n >> m;
    vector<pair<int, int> > p(n);
    for(int i = 0; i < n; i++){
        int a, b; cin >> a >> b;
        p[i] = {a, b};
    }
    sort(p.begin(), p.end());

    int ans = 0;
    for(int i = 0; i < n; i++){
        if(p[i].second <= m){
            m -= p[i].second;
            ans += p[i].second * p[i].first;
        }else{
            ans += m * p[i].first;
            break;
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;

namespace AtCoder_Beginner_Contest_128
{
    class Program
    {
        static public int[] SIn() { return ReadLine().Split().Select(int.Parse).ToArray(); }
        static void Main(string[] args)
        {
            var NK = SIn();
            var N = NK[0];
            var K = NK[1];
            var Vs = SIn();

            var max = 0;
            var lmax = Math.Min(K, N);
            for (var left = 0; left <= lmax; ++left)
            {
                var rmax = Math.Min(N - left, K - left);
                for (var right = 0; right <= rmax; ++right)
                {
                    var temochi = new List<int>(K);
                    for (var i = 0; i < left; ++i)
                    {
                        temochi.Add(Vs[i]);
                    }
                    for (var i = 0; i < right; ++i)
                    {
                        temochi.Add(Vs[N - 1 - i]);
                    }
                    temochi.Sort();
                    var start = 0;
                    var tmax = Math.Min(temochi.Count, K - (left + right));
                    for (start = 0; start < tmax; ++start)
                    {
                        if (0 <= temochi[start])
                            break;
                    }
                    var sum = 0;
                    for (; start < temochi.Count; ++start)
                    {
                        sum += temochi[start];
                    }
                    max = Math.Max(sum, max);
                }
            }
            WriteLine(max);
        }
    }
}

Measured memory_bytes: 13396
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;

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

    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        String S = scan.next();
        char[] d = S.toCharArray();
        BIT[] bits = new BIT[26];
        for (int i = 0; i < 26; i++) {
            bits[i] = new BIT(d.length);
        }
        for (int i = 0; i < d.length; i++) {
            bits[(int) d[i]-'a'].add(i + 1, 1);
        }
        int Q = scan.nextInt();
        for (int i = 0; i < Q; i++) {
            int type = scan.nextInt();
            if (type == 1) {
                int index = scan.nextInt()-1;
                char old_c = d[index];
                char new_c = scan.next().toCharArray()[0];
                if (old_c == new_c) {
                    continue;
                }
                bits[(int)old_c-'a'].add(index+1, -1);
                bits[(int)new_c-'a'].add(index+1, 1);
                d[index] = new_c;
                continue;
            }
            int l = scan.nextInt();
            int r = scan.nextInt();
            int ans = 0;
            for (int j = 0; j < 26; j++) {
                if (0 < bits[j].sum(r)-bits[j].sum(l-1)) {
                    ans += 1;
                }
            }
            System.out.println(ans);
        }
    }
    class BIT {
        int size;
        int[] data;
        BIT(int N) {
            int size = 1;
            while (size < N) {
                size *= 2;
            }
            int[] data = new int[size * 2];
            Arrays.fill(data, 0);
            this.size = size;
            this.data = data;
        }
        void add(int k, int a) {
            while (k <= this.size) {
                this.data[k] += a;
                k += (k & -k);
            }
        }
        int sum(int i) {
            int sum = 0;
            while (0 < i) {
                sum += this.data[i];
                i -= (i & -i);
            }
            return sum;
        }
    }
}


Measured memory_bytes: 222104
s = input()
k = int(input())
lst = []
if len(s) > 5:
    for i in range(1, 6):
        for j in range(len(s) - i + 1):
            lst.append(s[j:j + i])
else:
    for i in range(1, len(s) + 1):
        for j in range(len(s) - i + 1):
            lst.append(s[j:j + i])
ulst = list(set(lst))
ulst.sort()
print(ulst[k - 1])


Measured memory_bytes: 5084