akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
template <class T>
T GCD(T a, T b)
{
    T r;
    while (a)
        r = b, b = a, a = r % a;
    return b;
}
template <class T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repd(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (b); i--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef vector<ll> vl;
#define ERASE(x) x.erase(unique(ALL(x)), x.end()); // erase same elements
#define VEC(type, c, n)     \
    std::vector<type> c(n); \
    for (auto &i : c)       \
        std::cin >> i;

// input
#define INIT                          \
    std::ios::sync_with_stdio(false); \
    std::cin.tie(0);
#define VAR(type, ...) \
    type __VA_ARGS__;  \
    MACRO_VAR_Scan(__VA_ARGS__);

// output
template <typename T>
void MACRO_OUT(const T t) { std::cout << t; }

#define OUT(...) MACRO_OUT(__VA_ARGS__);
#define SP std::cout << " ";
#define TAB std::cout << "\t";
#define BR std::cout << "\n";
#define ENDL std::cout << std::endl;

#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define yes() printf("yes\n")
#define no() printf("no\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
    cout << a;
    ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
    cout << a << ' ';
}

ll ans = 0;
bool check = 0;
string s, t;
int N = 3;
vector<int> v(N);
int a, b, c, d, n;
int x, y;
int sum;
char ch;

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// cout << (conditon ? (result:  == 1 ): (==0)) << endl; <- output result of if
// long long 型が表せる値の上限はおよそ 9 × 10＾18 です．
int main()
{
    INIT;

    cin >> n;
    int y = 0, x = 10000;
    rep(i, n)
    {
        cin >> a;
        x = min(a, x);
        y = max(a, y);
    }
    pr(y - x);
    return 0;
}


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

int main(){
    int n; cin >> n;
    int a, prev;
    int cnt = 0;
    int state = -1;
    for(int i=0; i<n; i++){
        if(i == 0){
            cin >> prev;
            cnt++;
            continue;
        }
        cin >> a;
        if(state == -1){
            if(a > prev){
                state = 0;
            }
            else if(a < prev){
                state = 1;
            }
        }
        if(state == 0){
            if(a < prev){
                state = -1;
                cnt += 1;
            }
        }
        if(state == 1){
            if(a > prev){
                state = -1;
                cnt += 1;
            }
        }
        prev = a;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
import math
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()
n=int(input())
s=str(n)
ans=0
for i in s:
    ans+=int(i)
if ans%9==0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 75400
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int k;
  cin>>k;
  string s;
  for(int i=0;i<k;i++)
  {
    s.push_back('A');
     s.push_back('C');
     s.push_back('L');
  }
  cout<<s;
  return 0;
}

Measured memory_bytes: 3628
n, t = map(int, input().split())
List = [list(map(int, input().split())) for i in range(n)]

res = 10000
for i in range(n):
  if List[i][1] <= t:
    res = min(res, List[i][0])
if res == 10000:
  print("TLE")
else:
  print(res)

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

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

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};
template<typename T>
T kruskal(vector<edge<T>> &edges, int V) {
    sort(edges.begin(), edges.end(), [](const edge<T> &a, const edge<T> &b) {
        return a.cost < b.cost;
    });
    UnionFind unionFind(V);
    T res = 0;
    for (edge<T> &e: edges) {
        if (unionFind.merge(e.to, e.from)) {
            res += e.cost;
        }
    }
    return res;
}

int main() {
  int V, E; cin >> V >> E;
  vector<edge<int>> tree(E);
  REP(i, E) {
    int s, t, w; cin >> s >> t >> w;
    tree[i].from = s;
    tree[i].to = t;
    tree[i].cost = w;
  }
  cout << kruskal(tree, V) << endl;
}


Measured memory_bytes: 4148
from heapq import *
n,m=map(int,input().split())
ss={}
it=[0]*n
for i in range(n):
    a,b=map(int,input().split())
    it[i]=b
    try:
        ss[m-a].append(i)
    except:
        ss[m-a]=[i]
heap=[]
tot=0
for i in range(m-1,-1,-1):
    try:
        x=ss[i]
        for i in x:
            heappush(heap,-it[i])
    except:
        pass
    if heap==[]:
        continue
    a=heappop(heap)
    tot-=a
print(tot)
    


Measured memory_bytes: 29544
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch Test | diff Test.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address Test.cpp && ./a.out

/*

 6/22/2020

 22:09-

 */

//const int MAX_N=1e6+1;
int N,M;
string S;

void nope() {
  cout<<-1<<endl;
  exit(0);
}
void solve() {
  VI rl;
  REP(i,N+1) if(S[i]=='1') {
    if(i==0||S[i-1]=='0') rl.push_back(0);
    rl.back()+=1;
  }
  FORR(l,rl) if(l>=M) nope();

  VI ps={N};
  while(ps.back()!=0) {
    int cur=ps.back();
    int j=-1;
    REP(i,M) if(cur-i-1>=0&&S[cur-i-1]=='0') j=cur-i-1;
    ps.push_back(j);
  }
  //dumpc(ps);
  reverse(ALL(ps));
  REP(i,SZ(ps)-1) cout<<ps[i+1]-ps[i]<<" ";
  cout<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;

  cin>>N>>M>>S;
  solve();

  return 0;
}


Measured memory_bytes: 4084
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1e9+7
#define PI acos(-1.0)
#define ll long long
#define INF 1000000001

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

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  string s;cin>>s;
  int s_long=s.size();
  for(int i=s_long-3;i>=1;i-=2){
    bool g=true;
    for(int j=0;j<=(i-1)/2;j++){
      if(s[j]!=s[(i-1)/2+j+1])g=false;
    }
    if(g){
      P(i+1);
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int array[5];
	cin >> array[0] >> array[1] >> array[2] >> array[3] >> array[4];
	sort(array, array + 5);
	cout << array[4] << " " << array[3] << " " << array[2] << " " << array[1] << " " << array[0] << endl;
	return 0;
}

Measured memory_bytes: 1180
#include <bits/stdc++.h>
using namespace std;
#define LL long int
#define ULL unsigned long int
#define LD long double

LL MOD = 1000000007;


int main(){
    int n;
    cin >> n;
    cout << (ceil(n/1000.0)) * 1000 - n << endl;

    return 0;
}

Measured memory_bytes: 3780
n, y = map(int, input().split())
flag = 0
for i in range(n + 1):
   for j in range(n + 1 - i):
      k = n - i - j
      if (i * 10000 + j * 5000 + k * 1000) == y:
         flag = 1
         print('{} {} {}'.format(i, j, k))
         break
   else:
      continue
   break
if flag == 0:
   print('-1 -1 -1')

Measured memory_bytes: 3060
N = int(input())
A = [int(i) for i in input().split()]

colors = [0,0,0,0,0,0,0,0,0]

for a in A:
  if a < 400:
    colors[0] +=1
  elif 400<=a and a <800:
    colors[1] +=1
  elif 800<=a and a<1200:
    colors[2] +=1
  elif 1200<=a and a<1600:
    colors[3] +=1
  elif 1600<=a and a<2000:
    colors[4] +=1
  elif 2000<=a and a<2400:
    colors[5] +=1
  elif 2400<=a and a<2800:
    colors[6] +=1
  elif 2800<=a and a<3200:
    colors[7] +=1
  else:
    colors[8] +=1

ans = 0
for i in range(len(colors)-1):
  if colors[i] !=0 :
    ans +=1

if ans == 0:
  print(str(1) + " " + str(colors[8] + ans))
else:
  print(str(ans) + " " + str(colors[8] + ans))

Measured memory_bytes: 3064
n,k=map(int,input().split())
a=list(map(int,input().split()))
b=[]
for i in range(n):
    for j in range(i+1,n+1):
        s=sum(a[i:j])
        b.append(s)

x=0
for i in reversed(range(41)):
    cnt=0
    for j in b:
        if (x+2**i) & j ==(x+2**i):
            cnt+=1
    if cnt>=k:
        x+=2**i
print(x)

Measured memory_bytes: 110436
n, q = map(int, input().split())

# union find
# 最初は全て値であるとして初期化する parents[i] = i

# root(x) => xの根を返す関数
# unit(x,y) => root(x)とroot(y)が同じであればそのまま。違う場合は、xの根であるroot(x)をyの根であるroot(y)につける. 根が同じでない二つの木を合併する。
# same(x,y) => 二つのデータx,yが属する木が同じ場合、trueを返す。if root(x) == root(y)するだけ

parents = [i for i in range(n)]


def root(x):
    if parents[x] == x:
        return x
    parents[x] = root(parents[x])
    return parents[x]


def unit(x, y):
    root_x = root(x)
    root_y = root(y)
    if root_x < root_y:
        parents[root_y] = root_x
    else:
        parents[root_x] = root_y


def same(x, y):
    root_x = root(x)
    root_y = root(y)
    return (root_x == root_y)


for _ in range(q):
    query, x, y = map(int, input().split())
    if query == 0:
        unit(x, y)
    else:
        if same(x, y):
            print(1)
        else:
            print(0)



Measured memory_bytes: 5988
N,M = map(int,input().split())
A = list(map(int,input().split()))
BC = [list(map(int,input().split())) for _ in range(M)]

A.sort()
BC.sort(reverse = True, key = lambda x:x[1])
ans = sum(A)
idx = 0

for i in range(M):
    if idx + BC[i][0] >= N :
        BC[i][0] = N-idx
    if A[idx + BC[i][0]-1] < BC[i][1]:
        ans += BC[i][1] * BC[i][0] - sum(A[idx:idx+BC[i][0]])
    else:
        for j in range(BC[i][0]):
            if A[idx+j] >= BC[i][1]:
                break
        ans += BC[i][1] * j - sum(A[idx:idx + j])
        break
    idx += BC[i][0]
    if idx > N-1:break
print(ans)

            

Measured memory_bytes: 32968
/**
 *       Author:  kulubat
 *       Written on Thursday, 16 April 2020.
 **/

#include <bits/stdc++.h>


using namespace std;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    string s;
    cin >> s;

    int n = s.length();

    for(int k = 0; k+1 < n; ++k) {
        if(s[k] == s[k+1]) {
            cout << k+1 << " " << k+2 << "\n";
            return 0;
        }
    }

    for(int k = 0; k+2 < n; ++k) {
        if(s[k]==s[k+2]) {
            cout << k+1 << " " << k+3 << "\n";
            return 0;
        } 
    }

    cout << "-1 -1" << "\n";
    
    return 0;
}


Measured memory_bytes: 512
// Daniel Grzegorzewski
// while (clock()<=69*CLOCKS_PER_SEC)
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")

#define MP make_pair
#define PB push_back
#define ST first
#define ND second
#define int long long

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

//X.find_by_order(k); - zwraca iterator na k-ty element (numeracja od zerowego)
//X.order_of_key(k); - zwraca liczbę elementów ostro mniejszych niż k

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

void init_ios() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}

const int N = 2*(int)1e5 + 3;
const int MOD = (int)1e9 + 7;

int n, pot[N], inv[N], si[N], res[N], wyn[N];
VI child[N];

int ne(int x, int y) {
  if (x == y || y == 0)
    return 1;
  if (y > x)
    return 0;
  return pot[x]*inv[y]%MOD*inv[x-y]%MOD;
}

int fpow(int x, int y) {
  if (y == 0)
    return 1;
  if (y&1)
    return x*fpow(x, y-1)%MOD;
  int res = fpow(x, y/2);
  return res*res%MOD;
}

void dfs1(int v, int p) {
  si[v] = 1;
  int ilo_res = 1, ilo_new = 1;
  for (int x: child[v])
    if (x != p) {
      dfs1(x, v);
      si[v] += si[x];
      ilo_res = ilo_res*res[x]%MOD;
      ilo_new = ilo_new*inv[si[x]]%MOD;
    }
  res[v] = pot[si[v]-1]*ilo_new%MOD*ilo_res%MOD;
}

void dfs2(int v, int p) {
  si[v] = 1;
  int ilo_res = 1, ilo_new = 1;
  for (int x: child[v]) {
    si[v] += si[x];
    ilo_res = ilo_res*res[x]%MOD;
    ilo_new = ilo_new*inv[si[x]]%MOD;
  }
  res[v] = pot[si[v]-1]*ilo_new%MOD*ilo_res%MOD;
  wyn[v] = res[v];
  for (int x: child[v])
    if (x != p) {
      int pam = ilo_res, pam2 = ilo_new;
      ilo_res = ilo_res*fpow(res[x], MOD-2)%MOD;
      ilo_new = ilo_new*pot[si[x]]%MOD;
      int qwe = si[x];
      si[v] -= si[x];
      res[v] = pot[si[v]-1]*ilo_new%MOD*ilo_res%MOD;
      dfs2(x, v);
      si[v] += qwe;
      ilo_res = pam;
      ilo_new = pam2;
    }
}

signed main() {
  init_ios();
  pot[0] = 1;
  for (int i = 1; i < N; ++i)
    pot[i] = i*pot[i-1]%MOD;
  inv[N-1] = fpow(pot[N-1], MOD-2);
  for (int i = N-2; i >= 0; --i)
    inv[i] = (i+1)*inv[i+1]%MOD;
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int x, y;
    cin >> x >> y;
    child[x].PB(y);
    child[y].PB(x);
  }
  dfs1(1, 0);
  dfs2(1, 0);
  for (int i = 1; i <= n; ++i)
    cout<<wyn[i]<<"\n";
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull; 
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define SQ(a) (a)*(a)

template <class T, class U> ostream& operator<< (ostream &out, pair<T,U> c) { out << "(" << c.first << " "; out << c.second << ")"; return out; }
template <class T> ostream& operator<< (ostream &out, vector<T> c) { for (auto it = c.begin(); it != c.end(); ++it) { if (it != c.begin()) out << " "; out << *it; } return out; }
template <class T> ostream& operator<< (ostream &out, set<T> c) { for (auto it = c.begin(); it != c.end(); ++it) { if (it != c.begin()) out << " "; out << *it; } return out; }
const double PI  = 3.141592653589793238463;


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int a, b, f, s, t, fo ,fi, n, r = 0;
    cin >> a >> b;
    FOR(i,a,b+1){
        n = i;
        f = n/10000;
        n -= (n/10000*10000);
        s = n/1000;
        n -= (n/1000*1000);
        t = n/100;
        n -= (n/100*100);
        fo = n/10;
        n -= (n/10*10);
        fi = n;
        if(f == fi && s == fo){
            r++;
        }
    }
    cout << r << endl; 
}   

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (n, m) = readLongList()
    val conditionArray = Array(m.toInt()) { readIntegerList() }
    val first = if (n == 1L) 0 else pow(10, n - 1, Long.MAX_VALUE)
    for (i in first until pow(10, n, Long.MAX_VALUE)) {
        if (isOk(i.toString(), conditionArray)) {
            println(i)
            return
        }
    }

    println(-1)
}

fun isOk(i: String, cArray: Array<List<Int>>): Boolean {
    for (c in cArray) {
        if (i[c[0] - 1].toString() != c[1].toString()) {
            return false
        }
    }

    return true
}

fun pow(n: Long, m: Long, MOD: Long): Long {
    var ret = 1L
    var x = n
    var k = m
    while (k > 0) {
        if ((k and 1L) == 1L) {
            ret = (ret * x) % MOD
        }
        x = (x * x) % MOD
        k = k shr 1
    }

    return ret
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)


Measured memory_bytes: 36120
#!/usr/bin/env python3
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float("inf")
EPS = 1e-6


def yes():
    print("YES")  # type: str


def no():
    print("NO")  # type: str


def main():
    A, V = map(int, input().split())
    B, W = map(int, input().split())
    T = int(input())
    if V-W <= 0:
        no()
        return

    t = abs(A-B)/(V-W)
    if t <= T:
        yes()
    else:
        no()

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9200
//FIRST THINK THEN CODE.

#include <bits/stdc++.h>
 
 
using namespace std;
 
typedef long long ll;
 
//#define MOD 998244353
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define FOR(i,n)  for(ll i=0;i<n;i++)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define rev(p) reverse(p.begin(),p.end());
#define endl "\n"
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define popcount(x) __builtin_popcountll(x)
#define sz(x) ((ll)x.size())
const ll M=1000000007;
const ll MM=998244353;
ll begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";

 
ll newmod(ll a,ll b)
 {
  return ((a%b)+b)%b;
}
 
 
ll powM(ll a,ll b,ll m )
{ 
  if(a<=0)return 0;
  a%=m;
  if(!b)return 1;
  ll ans=1LL;
  while(b)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }
 
return ans;
}


 
ll poww(ll a,ll b)
{ 
  
  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a;
    a=a*a;
    b>>=1;
  }
 
return ans;

}

template<typename T,typename F>
void chmax( T &a,F b){
  if(b>a)a=b;
}

template<typename T,typename F>
void chmin( T &a,F b){
  if(b<a)a=b;
}



const ll N=2e5+5;




int main()
{ 

IOS;

ll a,b;
cin>>a>>b;

cout<<max({a+b,a*b,a-b});

//end_routine();

return 0;
 
 }

Measured memory_bytes: 3584
#include <iostream>
#include <utility>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <climits>
using namespace std;
signed main()
{
	ios::sync_with_stdio(false);
	int n;
	long long cnt=0;
	int tmp;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> tmp;
		while (tmp % 2 == 0) {
			tmp /= 2;
			cnt += 1;
		}
	}
	cout << cnt;
}

Measured memory_bytes: 256
import kotlin.math.*
import java.util.*

fun main(args: Array<String>) {
  val (n, m) = readLine()!!.split(' ').map(String::toInt)
  val h = readLine()!!.split(' ').map(String::toInt)
  val ten = Array(n) { sortedSetOf<Int>() }
  repeat(m) {
    val (a, b) = readLine()!!.split(' ').map(String::toInt)
    ten[a - 1].add(h[b - 1])
    ten[b - 1].add(h[a - 1])
  }
  var ans = 0
  for ((i, t) in ten.withIndex()) {
    if (t.isEmpty() || t.last() < h[i]) ans++
  }
  println(ans)
}


Measured memory_bytes: 78092
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define MOD3 1000000000
#define MOD2 998244353
float PHI = 1.6180339;
const float  PI_F=3.14159265358979f;
#define MAX 1000 m
#define endl "\n"    
#define manhunt 32 
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define pi 3.1415926535897932384626433
//typedef long long float;
#define int long long
//#define double long long
typedef pair<int, int> pii;
//#define float unsigned long long
#define FAST ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define CHAR_SIZE 26 

int modpow(int x, int n, int m) { if (n == 0) return 1%m; long long u = modpow(x,n/2,m); u = (u*u)%m; if (n%2 == 1) u = (u*x)%m; return u; } 


int add(int x, int y) 
{
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}
int sub(int x, int y) 
{
	x -= y;
	if (x < 0) return x + MOD;
	return x;
}
int inv(int a, int m = MOD2)
{
	return modpow(a, m - 2, m);
}
int mul(int a, int b) 
{
	return (long long) a * b % MOD2;
}


int nCrModp(int n, int r, int p) 
{ 
    int C[r+1]; 
    memset(C, 0, sizeof(C)); 
  
    C[0] = 1; 
    for (int i = 1; i <= n; i++) 
    { 
        for (int j = min(i, r); j > 0; j--) 
            C[j] = (C[j] + C[j-1])%p; 
    } 
    return C[r]; 
} 

int32_t main()
{
    /* freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout); */
    FAST
    cout << fixed << setprecision(12);
 
    
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    int sum=0;

        if(a>k)
        {
            sum+=k;
            k=0;
        }
        else
        {
            sum+=a;
            k-=a;
        }
        
        if(b>k)
        {
            sum+=0;
            k=0;
        }
        else
        {
            sum+=0;
            k-=b;
        }
        
        if(c>k)
        {
            sum-=k;
            k=0;
        }
        else
        {
            sum-=c;
            k-=c;
        }
    
    cout<<sum<<endl;
    
    
    
    return 0;
}

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


void solve(){
    int a,p;
    cin >> a >> p;
    cout << (3*a+p)/2 << endl;
}

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

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

int main() {
	int ans = 0;
	size_t N;
	string A, B, C;
	cin >> N >> A >> B >> C;
	for (size_t i = 0; i < N; ++i) {
		if (A.at(i) != B.at(i) || B.at(i) != C.at(i)) {
			if (A.at(i) == B.at(i) || A.at(i) == C.at(i) || B.at(i) == C.at(i)) ++ans;
			else ans += 2;
		}
	}
	cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define debug(...) cerr<<__LINE__<<" ["<<#__VA_ARGS__<<"]:",debug_out(__VA_ARGS__)
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec)
{ for (auto v : vec) os << v << ' '; os << '\n'; return os; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa)
{ os << '(' << pa.first << ',' << pa.second << ')'; return os; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T)
{ cerr << " " << H; debug_out(T...); }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    int n;
    cin >> n;
    vector<int> P(n);
    rep(i, n) cin >> P[i];
    int cnt = 0;
    rep(i, n - 2) {
        vector<int> X;
        rep(j, 3) {
            X.push_back(P[i + j]);
        }
        sort(all(X));
        if (X[1] == P[i + 1]) cnt++;
    }
    cout << cnt << endl;
}

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


Measured memory_bytes: 3636
import sys
input = lambda: sys.stdin.readline().rstrip()
n = int(input())
a = list(map(int, input().split()))
ans = 0
R = {}
L = {}
for i in range(n):
    r = i + a[i]
    l = max(i - a[i], 0)
    if r in R:
        R[r] += 1
    else:
        R[r] = 1
    if l in L:
        L[l] += 1
    else:
        L[l] = 1

for k, v in R.items():
    if k in L:
        ans += v * L[k]

print(ans)


Measured memory_bytes: 41740
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
    int n,a,b;
    cin >> n >> a >> b;
    vector<int> p(n);
    for(int i = 0; i < n; i++){
        cin >> p[i];
    }

    int q[3] = {0};
    for(int i = 0; i < n; i++){
        if(p[i]<=a) q[0]++;
        else if(p[i]<=b) q[1]++;
        else q[2]++;
    }

    cout << min(q[0],min(q[1],q[2])) << endl;

    return 0;
}

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

typedef struct{
  int val;
  char pattern;
}Card;

void BubbleSort(Card *, int);
void SelectionSort(Card *, int);

int main(){

  int n, i, flagb=1, flags=1;
  char tmp;
  Card cb[36], cs[36];

  scanf("%d%c",&n, &tmp);

  for(i = 0; i < n; i++)
    scanf("%c%d%c",&cb[i].pattern, &cb[i].val, &tmp);


  for(i = 0; i < n; i++)
    cs[i] = cb[i];

  SelectionSort(cs, n);
  BubbleSort(cb, n);

  for(i = 0; i < n; i++){
    printf("%c%d",cb[i].pattern, cb[i].val);
    if(i != n - 1) printf(" ");
    if(cb[i].pattern != cb[i].pattern || cb[i].val != cb[i].val) flagb = 0;
  }

  printf("\n");

  if(flagb == 1) printf("Stable\n");
  else printf("Not stable\n");

  for(i = 0; i < n; i++){
    printf("%c%d",cs[i].pattern, cs[i].val);
    if(i != n-1) printf(" ");
    if(cs[i].pattern != cb[i].pattern || cs[i].val != cb[i].val) flags = 0;
  }

  printf("\n");

  if(flags == 1) printf("Stable\n");
  else printf("Not stable\n");

  return 0;
}

void BubbleSort(Card *c, int n){

  int i, j;
  Card tmp;

  for(i = 0; i <= n-1; i++){
    for(j = n-1 ; j > i ; j--){
      if(c[j].val < c[j-1].val){
        tmp = c[j];
        c[j] = c[j-1];
        c[j-1] = tmp;
      }
    }
  }

  return;
}

void SelectionSort(Card *c, int n){

  int i, j, minj;
  Card tmp;

  for(i = 0; i <= n-1; i++){
    minj = i;
    for(j = i ; j <= n-1 ; j++){
      if(c[j].val < c[minj].val){
        minj = j;
      }
    }
    tmp = c[i];
    c[i] = c[minj];
    c[minj] = tmp;
  }

  return;
}

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

int main()
{
  int w, h, n;
  cin >> w >> h >> n;
  vector<int> x(n), y(n), a(n);

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

  int x_max = w, x_min = 0, y_max = h, y_min = 0;
  for (int i = 0; i < n; i++)
  {
    switch (a[i])
    {
    case 1:
      x_min = max(x_min, x[i]);
      break;
    case 2:
      x_max = min(x_max, x[i]);
      break;
    case 3:
      y_min = max(y_min, y[i]);

      break;
    case 4:
      y_max = min(y_max, y[i]);
      break;
    default:
      break;
    }
  }
  if (x_max - x_min < 0 || y_max - y_min < 0)
  {
    cout << 0 << endl;
    return 0;
  }
  cout << (x_max - x_min) * (y_max - y_min) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define N 1000005
using namespace std;

int n, say, a[N];

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	scanf("%d",&n);
	for(int i = 1; i <= n; i++)
		scanf("%d",a+i);
	for(int i = 1; i <= n - 1; i++)
		if(a[i + 1] == a[i]){
			say++;
			i++;
		}
		printf("%d\n",say);
	return 0;
}

Measured memory_bytes: 764
#include<iostream>
#include<vector>
void SHOW(std::vector<int> Card) {
	for (unsigned int i = 0; i < Card.size()-1; ++i) {
		std::cout << Card[i]<<" ";
	}
	std::cout << Card[Card.size() - 1] << std::endl;
}
int main(void) {
	int N;
	std::cin >> N;
	std::vector<int >Card(N);
	for (int i = 0; i < N; ++i) {
		std::cin >> Card[i];
	}
	for (int i = 0; i < N; ++i) {
				int v = Card[i];
		int NumberSequence = i - 1;
		while (0 <= NumberSequence&&Card[NumberSequence] > v) {
				Card[NumberSequence + 1] = Card[NumberSequence];
			--NumberSequence;
			Card[NumberSequence + 1] = v;
		}
		SHOW(Card);
	}
	//	system("pause");
	return 0;
}

Measured memory_bytes: 3128
//Traveling Salesman around Lake
#include<bits/stdc++.h>
using namespace std;
int main(){
    int k,n;
    cin>>k>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++)  cin>>a[i];
    int sum=0;
    for(int i=1;i<n;i++){
        int b=0;
        b = a[i]-a[i-1];
        sum = max(sum,b);
    }
    int ans=0;
    ans=max(a[0]+k-a[n-1],sum);
    cout<<k-ans<<endl;
}    

Measured memory_bytes: 4044
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::str::*;
#[allow(unused_imports)]
use std::mem::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::HashSet;
#[allow(unused_imports)]
use std::collections::VecDeque;
#[allow(unused_imports)]
use std::usize;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let mut line = String::new();
    stdin().read_line(&mut line).unwrap();
    line.trim().to_string().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_cols<T: FromStr>() -> Vec<T> {
    let mut line = String::new();
    stdin().read_line(&mut line).unwrap();

    line.trim()
        .split_whitespace()
        .map(|s| s.parse().ok().unwrap())
        .collect()
}

fn find(num_man_in_groups: &[u64], last_num_man: u64) -> Option<(u64, u64)> {
    let mut min_num_man = last_num_man;
    let mut max_num_man = last_num_man;
    for num_man_in_group in num_man_in_groups.iter().rev() {
        let actual_min_man = ((min_num_man - 1) / num_man_in_group + 1) * num_man_in_group;
        if actual_min_man > max_num_man {
            return None;
        }

        min_num_man = actual_min_man;
        max_num_man = (max_num_man / num_man_in_group + 1) * num_man_in_group - 1;
    }

    return Some((min_num_man, max_num_man));
}

fn main() {
    let num_rounds = read::<u64>();
    let num_man_in_groups = read_cols::<u64>();
    let last_num_man = 2;

    assert_eq!(num_rounds as usize, num_man_in_groups.len());

    match find(num_man_in_groups.as_slice(), last_num_man) {
        Some((min, max)) => println!("{} {}", min, max),
        None => println!("-1"),
    };
}


Measured memory_bytes: 8444
#include <bits/stdc++.h>
using namespace std;
int h,w,n,c[101][101],cur=1,a[10201];
int main(){
   std::cin >> h>>w>>n;
   for(int i = 1; i<=n; i++) std::cin >> a[i];
   for(int i = 0; i<h; i++){
     if(i%2==0){
       for(int j = 0; j<w; j++){
         c[i][j] = cur;
         a[cur]--;
         if(!a[cur]) cur++;
       }
     } else {
       for(int j = w-1; j>=0; j--){
         c[i][j] = cur;
         a[cur]--;
         if(!a[cur]) cur++;
       }
     }
   }
   for(int i = 0; i<h; i++){
     for(int j = 0; j<w; j++){
       printf("%d ", c[i][j]);
     }
     printf("\n");
   }
}


Measured memory_bytes: 384
using System;
class Program
 {
   static void Main(string[] args)
   {
     string[] AB;
     AB = Console.ReadLine().Split(' ');

     int A,B,ans;
     A = int.Parse(AB[0]);
     B = int.Parse(AB[1]);

     ans = A*B-(A+B)+1;
     Console.WriteLine(ans);
     
         
   }
 }

Measured memory_bytes: 11092
package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	N, _ := strconv.Atoi(nextLine())
	fmt.Println(dfs("0", N))
}

func dfs(s string, n int) int {
	sInt, _ := strconv.Atoi(s)
	if sInt > n {
		return 0
	}
	var ret int
	if strings.Contains(s, "3") && strings.Contains(s, "5") && strings.Contains(s, "7") {
		ret = 1
	} else {
		ret = 0
	}
	for _, c := range []string{"3", "5", "7"} {
		ret += dfs(s+c, n)
	}
	return ret
}


Measured memory_bytes: 2048
// 失敗するからこそ そこから立ち向かって行く強さがあって そんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#include<bits/stdc++.h>
using namespace std;

#if defined(DAIJOBU)
#include "/home/pavan/debug.hpp"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif

#define fi first
#define se second
#define FIO {ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef long double ld;

int main(){
	FIO
	
	string s,t;cin >> s >> t;
	int n, m;cin >> n >> m;
	string u;cin >> u;
	if(u == s)cout << n - 1 << " " << m;
	else cout << n << " " << m - 1;
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
//#pragma GCC optimize("O3")
//#pragma GCC target ("sse4")
using namespace std;
#define PB push_back
#define all(x) (x).begin(),(x).end()
#define MEM(x,a) memset((x),a,sizeof((x)))
#define F first
#define S second
#define imx INT_MAX
#define inI(x) scanf("%d",&x)
#define inI2(x,y) scanf("%d %d",&x,&y)
#define inI3(x,y,z) scanf("%d %d %d",&x,&y,&z)
const long long MOD = (long long)(1e9+7);
const long long MMX = (long long)(1e18);
typedef long long LL;
int a,b,c,n,x;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&x);
        if(x%4==0)a++;
        else if(x%2==0)b++;
        else c++;
    }
    if(c==0)printf("Yes");
    else if(b==0)
    {
        c-=a;
        if(c>1)printf("No");
        else printf("Yes");
    }
    else if(a==0)
    {
        if(c!=0)printf("No");
        else printf("Yes");
    }
    else
    {
        c-=a;
        if(c==0)printf("Yes");
        else
        {
            if(b==0)printf("Yes");
            else printf("No");
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repd(i,a,b) for (int i = (a); i < (b); i++)
#define INF LLONG_MAX
#define mod 1000000007
typedef long long ll;
int main(void)
{
	int N, M;
	cin >> N >> M;
	if(N==M) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


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

#define REP(i, k, n)  for(auto i = k; i != n; ++i)
#define RREP(i, n, k) for(auto i = n; i != k; --i)

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

#define mp make_pair
#define mt make_tuple

using ll = long long;
using Pii = pair<int, int>;
using Tiii = tuple<int, int, int>;
template<typename T>using V = vector<T>;
using Vi = vector<int>;
using VVi = vector<vector<int>>;

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

    int N, M; cin >> N >> M;
    Vi number = Vi(N+1);
    REP(i, 1, N+1) cin >> number[i];

    REP(k, 1, M+1) {
        int i = 1;
        while (i != N) {
            if (number[i]%k > number[i+1]%k) {
                int temp = number[i];
                number[i] = number[i+1];
                number[i+1] = temp;
            }
            ++i;
        }
    }
    REP(j, 1, N+1) cout << number[j] << endl;

    return 0;
}



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

// int/long:            -2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:      -9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define MOD 1000000007

#define Rep0(i, n)      for (auto i=0; i<n; i++)
#define Rep1(i, n)      for (auto i=1; i<=n; i++)
#define Sort(P) sort(P.begin(), P.end())
#define Rev(P)  reverse(P.begin(), P.end())

int     main() {
        ll N;
        cin >>N;
        vector<ll> NN(N+1, 2);
        NN.at(0)=0;
        NN.at(1)=1;
        ll SQ=sqrt(N);
        for (auto i=2; i<=SQ; i++) {
                ll IX=i*i;
                NN.at(IX)++;
                IX+=i;
                for (;IX<=N; IX+=i)
                        NN.at(IX) +=2;
        }
        ll S=0;
        Rep1(i, N)
                S +=NN.at(i)*i;
        cout <<S <<endl;
        return 0;
}

Measured memory_bytes: 81404
import os
import sys
from io import BytesIO, IOBase
 
BUFSIZE = 8192
 
 
class FastIO(IOBase):
    newlines = 0
 
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
 
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
 
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
 
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
 
 
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
 
 
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
sys.setrecursionlimit(10 ** 7)
mod = 10**9 + 7

import sys
input = lambda : sys.stdin.readline().rstrip()

n, q = map(int, input().split())
stx = []
for _ in range(n):
    s, t, x = map(int, input().split())
    stx.append([x, s - x, t - x])
stx.sort(reverse=True)
d = [int(input()) for _ in range(q)]

N = q
N0 = 2**(N-1).bit_length()
data = [None]*(2*N0)
INF = (-1, 10**9 + 1)
def update(l, r, v):
    L = l + N0; R = r + N0
    while L < R:
        if R & 1:
            R -= 1
            data[R-1] = v

        if L & 1:
            data[L-1] = v
            L += 1
        L >>= 1; R >>= 1
def _query(k):
    k += N0-1
    s = INF
    while k >= 0:
        if data[k]:
            s = max(s, data[k])
        k = (k - 1) // 2
    return s
def query(k):
    return _query(k)[1]



import bisect

for i, (x, start, last) in enumerate(stx):
    l = bisect.bisect_left(d, start)
    r = bisect.bisect_left(d, last)
    update(l, r, (i, x))

for i in range(q):
    res = query(i)
    if res == 10**9 + 1:
        print(-1)
    else:
        print(res)
    



Measured memory_bytes: 116780
#include<cstdio>
     
    using namespace std;
     
    int main(){
     
    int a, b;
     
    scanf("%d %d", &a, &b);
     
    if(a == 1)a = 14;
    if(b == 1)b = 14;
     
    if(a < b) printf("Bob\n");
    else if(a > b) printf("Alice\n");
    else printf("Draw\n");
     
    return 0;
     
    }

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

const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int a, b;
  cin >> a >> b;
  if (a <= b)
    cout << a << endl;
  else
    cout << a - 1 << endl;
  return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>
using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)


typedef long long ll;

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

const int INF = 1e9 + 7;

#define ARRAY_MAX 100005

template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


int main() {

	string s;
	cin >> s;
	ll k;
	cin >> k;
	
	ll index = 0;
	char c = s[0];

	bool flag = false;
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] == '1')
		{
			index++;
		}
		else
		{
			flag = true;
			c = s[i];
			break;
		}
	}
	if (!flag)
	{
		c = s[s.size() - 1];
	}

	if (index >= k)
	{
		cout << s[k-1] << endl;
	}
	else
	{
		cout << c << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <cctype>
using namespace std;

int main() {
    int x, a;
    cin >> x >> a;
    int ans = (a > x) ? 0 : 10;
    cout << ans << endl;
}
    

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

using std::max; using std::swap; using std::abs; using std::priority_queue; using std::queue; using std::bitset; using std::make_tuple; 
using std::istream; using std::ostream; using std::fixed; using std::greater; using std::tuple; using std::tie; using std::make_pair;
using std::cout; using std::cerr; using std::endl; using std::lower_bound; using std::upper_bound; using std::deque; using std::min; 
using std::map; using std::string; using std::fill; using std::copy; using std::sort; using std::unique; using std::unordered_set; 
using std::multiset; using std::nth_element; using std::min_element; using std::max_element; using std::vector; using std::set; 
using std::unordered_map; using std::pair; using std::next_permutation; using std::reverse; using std::rotate; using std::cin; 
using std::iota; using std::function; using std::shuffle;

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

int const INF = 100 + (int) 1e9;
ll const INFL = 100 + (ll) 1e18;
ld const PI = 3.141592653589793238462643L;
std::mt19937 mt19937(960172);

ll rnd(ll x, ll y) { static auto gen = std::bind(std::uniform_int_distribution<ll>(), mt19937); return gen() % (y - x + 1) + x; }
bool is_prime(ll x) { if (x <= 1) return 0; for (ll y = 2; y * y <= x; ++y) if (x % y == 0) return 0; return 1; }
ll sqr(int a) { return (ll) a * a; } ld sqr(ld a) { return a * a; } ll sqr(ll a) { return a * a; }
ll gcd(ll a, ll b) { while (b > 0) { ll t = a % b; a = b; b = t; } return a; }




void solve() {
    
    int n, a, b;
    string s;
    cin >> n >> a >> b >> s;
    
    int pas = 0;
    int over = 0;
    
    for (char x : s) {
        if (x == 'c') {
            cout << "No\n";
        } else if (x == 'a') {
            if (pas < a + b) {
                ++pas;
                cout << "Yes\n";
            } else {
                cout << "No\n";
            }
        } else {
            if (pas < a + b && over < b) {
                cout << "Yes\n";
                ++pas;
                ++over;
            } else {
                cout << "No\n";
            }
        }
    }
}



int main() {
    
    //freopen("", "r", stdin);
    //freopen("", "w", stdout);
    
    cout.precision(15);
    cout << fixed;
    cerr.precision(6);
    cerr << fixed;
    
    solve();
    
#ifdef LOCAL
    cerr << "time: " << (ll) clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
#endif
}

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

int main(){
	int H,A;
  	cin >> H >> A;
  
  	int P = H/A;
  
  	if(H%A == 0){
    	cout << P << endl;
    }else{
    	cout << P+1 << endl;
    }
}


Measured memory_bytes: 256