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

// modint: mod 計算を int を扱うように扱える構造体
template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};


const int MOD = 998244353;
using mint = Fp<MOD>;


int main(void)
{
    int N, K;
    cin >> N >> K;

    vector<int> l(K, 0);
    vector<int> r(K, 0);
    
    for(int i = 0; i < K; ++i)
    {
        cin >> l[i] >> r[i];
    }

    vector<mint> c(N+1,0);

    c[0] = 0;
    c[1] = 1;

    for(int i = 2; i <= N; ++i)
    {
        c[i] = c[i-1];
        for(int p = 0; p < K; ++p)
        {
            int rt = max(0, i-r[p]-1);
            int lt = max(0, i-l[p]);
            
            c[i] += c[lt] - c[rt];
        }
    }
    mint ans = c[N] -c[N-1];

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 4788
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <algorithm>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define ll long long int
#define REP(i, n) for(int i=0;i<n;++i)
#define ALL(a) (a).begin(),(a).end()

using namespace std;


class C {
public:
    ll N;
    ll tmp;
    ll ocnt[100001]{0};
    ll ecnt[100001]{0};
    ll omax = 0;
    ll oelem = -1;
    ll emax = 0;
    ll eelem = -1;
    ll omax2 = 0;
    ll emax2 = -1;

    void solve(std::istream& in, std::ostream& out) {
        in >> N;
        REP(i, N) {
            in >> tmp;
            if ((i+1) % 2 != 0) ocnt[tmp]++;
            else ecnt[tmp]++;

            if ((i+1) % 2 != 0 && ocnt[tmp] > omax) {
                omax = ocnt[tmp];
                oelem = tmp;
            } else if ((i+1) % 2 == 0 && ecnt[tmp] > emax) {
                emax = ecnt[tmp];
                eelem = tmp;
            }
        }

        if (oelem != eelem) {
            out << N - omax - emax << endl;
        } else {
            REP(i, N) {
                if ((i+1) != oelem && ocnt[i+1] > omax2) omax2 = ocnt[i+1];
                if ((i+1) != eelem && ecnt[i+1] > emax2) emax2 = ecnt[i+1];
            }

            out << min(N - omax - emax2, N - emax - omax2) << endl;
        }
    }
};


int main() {
    C solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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;
}

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

ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


template <typename T>
T amarinasi(T a,T b){
    if(a%b==0)
{
    return a/b;
}
else if(a%b>0)
{
    return a/b+1;
}
else
{
    return a/b-1;
}
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------

int main(){
ll x,y;
cin>>x>>y;
ll a[12]={1,3,1,2,1,2,1,1,2,1,2,1};
if(a[x-1]==a[y-1]){
    cout<<"Yes"<<endl;
}else{
    cout<<"No"<<endl;
}
}










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

a = []
for i in range(N - K + 1):
    a.append(min(abs(x[i] - 0) + abs(x[i + K - 1] - x[i]), abs(x[i + K - 1] - 0) + abs(x[i] - x[i + K - 1])))

print(min(a))

Measured memory_bytes: 14252
#include <iostream>
#include <stdio.h>
#include <cmath>
using namespace std;
int main(void){
    // Your code here!
    int H,W;
    scanf("%d %d",&H,&W);
    for (int k=1;k<=300;k++){
        if (H==0 && W==0){
            break;
        }
    for (int i=1;i<=H;i++){
        for (int j=1;j<=W;j++){
            printf("#");
        }
        printf("\n");
    }
    printf("\n");
    scanf("%d %d",&H,&W);
    }
    return 0;
}



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

const int N = 100;
const int H = 24;
const int K = 8;
const int INF = 1 << 29;

struct edge{
  int to, c, h, r;
  edge(int t=0, int c=0, int h=0, int r=0):to(t),c(c),h(h),r(r){}
};

struct state{
  int n, c, h;
  state(int n=0, int c=0, int h=0):n(n),c(c),h(h){}
  bool operator < (const state &s) const {
    return c > s.c;
  }
};

struct passport{
  int n, c, bit;
  passport(int n=0, int c=0, int b=0):n(n),c(c),bit(b){}
};

int n, m, h, kn, st, go, pn, pass[1<<K];
vector<edge> G[N];
vector<passport> pv;

int solve(){
  int ans = INF;

  for(int i=0;i<(1<<kn);i++){
    if(pass[i] >= INF) continue;
    for(int j=0;j<pn;j++){
      int next = i | pv[j].bit;
      pass[next] = min(pass[next], pass[i] + pv[j].c);
    }
  }

  for(int i=0;i<(1<<kn);i++){
    int d[N][H+1], res = INF;
    priority_queue<state> q;
    state u;

    if(pass[i] == INF) continue;

    fill(d[0], d[n], INF);
    d[st][0] = pass[i];
    
    for(q.push(state(st, pass[i], 0)); !q.empty();){
      u = q.top();
      q.pop();

      if(u.n == go){
        res = u.c;
        break;
      }

      for(int j=0;j<G[u.n].size();j++){
        edge next = G[u.n][j];
        state u2 = state(next.to, u.c + next.c, u.h + next.h);
        if(i & (1 << next.r)) u2.c = u.c;
        if(u2.h > h || d[u2.n][u2.h] <= u2.c) continue;
        d[u2.n][u2.h] = u2.c;
        q.push(u2);
      }
    }
    
    ans = min(ans, res);
  }


  return ans == INF ? -1 : ans;
}

int main(){
  while(cin >> n >> m >> h >> kn && (n|m|h|kn)){
    pv.clear();
    for(int i=0;i<n;i++) G[i].clear();
    fill(pass, pass+(1<<K), INF);
    pass[0] = 0;
    
    for(int i=0;i<m;i++){
      int a,b,c,d,e;
      cin >> a >> b >> c >> d >> e;
      a--; b--; e--;
      G[a].push_back(edge(b, c, d, e));
      G[b].push_back(edge(a, c, d, e));
    }
    cin >> st >> go;
    st--; go--;
    cin >> pn;
    for(int i=0;i<pn;i++){
      int l, d, x, bit = 0;
      cin >> l >> d;
      for(int j=0;j<l;j++){
        cin >> x;
        x--;
        bit |= 1 << x;
      }
      pass[bit] = min(pass[bit], d);
      pv.push_back(passport(l, d, bit));
    }
    
    cout << solve() << endl;
  }
}

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

typedef long long ll;
int main()
{
  ll a,b,c,d;
  cin >> a >> b >> c >> d;
  ll ans=0;
  ll gcd=0;
  ll lcm=0;

  
  ll cnum=(b/c)-((a-1)/c);
  ll dnum=(b/d)-((a-1)/d);
  //cout << b/d << " " << (a-1)/d << endl;
  
  ll x=c*d;
  if(c<d){
    ll tmp=c;
    c=d;
    d=tmp;
  }
  ll r=c%d;
  while(r!=0){
    c=d;
    d=r;
    r=c%d;
  }
  lcm=x/d;
  ll lcmnum=(b/lcm)-((a-1)/lcm);
  
  ans = (b-a+1)-(cnum+dnum)+lcmnum;
  //cout << cnum << " " << dnum << " " << lcmnum << endl;
  cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())
s = sorted([list(input()) for _ in range(n)])

word = list(set(s[0]))
d = {}
for i in word:
  t = 1000000
  for j in s:
    p = j.count(i)
    if p < t: t = p
  d[i] = t

ans = ""
for i in sorted(d.items()):
  ans += i[0]*i[1]
print(ans)

Measured memory_bytes: 9108
#include <stdio.h>

int main(){

    int h, n, hl = 0;

    scanf("%d%d", &h, &n);
    int at;

    for(int i = 0; i < n; ++i){
        scanf("%d", &at);

        hl += at;
    }

    if(hl >= h)
        printf("Yes\n");
    else
        printf("No\n");


    return 0;
}


Measured memory_bytes: 128
#line 1 "main.cpp"

#include <iostream>
#include <algorithm>
#include <utility>
#include <numeric>
#include <vector>
#include <array>
#include <queue>

template <class T, class U>
inline bool chmin(T &lhs, const U &rhs) {
  if (lhs > rhs) { lhs = rhs; return true; }
  return false;
}

template <class T, class U>
inline bool chmax(T &lhs, const U &rhs) {
  if (lhs < rhs) { lhs = rhs; return true; }
  return false;
}

struct range {
  using itr = int64_t;
  struct iterator {
    itr i;
    constexpr iterator(itr i_) noexcept : i(i_) { }
    constexpr void operator ++ () noexcept { ++i; }
    constexpr itr operator * () const noexcept { return i; }
    constexpr bool operator != (iterator x) const noexcept { return i != x.i; }
  };
  const iterator l, r;
  constexpr range(itr l_, itr r_) noexcept : l(l_), r(std::max(l_, r_)) { }
  constexpr iterator begin() const noexcept { return l; }
  constexpr iterator end() const noexcept { return r; }
};

struct revrange {
  using itr = int64_t;
  struct iterator {
    itr i;
    constexpr iterator(itr i_) noexcept : i(i_) { }
    constexpr void operator ++ () noexcept { --i; }
    constexpr itr operator * () const noexcept { return i; }
    constexpr bool operator != (iterator x) const noexcept { return i != x.i; }
  };
  const iterator l, r;
  constexpr revrange(itr l_, itr r_) noexcept : l(l_ - 1), r(std::max(l_, r_) - 1) { }
  constexpr iterator begin() const noexcept { return r; }
  constexpr iterator end() const noexcept { return l; }
};

using i32 = int32_t;
using i64 = int64_t;
using u32 = uint32_t;
using u64 = uint64_t;

constexpr i32 inf32 = (i32(1) << 30) - 1;
constexpr i64 inf64 = (i64(1) << 62) - 1;

i64 calc(const std::vector<std::vector<i32>> &vec) {
  i64 res = 0;
  std::priority_queue<i32> que;
  for (auto i: revrange(0, vec.size())) {
    for (auto x: vec[i]) {
      que.push(x);
    }
    if (!que.empty()) {
      res += que.top();
      que.pop();
    }
  }
  return res;
}

int main() {
  size_t testcases;
  std::cin >> testcases;
  auto solve = [&]() -> bool {
    size_t N;
    std::cin >> N;
    std::vector<std::tuple<i32, i32, i32>> A(N);
    for (auto &[k, l, r]: A) {
      std::cin >> k >> l >> r;
    }
    i32 left = 0, right = 0;
    for (const auto [k, l, r]: A) {
      if (l < r) ++right;
      if (l > r) ++left;
    }
    i64 base = 0;
    std::vector<std::vector<i32>> L(left + 1);
    std::vector<std::vector<i32>> R(right + 1);
    for (const auto [k, l, r]: A) {
      if (l < r) {
        base += l;
        if (k == N) continue;
        R[std::min<i32>(right, N - k - 1)].push_back(r - l);
      }
      else if (l > r) {
        base += r;
        L[std::min<i32>(left, k - 1)].push_back(l - r);
      }
      else {
        base += l;
      }
    }
    std::cout << base + calc(L) + calc(R) << '\n';
    return 0;
  };
  while (testcases--) {
    solve();
  }
  return 0;
}

/**
 * @title Template
 */


Measured memory_bytes: 13468
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (ll i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define INF (1000000000)
#define MOD (1000000007)
#define MAX (100000)
#define pii pair<int, int>

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

class XY{
public:
  ll x, y;
  XY() {x = y = 0;}
  XY(ll u, ll v) {x = u; y = v;}
};

template<typename T1, typename T2>
void chmin(T1 &a, T2 b) {if(a > b) a = b;}
template<typename T1, typename T2>
void chmax(T1 &a, T2 b) {if(a < b) a = b;}

template<typename T1, typename T2>
T1 mypow(T1 a, T2 n){
  if(n == 0) return 1;
  if(n == 1) return a;
  if(n % 2) return a * mypow(a, n - 1);
  T1 tmp = mypow(a, n / 2);
  return tmp * tmp;
}

template<typename T>
int BS(vector<T> V, int left, int right, T key){
  int mid = (left + right) / 2;
  if(V[mid] <= key) left = mid;
  else right = mid;
  if(right - mid == 1) return left;
  else return BS(V, left, right, key);
}

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

void Main(){
  ll N, A, B; cin >> N >> A >> B;
  vector<ll> X(N);
  rep(i, 0, N) cin >> X[i];
  ll res = 0;
  rep(i, 1, N) res += min((X[i] - X[i - 1]) * A, B);
  cout << res << endl;
}

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

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << std::fixed << std::setprecision(15);

  Main();
}

Measured memory_bytes: 1024
def deque(n, arr):
    dp = [[0] * n for _ in range(n)]
    for i in range(n):
        dp[i][i] = arr[i]

    for l in range(n-1, -1, -1):
        for r in range(l, n):
            if l == r:
                continue
            L = arr[l] - dp[l+1][r]
            R = arr[r] - dp[l][r-1]
            dp[l][r] = L if L > R else R
    return dp[0][n-1]

n = int(input())
arr = [int(x) for x in input().split()]
print(deque(n, arr))

Measured memory_bytes: 234176
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
using namespace std;

#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    string s,t;
    cin>>s>>t;
    string x = t;
    if(s.size()<t.size()){
        cout<<"UNRESTORABLE"<<endl;
        return 0;
    }

    int cnt=0;
    int ans_i;
    bool flag = false;
    for(int i=s.size()-t.size();i>=0;i--){
        for(int j=0;j<t.size();j++){
            // cout<<"AAAAA"<<endl;
            if((s.at(i+j)!='?') && (s.at(i+j)!=t.at(j))){
                if(i==0){flag=true;}
                cnt=0;
                break;
            }
            cnt++;
            // cout<<i << " "<< j << " "<< cnt<<endl;
        }
        if(cnt==t.size()){
            // cout<<"AAAAA"<<endl;
            ans_i=i;
            break;
        }
        x = t;
    }
    if(flag){
        cout<<"UNRESTORABLE"<<endl;
        return 0;
    }
    for(int k=0;k<t.size();k++){
        s.at(ans_i+k)=t.at(k);
    }
    // cout<<"AAAAA"<<endl;
    for(int i=0;i<s.size();i++){
        if(s.at(i)=='?')s.at(i)='a';
    }
    cout<<s<<endl;







    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
  int w,h,x,y,r;
  cin >> w >> h >> x >> y >> r;
  
  if(x+r>=0 && x+r<=w && x-r>=0 && x-r<=w &&y+r>=0 && y+r<=h && y-r>=0 && y-r<=h) cout << "Yes" <<endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 1156
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1e18) + 1;

int main(void)
{
    double a, b, x;
    double c, d;
    double s;

    cin >> a >> b >> x;

    s = a * a * b;

    if (x <= s / 2)
    {
        c = 2 * x / (a * b);
        d = sqrt(c * c + b * b);

        printf("%.10f\n", 180 * acos(c / d) / M_PI);
    }
    else
    {
        x = s - x;
        c = 2 * x / (a * a);
        d = sqrt(c * c + a * a);

        printf("%.10f\n", 180 * acos(a / d) / M_PI);
    }
}

Measured memory_bytes: 384
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE BangPatterns #-}

-- Default Imports

import Control.Monad
import Control.Monad.ST
import Control.Monad.Trans.Class

import qualified Control.Monad.Reader as Reader
import Control.Monad.Reader (Reader, ReaderT, runReader, runReaderT)

import qualified Data.Array.MArray as MArray
import qualified Data.Array.ST as STArray
import Data.Array.ST (STArray, STUArray, runSTArray, runSTUArray)
import Data.Ix (Ix)

import qualified Data.Bits as Bits
import Data.Bits ((.&.), (.|.))

import qualified Data.ByteString.Char8 as BS
import Data.ByteString.Char8 (ByteString)

import qualified Data.Char as Char
import qualified Data.List as List
import qualified Data.Map as Map
import Data.Map (Map)
import qualified Data.Maybe as Maybe
import qualified Data.Set as Set
import Data.Set (Set)

import qualified Data.Vector as Vector
import qualified Data.Vector.Generic as GVector
import qualified Data.Vector.Mutable as MVector
import Data.Vector.Mutable (STVector)
import qualified Data.Vector.Unboxed as UVector

import Numeric

import Debug.Trace
-- ----------

-- Custom Import Here


-- ----------

-- Default Definitions

type Vector = Vector.Vector
-- type GVector = GVector.Vector
type UVector = UVector.Vector

readIntToList :: ByteString -> [Int]
readIntToList = List.unfoldr (fmap (second $ BS.dropWhile Char.isSpace) . BS.readInt)

readToList :: Read a => ByteString -> [a]
readToList = List.unfoldr $ fmap (mapTaken . mapRemain) . span' (not . Char.isSpace)
	where
		mapTaken  = first $ read . BS.unpack
		mapRemain = second $ BS.dropWhile Char.isSpace
		span' pred s
			| BS.null taken = Nothing
			| otherwise     = Just (taken, remain')
			where
				(taken, remain) = BS.span pred s
				remain' = BS.dropWhile Char.isSpace remain

readToListN :: Read a => Int -> ByteString -> [a]
readToListN n = take n . readToList

readIntToUVector :: ByteString -> UVector.Vector Int
readIntToUVector = UVector.unfoldr (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace

readIntToUVectorN :: Int -> ByteString -> UVector.Vector Int
readIntToUVectorN n = UVector.unfoldrN n (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace

first :: (a -> a') -> (a, b) -> (a', b)
first f (a, b) = (f a, b)

second :: (b -> b') -> (a, b) -> (a, b')
second f (a, b) = (a, f b)

average :: Fractional a => [a] -> a
average xs = sum xs / (fromIntegral . length) xs

-- ----------

main :: IO ()
main = do
	[k, x] <- map read . words <$> getLine
	putStrLn $ if 500 * k >= x then "Yes" else "No"


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


int main() {
    int count = 0;
    int n;
    string s;
    cin >> n >> s;
    for (int i = 0; i < n-2; i++) {
        if (s.substr(i, 3) == "ABC") count++;
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
ll a,b,c;
cin>>a>>b;
cout << a+1-b << endl;}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define rep(i, n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
 
int main(void){
    ll a, b, c, x, y;
    cin>>a>>b>>c>>x>>y;
    ll ans;
    if(a+b<=2*c){
        ans = a*x+b*y;
    }
    else{
        if(x>=y){
            ans = y*2*c;
            ans += (x-y)*min(2*c, a);
        }
        else{
            ans = x*2*c;
            ans += (y-x)*min(2*c, b);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <iomanip>
#include <iostream>
using namespace std;
const long double pi = acos(-1);
int n;
int main() {
	while (cin >> n, n) {
		if (n % 3 == 0) n /= 3;
		long double theta = 2 * pi / (3 * n);
		long double tp = pi * 2 / 3 + theta;
		long double xa = sqrt(2) * sqrt(1 - cos(theta));
		long double xb = sqrt(2) * sqrt(1 - cos(tp));
		long double ya = cos(theta / 2);
		long double yb = cos(tp / 2);
		long double cp = xb / (xa + xb) * (ya + yb) - yb;
		cout << fixed << setprecision(15) << xa * cp * n / 2 << endl;
	}
	return 0;
}

Measured memory_bytes: 3504
//# define FLAG
///delet.........
# include <stdio.h>
# include <string.h>
# include <stdlib.h>
# include <iostream>
# include <fstream>
# include <vector>
# include <queue>
# include <stack>
# include <map>
# include <math.h>
# include <algorithm>
using namespace std;
# define pi acos(-1.0)
# define IOS ios::sync_with_stdio(false)
# define mem(a,b) memset(a,b,sizeof(a))
# define FOR(i,a,n) for(int i=a; i<=n; ++i)
# define For(i,n,a) for(int i=n; i>=a; --i)
# define FO(i,a,n) for(int i=a; i<n; ++i)
# define Fo(i,n,a) for(int i=n; i>a ;--i)
typedef long long LL;
typedef unsigned long long ULL;
inline int Scan() {
    int x=0,f=1; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}
///coding...

int main()
{
#ifdef FLAG
    freopen("in.txt","r",stdin);
#endif /// FLAG
    int i=1;
    int b;
    cin>>b;
    while(b>=i)
    {
        i<<=1;
    }
    cout<<(i>>1)<<endl;;
    return 0;
}
///delete # define FLAG...


















Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
void print(int, int);
void replace(int, int);
void reverse(int, int);

string str;

int main() {
	int q;
	cin >> str >> q;

	for (int i = 0; i < q; i++) {
		string op;
		int a,b;
		cin >> op >> a >> b;
		if (op == "print") print(a,b);
		else if (op == "replace") replace(a, b);
		else if (op == "reverse") reverse(a, b);
	
	}
	return 0;
}

void print(int a, int b) {
	string copy = str.substr(a, b - a + 1);
	cout << copy << endl;
}

void replace(int a, int b) {
	string s1;
	cin >> s1;
	str.erase(str.begin() + a, str.begin() + b + 1);
	int k = b - a + 1;
	for (int i = k - 1; i >= 0; i--) {
		str.insert(str.begin() + a, s1[i]);
	}
	//cerr << "replaced: " << str << endl;

}

void reverse(int a, int b) {
	string copy = str;
	for (int i = a; i <= b; i++) {
		str[i] = copy[b - (i-a)];
	}
	//cerr << "reversed: " << str << endl;;
}

Measured memory_bytes: 1240
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define szz(x) (int)x.size()
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) x.begin(), x.end()
typedef tuple<int, int, int> t3;

ll gc(ll a, ll b) { return b == 0 ? a : gc(b, a%b); }

void solve(){
	ll A, B, C, D;
	scanf("%lld%lld%lld%lld", &A, &B, &C, &D);
	if(A < B) puts("No");
	else if(B > D) puts("No");
	else if(C+1 >= B) puts("Yes");
	else {
		A %= B;
		D %= B;
		ll g = gc(B, D);
		ll lv = (C + 1 - A + B);
		ll rv = (B - 1 - A + B);
		ll temp = (lv + g - 1) / g * g;
		if(temp <= rv) puts("No");
		else puts("Yes");
	}
}

int main(){
	int Tc = 1; scanf("%d", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		solve();
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll INF = 1e18;

struct edge {
    int from, to;
    ll cost;
};

int n, m;
ll d[1001];
edge es[2001];

bool negative[1001];

int main(){
    cin >> n >> m;
    rep(i, m) {
        cin >> es[i].from >> es[i].to >> es[i].cost;
        es[i].from--; es[i].to--;
        es[i].cost *= -1;
    }

    fill(d, d + 1000, INF);
    d[0] = 0;
    rep(i, m){
        edge e = es[i];
        rep(j, n-1){
            if(d[e.from] != INF && d[e.to] > d[e.from] + e.cost){
                d[e.to] = d[e.from] + e.cost;
            }
        }
    }

    rep(i, m){
        edge e = es[i];
        rep(j, n-1){
            if(d[e.from] != INF && d[e.to] > d[e.from] + e.cost){
                d[e.to] = d[e.from] + e.cost;
                negative[e.from] = true;
                negative[e.to] = true;
            }
        }
    }

    if(negative[n-1]) cout << "inf" << endl;
    else cout << -d[n-1] << endl;
}

Measured memory_bytes: 256
x=int(input())

dp=[[0 for n in range(10)] for n in range(10)]
dp1=dp.copy()

for n in range(x+1):
    v=str(n)
    p=int(v[0])
    q=int(v[-1])
    for a in range(10):
        for b in range(10):
            if a==p and b==q:
                dp[a][b]+=1

res=-1

for n in range(10):
    for k in range(10):
        res+=dp[n][k]*dp[k][n]

print(res)


Measured memory_bytes: 9148
using System;
using System.Linq;

namespace ConsoleApp12
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] i = Console.ReadLine().Split(' ');
            int N = int.Parse(i[0]);
            int D = int.Parse(i[1]);
            int Dfa = D * 2;
            Dfa += 1;
            int o = N / Dfa;
            if (N % Dfa != 0)
            {
                o += 1;
                Console.WriteLine(o);
            }
            else Console.WriteLine(o);
        }
    }
}


Measured memory_bytes: 13140
#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;

template <typename T> inline constexpr bool chmin(T &a, T b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
template <typename T> inline constexpr bool chmax(T &a, T b) {
  if (b > a) {
    a = b;
    return true;
  }
  return false;
}
template <typename ite>
void print_ite(ite start, ite end, char sp = ' ', char en = '\n') {
  for (auto i = start; i != end; i++)
    cout << *i << sp;
  cout << en;
}
template <typename ite> void scan_ite(ite start, ite end) {
  for (auto i = start; i != end; i++)
    cin >> (*i);
}
inline void Yes(bool condition) { cout << (condition ? "Yes\n" : "No\n"); }

int main() {
  ll n;
  cin >> n;
  ll ans = 0;
  for (int i = 1; i <= n; i++) {
    if (i % 3 == 0 || i % 5 == 0) {
      continue;
    }
    ans += i;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3164
moji = str(input())
k = 0
u = 0
p = 0
c = 0
for a in range(len(moji)):
  if moji[a] == "K":
    k += 1
  elif moji[a] == "U":
    u += 1
  elif moji[a] == "P":
    p += 1
  elif moji[a] == "C":
    c += 1
print(min(k,u,p,c))


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

using namespace std;

int main()
{
   int arr[100],i,k,l,m,p[100],cnt=0;
   scanf("%d",&k);
   for(i=0;i<k;i++)
   {
      scanf("%d",&arr[i]);
   }
   sort(arr,arr+k);
   for(i=0;i<k;i++)
   {

      if(arr[i]!=arr[i+1]) cnt++;
      else arr[i]=arr[i+1];
      if(i==(k-1)) break;
   }

   printf("%d\n",cnt);
   return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int  ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define txt freopen("ip.txt", "r", stdin); freopen("op.txt", "w", stdout)
#define a3 INT_MAX
#define i3 INT_MIN
#define a6 INT64_MAX
#define i6 INT64_MIN
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define quickie ios_base::sync_with_stdio(false); cin.tie(NULL);
#define div2(a) (!(a&1))
#define deb(x) cout<<(#x)<<" "<<(x)<<"\n";
#define newl cout<<"\n" 
#define all(s) s.begin(),s.end()
#define pi 3.14159265358979323846
#define fp(x) fixed<<setprecision(x)<<
template<class T>
T mod(T a){
   if(a < 0){
       a += 1000000007;
   }
   return a%1000000007; 
}
template<class T>
T addmod(T a, T b){
   return (mod(a) + mod(b)) % 1000000007;
}
template<class T>
T prodmod(T a, T b){
   return (mod(a) * mod(b)) % 1000000007;
}
template<class T>
T bin_exp(T a, T b)
{
   T res = 1;
   T temp = 1;
   if (b <= 1)
       return a;
   if (b %2 == 0)
       res = bin_exp(a * a, b / 2);
   else
   {
       res *= a;
       temp = bin_exp(a, --b);
   }
   return res * temp;
}
template<class T>
T bin_expmod(T a, T b)
{
   T res = 1;
   T temp = 1;
   if (b <= 1)
       return a;
   if (b %2 == 0)
       res = bin_expmod(prodmod(a,a), b / 2);
   else
   {
       res = prodmod(a,res);
       temp = bin_exp(a, --b);
   }
   return prodmod(res , temp);
}

template<class T>
int digit(T a)
{
   vector<long long> dig = {
       0,
       9,
       99,
       999,
       9999,
       99999,
       999999,
       9999999,
       99999999,
       999999999,
       9999999999,
       99999999999,
       999999999999,
       9999999999999,
       99999999999999,
       999999999999999,
       9999999999999999,
       99999999999999999,
       999999999999999999,
       INT64_MAX};
   auto it = lower_bound(dig.begin(), dig.end(), a);
   int idx = (it - dig.begin());
   return idx;
}
template<class T>
int sumAllInts(T n){
   int a = 1;
   int su = 0;
   while(n){
       su += n%10;
       n/=10;
   }
   return su;
}
template<class T>
void split(char c,T s){
   int n = s.size();
   int i = 0;
   while ((cout<<s[i],i+=1) && (i<n) && (cout<<c<<' '));
}
void solve(){
   int n; cin>>n;
   ll res = 1;
   for (ll i = 1; i <= n; i++)
   {
       res = prodmod(res,i) ;
   }
   cout<<res;
   

}
int main(){
   quickie;
    //txt;
   int t = 1;
   while(t--){
       solve(); 
       newl; 
   } 
   return 0;
}

Measured memory_bytes: 3596
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC152 {
    class B {
        static void Main (string[] args) {
            int[] ab = Console.ReadLine ().Split ().Select (int.Parse).ToArray ();
            Console.WriteLine (ab[0]==ab[1]?"Yes":"No");
        }
    }
}

Measured memory_bytes: 13396
#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

int main(void) {
  uint N;
  uint M;

  cin >> N;
  cin >> M;

  vector<uint> H(N);
  
  for(uint i=0; i<N; i++)
    cin >> H[i];

  vector<uint> result(N,1);
    
  for(uint i=0; i<M; i++) {
    uint s;
    uint g;
    cin >> s;
    cin >> g;
    if(H[s-1] < H[g-1])
      result[s-1] = 0;
    else if(H[g-1] < H[s-1])
      result[g-1] = 0;
    else {
      result[s-1] = 0;
      result[g-1] = 0;
    }
  }

  cout << accumulate(result.begin(),result.end(),0) << endl;

  return 0;
}


Measured memory_bytes: 3636
A, B, M = list(map(int, input().split()))

cost_a = list(map(int, input().split()))
cost_b = list(map(int, input().split()))

ans = min(cost_a) + min(cost_b)

for m in range(M):
    coupon = list(map(int, input().split()))
    ans = min(ans, cost_a[coupon[0]-1]+cost_b[coupon[1]-1]-coupon[2])

print(ans)


Measured memory_bytes: 18736
// Do you knOW what it feels like?

		// To be TorTured by your own MinD?
	
	// I don't wanna feel the PAIN.

// I BeG you to KILL me, pleASE...

#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("Os")

#define F first
#define S second
#define pb push_back
#define SZ(x) (ll)(x.size())
#define all(x) x.begin(),x.end()

typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll maxn=1e5+10, lg=17, mod=1e9+7, inf=1e18;

ll n;
ld a,b,ans;

int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);

	cin>>n>>a>>b;
	while(n--){
		ans+=a+b*(2*n+1)/2;
		a+=(a+2.5*b)/(n+1), b+=2*b/(n+1);
	}
	cout<<fixed<<setprecision(10)<<ans;
	
	return 0;
}


















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

int main(){
  int a,b,c,m,r;cin>>a>>b>>c;
  if(a>=b&&a>=c) m=a*2,r=b+c;
  else if(b>=a&&b>=c) m=b*2,r=a+c;
  else m=c*2,r=a+b;
  cout<<(m-r+((m-r)%2?3:0))/2;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define abdelrahman010 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
using namespace std;
const int N = 2e5 + 5;
int main()
{
    abdelrahman010
    int x;
    cin >> x;
    cout << (x / 500 ) * 1000 + ((x % 500) / 5) * 5;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
int main() {
  long long int a,b,c,n;
  cin>>a>>b>>c;
  if(a%2==0 || b%2==0 || c%2==0){
    cout<<0<<endl;
    return 0;
  }
  n=min(a*b,min(b*c,c*a));
  cout<<n<<endl;
}


Measured memory_bytes: 256
n, m = gets.split.map(&:to_i)
mod = 10**9 + 7

if (n - m).abs > 1
  puts 0
else
  pd = [*1..n].inject { |memo, i| memo * i % mod }
  pm = [*1..m].inject { |memo, i| memo * i % mod }

  puts n == m ? 2 * pd * pm % mod : pd * pm % mod
end

Measured memory_bytes: 4988
import java.io.*;
import java.util.*;
import java.lang.*;

public class Main {
    static ArrayList<Integer> heights = new ArrayList<>();
    static ArrayList<Integer> bests = new ArrayList<>();
    static int stones = 0;

    public static void main(String args[])  {
        Scanner sc = new Scanner(System.in);

        stones = sc.nextInt() ;
        for (int c=0;c<stones;c++) {
           heights.add(sc.nextInt());
        }

        bests.add(0);
        bests.add(Math.abs(heights.get(0)-heights.get(1)));

        if (stones > 2){
            for (int c=2;c<stones;c++) {
                bests.add(Math.min(bests.get(c-2) + Math.abs(heights.get(c-2) - heights.get(c)), bests.get(c-1) + Math.abs(heights.get(c-1) - heights.get(c))));
            }
        }


        System.out.println(bests.get(bests.size() - 1));

    }


}


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

al = ["z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y"]
re = []


while(n != 0):
    am = n%26
    
    n = n//26
    
    re.append(al[am])
    
    if(am == 0):
        n -=1
    
re.reverse()

for i in re:
    print(i,end="")

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

int main()
{
    int n;
    cin>>n;
    vector<int> h(n);
    int i;
    for(i=0;i<n;i++)cin>>h.at(i);
    int ans=0;
    int count=0;
    for(i=1;i<n;i++)
    {
        if(h.at(i)<=h.at(i-1))count++;
        else
        {
            if(ans<count)ans=count;
            count=0;
        }
    }
    if(ans<count)ans=count;
    cout<<ans<<endl;
}


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

int main() {
    long long x;
    cin >> x;
    long long com=100;
    long long count=0;
    while(1){
        count++;
        com*=1.01;
        if(com>=x) break;
    }
    cout << count << endl;
}

Measured memory_bytes: 3632
class unionfind():
    def __init__(self, n):
        self.parents = [-1 for i in range(n)]

    def find(self, a):
        if self.parents[a] < 0:
            return a
        self.parents[a] = self.find(self.parents[a])
        return self.parents[a]

    def union(self, x, y):
        x, y = self.find(x), self.find(y)
        if x == y:
            return
        if x < y:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self):
        return len(list(filter(lambda x: x < 0, self.parents))) - 1

n, m = map(int, input().split())
uf = unionfind(n)
for i in range(m):
    tmp = list(map(int, input().split()))
    uf.union(tmp[0] - 1, tmp[1] - 1)

print(uf.size())


Measured memory_bytes: 10976
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }



int main(int argc, char const *argv[]) {
  int n,k,r,s,p;
  string t;
  cin >> n >> k >> r >> s >> p >> t;
  ll rec=0;
  rep(i,sz(t)){
    if(t[i]=='r') rec+=p;
    else if(t[i]=='s') rec+=r;
    else rec+=s;
  }

  rep(i,sz(t)-k){
    if(t[i]==t[i+k]){
      t[i+k]='?';
      if(t[i]=='r') rec-=p;
      else if(t[i]=='s') rec-=r;
      else rec-=s;
    }
  }
  cout << rec << endl;
  return 0;
}


Measured memory_bytes: 764
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
ans=0
for n in range(N):
    if A[n]>=B[n]:
        ans+=B[n]
    else:
        nex=B[n]-A[n]
        ans+=A[n]
        if A[n+1]>=nex:
            A[n+1]-=nex
            ans+=nex
        else:
            ans+=A[n+1]
            A[n+1]=0

print(ans)

Measured memory_bytes: 18624
import math
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors
N, M  = map(int, input().split())
div = make_divisors(M)
ans = 0
for i in div:
    if M // i >= N:
        ans = max(ans,i)
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
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; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int N,C;
const int MAX = 100010;
int s[MAX],t[MAX],c[MAX];
int cs[30][MAX];
int ss[MAX];

int main() {
  IOS;
  cin >> N >> C;
  REP(i,N) {
    int s,t,c;
    cin >> s >> t >> c;
    c--; s--;
    cs[c][s]++;
    cs[c][t]--;
  }

  REP(i,C) REP(j,MAX-1) cs[i][j+1] += cs[i][j];

  REP(i,C) REP(j,MAX-1) {
    if (cs[i][j]) ss[j]++;
  }

  int ans = 0;
  REP(i,MAX) { chmax(ans, ss[i]); }
  COUT(ans);

  return 0;
}

Measured memory_bytes: 15764
X, N = map(int, input().split())

int_set = set(list(range(-1,102)))

for x in input().split():
    int_set.remove(int(x))

for i in range(200):
    if X - i in int_set:
        print(X - i)
        break
    elif X + i in int_set:
        print(X + i)
        break



Measured memory_bytes: 9116
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
using ll = long long;
int MOD = 1e9 + 7;
using namespace std;
ll GCD(ll x, ll y)
{
    if (y == 0)
    {
        return x;
    }
    else
    {
        return GCD(y, x % y);
    }
}
ll LCM(ll x, ll y)
{
    return x / GCD(x, y) * y;
}
struct UnionFind
{
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N)
    { //最初は全てが根であるとして初期化
        for (int i = 0; i < N; i++)
            par[i] = i;
    }

    int root(int x)
    { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x)
            return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y)
    {                     // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry)
            return;   //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y)
    { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};
int main()
{
    int n, m;
    cin >> n >> m;
    vector<vector<int>> BIT((1 << n));
    for (int i = 0; i < (1 << n);i++){
        for (int j = 0; j < n;j++){
            if(i&(1<<j)){
                BIT[i].push_back(1);
            }else{
                BIT[i].push_back(0);
            }
        }
    }
   // cout<<BIT.size()<<endl;
    vector<vector<int>> L(m);
    for (int i = 0; i < m;i++){
        int k;
        cin >> k;
        for (int j = 0; j < k;j++){
            int x;
            
            cin >> x;
            x--;
            L[i].push_back(x);
        }
    }
    vector<int> S(m);
    ll c=0;
    for (int i = 0; i < m;i++){
        cin >> S[i];
    }
    for (int i = 0; i < (1 << n); i++)
    {
        bool h = true;
        for (int j = 0; j < m; j++)
        {
            ll sum = 0;
            for (int k = 0; k < L[j].size(); k++)
            {
            //    cout<<L[j][k]<<endl;
                if (BIT[i][L[j][k]]==1)
                {
                    sum++;
                }
            }
            if (sum % 2 != S[j])
            {
                h = false;
                break;
            }
        }
        if (h)
        {
            c++;
        }
    }
    cout << c << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h> 
using namespace std;
 
int main () {
    int a,b;
 
    cin >> a;
    cin >> b;
 
    if( a < 0 )
        return 0;
 
    if( b > 1000000000 )
        return 0;
 
    if( (a+b)%2 == 1) {
        cout << "IMPOSSIBLE";
    } else {
        unsigned k = (a+b)/2;
        cout << k;
    }
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <cmath>

#define	MOD 1000000007;
#define PI 3.14159265358979323846;
using namespace std;
typedef long long ll;
ll mod = 1000000007;

int main()
{
	ll N;
	cin >> N;
	ll T[1000], A[1000], P[1000];

	ll t, a;
	for (ll i = 0; i < N; i++)
	{
		cin >> T[i] >> A[i];

		if (i == 0) {
			t = T[i];
			a = A[i];
		}
		else {
			ll b = (t - 1) / T[i] + 1;
			ll c = (a - 1) / A[i] + 1;

			ll k = max(b, c);

			t = k * T[i];
			a = k * A[i];
		}
	}

	cout << t + a << endl;

	return 0;
}
//
//ll N;
//cin >> N;
//ll T[1000], A[1000], P[1000];
//
//ll t, a;
//for (ll i = 0; i < N; i++)
//{
//	cin >> T[i] >> A[i];
//
//	if (i == 0) {
//		P[i] = T[i] + A[i];
//	}
//	else {
//		ll CurrentT = P[i - 1] * T[i - 1] / (T[i - 1] + A[i - 1]);
//		ll CurrentA = P[i - 1] * A[i - 1] / (T[i - 1] + A[i - 1]);
//
//		ll b = CurrentT / T[i] + (CurrentT % T[i] == 0 ? 0 : 1);
//		ll c = CurrentA / A[i] + (CurrentA % A[i] == 0 ? 0 : 1);
//
//		ll k = max(b, c);
//
//		CurrentT = k * T[i];
//		CurrentA = k * A[i];
//
//		P[i] = CurrentT + CurrentA;
//	}
//}
//
//cout << P[N - 1] << endl;

Measured memory_bytes: 256
N,Q=gets.split.map(&:to_i)
S=gets.chomp+"?X"

ac=Array.new(N+1){0}
1.upto(N) do |i|
  ac[i]+=ac[i-1]
  ac[i]+=1 if S[i-2]==?A && S[i-1]==?C
end

Q.times do
  l,r=gets.split.map(&:to_i)
  p ac[r]-ac[l]
end

Measured memory_bytes: 3452
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		int a,b;
		String str1,str2;

        Scanner in = new Scanner(System.in);

        str1 = in.next();
        str2 = in.next();

        a = Integer.parseInt(str1);
        b = Integer.parseInt(str2);

        if(a == b) System.out.println("a == b");
        else if(a < b) System.out.println("a < b");
        else System.out.println("a > b");

        in.close();
    }
}

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


void solve(int N) {
    long long ans = 0;
    map<int, int> mp;
    for (int x = 1; x <= 100; x++) {
        for (int y = 1; y <= 100; y++) {
            for (int z = 1; z <= 100; z++) {
                int n = x * x + y * y + z * z + x * y + y * z + z * x;
                mp[n]++;
            }
        }
    }
    for (int i = 1; i <= N; i++) {
        cout << mp[i] << endl;
    }
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    int N;
    scanf("%d",&N);
    solve(N);
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  int ans;
  for (int i = 1; i <= 10; ++i){
    if (n <= i*1000) {
      ans = i*1000 - n;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636