akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>

using namespace std;

typedef long long LL;
typedef vector<LL> VL;
#define REPD(i,a,b) for (LL i=(a);i<(b);i++)
#define REP(i,n) REPD(i,0,n)

LL inputValue(){
  LL a;
  cin >> a;
  return a;
};

string inputString(){
  string a;
  cin >> a;
  return a;
};

vector<LL> inputVector(LL a){
  vector<LL> rv;
  REP(i, a){
    LL input;
    cin >> input;
    rv.push_back(input);
  }
  return rv;
}

vector<string> inputVectorString(LL a){
  vector<string> rv;
  REP(i, a){
    string input;
    cin >> input;
    rv.push_back(input);
  }
  return rv;
}
vector<vector<LL>> inputVector2D(LL a, LL b){
  vector<vector<LL>> rv;
  REP(i, a){
    rv.push_back(vector<LL>());
    REP(j, b) {
      LL input;
      cin >> input;
      rv.at(i).push_back(input);
    }
  }
  return rv;
}

#if 1
#define debug(d) debug1(__LINE__,#d, d)
void debug1(LL line, const char* name, vector<LL>& v) {
  cout << line << ":" << name << ":vector<LL>(" << v.size() << ") ";
  REP(i, (LL)v.size()) {
    cout << v.at(i) << " ";
  }
  cout << endl;
}
void debug1(LL line, const char* name, LL i) {
  cout << line << ":" << name << ":LL " << i << endl;;
}
void debug1(LL line, const char* name, vector<string>& v) {
  cout << line << ":" << name << ":vector<string>(" << v.size() << ") ";
  REP(i, (LL)v.size()) {
    cout << v.at(i) << " ";
  }
  cout << endl;
}
void debug1(LL line, const char* name, vector<vector<LL>>& v) {
  cout << line << ":" << name << ":vector<vector<LL>>(" << v.size() << ") ";
  REP(i, (LL)v.size()) {
    REP(j, (LL)v.at(i).size()) {
      cout << v.at(i).at(j) << " ";
    }
    cout << ", ";
  }
  cout << endl;
}
#else
#define debug(n)
#endif

int main(int argc, const char * argv[]) {
	cout.precision(16);
  // source code

  unsigned long long n = inputValue();
  cout << n*(n-1)/2 << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int H, W;
  char S[100][101];
  int Calc[100][101];
  fill_n(*Calc, 100 * 101, -1);
  
  cin >> H >> W;
  for(int i = 0; i < H; i++) {
    cin >> S[i];
  }
  for(int i = 0; i < H; i++) {
    for(int j = 1; j <= W; j++) {
      if(S[i][j - 1] == 'c') Calc[i][j] = 0;
      else if(Calc[i][j - 1] == -1) Calc[i][j] = -1;
      else Calc[i][j] = Calc[i][j - 1] + 1;
    }
  }
  for(int i = 0; i < H; i++) {
    for(int j = 1; j <= W; j++) {
      if(j > 1) cout << " ";
      cout << Calc[i][j];
    }
    cout << endl;
  }
  return(0);
}

Measured memory_bytes: 1212
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define llu unsigned long long int
#define Endl endl
#define mod  998244353
#define mkp make_pair
#define pb push_back
#define cin(n) scanf("%d",&n)
#define cout(n) printf("%d ",n)
#define sf(n) scanf("%d",&n)
#define pf(n) printf("%d ",n)
#define bitget(n) __builtin_popcountll(n)
ll dx[] = {1,1,0,-1,-1,-1,0,1};
ll dy[] = {0,-1,-1,-1,0,1,1,1};
ll dxx[] = {1,-1,0,0};
ll dyy[] = {0,0,-1,1};
ll modexpo(ll x,ll y){if(y==0)return 1;if(y%2){ll viky=modexpo(x,y/2);
return (((x*viky)%mod)*viky)%mod;}else{ll viky=modexpo(x,y/2);return (viky*viky)%mod;
}}
ll gcd(ll a, ll b){if(b == 0)return a;return gcd(b, a % b);} 
bool isvalid(ll x,ll y,ll n, ll m) { return (x>=0&&x<n&&y>=0&&y<m); }

ll dp[1001][4444];

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

    ll n,m;

    cin>>n>>m;

    ll ap[1001],b[1001];

    for(ll i=0;i<m;i++){

        cin>>ap[i];
        ll p;
        cin>>p;

        ll val1 = 0,val;
        for(ll j=0;j<p;j++){

            cin>>val;
            val1 = val1+(1<<(val-1));
        }
        b[i] = val1;
    }

    ll maxi = (1<<n);

    for(ll i=0;i<m;i++){

        for(ll j=0;j<maxi;j++){

            dp[i][j] = mod;
        }
    }

    dp[0][0] = 0;

    for(ll i=0;i<m;i++){

        for(ll j=0;j<maxi;j++){

            dp[i+1][j] = min(dp[i][j], dp[i][j-(j&b[i])]+ap[i]);
        }
    }

    if(dp[m][maxi-1] == mod){

        cout<<-1;
    }else{

        cout<<dp[m][maxi-1];
    }

    return 0;
}

Measured memory_bytes: 35072
n = int(input())
li_a = list(map(int, input().split()))

flg = False
nextval = 1
br = 0
for idx, a in enumerate(li_a):
    if a == nextval:
        nextval += 1
        flg = True
    else:
        br += 1
if flg:
    print(br)
else:
    print('-1')


Measured memory_bytes: 26268
#![allow(unused_imports, dead_code)]
use std::f64::*;
use std::cmp::*;
use std::collections::*;

macro_rules! dump{
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

const INF: i64 = 0x3f3f3f3f3f3f3f3f;
const MOD: i64 = 1000000007;
const NOTHING: usize = std::usize::MAX;
const DX: [usize; 4] = [1, 0, std::usize::MAX, 0];
const DY: [usize; 4] = [0, 1, 0, std::usize::MAX];

fn main() {
    let (n, k): (usize, u32) = readln();
    let mut a: Vec<u32> = Vec::with_capacity(n);
    let mut v: Vec<i64> = Vec::with_capacity(n);
    for _ in 0..n {
        let (x, y) = readln();
        a.push(x);
        v.push(y);
    }

    if k == 0 {
        let mut res = 0;
        for i in 0..n {
            if a[i] == 0 {
                res += v[i];
            }
        }
        println!("{}", res);
        return;
    }

    let l = k.leading_zeros();
    let mut h_bit = 1u32 << (31 - l);
    let mut c: Vec<u32> = vec![];
    c.push(k);
    c.push(h_bit - 1);
    let mut mask = 0xffffffffu32;
    mask = mask << 1;
    while h_bit > 0 {
        let x = (k ^ h_bit) | (h_bit - 1);
        h_bit = h_bit >> 1;
        if x <= k {
            c.push(x);
        }
        mask = (mask << 1) | 1
    }
    c.sort();
    c.dedup();

    let mut res = 0i64;
    for i in 0..c.len() {
        let x = c[i];
        let mut tmp: i64 = 0i64;
        for j in 0..n {
            if x | a[j] == x {
                tmp += v[j];
            }
        }
        res = max(res, tmp);
    }
    println!("{}", res);
}

trait Read {
    fn read(s: &str) -> Self;
}

fn readln<T: Read>() -> T {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    T::read(buf.trim_right())
}

macro_rules! read_impl{
    ($($t:ty)*) => ($(
        impl Read for $t {
            fn read(s: &str) -> $t{
                s.parse().unwrap()
            }
        }
    )*)
}
read_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }

impl Read for String {
    fn read(s: &str) -> Self {
        s.to_string()
    }
}

impl Read for Vec<char> {
    fn read(s: &str) -> Self {
        s.chars().collect()
    }
}

impl<T: Read> Read for Vec<T> {
    fn read(s: &str) -> Self {
        s.split_whitespace().map(T::read).collect()
    }
}

impl<A: Read, B: Read> Read for (A, B) {
    fn read(s: &str) -> Self {
        let tokens: Vec<_> = s.split_whitespace().collect();
        (A::read(tokens[0]), B::read(tokens[1]))
    }
}

impl<A: Read, B: Read, C: Read> Read for (A, B, C) {
    fn read(s: &str) -> Self {
        let tokens: Vec<_> = s.split_whitespace().collect();
        (A::read(tokens[0]), B::read(tokens[1]), C::read(tokens[2]))
    }
}

impl<A: Read, B: Read, C: Read, D: Read> Read for (A, B, C, D) {
    fn read(s: &str) -> Self {
        let tokens: Vec<_> = s.split_whitespace().collect();
        (A::read(tokens[0]), B::read(tokens[1]), C::read(tokens[2]), D::read(tokens[3]))
    }
}


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

int main() {
  string s,t;
  cin >> s >> t;
  for (int i = 0; i < s.size() - 1; i++){
    int min = i;                               
    for (int j = i + 1; j < s.size(); j++){
      if (s.at(j) < s.at(min)) {
        min = j;
      }
    }
    if (i != min){
      char temp = s.at(i);
      s.at(i) = s.at(min);
      s.at(min) = temp; 
    }
  }
  for (int i = 0; i < t.size() - 1; i++){
    int max = i;                               
    for (int j = i + 1; j < t.size(); j++){
      if (t.at(j) > t.at(max)) {
        max = j;
      }
    }
    if (i != max){
      char temp = t.at(i);
      t.at(i) = t.at(max);
      t.at(max) = temp; 
    }
  }
  for (int i = 0; i < t.size(); i++){
    if (i == s.size() || s.at(i) < t.at(i)){
      cout << "Yes";
      break;
    }
    else if (s.at(i) > t.at(i) || i == t.size() - 1){
      cout << "No";
      break;
    }      
  } 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<stdio.h>
#include<iostream>
#include<string>
#include<math.h>
#include<map>
#include<iterator>
using namespace std;
#define tt int t;cin>>t;while(t--)
#define ll long long
#define nl endl
#define srt(v) sort(v.begin(),v.end());
#define rsrt(v) sort(v.begin(),v.end(),greater<int>());
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define amax(a,n) *max_element(a,a+n)
#define amin(a,n) *min_element(a,a+n)
#define vmax(a) *max_element(a.begin(),a.end())
#define vmin(a) *min_element(a.begin(),a.end())
#define so ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define a_size 100
ll i,j;

int main()
{
        so

        int n;
        string s="ACL";
        cin>>n;
        for(i=0;i<n;i++){
          cout<<s;
        }





        return 0;
}



Measured memory_bytes: 3640
#include <cstdio>
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;
int a[100100],b[100100];
bool cmp(int a,int b)
{
 return a>b;
}
int main()
{
  int n;
  cin>>n;
  memset(b,0,sizeof(b));
  for(int i=0;i<n;i++)
    {
        cin>>a[i];
        b[a[i]+1]++;
        b[a[i]-1]++;
        b[a[i]]++;
    }
    sort(b,b+100100,cmp);

        cout<<b[0]<<endl;

}


Measured memory_bytes: 1024
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
using namespace std;
#define MAXN 200010
int n;
struct node{
	int a,b;
}bud[MAXN];
priority_queue<int> Q;
bool cmp(node p,node q)
{
	return p.b<q.b;
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    	scanf("%d %d",&bud[i].a,&bud[i].b);
    sort(bud+1,bud+n+1,cmp);
    int T=0;
    for(int i=1;i<=n;i++)
    {
    	if(T+bud[i].a>bud[i].b)
    	{
    		printf("No\n");
    		return 0;
    	}
    	T+=bud[i].a;
    }
	printf("Yes\n");
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
typedef long long ll;
using namespace std;

int main() {
  ll n; cin >> n;
  ll ans = 0;
  for(ll i = 1; i*i <= n; ++i) {
      if(n%i==0) {
          ll j = n/i;
          if(j-1 > i) ans += j - 1;
      }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

int main() {
    init();

    int x; cin >> x;
    cout << (x < 1200 ? "ABC\n" : "ARC\n");
}


Measured memory_bytes: 256
N, K = map(int, input().split())
h = list(map(int, input().split()))

h += [float("inf")] * (K)
dp = [float("inf")] * (N+K)
dp[0] = 0
for i in range(N):
    for j in range(K):
        dp[i+j+1] = min(dp[i+j+1], dp[i]+abs(h[i] - h[i+j+1]))


print(dp[N-1])

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

using namespace std;

//#define DEBUG
#ifdef DEBUG
#define dump(x) cout << "[*] " #x ": " << x << endl
#define debug(x) x
#else
#define dump(x)
#define debug(x)
#endif

constexpr int MAX = 100000;
int table[MAX];

inline int string_to_time(const string& str) {
    int h = str[0] - '0';
    h = h * 10 + (str[1] - '0');
    int m = str[3] - '0';
    m = m * 10 + (str[4] - '0');
    int s = str[6] - '0';
    s = s * 10 + (str[7] - '0');
    return h * 60 * 60 + m * 60 + s;
}

int main() {
    int n;
    string str;
    while (cin >> n, n) {
        for (int i = 0; i < MAX; ++i) {
            table[i] = 0;
        }
        for (int i = 0; i < n; ++i) {
            cin >> str;
            const int start = string_to_time(str);
            table[start]++;
            cin >> str;
            const int end = string_to_time(str);
            table[end]--;
            dump(start);
            dump(table[start]);
            dump(end);
            dump(table[end]);
        }

        int ans = 0;
        int tmp = 0;
        for (int i = 0; i < MAX; ++i) {
            tmp += table[i];
            ans = max(ans, tmp);
        }
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 3532
n, k, c = map(int, input().split())
s = input()

l = []
next_workable = 0
for i in range(n):
    if next_workable <= i and s[i] == 'o':
        l.append(i)
        next_workable = i + c + 1

r = []
next_workable = n-1
for i in range(n-1, -1, -1):
    if i <= next_workable and s[i] == 'o':
        r.append(i)
        next_workable = i - c - 1
if len(l) > k:
    exit()
for i in range(k):
    if l[i] == r[-1 - i]:
        print(l[i] + 1)


Measured memory_bytes: 58104
N = input()
Dig = len(N)
num = None
if Dig == 1:
    print(N)
else:
    for i in range(Dig-1):
        if N[i+1] != str(9):
            num = i
            break
        else:
            continue
    list_num = list(N)
    if not num == None:
        target = int(list_num[num]) -1
        array = list(map(int,N))
        ans = sum(array[:num]) + target + 9*(Dig-num-1)
        print(ans)
    else:
        array = list(map(int,N))
        print(sum(array))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
  #define rep(i,n) for(int i=1;i<=n;i++)
  using namespace std;
    int main(){
        int n,a,b;
        cin >> n >> a >> b;
        int ans=0;
        rep(i,n){
       int h=0;
        int s=0;
            s=i;
            if(s<10){
            h=s;
            }
            else{ 
            while(s>=10){
              h+=s%10;
              s/=10;
            }
            h+=s;
            }
            //cout << h << endl;
            if(a<=h && h<=b){
                ans+=i;
            }
        }
          cout << ans << endl;
          return 0;
    }

Measured memory_bytes: 3592
#coding=UTF-8

n=int(input())

mozir=input()
hyo=mozir.split(' ')
#a=[int(mono) for mono in hyo]


idx=n-1
ans=''
#decending
while idx>=0:
    ans=ans+hyo[idx]
    ans=ans+' '
    idx=idx-2

if idx%2==0:
    idx=1
else:
    idx=0

while idx<n:
    ans=ans+hyo[idx]
    if n-idx <= 2:
        pass
    else:
        ans=ans+' '
    idx=idx+2

print(ans)    



Measured memory_bytes: 25776
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

const int DEBUG = 0;


using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;

int n;

void ans_swap(VI &ans, int &pos, int j) {
  if (ans.size() > 100000) {
    assert (0);
  }
  while (pos != j + 1) {
    pos = (pos + 1) % n;
    ans.push_back(1);
  }
  ans.push_back(n - 1);
}

void shift(VI &ans, int &pos, int dest) {
  while (pos != dest) {
    pos = (pos + 1) % n;
    ans.push_back(1);
  }
}


int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  VI p(n);
  REP(i, 0, n) {
    cin >> p[i];
  }
  VI cp(p);
  VI ans;
  int pos = 0;
  REP(i, 0, n - 1) {
    REP(j, 0, n - i - 1) {
      if (p[j] > p[j + 1]) {
	swap(p[j], p[j + 1]);
	ans_swap(ans, pos, j);
      }
    }
  }
  shift(ans, pos, 0);
  cout << ans.size() << "\n";
  REP(i, 0, ans.size()) {
    cout << ans[i] << "\n";
  }
  if (DEBUG) {
    REP(i, 0, ans.size()) {
      int k = ans[i];
      for(int i=k;i<n;i++)
	swap(cp[i],cp[i-k]);
    }
    REP(i, 0, n) {
      cerr << "result: ";
      for(auto cpp:cp)cerr << " " << cpp;
      cerr << endl;
    }
  }
}


Measured memory_bytes: 764
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
typedef pair<int,int> P;
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define rep(i, n) for (lint i = 0; i < (n); i++)
#define INF LLONG_MAX
#define all(x) (x).begin(),(x).end()
#define pb push_back
int main(){
    int n;
    cin>>n;
    if(n>=1000){
        cout<<"ABD"<<endl;
    }else{
        cout<<"ABC"<<endl;
    }
    


    return 0;
}


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

#define SE second
#define FI first
#define PB push_back
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((int) (x).size())

#define _ << " " <<
#define TR(x) cout << #x _ x << endl

using namespace std;
using ii = pair<int, int>;

const int INF = (int) 1e9 + 5;

int a, b, c, d;

int main() {
    cin >> a >> b >> c >> d;
    int st = max(a, c);
    int en = min(b, d);
    cout << max(0, en - st) << endl;
    return 0;
}


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

#define MAX 999999999
#define N 500000

void Merge(int *,int,int,int);
void Mergesort(int *,int,int);

int calc;
int main(){
  int n,a[N],i;
  calc=0;
  scanf("%d",&n);
  for(i=0; i<n; i++){
    scanf("%d",&a[i]);
  }
  Mergesort(a,0,n);
  for(i=0; i<n-1; i++){
    printf("%d ",a[i]);
  }
  printf("%d\n",a[i]);
  printf("%d\n",calc);
  
  return 0;
}

void Merge(int *a,int left,int mid,int right){
  int n1,n2,L[N],R[N],i,j,k;
  n1=mid-left;
  n2=right-mid;
  for(i=0; i<n1; i++) L[i]=a[left+i];
  for(i=0; i<n2; i++) R[i]=a[ mid+i];
  L[n1]=MAX;
  R[n2]=MAX;
  i=j=0;
  for(k=left; k<right; k++){
    calc++;
    if(L[i]<=R[j]){
      a[k]=L[i];
      i++;
    }else{
      a[k]=R[j];
      j++;
    }
  }
}

void Mergesort(int *a,int left,int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    Mergesort(a,left,mid  );
    Mergesort(a, mid,right);
    Merge(a,left,mid,right);
  }
}



Measured memory_bytes: 5600
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
	int n;
	scanf("%d",&n);
	int t,a;
	scanf("%d %d",&t,&a);
	int flag=0;
	double ans=0x3f3f3f3f;
	for(int i=1;i<=n;i++){
		int h;
		scanf("%d",&h);
		double te=t-h*0.006;
		if(abs(a-te)<ans){
			ans=abs(a-te);
			flag=i;
		}
	}
	printf("%d\n",flag);
	return 0;
} 

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int digit(int i){
	int sum = 0;
	while(i > 0){
		sum += i % 10;
		i /= 10;
	}
	return sum;
}

int main(){
	int n, a, b;
	scanf("%d %d %d", &n, &a, &b);
	
	int sum = 0;
	
	for(int i = 1; i <= n; i++){
		if(digit(i) >= a && digit(i) <= b){
		sum += i;
		}	
	}
	printf("%d\n", sum);
	return 0;
}

Measured memory_bytes: 1736
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define n 1000000
int b[1000005];
vector<int>p;
void seive()
{
    b[0]=b[1]=1;
    for(int i=4; i<=n; i+=2)
    {
        b[i]=1;
    }
    for(int j=3; j*j<=n; j+=2)
    {
        if(!b[j])
        {
            for(int i=j*j; i<=n; i+=(j*2))
            {
                b[i]=1;
            }
        }
    }
    p.push_back(2);
    for(int i=3; i<=n; i+=2)
    {
        if(!b[i])
            p.push_back(i);
    }
}
int main()
{
    seive();
    int x;
    cin>>x;
    vector<int>::iterator it=lower_bound(p.begin(),p.end(),x);
    cout<<*it<<endl;
    return 0;
}



Measured memory_bytes: 4732
#include<cstdio>

int main() {
  char s[3];
  int topping = 0;
  scanf("%s", &s);
  for(int i = 0; i < 3; ++i)
    if(s[i] == 'o') topping++;
  printf("%d\n", 700 + 100 * topping);

  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
using namespace std;
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <set>
#include <map>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200010
#define LIMIT2 500010
#define LIMIT3 1000010
#define INF ((1<<30)-1)
#define LLINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef long double ld;
typedef const void cv;
typedef pair<ll,ll> P;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define per(i,n) for((i)=(n)-1;(i)>=0;(i)--)
template<class T,class C> T max(T a,C b){ return ((a)>(T)(b) ? (a) : (T)(b)); }
template<class T,class C> T min(T a,C b){ return ((a)<(T)(b) ? (a) : (T)(b)); }
#define zt(a,b) (max((a),(b))-min((a),(b)))
#define setpre(n) fixed << setprecision(n)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[8]={1,0,-1,0,1,-1,-1,1},dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(cv *a, cv *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(cv *a, cv *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(cv *left, cv *right) {return strcmp((char *)left,(char *)right);}
int downchar(cv *left, cv *right) {return strcmp((char *)right,(char *)left);}
ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1){
      res *= a; if(mod>=1) res %= mod;
    }
    a *= a; if(mod>=1) a %= mod;
    n >>= 1;
  }
  return res;
}
void initialize(){
  
}
const int MAX_N=LIMIT2;
int bit[MAX_N+1]={0},n;
//1-indexed BIT
ll sum(int i){
  ll s=0;
  while(i>0){
    s += bit[i];
    i -= i&(-i);
  }
  return s;
}
void add(int i,ll x){
  while(i<=n){
    bit[i] += x;
    i += i&(-i);
  }
}
ll rangesum(int l,int r){
  if(l>r) return 0;
  return sum(r)-sum(l-1);
}
int main(void){
  initialize();
  ll m,i,j,k,result=0;
  ll l[LIMIT1]={0},r[LIMIT1]={0};
  ll dp[LIMIT1]={0};
  string s;
  
  cin >> n >> k;
  rep(i,k){
    cin >> l[i] >> r[i];
  }
  
  dp[1] = 1;
  for(i=1;i<=n;i++){
    dp[i] += dp[i-1];
    rep(j,k){
      if(i+l[j]<=n){
        dp[i+l[j]] += dp[i];
        dp[i+l[j]] %= MOD2;
        if(i+r[j]<=n) dp[i+r[j]+1] -= dp[i];
        if(i+r[j]+1<=n && dp[i+r[j]+1]<0) dp[i+r[j]+1]+=MOD2;
        //cout << i << ":" << i+l[j] << ":" << i+r[j] << endl;
      }
    }
  }
  
  result = dp[n]-dp[n-1];
  
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 8296
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
using namespace std;

int main(){
string s;cin>>s;
for(int i=0;i<s.length();i++){
    if(i%2==0&&(s[i]=='R'||s[i]=='U'||s[i]=='D'))continue;
    else if(i%2&&(s[i]=='L'||s[i]=='U'||s[i]=='D'))continue;
    else{cout<<"No";return 0;}
}
cout<<"Yes";
}

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

void chmax(ll &a, ll b) {
    if(a < b) a = b;
}

int main() {
    int N, W;
    cin >> N >> W;

    vector<int> w(N), v(N);
    for (int i = 0; i < N; i++)
    {
        cin >> w[i] >> v[i];
    }
    
    vector<vector<ll>> dp(N + 1, vector<ll>(W + 1, 0));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= W; j++) {
            if(j + w[i] <= W) chmax(dp[i + 1][j + w[i]], dp[i][j] + v[i]);
            chmax(dp[i + 1][j], dp[i][j]);
        }
    }

    ll ans = 0;
    for (int i = 0; i <= W; i++) {
        chmax(ans, dp[N][i]);
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M);

  int sum = 0;
  for (int i = 0; i < M; i++) {
    cin >> a[i];
    sum += a[i];
  }

  if (N < sum) {
    cout << "-1" << endl;
  } else {
    int result = N - sum;
    cout << result << endl;
  }
  return 0;
}


Measured memory_bytes: 3672
from itertools import combinations

N, A, B, C = map(int, input().split())
S = [input() for _ in range(N)]

cnt = {'A': A, 'B': B, 'C': C}

def out(T):
    now = {'A': A, 'B': B, 'C': C}

    ans = []
    for i, s in enumerate(S):
        u, v = s[0], s[1]
        if now[u] == now[v] == 0:
            return []
        if now[u] > now[v]:
            ans.append(v)
            now[u] -= 1
            now[v] += 1
            continue
        if now[u] < now[v]:
            ans.append(u)
            now[u] += 1
            now[v] -= 1
            continue
        if i == N - 1:
            ans.append(u)
            continue

        nx = S[i + 1]
        if u in nx:
            ans.append(u)
            now[u] += 1
            now[v] -= 1
            continue
        if v in nx:
            ans.append(v)
            now[v] += 1
            now[u] -= 1
            continue

    return ans

ans = out('')
if len(ans) == 0:
    print('No')
    exit()
print('Yes')
print(*ans, sep='\n')

# for s in combinations(['', '', 'A', 'B', 'C'], r=3):
#     s = ''.join(s)
#     for t in s:
#         if cnt[t] == 0:
#             break
#     else:
#         ans = out(s)
#         if len(ans) == 0:
#             continue
#         print('Yes')
#         print(*ans, sep='\n')
#         exit()

# print('No')


Measured memory_bytes: 18604
#include <iostream>
#include <iterator>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <limits>

using namespace std;

int main(){

    //int ans=0;
    bool ans=false;

    string a;
    cin>>a;

    if(a=="AAA" || a=="BBB"){
        ans=true;
    }
    //cout<<ans<<endl;
    if(ans){
        cout<<"No"<<endl;
    }
    else{
        cout<<"Yes"<<endl;
    }

    return 0;
}

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

int a[100005];
int byk1[100005],byk2[100005];

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    vector<int> V1,V2;
    int n;
    cin >> n;
    for(int i=1;i<=n;i++){
    	cin >> a[i];
    	if(i%2==0)V1.push_back(a[i]);
    	else V2.push_back(a[i]);
	}
	for(int i=0;i<V1.size();i++){
		byk1[V1[i]]++;
	}
	for(int i=0;i<V2.size();i++){
		byk2[V2[i]]++;
	}
	int maxi=-1,temp1,maxi2=-1,temp2;
	for(int i=1;i<=100000;i++){
		if(byk1[i]>maxi){
			maxi=byk1[i];
			temp1=i;
		}
		if(byk2[i]>maxi2){
			maxi2=byk2[i];
			temp2=i;
		}
	}
	if(temp1!=temp2){
		cout << n-maxi-maxi2 << endl;
	}
	else{
		int maxiA=-1;
		for(int i=1;i<=100000;i++){
			if(byk1[i]>maxiA && temp1!=i){
				maxiA=byk1[i];
			}
		}
		int ans1=n-maxiA-maxi2;
		int maxiB=-1;
		for(int i=1;i<=100000;i++){
			if(byk2[i]>maxiB && temp2!=i){
				maxiB=byk2[i];
			}
		}
		int ans2=n-maxi-maxiB;
		cout << min(ans1,ans2) << endl;
	}
	return 0;
}



Measured memory_bytes: 2044
import java.io.PrintWriter;
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);
    int h = sc.nextInt();
    int n = sc.nextInt();
    int[] power = new int[n];
    int[] cost = new int[n];
    int[][] arr = new int[n][2];

//    int[] dp = new int[h+10001];

    int[][] dp = new int[n+1][10001];

    PrintWriter out = new PrintWriter(System.out);


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

    void run() {
        for (int i=0; i<n; i++) {
            int pow = sc.nextInt();
            int cost = sc.nextInt();
            arr[i][0] = pow;
            arr[i][1] = cost;
//            Pair pair = new Pair(pow, cost);
        }

        for (int i=0; i<n+1; i++) {
            for (int j=0; j<h+1; j++) {
                dp[i][j] = Integer.MAX_VALUE;
            }
        }

        for (int i=1; i<=n; i++) {
            for (int j=0; j<arr[i-1][0]; j++) {
                dp[i][j] = Math.min(dp[i][j], dp[i-1][j]);
                dp[i][j] = Math.min(dp[i][j], arr[i-1][1]);
            }
            for (int j=arr[i-1][0]; j<=h; j++) {
                dp[i][j] = Math.min(dp[i][j], dp[i-1][j]);
                dp[i][j] = Math.min(dp[i][j], dp[i][j-arr[i-1][0]]+arr[i-1][1]);
            }
        }

//        for (int i=0; i<n+1; i++) {
//            for (int j=0; j<h; j++) {
//                out.print(dp[i][j]+" ");
//            }
//            out.println(dp[i][h]);
//        }

        out.print(dp[n][h-1]);

//        for (int i=0; i<h+1; i++) dp[i] = Integer.MAX_VALUE;
//
//        for (int i=0; i<n; i++) {
//            for (int j=0; j<arr[i][0]; j++) {
//                dp[j] = Math.min(dp[j], arr[i][1]);
//            }
//            for (int j=arr[i][0]; j<h+1; j++) {
//                dp[j] = Math.min(dp[j], dp[j-arr[i][0]]+arr[i][1]);
//            }
//        }


//        for (int i=0; i<h+1; i++) out.print(dp[i]+" ");



//        out.println(dp[h-1]);
        out.flush();
    }

    void solve(int i, int m) {
    }

    class Pair {
        int power;
        int cost;
        public Pair(int p, int c) {
            this.power = p;
            this.cost = c;
        }

        public int compareTo(Pair p) {
            if (this.cost < p.cost) return -1;
            if (this.cost > p.cost) return -1;
            return 0;
        }
    }
}


Measured memory_bytes: 83008
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>

#define FOR(i, a, b) for(decltype(b) i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;

using namespace std;

#ifdef INPUT
#include <sstream>
stringstream input(R"(
6 6 7
)");
#define cin input
#endif

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

	cout << (max({a, b, c}) * 9 + a + b + c) << endl;

	return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
x = []
for _ in range(m):
    a, b = map(int, input().split())
    x.append([a, b, 0])
y = sorted(x)
y[0][2] = 1
cnt = 1
for i in range(1, m):
    if y[i][0] == y[i - 1][0]:
        cnt += 1
        y[i][2] = cnt
    else:
        cnt = 1
        y[i][2] = cnt
for i in range(m):
    print((6 - len(str(x[i][0]))) * '0', end='')
    print(str(x[i][0]), end='')
    print((6 - len(str(x[i][2]))) * '0', end='')
    print(str(x[i][2]))
    # print(str(x[i][0].zfill(6)) + str(x[i][2].zfill(6)))


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

int main(){
    int64_t n, q, t;
    cin >> n;
    map<int64_t, int64_t> mp;
    for(int64_t i = 0; i < n; i++){
        int64_t tmp;
        cin >> tmp;
        mp[tmp] = 1;
    }
    cin >> q;
    int64_t ans = 0;
    for(int64_t i = 0; i < q; i++){
        cin >> t;
        ans += mp[t];
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3192
//#include "pch.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

#define ll long long
#define fr(i,l,r) for(i=(l);i<(r);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))
#define INF 1000000000000//10^12




int main(void)
{
	//変数の宣言
	ll int n,x;
	ll int a[100010];
	
	//よく使う変数
	int i,j,k,l;
	int flag=0;
	ll int ans=0;
	int count=0;
	int temp,temp1,temp2;
	int max,min;
	int len;
	int sum=0;
	
	
	//データの読み込み
	scanf("%lld %lld",&n,&x);
//	scanf_s("%lld %lld",&n,&x);

	fr(i,0,n){
		scanf("%lld",&a[i]);
//		scanf_s("%lld",&a[i]);
	}

	//	printf("nは%dです\n", n);
	//	printf("データの読み込み終了\n");
	//実際の処理
	
	fr(i,0,n){
		if(i==0){
			if(a[0]>x){
				ans=ans+a[0]-x;
				a[0]=x;
			}
		}else{
			if(a[i]+a[i-1]>x){
				ans=ans+a[i]+a[i-1]-x;
				a[i]=x-a[i-1];
			}
		}	
	}

	
	//	printf("計算部分終了\n");
	
	//出力
	
	printf("%lld",ans);
	
	//	printf("結果の出力終了\n");
	
	return 0;
}



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

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

    string s;
    cin>>s;
    vector<string> dict{"Sunny", "Cloudy", "Rainy"};
    if (s == dict[0])
        cout << dict[1] << endl;
    if (s == dict[1])
        cout << dict[2] << endl;
    if (s == dict[2])
        cout << dict[0] << endl;
}


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

class Node{
public:
	vector< int > e_to;
	vector< int > e_cost;
	
	bool def;
	int min_cost;
	
	Node(){
		def = false;
		min_cost = -1;
	}
};
bool operator==(const Node& ot1, const Node& ot2){
	return ot1.min_cost == ot2.min_cost;
}
bool operator!=(const Node& ot1, const Node& ot2){
	return !(ot1 == ot2);
}
bool operator<(const Node& ot1, const Node& ot2){
	return ot1.min_cost < ot2.min_cost;
}
bool operator>(const Node& ot1, const Node& ot2){
	return ot1.min_cost > ot2.min_cost;
}
bool operator<=(const Node& ot1, const Node& ot2){
	return !(ot1 > ot2);
}
bool operator>=(const Node& ot1, const Node& ot2){
	return !(ot1 < ot2);
}
vector< Node > nodes;
priority_queue< Node, vector< Node >, greater< Node > > que;

int dijkstra(int s, int t){
	for(vector< Node >::iterator it = nodes.begin(); it != nodes.end(); ++it){
		it->def = false;
		it->min_cost = -1;
	}
	nodes[s].min_cost = 0;
	que.push(nodes[s]);
	while(!que.empty()){
		Node def_node = que.top();
		que.pop();
		if(def_node.def)continue;
		def_node.def = true;
		for(int i = 0; i < def_node.e_to.size(); ++i){
			int to = def_node.e_to[i];
			int cost = def_node.min_cost + def_node.e_cost[i];
			if(nodes[to].min_cost == -1 || cost < nodes[to].min_cost){
				nodes[to].min_cost = cost;
				que.push(nodes[to]);
			}
		}
	}
	
	return nodes[t].min_cost;
}

int main(){
	int n, m, a, b, c, d, x1, x2, y1, y2;
	
	
	cin >> n >> m;
	nodes.resize(n);
	
	for(int i = 0; i < n; ++i){
		nodes[i] = Node();
	}
	
	for(int i = 0; i < m; ++i){
		scanf("%d,%d,%d,%d", &a, &b, &c, &d);
		nodes[a - 1].e_to.push_back(b - 1);
		nodes[a - 1].e_cost.push_back(c);
		
		nodes[b - 1].e_to.push_back(a - 1);
		nodes[b - 1].e_cost.push_back(d);
	}
	scanf("%d,%d,%d,%d", &x1, &x2, &y1, &y2);
	
	cout << y1 - y2 - (dijkstra(x1-1, x2-1) + dijkstra(x2-1, x1-1)) << endl;
	return 0;
}

Measured memory_bytes: 1284
# 抽象化をやめる
class Rmq(object):
    __slots__ = ["elem_size", "tree", "real_size"]

    def __init__(self, a):
        if hasattr(a, "__iter__"):
            self.real_size = len(a)
            self.elem_size = elem_size = 1 << (self.real_size-1).bit_length()
            self.tree = tree = [float("inf")] * (elem_size * 2)
            tree[elem_size:elem_size + self.real_size] = a
            for i in range(elem_size - 1, 0, -1):
                tree[i] = min(tree[i << 1], tree[(i << 1) + 1])
        elif isinstance(a, int):
            self.real_size = a
            self.elem_size = elem_size = 1 << (self.real_size-1).bit_length()
            self.tree = [float("inf")] * (elem_size * 2)

    def get_value(self, x: int, y: int) -> int:  # 半開区間
        l, r = x + self.elem_size, y + self.elem_size
        tree = self.tree
        result = float("inf")
        while l < r:
            if l & 1:
                result = min(tree[l], result)
                l += 1
            if r & 1:
                r -= 1
                result = min(tree[r], result)
            l, r = l >> 1, r >> 1
        return result

    def set_value(self, i: int, value: int) -> None:
        k = self.elem_size + i
        tree = self.tree
        tree[k] = value
        while k > 1:
            k >>= 1
            tree[k] = min(tree[k << 1], tree[(k << 1) + 1])

    def get_one_value(self, i):
        return self.tree[i+self.elem_size]

    def debug(self):
        print(self.tree[self.elem_size:self.elem_size+self.real_size])


from operator import itemgetter

N, M = map(int, input().split())
LRC = [list(map(int, input().split())) for _ in range(M)]
LRC.sort(key=itemgetter(0))

idx_LRC = 0
q = []

seg = Rmq(N+1)

seg.set_value(1, 0)
for v in range(1, N + 1):
    d = seg.get_value(v, N + 1)
    while idx_LRC < M:
        l, r, c = LRC[idx_LRC]
        if l <= v:
            seg.set_value(r, min(seg.tree[r + seg.elem_size], d + c))
            idx_LRC += 1
        else:
            break
ans = seg.tree[N + seg.elem_size]
print(ans if ans != float("inf") else -1)


Measured memory_bytes: 103892
fun main(args: Array<String>) {
    var N = readLine()!!.toInt()

    if (N == 0) {
        println("0")
        return
    }

    var ans = ""
    while (N != 0) {
        var q = if (N % 2 == 0) N / -2 else (N - 1) / -2
        var r = if (N % 2 == 0) 0 else 1
        N = q
        ans += r
    }
    println(ans.reversed())
}

Measured memory_bytes: 33652
def convert(infile, outfile, n):
    dictionary = {}
    for i in range(n):
        key, val = infile.readline().split()
        dictionary[key]=val
    m = int(infile.readline())
    for j in range(m):
        x = infile.readline().split()[0]
        outfile.write(dictionary.get(x, x))
    print >> outfile
 
def run(infile, outfile):
    while True:
        n = int(infile.readline())
        if n == 0:
            break
        convert(infile, outfile, n)
 
if __name__ == "__main__":
    import sys
    run(sys.stdin, sys.stdout)

Measured memory_bytes: 7364
#include<bits/stdc++.h>
#define fi        first
#define se        second
#define LC(a)     ((a<<1))
#define RC(a)     ((a<<1)+1)
#define MID(a,b)  ((a+b)>>1)
#define mem(a, b) memset(a, b, sizeof(a))
#define IOS()     std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned long long uLL;
typedef pair<int,int> Pii;
typedef pair<ll,ll>   Pll;
typedef pair<ll,int>  Pli;
const int INF = 0X3F3F3F3F;
const int MIN = -(1<<30);
const ll N = 1e5+7;
int main()
{
	IOS();
	
	ll a,b,k;
	cin>>a>>b>>k;
	
	if(a>=k) cout<<a-k<<" "<<b<<endl;
	else if(a<k && a+b>k) cout<<0<<" "<<a+b-k<<endl;
	else if(a+b<=k) cout<<0<<" "<<0<<endl;
	
	return 0;
}



Measured memory_bytes: 256
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

ll n,b[maxn],siz[maxn],tot,ans;
vector <int> mp[maxn];
const ll mod=1000000007;

inline ll pw(ll a,ll b)
{
	ll ans=1,base=a;
	while(b)
	{
		if(b&1) ans=(ans*base)%mod;
		base=(base*base)%mod; b>>=1;
	}
	return ans;
}

inline void dfs1(int u,int fa)
{
	siz[u]=1;
	for(int i=0;i<mp[u].size();i++)
	{
		int v=mp[u][i]; if(v==fa) continue;
		dfs1(v,u); siz[u]+=siz[v];
	}
}

inline void dfs2(int u,int fa)
{
	ll p=0;
	for(int i=0;i<mp[u].size();i++)
	{
		int v=mp[u][i]; if(v==fa) continue;
		p=(p+b[siz[v]]-1)%mod; dfs2(v,u);
	}
	if(fa!=0) p=(p+b[n-siz[u]]-1)%mod; tot=(tot+p)%mod;
}

int main()
{
	n=read(); rep(i,1,n-1){int u=read(),v=read(); mp[u].pb(v); mp[v].pb(u);}
	b[0]=1; rep(i,1,n) b[i]=(b[i-1]*2)%mod;
	dfs1(1,0); dfs2(1,0);
	ans=(n*b[n-1]-n+mod)%mod; ans=(ans-tot+mod)%mod;
	ans=(ans*pw(b[n],mod-2))%mod; cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 47376
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<math.h>
#include<queue>
#include<deque>
#include<map>
#include<bitset>

#define rep(i, n) for(int i = 0;i < (n);i++)
#define rrep(i, n) for(int i = (n);i >= 0;i--)
#define FOR(i, m, n) for(int i = (m);i < (n);i++)

using namespace std;
using ll = long long;

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

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


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



int main() {
    int x; cin >> x;
    // エラトステネス
    // 0からmxまでの素数を割り出す
    int mx = 100100;
    vector<bool> is_prime(mx, 1);   // すべて素数と初期化
    is_prime[0] = false;
    is_prime[1] = false;
    for (int i = 2; i < mx; i++) {
        if (!is_prime[i]) continue;
        for (int j = i*2; j < mx; j += i) {
            is_prime[j] = false;
        }
    }
    int ans = 0;
    for (int i = x; i < 100100; i++)
    {
        if (is_prime[i]) {
            ans = i;
            break;

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


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class program{
    public static void Main(){
        var s = Console.ReadLine();
        int counter = 0;
        if(s[0] == '1') counter++;
        if(s[1] == '1') counter++;
        if(s[2] == '1') counter++;
        Console.WriteLine(counter);
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <utility>
#include <string>
#include <cmath>
#include <set>
#include <functional>
#include <map>
#include <queue>
#include <cstring>
#include <stack>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cassert>
#include <unordered_map>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define show(x) cout << #x << " = " << x << endl;
typedef long long ll;
typedef pair<int,int> pii;

void solve2(){
    int n;
    cin >> n;
    vector<ll>a(n);
    rep(i,n){
        cin >> a[i];
    }
    sort(a.begin(),a.end());
    ll k = n-1;
    ll ans = 0;
    rep(i,n){
        if(a[i]>k){
            ans += a[i]-k;
        }
    }
    
    cout << ans << endl;
}
void solve1(){
    ll k;
    cin >> k;
    int n = 50;
    vector<ll>a(n);
    int c = 0;
    while(k%50)k+=51,c++;
    //show(k);
    ll m = k/50LL+49;
    rep(i,n){
        if(i < c)a[i] = m-i-50-1;
        else a[i] = m;
    }
    cout << n << endl;
    rep(i,n-1){
        cout << a[i] << " ";
    }
    cout << a[n-1] << endl;
}

bool f[200005],g[200005];
void solve3(){
    int n,m;
    cin >> n >> m;
    int a,b;
    rep(i,m){
        cin >> a >> b;
        if(a==1)f[b] = true;
        if(b==n)g[a] = true;
    }
    rep(i,n){
        if(f[i+1] ==true&& g[i+1] == true){
            cout << "POSSIBLE" << endl;
            exit(0);
        }
    }
    cout << "IMPOSSIBLE" << endl;
}
int main(){
    solve1();
}

Measured memory_bytes: 256
/*-----------------------------------------------,
|  __                                       __   |
| |  |--.-----.---.-.----.----.-----.-----.|  |_ |
| |  _  |  -__|  _  |  __|  __|  -__|  _  ||   _||
| |_____|_____|___._|____|____|_____|   __||____||
|                                   |__|         |
`-----------------------------------------------*/
#include<algorithm>
#include<array>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
typedef long long ll; typedef long double ld ;using namespace std;
#define INF 1000000000000
#define MOD 10000007
#define ALL(name) (name).begin(),(name).end()
#define REP(counter, limit) for (long long counter = 0; counter < limit; counter++)
int gcd(int a, int b) { if (a % b == 0) { return(b); } else { return(gcd(b, a % b)); } }
int lcm(int a, int b) { return a * b / gcd(a, b); }
bool primenum(int a) { if (a == 1) { return false; }if (a == 2) { return true; }if (a % 2 == 0) { return false; }for (int i = 3; i < sqrt(a) + 1; i += 2) { if (a != i) { if (a % i == 0) { return false; } } }return true; }
struct setupios{setupios(){ios::sync_with_stdio(0);cin.tie(nullptr); /*cout<<fixed<<setprecision(20);*/};}setupios;
int main() {

  int n;
  cin>>n;
  vector<int> a(n);
  REP(i,n)cin>>a[i];
  int ans=0;
  while(true){
    REP(i,n){
      if(a[i]%2==1){
        goto end;
      }else{
        a[i]/=2;
      }
    }
    ans++;
  }
end:
  cout<<ans<<endl;

}


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

using namespace std;

int main(void){

    int n;
    double ans;

    cin >> n;

    ans = (n % 2 == 0 ? (n/2.0)/n : ((n+1)/2.0)/n);

    printf("%.10lf\n", ans);

    return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
MOD = 10**9 + 7

dp = [[0] * (M + 1) for _ in range(N + 1)]
for i in range(N + 1):
    dp[i][0] = 1
for j in range(M + 1):
    dp[0][j] = 1

for i, a in enumerate(A, start=1):
    for j, b in enumerate(B, start=1):
        if a == b:
            dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD
        else:
            dp[i][j] = (dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1]) % MOD

print(dp[N][M])


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

int main(){
    string s;
    vector<string> v(101, "");
    int len = 0;
    while(getline(cin, s), s != "END_OF_TEXT"){
        v[len++] = s;
    }
    string buf = "";
    int i = 0, j = 0;
    char com;
    while(cin >> com, com != '-'){
        if(com == 'a'){
            j = 0;
        }else if(com == 'e'){
            j = v[i].size();
        }else if(com == 'p'){
            if(i){
                i--;
            }
            j = 0;
        }else if(com == 'n'){
            if(i+1 < len){
                i++;
            }
            j = 0;
        }else if(com == 'f'){
            if(j < v[i].size()){
                j++;
            }else if(i+1 < len){
                i++;
                j = 0;
            }
        }else if(com == 'b'){
            if(j != 0){
                j--;
            }else if(i){
                i--;
                j = v[i].size();
            }
        }else if(com == 'd'){
            if(j < v[i].size()){
                v[i] = v[i].substr(0, j) + v[i].substr(j+1);
            }else if(i+1 < len){
                v[i] += v[i+1];
                len--;
                for(int k = i+1; k < len; k++)  v[k] = v[k+1];
            }
        }else if(com == 'k'){
            if(j < v[i].size()){
                buf = v[i].substr(j);
                v[i] = v[i].substr(0, j);
            }else if(i+1 < len){
                buf = "---";
                v[i] += v[i+1];
                len--;
                for(int k = i+1; k < len; k++)  v[k] = v[k+1];
            }
        }else if(com == 'y'){
            if(buf == ""){
                // do nothing.
            }else if(buf == "---"){
                string line = v[i].substr(j);
                v[i] = v[i].substr(0, j);
                len++;
                for(int k = len-1; k > i; k--)    v[k] = v[k-1];
                v[i+1] = line;
                i++;
                j = 0;
            }else{
                v[i] = v[i].substr(0, j) + buf + v[i].substr(j);
                j += buf.size();
            }
        }
    }
    for(int i = 0; i < len; i++)    cout << v[i] << endl;
    return 0;
}


Measured memory_bytes: 3160
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define erep(i,a,n) for(int i = a;i<=n;i++)
typedef long long ll;
#define int long long
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 1101010101010101010
#define MOD 1000000007
#define P pair<int,int>
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

signed main(){
  int n;
  cin >> n;
  vvint A(n,vint(n));
  rep(i,0,n){
    rep(j,0,n){
      cin >> A[i][j];
    }
  }
  vector<vector<bool>> AJ(n,vbool(n));

  rep(k,0,n){
    rep(i,0,n){
      rep(j,0,n){
        if(A[i][j] > A[i][k] + A[k][j]){
          cout << -1 << endl;
          return 0;
        }
        if(A[i][k] + A[k][j] == A[i][j] && A[i][k] > 0 && A[k][j] > 0){
          AJ[i][j] = true;
        }
      }
    }
  }
  int ans = 0;
  rep(i,0,n){
    rep(j,0,n){
      if(!AJ[i][j]) ans += A[i][j];
    }
  }
  cout << ans/2 << endl;
}

Measured memory_bytes: 1024
num = list(map(int, input().split()))

W = num[0]
H = num[1]
x = num[2]
y = num[3]
r = num[4]

if H >= y + r and y - r >= 0 and W >= x + r and x - r >= 0:
    print('Yes')

else:
    print('No')


Measured memory_bytes: 5596