akhauriyash/Code-Regression huggingface dataset:
import java.security.KeyStore.TrustedCertificateEntry
import java.util
import java.util.regex.Pattern
import java.util.{ArrayList, Collections, Comparator, List => JList}

import scala.collection.immutable.TreeMap
import scala.math._
import scala.collection.mutable
import scala.collection.mutable.{ArrayBuffer, ListBuffer}
import scala.util.{Failure, Success, Try}

object Main{
  val LINE_SEPARATOR = "\n"
  def main(args: Array[String]): Unit = {
    if (sys.env.getOrElse("TEST", "")=="1"){
      println(test());
    }else{
      val input=io.Source.stdin.getLines().mkString(LINE_SEPARATOR);
      println(solve(input).trim());
    }
  }

  def init (nRows: Int, nCols: Int, default: Int) = Array.tabulate(nRows,nCols)( (x,y) =>  default)

  def sortIgnoreCase1(list: JList[String]): JList[String] = {
    val r = new ArrayList[String](list)
    Collections.sort(r, new Comparator[String] {
      override def compare(o1: String, o2: String): Int = o1.compareToIgnoreCase(o2)
    })
    r
  }

  def solve(input: String): String = {
    val Array(x, y) = input.split(" ").map(_.toInt)
    if ((x * 2 to x * 4 by 2).contains(y)) "Yes" else "No"
  }

  def medianCalculator(seq: Seq[Long]): Long = {
    //In order if you are not sure that 'seq' is sorted
    val sortedSeq = seq.sortWith(_ < _)

    if (seq.size % 2 == 1) sortedSeq(sortedSeq.size / 2)
    else {
      val (up, down) = sortedSeq.splitAt(seq.size / 2)
      (up.last + down.head) / 2
    }
  }

  def factorize(x: Long): List[Long] = {
    def foo(x: Long, a: Long = 2, list: List[Long] = Nil): List[Long] = a*a > x match {
      case false if x % a == 0 => foo(x / a, a    , a :: list)
      case false               => foo(x    , a + 1, list)
      case true                => x :: list
    }
    foo(x)
  }

  def divisors(n: Long): Vector[Long] = {
    val halfList = (1 to sqrt(n).toInt).toVector.filter(_ % n == 0).map(_.toLong)
    val reversedList = if (sqrt(n).floor == sqrt(n)) halfList.reverse.tail.map(n/_) else halfList.reverse.map(n/_)
    halfList ++ reversedList
  }

  def gcd(m: Long, n: Long): Long = n match {
    case 0 => m
    case _ => gcd(n, m % n)
  }
  def lcm(a: Long, b: Long): Long = a * b / gcd(a, b)

  val tests=List(
    """3 8""".stripMargin -> """Yes
                               |
                                     |
                                   |
                                   |""".stripMargin,
    """2 100""".stripMargin -> """No
                                 |""".stripMargin,
    """1 2""" -> """Yes"""
  )

  def test():String= {
    return tests.map{case (i,o)=>(i.trim(),o.trim())}
      .zipWithIndex.map{
      case ((input,outputExpect),i)=>{
        val output=solve(input).trim();
        s"test${i+1}:"+(if(output==outputExpect){
          "Passed"
        }else{
          s"Failed\nexpect:\n${outputExpect}\noutput:\n${output}"
        })
      }}
      .mkString("\n");
  }
}


Measured memory_bytes: 55416
#include <stdio.h>
                                                                                                
  
int main(void){
                                                                                                
   
    int a, b, x;
   
      
    scanf("%d %d %d", &a, &b, &x );
   

    if( a <= x && a + b >= x ){

        printf("YES\n");

        return 0;

        }

    else printf("NO\n");

    return 0;
                                                          
}

Measured memory_bytes: 128
#include <stdio.h>

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

using namespace std;

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

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

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

typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N, A, B;
    cin >> N >> A >> B;
    cout << min(N*A, B) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;

#define ll long long
#define P pair<int, int>
#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define GI(name) \
  int(name);     \
  scanf("%d", &(name))
#define GI2(name1, name2) \
  int(name1), (name2);    \
  scanf("%d %d", &(name1), &(name2))
#define GI3(name1, name2, name3) \
  int(name1), (name2), (name3);  \
  scanf("%d %d %d", &(name1), &(name2), &(name3))
#define GVI(name, size)    \
  vector<int>(name)(size); \
  FOR(i, (size)) scanf("%d", &(name)[i])
#define GS(name) \
  string(name);  \
  cin >> (name);
#define MOD 1000000007
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

string to_string(string s) {
  return s;
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  FOR(i, v.size() - 1) { ret += to_string(v[i]) + ","; }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() {
  cerr << endl;
}

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() {
  cout << endl;
}

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

int main() {
  GI2(H, W);
  GI(N);
  vector<vector<int>> c(H, vector<int>(W));
  int nowH = 0, nowW = 0, ori = 1;
  FOR(i, N) {
    GI(a);
    FOR(j, a) {
      c[nowH][nowW] = i + 1;
      nowW += ori;
      if (nowW >= W) {
        nowW--;
        ori *= -1;
        nowH++;
      } else if (nowW < 0) {
        nowW++;
        ori *= -1;
        nowH++;
      }
    }
  }
  FOR(i, H) {
    FOR(j, W - 1) { cout << c[i][j] << " "; }
    cout << c[i][W - 1] << endl;
  }
  return 0;
}

Measured memory_bytes: 384
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
fun <T> Array<Array<T>>.print() {
    this.forEach {
        println(it.joinToString(" "))
    }
}

fun main() {
    val s = readString()

    if (s[0].isUpperCase()) {
        println('A')
    } else {
        println('a')
    }
}

Measured memory_bytes: 34472
#include <algorithm>
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>


typedef long long LL;
using namespace std;
 
void read(int &v) {
    int k = 0, l = 1;
    char ch;
    ch = getchar();
    while (ch > '9' || ch < '0') {
        if (ch == '-')
            l = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9') k = k * 10 + ch - '0', ch = getchar();
    v = l * k;
}

void print(int v) {
    if (v < 0)
        putchar('-'), v = -v;
    if (v > 9)
        print(v / 10);
    putchar(v % 10 + '0');
}

int max(int a, int b) {
        return a > b ? a : b;
}

int min(int a, int b) {
        return a < b ? a : b;
}

static int n, max2, max1, num1, num2, x;

int main() {
        read(n);
        for (int i = 1; i <= n; ++i ) {
                read(x);
                if (x > max1) max1 = x, num1 = i;
                else if (x > max2) max2 = x, num2 = i;
        }
        for (int i = 1; i <= n; ++i) {
                if (i == num1) print(max2), puts("");
                        else print(max1), puts("");
        }
        return 0;
}

Measured memory_bytes: 1664
import Control.Applicative
import Control.Monad
import Data.List
import Data.Maybe (fromJust)

type Dice = [Int]

rot :: Dice -> Char -> Dice
rot d 'E' = [d!!3, d!!1, d!!0, d!!5, d!!4, d!!2]
rot d 'W' = [d!!2, d!!1, d!!5, d!!0, d!!4, d!!3]
rot d 'N' = [d!!1, d!!5, d!!2, d!!3, d!!0, d!!4]
rot d 'S' = [d!!4, d!!0, d!!2, d!!3, d!!5, d!!1]
rot _ _ = undefined

solve :: [[Int]] -> String
solve (diceA:diceB:_) =
    let es = cycle "E" in
    let ns = cycle "N" in
    let cmdSets =   [ take a es ++ take b ns ++ take c es ++ take d ns
                    | a<-[1..4], b<-[1..4], c<-[1..4], d<-[1..4]]
    in  
    solve' cmdSets
    where
    solve' [] = "No"
    solve' (cmd:cmds) =
        if (foldl' rot diceB cmd == diceA) then
            "Yes"
        else
            solve' cmds

main =
    putStrLn =<< solve . map (map read . words) . lines <$> getContents 


Measured memory_bytes: 4064
X, Y, A, B, C = map(int, input().split())

p = [int(x) for x in input().split()]
q = [int(x) for x in input().split()]
r = [int(x) for x in input().split()]

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

apples = []
apples.extend(p[:X])
apples.extend(q[:Y])

apples.sort(reverse=True)
apples.extend(r)

apples.sort(reverse=True)
print(sum(apples[:(X+Y)]))

Measured memory_bytes: 23340
def read_input():
    a, b, c, d = map(int, input().split())

    return a, b, c, d

# baseの倍数がfrom_n ~ to_nにいくつあるか数える
def count_multiples(from_n, to_n, base):
    # from_nより大きい最小の倍数
    if from_n % base == 0:
        a = from_n // base
    else:
        a = from_n // base + 1
    left = a

    # to_nより小さい最大の倍数
    a = to_n // base
    right = a

    if left > right:
        return 0

    return right - left + 1

def euclidian(c, d):
    if c > d:
        p = c
        q = d
    else:
        p = d
        q = c

    while q:
        r = p % q
        p = q
        q = r

    return p


def submit():
    a, b, c, d = read_input()

    all_n = b - a + 1

    # cで割り切れる数
    c_div = count_multiples(a, b, c)

    # dで割り切れる数
    d_div = count_multiples(a, b, d)

    # cdの最小公倍数で割り切れる数
    min_mul = c * d // euclidian(c, d)
    cd_div = count_multiples(a, b, min_mul)


    print(all_n - c_div - d_div + cd_div)


if __name__ == '__main__':
    submit()


Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <vector>

class ope {
 public:
  int B, C;
  ope(){};
  ope(int _B, int _C) : B(_B), C(_C){};

  bool operator<(const ope &other) const { return C < other.C; }
};

int main() {
  int N, M;
  std::cin >> N >> M;

  std::vector<int> A(N);
  for (int i = 0; i < N; ++i) {
    std::cin >> A[i];
  }

  std::sort(A.begin(), A.end());

  std::vector<ope> BC(M);
  for (int i = 0; i < M; ++i) {
    int B, C;
    std::cin >> B >> C;
    BC[i] = ope(B, C);
  }
  std::sort(BC.begin(), BC.end());

  int index = 0;
  for (int i = BC.size() - 1; i >= 0; --i) {
    auto &bc = BC[i];
    while (A[index] < bc.C) {
      A[index++] = bc.C;
      --bc.B;
      if (bc.B == 0) {
        break;
      }
    }
  }

  int64_t sum = 0;

  for (int i = 0; i < N; ++i) {
    sum += A[i];
  }

  int64_t result = sum;
  std::cout << result << std::endl;

  return 0;
}

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

const ll INF = 1LL << 60;

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

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

    vector<ll> dp(100,0);
    dp[0] = 1000;

    for (ll i = 1; i < n; i++){
        dp[i] = dp[i-1];
        for (ll j = 0; j < i; j++){
            ll s = dp[j]/a[j];
            ll m = (dp[j]%a[j]) + a[i]*s;
            dp[i] = max(dp[i],m);
        }
    }

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

Measured memory_bytes: 3604
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[8] = {-1,0,1,0,-1,1,1,-1};
int dx[8] = {0,1,0,-1,1,1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100100;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,l;
    cin>>n>>l;
    int m=mod,res=0;
    for(int i=0;i<n;i++){
        res+=l+i;
        if(abs(m)>abs(l+i))m=l+i;
    }

    cout<<res-m<<endl;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 45;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  string s;
  cin >> s;
  char a = s[s.size()-1];
  int x = a-'0';
  if(x == 2 || x  == 4 || x == 5 || x == 7 || x == 9) cout << "hon" << endl;
  else if(x == 0 || x == 1 || x == 6 || x == 8) cout << "pon" << endl;
  else cout << "bon" << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <vector>
#include <iterator>  // std::prev(iter, n) n 個分デクリメントしたイテレータ
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;
using ll = long long;

#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define MIN(vec) min_element(vec.begin(), vec.end())  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(vec.begin(), vec.end())
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(vec.begin(), vec.end(), 0LL)  // 0 は初期値
#define pll pair<ll, ll>
#define F first
#define S second
const ll INF = 1LL<<60;  // 10^18（const int inf   = 1<<29;）

int main() {
    // input(sunippets: inpv, inpn, inps)
    ll N;
    vector<ll> stairs;
    while (cin >> N) {
        if (N) stairs.push_back(N);
        else break;
    }
    
    // calculation
    REP(i, stairs.size()) {
        ll num_stair = stairs[i];
        
        // dp table
        vector<ll> dp(num_stair+1, 0);
        
        // dp table init
        dp[num_stair] = 1;
        if (num_stair >= 2) dp[num_stair-1] = 1;
        if (num_stair >= 3) dp[num_stair-2] = 2;
        
        for (ll j = num_stair-3; j >= 0; --j) {
            dp[j] = dp[j+1] + dp[j+2] + dp[j+3];
        }
        
        cout << (365 + (dp[0]/10))/365 << "\n";
    }
    
    
    
    return 0;
}


Measured memory_bytes: 3144
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<math.h>
#define rep(i,n) for(int i = 0;i<(int)(n);i++);
using namespace std;
using ll = long long;
const ll INF = 100100100100100;

int main() {
	ll N, K;
	cin >> N >> K;//左から k個
    vector<pair<ll,ll>> p(N);
	for (int i = 0; i < N; i++){
        int a,b;
        cin >> a >> b;
        p[i] = {a,b};
    }
    sort(p.begin(),p.end());
	ll cnt = 0;
	ll ans = 0;
	while (K) {//Kからb[cnt]を引いていき、0を下回ったらストップ
		if (p[cnt].second >= K) {
			ans = cnt;
			K = 0;
		}
		else {
			K -= p[cnt].second;
			cnt++;
		}
	}
	cout << p[ans].first << endl;
}


Measured memory_bytes: 1792
from fractions import gcd

def lcs(c,d,g) :
    return (c*d)//g


A,B,C,D = map(int,input().split())

al = B-(A-1)

divisible_c = B//C - (A-1)//C
divisible_d = B//D - (A-1)//D

G = gcd(C,D)
L = lcs(C,D,G)

divisible_c_and_d = B//L - (A-1)//L

ans = al - (divisible_c + divisible_d - divisible_c_and_d)

print(ans)



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

using namespace std;


int main() {
    int N;
    cin >> N;
    vector<int> A(2 * N);
    for (int i = 0; i < 2 * N; i++) {
        cin >> A[i];
    }
    sort(A.begin(), A.end());
    long long ans = 0;
    for(int i = 0 ; i < N ; i++){
        ans += A[2 * i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <math.h>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

/*
// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}*/


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

	string s;
	cin >> s;

	int ans = 0;
	int tmp = 0;
	rep(i, s.size()) {
		if (s[i] == 'A' || s[i] == 'T' || s[i] == 'C' || s[i] == 'G') {
			tmp++;
			ans = max(ans, tmp);
		}
		else {
			tmp = 0;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    long MOD = (long)1e9 + 7;

    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), m = sc.nextInt();

        int[] ng = new int[m];
        for (int i = 0; i < m; i++) {
            ng[i] = sc.nextInt();
        }

        long[] dp = new long[n + 1];
        dp[0] = 1;

        int p;
        if (m != 0) {
            dp[1] = ng[0] == 1 ? 0 : 1;
            p = ng[0] == 1 ? 1 : 0;
        } else {
            dp[1] = 1;
            p = 0;
        }

        for (int i = 2; i <= n; i++) {
            if (p < m && ng[p] == i) {
                p++;
                continue;
            }
            dp[i] = (dp[i - 1] + dp[i - 2]) % MOD;
        }
//        debug(dp);
        System.out.println(dp[n]);
    }

    void debug(Object...os) {
        System.err.println(Arrays.deepToString(os));
    }

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


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

using namespace std;
const int MOD = 1000000007,MAX = 510000;
long int pow107 = (int)pow(10, 9) + 7,llimit = LONG_MAX,fac[MAX], finv[MAX], inv[MAX];
int ilimit = INT_MAX;

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long int COM(long int n,long int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

bool comp(pair<int, int> a, pair<int, int> b){
    if(a.first != b.first) return a.first > b.first;
    else return a.second < b.second;
}

long int jou(long int x, long int y){
    long int f = 1;
    for(int i = 0; i < y; ++i){
        f = f * x % pow107;
    }
    return f;
}

bool pn(long int x){
    if(x != 2 && x % 2 == 0)
        return false;
    for(int i = 3; i < x; ++i){
        if(x != i && x % i == 0)
            return false;
    }
    return true;
}

long int factorial(long int n){
    long int f = 1;
    for(long int i = 1; i <= n; ++i){
        f = f * i % pow107;
    }
    return f;
}

long int Func2(long int n,long int m){
    long int s2 = 1,
        r = 1;
    for(long int i = 1; i <= m; ++i){
        s2 = (s2*(n - (i - 1))/i) % (pow107);
    }
    return s2;
}

bool secsort(pair<int, int> a, pair<int, int> b){
    if(a.second == b.second)return a.first > b.first;
    else return a.second > b.second;
}

long int GCD(long int a,long int b){
    if(b == 0)return a;
    return GCD(b,a%b);
}

long int LCM(long int a,long int b){
    return a/GCD(a,b)*b;
}

//long intの最大llimit
//intの最大ilimit
//10^9+7    pow107
//素数pn
//n乗jou
//階乗factorial
//コンビネーションFunc2
//コンビネーションCOMinit(),COM(n,m)

int main(){
    long int n, l[86] = {2,1};
    cin >> n;
    for(int i = 2; i <= n; ++i){
        l[i] = l[i-1] + l[i-2];
    }
    cout << l[n] << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <vector>
#include <list>

using namespace std;


int main() {
	int n;
	double a[100], b[100], sum = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		b[i] = 1 / a[i];
		sum += b[i];
	}
	cout << 1 / sum << endl;

	return 0;
}

Measured memory_bytes: 764
N, M = map(int, input().split())
p = []
for i in range(M):
	p.append(list(map(int, input().split())))

g = [[] for i in range(N + 1)]
for pi in p:
	g[pi[0]].append(pi[1])
	g[pi[1]].append(pi[0])

for i in g[1]:
	if N in g[i]:
		print("POSSIBLE")
		exit()
print("IMPOSSIBLE")


Measured memory_bytes: 66840
#include<iostream>

int main(){
	int s[2],a;
	s[0]=0;
	s[1]=0;
	for(int i=0;i<2;++i){
		for(int j=0;j<4;++j){
			std::cin>>a;
			s[i]+=a;
		}
	}
	if(s[0]<s[1])
		std::cout<<s[1]<<std::endl;
	else
		std::cout<<s[0]<<std::endl;
	return 0;
}

Measured memory_bytes: 1160
N,K = map(int, input().split())

A = list(map(int, input().split()))

dp = [0] * (K+1)

for k in range(0,K+1):
    for i in A:
        if dp[k] == 0 and k-i >= 0 and dp[k-i] == 0:
            dp[k] = 1

            
if dp[k] == 1:
    print('First')
else:
    print('Second')

Measured memory_bytes: 3828
#include <iostream>
#include <algorithm>
#include <vector>
#include <functional>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

int N, H;
std::vector<int> a, b;

int main() {
  cin >> N >> H;
  a.resize(N);
  b.resize(N);
  for (int i = 0; i < N; ++i) {
    cin >> a[i] >> b[i];
  }
  
  int ans = 0;
    
  std::sort(a.begin(), a.end(), std::greater<int>());
  std::sort(b.begin(), b.end(), std::greater<int>());
  
  for (int i = 0; i < N; ++i) {
    if (H <= 0 || b[i] <= a[0]) break;
    H -= b[i];
    ans++;
  }
  
  if (H > 0) ans += (H / a[0]) + (H % a[0] == 0 ? 0 : 1);
  
  cout << ans << endl;
    
  return 0;
}
  

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

using namespace std;

const int INF=1e9;

int main()
{
    int n;
    int a[1010];
    int b[1010];
    bool visit[1010];

    while(cin>>n)
    {
        int mi=INF;
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
            b[i]=a[i];
            mi=min(mi,a[i]);
        }

        int ans=0;

        sort(b,b+n);

        map<int,int> mp;
        for(int i=0;i<n;i++)
        {
            mp[b[i]]=i;
        }

        memset(visit,0,sizeof(visit));

        for(int i=0;i<n;i++)
        {
            if(visit[i])
                continue;

            int cur=i;
            int sum=0,s=INF;
            int cnt=0;
            while(true)
            {
                visit[cur]=true;
                s=min(s,a[cur]);
                sum+=a[cur];
                cnt++;

                cur=mp[a[cur]];

                if(visit[cur])
                    break;
            }
            ans+=min(sum+(cnt-2)*s,sum+s+(cnt+1)*mi);
        }
        cout<<ans<<endl;
    }


    return 0;
}



Measured memory_bytes: 3204
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);i++)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;i--)
#define lb lower_bound
#define ub upper_bound
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 +99);
vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T>T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T>T mpow(T a, T n) {
   T res = 1;
   for(;n;n>>=1) {
      if (n & 1) res = res * a;
      a = a * a;
   }
   return res;
}

//cin.tie(0);ios::sync_with_stdio(false);



signed main(){
  string s,t;cin>>s>>t;
  vector<ll> sums(siz(s)+1,0),sumt(siz(t)+1,0);
  int q;cin>>q;

  rep(i,0,siz(s)){
    sums[i+1]=sums[i]+(s[i]-'A');
  }

  rep(i,0,siz(t)){
    sumt[i+1]=sumt[i]+(t[i]-'A');
  }

  while(q--){
    ll a,b,c,d;cin>>a>>b>>c>>d;
    a--;b--;c--;d--;
    ll sres=b-a+1+sums[b+1]-sums[a];
    ll tres=d-c+1+sumt[d+1]-sumt[c];
    //cout<<sres<<" "<<tres<<endl;
    if(sres%3 == tres%3)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
}

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

using namespace std;

#define int long long

void solve() {
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; ++i) {
        if (i % 3 && i % 5) ans += i;
    }
    cout << ans;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 3652
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>
#include <stack>
#include <bitset>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

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(a>b){a=b;return 1;}return 0;}



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

  int n, m;
  cin >> n >> m;

  vector<P> ab(n);

  priority_queue<int> pq;

  REP(i,n) cin >> ab[i].first >> ab[i].second;

  sort(ab.begin(), ab.end());

  int p=0, res=0;
  FOR(i,1,m+1){
    while(p < n && ab[p].first <= i) pq.push(ab[p++].second);

    if(!pq.empty()){
      res+=pq.top();
      pq.pop();
    }
  }

  cout << res << endl;
  
  return 0;
}


Measured memory_bytes: 1660
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=-1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

N=gets.to_i
A=get_i
kind={}
A.each do|a|
    kind[a]=0 if kind[a].nil?
    kind[a]+=1
end
ans=0
kind.each do|key,val|
  if key>val
      ans+=val
  elsif key<val
      ans+=(val-key)
  end 
end
puts ans

Measured memory_bytes: 15500
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
const int mod=1e9+7;
const int maxn=2e5;
ll a[maxn+5];
int n,k;
int main()
{

    ios::sync_with_stdio(false);
    cin>>n>>k;
    for(int i=1;i<=n;++i) cin>>a[i];
    sort(a+1,a+n+1);
    ll sum=0;
    for(int i=1;i<=n-k&&i<=n;++i) sum+=a[i];
    cout<<sum<<endl;
    return 0;
}

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

typedef long long ll;
typedef vector<long long> VLL;
typedef vector<pair<int,int>> VP;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define MOD (1e9+7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
/*--------------------------------------------*/

int main(){
  ll n, k;
  cin >> n >> k;
  ll h, ans = 0;
  rep(i,n){
	cin >> h;
    if(h >= k) ans++;
  }
  
  cout << ans << endl;
 
}

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

void disp(const vector<int>& a){
  for(int i = 0; i < a.size(); i++){
    if(i > 0) cout << " ";
    cout << a[i];
  }
  cout << endl;
}

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    a[i] = i + 1;
  }
  disp(a);
  while(next_permutation(a.begin(), a.end())){
    disp(a);
  }
  return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define F .first
#define S .second 
#define endl "\n"
using ll=long long;
using ld=long double;
using namespace std;
const ll mod=1e9+7;


main(){
 ll x,ans=0;
 cin>>x;
 bool b=true;
 while(b){
   ll s=x,k=2;
   while(s>=k*k){
     if(s%k==0){
        x++;
        break;
      } else {
        k++;
      }
   }
   if(s==x){ans=s;b=false;}
 }
 cout<<ans;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
      String S = sc.next();
      String b ="";
      int count =0;
      for(int i=0;i<N;i++){
        if(!b.equals(S.substring(i,i+1))){
          count++;
        }
        b = S.substring(i,i+1);
      }

      System.out.println(count);

    }
  
  private static long lcm(long m, long n) {
    return m * n / gcd(m, n);
}
  
  private static long gcd(long m, long n) {
    if(m < n) return gcd(n, m);
    if(n == 0) return m;
    return gcd(n, m % n);
}
}

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

int main(){
    int n;
    cin >> n;
    vector<int> vec(n);
    for(int i = 0; i < n; ++i){
        cin >> vec.at(i);
    }

    int min;
    for(int p = 1; p < 100; ++p){
        int sum = 0;
        for(int j = 0; j < n; ++j){
            sum += pow(vec.at(j) - p, 2);
        }
        if(p == 1){
            min = sum;
        }
        else{
            if(sum < min){
                min = sum;
            }
        }
    }

    cout << min << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		public void solve(int testNumber, InputReader in, PrintWriter out) {

			char[] s = in.nextString().toCharArray();

			StringBuffer sb = new StringBuffer();
			for (int i = 0; i < s.length; i++) {
				if (i % 2 == 0) {
					sb.append(s[i]);
				}
			}
			out.println(sb.toString());

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}


Measured memory_bytes: 21972
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<cmath>
#include<queue>
#include<limits>
#include<cassert>
#include<set>
#include<tuple>
#include<map>
using namespace std;

int main() {
	int N,A,B;
	cin >> N >> A >> B;
	if ((N * A) <= B) cout << N * A << endl;
	else cout << B << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
#define forn(i,a,b) for(int i=a; i<=b; i++)
#define ford(i,a,b) for(int i=a; i>=b; i--)
using namespace std;
int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int h,w;
	string s;
	cin>>h>>w;
	forn(i,1,h){
		cin>>s;
		cout<<s<<"\n"<<s<<"\n";
	}
	return 0;
}

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

using namespace std;

int main(){

  int x=0;
  int n;
  cin>>n;
  string s;
  cin>>s;
  int ans=0;

  for(int i=0; i<s.size(); i++){
  
    if(s[i]=='I') x+=1;
    else if(s[i]=='D') x-=1;
    
    ans=max(ans, x);

  }

  cout<<ans<<endl;
}


Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <cstdio>
#include <map>
#include <algorithm>
#include <math.h>
#include <string>
#include <cstring>
#include <set>
#include <queue>
#include <unordered_set>
#include <unordered_map>

using namespace std;

typedef long long ll;
typedef double ld;
const int N = 200001;

map<int, int> q;

int ask(int v)
{
    if (q.count(v))
        return q[v];
    cout << v << endl;
    string s;
    cin >> s;
    if (s[0] == 'V')
        exit(0);
    if (s[0] == 'F')
        q[v] = 1;
    else
        q[v] = 0;
    return q[v];
}

int main()
{
   // freopen("in.txt", "r", stdin);
    int n;
    cin >> n;
    int f = ask(0);
    int l = 0, r = n - 1;
    while (r - l > 1)
    {
        int mid = (r + l) / 2;
        int k = ask(mid);
        if (mid % 2)
            k ^= 1;
        if (k == f)
            l = mid;
        else
            r = mid;
    }
    ask(r);
    ask(l);
    return 0;
}


Measured memory_bytes: 852
#include <stdio.h>
int i,n,q,a,v,f[1000000][2],ad[1000000];
void swap(int* x,int* y){int z; z=*x;*x=*y;*y=z;}
int check(int x,int y){
	if(y>=n)return 0;
	else if(f[y][1]>f[x][1] || (f[y][1]==f[x][1] && f[y][0]<f[x][0]))return 1;
	else return 2;
}
void inc(int x){
	int ppp=(x-1)/2;
	if(check(ppp,x)==1){
		swap(&ad[f[x][0]-1],&ad[f[ppp][0]-1]);
		swap(&f[x][0],&f[ppp][0]);
		swap(&f[x][1],&f[ppp][1]);
		if(ppp>0)inc((x-1)/2);
	}
}
void dec(int x){
	int lll=x*2+1,rrr=x*2+2,mmm;
	if(lll>n-1)return;
	else if(lll==n-1)mmm=lll;
	else if(check(lll,rrr)==1)mmm=rrr; else mmm=lll;
	if(check(x,mmm)==1){
		swap(&ad[f[x][0]-1],&ad[f[mmm][0]-1]);
		swap(&f[x][0],&f[mmm][0]);
		swap(&f[x][1],&f[mmm][1]);
		dec(mmm);
	}
}
int main(void){
	scanf("%d %d",&n,&q);
	for(i=n;i>0;i--){f[i-1][0]=i;f[i-1][1]=0;ad[i-1]=i-1;}
	for(;q>0;q--){
		scanf("%d %d",&a,&v);
		f[ad[a-1]][1]+=v;
		if(v>0 && ad[a-1]>0)inc(ad[a-1]);
		if(v<0)dec(ad[a-1]);
		printf("%d %d\n",f[0][0],f[0][1]);
	}
	return 0;
}

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

bool test(int n) {
    string str = to_string(n);
    int len = str.length();
    int end = len - 1;
    for(int i = 0; i < (len / 2); i++) {
        if(str[i] != str[end]) {
            return false;
        }
        end--;
    }
    return true;
}

int main() {
    int a, b;
    cin >> a >> b;
    int cnt = 0;
    for(int i = a; i <= b; i++) {
        if(test(i)) {
            cnt++;
        }
    }
    cout << cnt << endl;
}


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

using namespace std;

int solve(int c, int k, const std::vector<int>& ts) {
  int ret = 0;
  int count = 0;
  int firstT = 0;
  for (auto const t : ts) {
    if (firstT + k < t) {
      firstT = 0;
      count = 0;
    }
    if (!firstT) {
      firstT = t;
      ret++;
    }
    count++;
    if (count == c) {
      firstT = 0;
      count = 0;
    }
  }
  return ret;
}

int main() {
  int n, c, k;
  std::cin >> n >> c >> k;
  std::vector<int> ts(n);
  for (auto& t : ts) {
    std::cin >> t;
  }
  std::sort(ts.begin(), ts.end());
  std::cout << solve(c, k, ts) << std::endl;
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    FOR(c, 'a', 'z') {
        int prev_i = -10;
        REP(i, s.size())if(s[i] == c) {
            if(i - prev_i <= 2) {
                cout << prev_i + 1 << " " << i + 1 << endl;
                return 0;
            }
            prev_i = i;
        }
    }
    cout << -1 << " " << -1 << endl;
    return 0;
}


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

int main()
{
    int n;
    string s;

    cin >> n;
    cin >> s;

    for (int i = 0; i < s.size(); i++)
    {
        int first = 'A'; // 65
        int tmp = ((int)s[i] - first + n) % 26 + first;
        cout << (char)tmp;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
 
	queue<int> q;
	for(int i=1;i<=n;i++)
	{
		int t;
		cin>>t;
		q.push(t);
	}
 
	int res=1;
    int mini=q.front();
    int maxi=q.front();
   q.pop();
 
	while(!q.empty())
	{
		int now= q.front();
		if(now<=mini and now<=maxi)
		{
			res++;
		}
 
		if(now>maxi)
		{
			maxi=now;
		}
 
		if(now<mini)
		{
			mini=now;
		}
 
		q.pop();
	}
 
	cout<<res<<endl;
	
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0; i < (long long)n; i++)
//#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Vl = vector<ll>;
using vi = vector<int>;
using Graph = vector<vi>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(15); //"for float-base
  // problem"
  /*body*/
  int X, N;
  cin >> X >> N;
  set<int> P;
  REP(i, N) {
    int in;
    cin >> in;
    P.insert(in);
  }
  if (P.empty()) {
    cout << X << endl;
    return 0;
  }
  int MX, mn, abp, abm;
  for (int i = X; i < X + 100; i++) {
    if (!P.count(i)) {
      MX = i;
      abp = i - X;
      break;
    }
  }
  for (int i = X; i > X - 100; i--) {
    if (!P.count(i)) {
      mn = i;
      abm = X - i;
      break;
    }
  }
  if (abp < abm) {
    cout << MX << endl;
  } else
    cout << mn << endl;
}

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

using namespace std;

int main() {
    string str;
    cin>>str;
    
    for(auto&& t:str){
        if(t=='9'){
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
    
    
	return 0;
}


Measured memory_bytes: 256
k, n = map(int, input().split())
a_list = list(map(int, input().split()))
a_list.sort()
r_list = list()
for index, a in enumerate(a_list):
	if index == n - 1:
		r_list.append((k - a) + a_list[0])
	else:
		r_list.append(a_list[index+1] - a)
r = k - max(r_list)
print(r)


Measured memory_bytes: 86220
def dice_and_coin(N: int, K: int)->int:
    ans = 0

    for n in range(1, N+1):
        if n < K:
            c = 0
            while n < K:
                n <<= 1
                c += 1

            ans += 1 / (1 << c)
        else:
            ans += 1

    return ans / N


if __name__ == "__main__":
    N, K = map(int, input().split())

    ans = dice_and_coin(N, K)
    print('{:.10f}'.format(ans))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;//typo用
using itn = int;//typpo用
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a); i > (intl)(b); i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl//1次元配列の出力
#define rrdebug(i, j, x) rep(i, alength(x))rep(j, alength(x[i]))cout << #x << "[" << i << "][" << j << "]:" << x[i][j] << endl//二次元配列の出力
#define pb push_back
#define mp make_pair
#define pii pair<intl,intl>
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld EPS = 1.0e-14;//-9
const ld PI = acos(-1);
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
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; }
intl kai(intl k){//k!を求める関数
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl digit10(intl a){//aを10進数で表したときの桁数を求める関数
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}


signed main(){
    cout << fixed << setprecision(10);
    intl x;
    cin >> x;
    intl cnt = 2 * (x / 11);
    intl a = x % 11;
    cnt += (a > 6);
    cout << cnt + !!(a) << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.IO;

class MainClass {
    static void Main() {
        int n = int.Parse(Console.ReadLine());
        for(int i = 0;i<n;i++){
            string[] tokens = Console.ReadLine().Split(' ');
            int a = int.Parse(tokens[0]);
            int b = int.Parse(tokens[1]);
            int c = int.Parse(tokens[2]);
            if((a*a == b*b + c*c)||(b*b == a*a+c*c)||(c*c == a*a + b*b)){
            Console.WriteLine("YES");
        }else{
            Console.WriteLine("NO");
        }



        }
        
       
    }
}

Measured memory_bytes: 8940
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define inf 10000000000
using namespace std;
using ll = long long;
int main()
{
    int h,n;
    cin >> h >> n;
    ll a = 0;
    rep(i,n){
        int b;
        cin >> b;
        a += b;
    }
    if(a>=h){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}

Measured memory_bytes: 256