akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
 
#define lol long long
#define gcd(x,y) __gcd(x,y)
#define mt make_tuple
#define mp make_pair
#define fi first
#define se second
#define fixed fixed<<setprecision(14)
using namespace std;
using pii=pair<int,int>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
template <class A> inline lol abs(A &a) { return (a < 0 ? -a : a); }
bool inLine(int x,int y,int mx,int my){return (x>=0&&y>=0&&x<mx&&y<my);}
const lol inf=(1LL<<62);
const lol MOD=(1e9)+7;
const lol mod=998244353;
const int dx[]={1,0,-1,0,1,1,-1,-1};
const int dy[]={0,1,0,-1,1,-1,1,-1};
lol n,m,k,r;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >>n;
  string ans;
  while(n){
    n--;
    int tm=n%26;
    ans.push_back(tm+'a');
    n/=26;
  }
  for(int i=ans.size()-1;i>=0;i--) cout <<ans[i];
  cout <<'\n';
  return (0);
}

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

int main(){
  int N;
  cin >> N;
  set<string> S;
  for(int i = 0; i < N; ++i){
    string s;
    cin >> s;
    S.insert(s);
  }
  cout << S.size() << endl;
}


Measured memory_bytes: 19196
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define pb(a) push_back(a)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
using namespace std;

/*
1 2 3 5 7 8 9 10 11 12 13 15 17 18 19 new
1 2 3 4 5 6 7 10 11 12 13 14 15 16 17 
*/

string changeStr(long long n){
    long long copy = n;
    int len = -1;
    while(copy != 0){
        len++;
        copy/=10;
    }

    string str;
    long long K = 1;
    rep(i,len) K*=10;
    rep(i,len + 1){
        if(n / K == 0) str+= '0';
        else str+= ('0' + n / K);
        n%=K; K/=10;
    }
    return str;
}

long long newRoomNumber(long long o){ //old number, new number
    long long n = 0, K = 1;
    while(o != 0){
        n+= (o % 8) * K;
        o/= 8;
        K*=10;
    }
    return n;
}

string deleteFourAndSix(string n){
    rep(i,n.size()){
        if(n[i] == '4') n[i] = '5';
        else if(n[i] == '5') n[i] = '7';
        else if(n[i] == '6') n[i] = '8';
        else if(n[i] == '7') n[i] = '9';
    }
    return n;
}

int main(){
    long long n;
    while(cin >> n, n){
        cout << deleteFourAndSix(changeStr(newRoomNumber(n))) << endl;
    }
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T & a, U & ... b) { cin >> a; IN_(b ...); };
template<typename T> void OUT(T && a) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

int main() {
	IN(int, n);
	OUT(n / 500 * 1000 + n % 500 / 5 * 5);
}


Measured memory_bytes: 256
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

s, t  = S_MAP()
a,b = MAP()
u = input()

if s == u and t == u:
    # print(a + b - 2)
    a = a-1
    b = b -1
elif s == u:
    # print(a + b - 1)
    a = a - 1
elif t==u:
    # print(a + b -1)
    b = b - 1
print(a, b)

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

int main(){
    int n; ll t;
    cin>>n>>t;
    vector<int> h(n);
    for(int i=0;i<n;i++) cin>>h[i];

    vector<int> res(n);
    int x=0;
    int l=0;
    ll offset=0;
    for(int i=0;i<n;i++){
        offset+=x;
        x=h[i];
        l=max(l,x);
        if(t<offset+x){
            res[i]=0;
        }
        else{
            res[i]=(t-offset-x)/l+1;
        }
    }
    for(int i=0;i<n;i++){
        cout<<res[i]+1<<endl;
    }
    

    return 0;
}


Measured memory_bytes: 3628
#include <stdio.h>  /*入出力*/
#include <stdlib.h> /*標準ライブラリ*/
#include <string.h> /*文字列*/
#include <math.h>   /*計算*/
#include <assert.h> /*確認*/
#include <ctype.h>  /*文字操作*/
#include <stdbool.h>/*bool型*/
#include <limits.h>/*限界*/
//---------------------------------------------------
#define rep(i, n) for(int  i = 0; i < (n); i++)
#define ABS(a) (((a)>(0))?a:-(a))
#define LL long long
#define MOD 1000000007//10^9+7(素数)
//---------------------------------------------------
LL max(LL a, LL b){
  if (a > b) {
    return a;
  }else return b;
}

int main(void)
{
  int k;
  char s[105];
  scanf("%d", &k);
  scanf("%s", &s);
  int len = strlen(s);
  if (len <= k) {
    printf("%s\n", s);
  }else{
    for (size_t i = 0; i < k; i++) {
      printf("%c", s[i]);
    }
    printf("...\n");
  }
  return 0;
}


Measured memory_bytes: 1624
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>
#include <list>
#include <random>

// macros
#define ll long long int
#define pb emplace_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1e9 + 7;

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

template <typename T>
T power(T a, T n, T mod) {
  T res = 1;
  T tmp = n;
  T curr = a;
  while(tmp){
    if(tmp % 2 == 1){
      res = (T)((ll)res * curr % mod);
    }
    curr = (T)((ll)curr * curr % mod);
    tmp >>= 1;
  }
  return res;
}

ll fac[200001], inv[200001];

ll comb(int n, int k){
  if(k > n)return 0;
  ll res = fac[n];
  res = res * inv[k] % mod;
  res = res * inv[n-k] % mod;
  return res;
}

int main(int argc, char const* argv[])
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  fac[0] = 1;
  for(int i = 1 ; i < 200001; i++)fac[i] = i * fac[i-1] % mod;
  inv[200000] = power<ll>(fac[200000], mod - 2, mod);
  for(int i = 199999; i >= 0; i--)inv[i] = inv[i+1] * (i + 1) % mod;
  int b, w;
  cin >> b >> w;
  ll p = 0, q = 0;
  for(int i = 0; i < b + w; i++){
    p = p + comb(i - 1, b - 1) * power<ll>(inv[2], i, mod) % mod;
    p %= mod;
    q = q + comb(i - 1, w - 1) * power<ll>(inv[2], i, mod) % mod;
    q %= mod;
    ll res = 1 - p + q;
    res %= mod;
    if(res < 0)res += mod;
    res = res * inv[2] % mod;
    cout << res << endl;
  }
	return 0;
}


Measured memory_bytes: 5376
# coding: utf-8
# Your code here!
n,m= list(map(int,input().split()))
A = list(map(int,input().split()))
d = sum(A)
    
A.sort(reverse=True)
for a in range(m):
    if A[a]< d/(4*m):
        d = 0
        break
if d == 0:print("No")
else: print("Yes")


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define N 100010
#define ll long long
int fun(int a,int b,int c){
    if(a != b && a != c && b != c){
        if(a<b+c && b<a+c && c<a+b){
            return 1;
        }
    }
    return 0;
}
int main()
{
    int ans = 0;
    int n;
    cin>>n;
    int a[n];
    for(int i = 0; i < n; i++){
        cin>>a[i];
    }
    for(int i = 0; i < n-2; i++){
        for(int j = i+1; j < n-1; j++){
            for(int k = j+1; k < n; k++){
                ans += fun(a[i],a[j],a[k]);
            }
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3472
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,l,r) for(ll i=(l);i<(r);i++)
int main(){
  int h,w;
  cin>>h>>w;
  string s;
  rep(i,0,h){
    cin>>s;
    cout<<s<<"\n"<<s<<"\n";
  }
}

Measured memory_bytes: 256
#include<stdio.h>
    int main(void)
    {
        int l,r;
        int i,j;
        int imod;
        int iminmod = 2020; 
         0 <= l < 2000000000;
        0 < r <= 2000000000;
     
        scanf("%d%d",&l,&r);
     
        i = l;
        if(r-l>=2019){
            printf("%d\n",0);
            return 0;
        }
        else{
        for(j =i+1; j<=r; j++ ){
            for(i = l; i<=j-1;i++){
                imod=(i%2019)*(j%2019)%2019;
                if(imod < iminmod){
                    iminmod = imod;               
                }
            }
        }
        }
           
         printf("%d\n",iminmod);
         return 0;
         }

Measured memory_bytes: 128
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main(void){
    
    string s,t;
    
    cin >> s >> t;
    
    for(int i = s.size() - t.size(); i >= 0; i--){
        //cout << s[i] << endl;
        bool flag = true;
        for(int j = i; j < i+t.size(); j++){
            if(s[j] == '?' || s[j] == t[j-i]){
                
            }else{
                flag = false;
            }
        }
        
        if(flag){
            
            for(int j = i; j < i+t.size(); j++)
                s[j] = t[j-i];
                
            for(int j = 0; j < s.size(); j++){
                if(s[j] == '?')
                    cout << 'a';
                else
                    cout << s[j];
            }
            cout << endl;
            
            return 0;
        }
        
    }
    
    cout << "UNRESTORABLE" << endl;
    
}


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

int main() {
    int n,m;
    cin>>n>>m;
    int ac[n]{},wa[n]{};
    for (int i=0;i<m;i++) {
        int a;string s;
        cin>>a>>s;
        if (s=="AC")
            ac[a-1]=1;
        else if (!ac[a-1])
            wa[a-1]++;
    }
    int ans=0;
    int ans2=0;
    for (int i=0;i<n;i++)
        if (ac[i]) {
            ans++;
            ans2+=wa[i];
        }
    cout<<ans<<" "<<ans2<<endl;
    return 0;
}

Measured memory_bytes: 1024
let [| l; m; |] = stdin.ReadLine().Split() |> Array.map int

match seq{l..m} |> Seq.exists (fun x -> x % 2019 = 0 ) with 
|true -> 0
|false -> 
    [for i in l..m do for j in i+1..m -> i,j] |> List.map (fun (x1, x2) -> (x1 % 2019, x2 % 2019))
    |> List.map (fun (x1,x2) -> x1 * x2 % 2019)
    |> List.min
|> stdout.WriteLine

Measured memory_bytes: 244232
arr = gets.chomp.split("\s")
a, b = arr[0].to_i, arr[1].to_i

s1 = a / b
s2 = a % b
s3 = (a / b.to_f).round(8)

print(s1,"\s", s2, "\s")
puts sprintf("%10.9f", s3)

Measured memory_bytes: 6176
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
  
#define repd(i,a,b) for (int i=(a);i<=(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;

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

void inputArray(int * p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    rep(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

std::vector<int> enum_div(int n)
{
	std::vector<int> ret;
	for(int i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret.push_back(i);
			if(i!=1 && i*i!=n)
			{
				ret.push_back(n/i);
			}
		}
	}
	return ret;
} 

int main()
{
  int i,j;
  int n; cin >> n;
  int a[n]; rep(i,n-1){cin >> a[i];}
  int b[n] = {0};
  int ans = 0;
  int c[n] = {0};
  std::vector<int> r;
  
  for(j=n-1;j>=0;j--){
    if(b[j] % 2 != a[j]){
        c[ans] = j+1; ans++;
        r = enum_div(j+1);
        for(auto i : r){b[i-1]++;}
    }
  }

  cout << ans << endl;
  if(ans > 0){
      for(i=ans-1;i>=0;i--){
          cout << c[i];
          if(i > 0){cout << " ";}else{cout << endl;}
      }
  }
  
  return 0;
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main ()
{
    ll x,y,ma,mi;
    cin>>x>>y;
    if (y%2==1)
    {
        cout<<"No\n";
    }
    else
    {
        ma=y/2;
        mi=y/4;
        if (x<=ma&&(y/4+(y%4)/2)<=x)
        {
            cout<<"Yes\n";
        }
        else
        {
            cout<<"No\n";
        }
        
    }
    return 0;
    
}

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

int main() {
  int H, W; cin >> H >> W;
  vector<vector<int>> a(H, vector<int>(W));
  vector<vector<int>> ope;
  int cnt = 0;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) cin >> a.at(i).at(j);
  }
  for (int i = 0; i < H-1; i++) {
    for (int j = 0; j < W; j++) {
      if (a.at(i).at(j) % 2 == 0) continue;
      a.at(i).at(j)--;
      a.at(i+1).at(j)++;
      cnt++;
      ope.push_back({ i+1, j+1, i+2, j+1 });
    }
  }
  for (int j = 0; j < W-1; j++) {
    if (a.at(H-1).at(j) % 2 == 0) continue;
    a.at(H-1).at(j)--;
    a.at(H-1).at(j+1)++;
    cnt++;
    ope.push_back({ H, j+1, H, j+2 });
  }
  cout << cnt << endl;
  for (int i = 0; i < ope.size(); i++) {
    cout << ope.at(i).at(0) << " " << ope.at(i).at(1) << " " << ope.at(i).at(2) << " " << ope.at(i).at(3) << endl;
  }
}

Measured memory_bytes: 11312
S = int(input())
p = 10**9 +7

def pow_mod(p,a,n):
    res = 1
    while n > 0:
        if n % 2 == 1:
            res = (res * a) % p
        n = n // 2
        a = (a*a)%p
    return res

n = 2000
fac = [1]
foo = 1
for i in range(1,n+1):
    foo = (foo*i)%p
    fac.append(foo)

#コンビネーションのmod
def comb_mod(n,k):
    res = (fac[n] * pow_mod(p,fac[k],p-2) * pow_mod(p,fac[n-k],p-2)) % p
    return res

ans = 0
for i in range(1,1+S//3):
    t = S - 3*i
    ans = (ans + comb_mod(t+i-1,t)) %p

print(ans)

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

typedef long long ll;
typedef unsigned long long ull;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout.precision(12);
    cout.setf(ios_base::fixed, ios_base::floatfield);
    
    int N, M, C;
    cin >> N >> M >> C;
    int B[20];
    for(int i=0;i<M;i++) cin >> B[i];

    int ans = 0;
    for(int i=0;i<N;i++){
        int A[20];
        for(int j=0;j<M;j++) cin >> A[j];
        int feat = C;
        for(int j=0;j<M;j++) feat += A[j]*B[j];
        if(feat > 0) ans++;
    }
    cout << ans << endl;
    
    return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

struct edge{
    int to,cap,rev;
};

vector<edge> G[505];
vector<int> check(505, 0);

int dfs(int v, int t, int f){
    if(v==t){return f;}
    check[v]=1;
    for(int i=0;i<G[v].size();i++){
        edge &e = G[v][i];
        if(check[e.to]==0 && e.cap > 0){
            int ff =dfs(e.to,t,min(f,e.cap));
            if(ff>0){
                e.cap -= ff;
                G[e.to][e.rev].cap += ff;
                return ff;
            }
        }
    }
    return 0;
}

int maxflow(int s,int t){
    int flow = 0;
    while(1){
        fill(check.begin(),check.end(),0);
        int f = dfs(s,t,INT_MAX);
        if(f==0){return flow;}
        flow += f;
    }
}

bool prime_check(ll X){
    if(X<2) return false;
    ll sqX = (int)sqrt(X)+1;
    for(int i=2;i<sqX;i++){
        if(X%i==0) return false;
    }
    return true;
}


int main(){
    int N;
    cin >> N;
    ll x[N];
    REP(i, N) cin >> x[i];
    sort(x, x+N);
    vector<ll> koma;
    REP(i, N){
        if(i==0||x[i]!=x[i-1]+1) koma.push_back(x[i]);
        if(i==N-1||x[i+1]!=x[i]+1) koma.push_back(x[i]+1);
    }
    vector<ll> koma_even, koma_odd;
    REP(i, koma.size()){
        if(koma[i]%2==0){
            koma_even.push_back(koma[i]);
        }else{
            koma_odd.push_back(koma[i]);
        }
    }
    REP(i, koma_even.size()){
        REP(j, koma_odd.size()){
            ll dif = abs(koma_even[i]-koma_odd[j]);
            if(prime_check(dif)){
                int v1 = i;
                int v2 = koma_even.size()+j;
                G[v1].push_back((edge){v2, 1, G[v2].size()});
                G[v2].push_back((edge){v1, 0, G[v1].size()-1});
            }
        }
    }
    REP(i, koma_even.size()){
        int v1 = koma_even.size()+koma_odd.size();
        int v2 = i;
        G[v1].push_back((edge){v2, 1, G[v2].size()});
        G[v2].push_back((edge){v1, 0, G[v1].size()-1});
    }
    REP(i, koma_odd.size()){
        int v1 = koma_even.size()+i;
        int v2 = koma_even.size()+koma_odd.size()+1;
        G[v1].push_back((edge){v2, 1, G[v2].size()});
        G[v2].push_back((edge){v1, 0, G[v1].size()-1});
    }

    int N1 = maxflow(koma_even.size()+koma_odd.size(), koma_even.size()+koma_odd.size()+1);
    /*
    printf("N1: %d\n", N1);
    REP(i, koma.size()){
        cout << koma[i] << endl;
    }
    */
    int N2 = (koma_even.size()-N1)/2 + (koma_odd.size()-N1)/2;
    int N3 = (koma_even.size()-N1)%2;
    cout << N1+2*N2+3*N3 << endl;
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
int n,k,ans;
bool b[25];
bool check(int x)
{
	int i;
	while(x)
	{
		if(b[x%10]) return false;
		x/=10;
	}
	return true;
}
int main()
{
	int i,x;
	cin>>n>>k;
	for(i=1;i<=k;i++)
	{
		cin>>x;
		b[x]=true;
	}
	for(i=n;;i++)
		if(check(i))
		{
			cout<<i<<endl;
			return 0;
		}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
int j,y;
void dfs(int a,int b,string s){
  if(a==j&&b==y){
    cout<<s<<endl;
    return;
  }
  if(a>j||b>y) return;
  if(a<=3&&b>=5) return;
  if(a>=5&&b<=3) return;
  if(a+b>=10) return;
  dfs(a+1,b,s+"A");
  dfs(a,b+1,s+"B");
} 
signed main(){
  cin>>j>>y;
  dfs(0,0,"");
  return 0;
}

Measured memory_bytes: 3156
#include<bits/stdc++.h>
using namespace std;
using ll = long long int;
ll a;
set<ll>k{2,4,5,7,9};
set<ll>l{0,1,6,8};
void a_therefore()
{
	cin>>a;
	cout<<(k.count(a%10)?"hon":(l.count(a%10)?"pon":"bon"))<<"\n";
}
int main()
{
	a_therefore();
	return 0;
}

Measured memory_bytes: 3596
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

int main() {
    int n, m;
    int a[100010];
    cin >> n >> m;
    int dp[100010];
    imfor(i, n + 1) {
        dp[i] = -1;
    }
    imfor(i, m) {
        cin >> a[i];
        dp[a[i]] = 0;
    }
    imfor(i, n + 1) {
        if (i == 0) {
            dp[i] = 1;
        }
        else if (i == 1) {
            if (dp[i] == -1) {
                dp[i] = dp[i - 1];
                dp[i] %= MOD;
            }
        }
        else {
            if (dp[i] == -1) {
                dp[i] = dp[i - 1] + dp[i - 2];
                dp[i] %= MOD;
            }
        }
    }
    cout << dp[n] << endl;
    
}

Measured memory_bytes: 1024
N,K =map(int,input().rstrip().split())
ans = [0 for _ in range(10 ** 5 + 1)]
for i in range(N):
  a,b = map(int,input().rstrip().split())
  ans[a] += b
counter = 0
c2 = 0
while counter < K:
  c2  += 1
  counter += ans[c2]
print(c2)

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

#define N 100000

int main() {
	static char s[N + 1];
	static int aa[N];
	int n, i, j, k, x, y, z, tmp;

	scanf("%s", s);
	n = strlen(s);
	i = 0;
	while (i < n) {
		j = i + 1;
		while (j < n && s[j] == 'R')
			j++;
		k = j + 1;
		while (k < n && s[k] == 'L')
			k++;
		x = j - i;
		y = k - j;
		if (x > y) {
			z = (x - y + 1) / 2;
			aa[j - 1] = x - z;
			aa[j] = y + z;
			if (x % 2) {
				tmp = aa[j - 1];
				aa[j - 1] = aa[j];
				aa[j] = tmp;
			}
		} else if (y > x) {
			z = (y - x + 1) / 2;
			aa[j - 1] = x + z;
			aa[j] = y - z;
			if (y % 2) {
				tmp = aa[j - 1];
				aa[j - 1] = aa[j];
				aa[j] = tmp;
			}
		} else {
			aa[j - 1] = x;
			aa[j] = y;
		}
		i = k;
	}
	for (i = 0; i < n; i++)
		printf("%d ", aa[i]);
	printf("\n");
	return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

map<ll,int> expo;

map<ll,int> prime_factor(ll n){
    map<ll,int>ret;
    for(ll i=2;i*i<=n;i++){
        while(n%i==0){
            ret[i]++;
            n/=i;
        }
    }
    if(n!=1)ret[n]=1;
    return ret;
}

ll rec(map<ll,int>::iterator it, ll cnt){
    if(it==expo.end()){
        if(cnt==1)return 1;
        else return 0;
    }
    ll res = 0;
    for(int i=1;i<=it->second+1;i++){
        if(cnt%i!=0)continue;
        res += rec(++it,cnt/i);
        it--;
    }
    return res;
}

int main(){
    int N;cin >> N;
    for(int i=2;i<=N;i++){
        auto ps = prime_factor(i);
        for(auto it:ps)expo[it.first]+=it.second;
    }   
    cout << rec(expo.begin(),75) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    long N = sc.nextLong();
    long count = 0;
    long countA = 0;
    ArrayList<Long> a = new ArrayList<Long>();
    for(long i = 0;i < N;i++){
        count++;
        if(count % 15 == 0){
            // System.out.print(count + ",");
            continue;
        } else if(count % 3 == 0){
            // System.out.print("Fizz");
            continue;
        } else if(count % 5 == 0){
            // System.out.print("Buzz");
            continue;
        }
            a.add(count);
    }
        long print = 0;
        for(int i = 0;i < a.size();i++){
            print += a.get(i);
            // System.out.print(print);
        }
        System.out.println(print);
  }
}


Measured memory_bytes: 59712
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
//const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) {cout << (A) << '\n'; exit(0);}

int main()
{
  ll r;
  cin >> r;
  cout << r * r << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,w) for (int i = 0;i < (w); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int INF = 1e9;


int main(){
  int a,b,c,x,y;cin >> a >> b >> c >> x >> y;
  int ans = INF;
  int temp = a*x + b*y;
  ans = temp;
  while(x > 0 || y > 0){
    if(x > 0) temp -= a;
    if(y > 0) temp -= b;
    temp += 2*c;
    x = max(x-1,0);
    y = max(y-1,0);
    ans = min(ans,temp);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3632
#include <iostream>
 
using namespace std;
int field[50][50];
int w, h, ans;
int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1}, dy[8] = {-1, -1, -1, 0,  0, 1, 1, 1};
 
void check(int x, int y)
{
    if (field[x][y])
        field[x][y] = 0;
    else
        return;
         
    for (int i=0; i<8; i++) {
        int nx = x+dx[i], ny = y+dy[i];
        if (0<= nx && nx<w && 0<=ny&&ny<h) {
            check(nx, ny);
        }
    }
}
 
int main()
{
    while (cin>>w>>h, w||h) {
        for (int y=0; y<h; y++) {
            for (int x=0; x<w; x++) {
                int i; cin >> i;
                field[x][y] = i;
                }
           }
        
       ans = 0;
       for (int y=0; y<h; y++) {
          for (int x=0; x<w; x++) {
               if (field[x][y]) {
                       ans++;
                       check(x, y);
               }  
            }   
        }
 
        cout << ans << endl;
   }           
     
    return 0;
}

Measured memory_bytes: 1236
s = input()
length  = len(s)
s = '0b'+s
s = int(s, 0)

c1 = '0b'+'01'*100000
c1 = int(c1, 0)
c2 = '0b'+'10'*100000
c2 = int(c2, 0)

a1 = bin(s^c1)
a2 = bin(s^c2)

a1 = a1[-length:]
a2 = a2[-length:]

print(min(a1.count('1'),a2.count('1')))

Measured memory_bytes: 3544
H,W,K = map(int,input().split())

L = []

for _ in range(H):
    S = input()
    x = [S[i] for i in range(len(S))]
    L.append(x)

item = [i for i in range(H)]
item2 = [i for i in range(W)]
Ans = 0
for i in range(2 ** H):
    bag = []
    for j in range(H):
        if ((i >> j) & 1):
            bag.append(item[j])
    #print(bag)
    for k in range(2 ** W):
        bag2 = []
        for j in range(W):
            if ((k >> j) & 1):
                bag2.append(item2[j])
        L_copy = [[L[i][j] for j in range(W)] for i in range(H)]
        for x in bag:
            for j in range(W):
                L_copy[x][j] = "red"
        for x in bag2:
            for j in range(H):
                L_copy[j][x] = "red"
        count = 0
        for j in range(H):
            for l in range(W):
                if L_copy[j][l] == "#":
                    count +=1
        if count == K:
            Ans +=1
print(Ans)

Measured memory_bytes: 9188
import scipy as sp


def divisor(num):
    list = set()
    for i in sp.arange(1, num+1):
        if num % i == 0:
            list.add(i)
    return list


a, b, k = [int(i) for i in input().split()]

div_a = divisor(a)
div_b = divisor(b)

cd = sp.sort(list(div_a & div_b))
cd_r = cd[::-1]
print(cd_r[k-1])


Measured memory_bytes: 20452
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a=n/10;
    int b=n%10;
    if(a==9 || b==9)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
}


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

int main()
{
  int n;
  cin>>n;
  string s;
  cin>>s;
  int w=0,r=0;
  for(int k=0;k<n;k++)
  {
  	if(s[k]=='W')w++;
  	else r++;
  }
  int cost=0;
  for(int i=0;i<r;i++)
  {
  	if(s[i]=='W')cost++;
  }
  int cost1=0;
  for(int i=r;i<n;i++)
  {
  	if(s[i]=='R')cost1++;
  }
  cout<<min(cost,cost1);
    return 0;
}



Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
#define rep2(i, m, n) for(int i=int(m); i<int(n); ++i)
#define rep(i, n) rep2(i, 0, n)
using ll = long long;
using V = vector<int>;
using Vll = vector<ll>;
using VV = vector<V>;
using VVll = vector<Vll>;

char s[1000000];
ll t[3][1000001];

int main() {
  int n, q;
  scanf("%d%s%d", &n, s, &q);

  V D, C;
  rep(i, n) {
    rep(j, 3) t[j][i+1] = t[j][i];
    switch(s[i]){
      case 'D':
        ++t[0][i+1];
        D.push_back(i);
        break;
      case 'M':
        ++t[1][i+1];
        break;
      case 'C':
        ++t[2][i+1];
        C.push_back(i);
        break;
    }
  }

  rep(_, q) {
    int k; 
    scanf("%d", &k);
    ll ans = 0;
    for (auto &c : C) ans += t[1][c] * (t[0][c] - t[0][max(c-k+1, 0)]);
    for (auto &a : D) ans -= t[1][a+1] * (t[2][min(a+k, n)] - t[2][a+1]);
    printf("%lld\n", ans);
  }
  return 0;
}


Measured memory_bytes: 28652
//==========//============================================================================
// Name        : Hello5.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <vector>
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using p = pair<int,int>;//<key,value>


int main() {

string s;;
cin>>s;
rep(i,4)s[i];
if(s[0]==s[1]&&s[2]==s[3]&&s[0]!=s[2])cout<<"Yes"<<endl;
else if(s[0]==s[2]&&s[1]==s[3]&&s[0]!=s[1])cout<<"Yes"<<endl;
else if(s[0]==s[3]&&s[1]==s[2]&&s[0]!=s[2])cout<<"Yes"<<endl;
else cout<<"No"<<endl;
return 0;
}







Measured memory_bytes: 256
n = int(input())
l = [int(i) for i in input().split()]

v = 0


for i in range(len(l)-1,-1,-1):
    j = 0
    nosee = False 
    for j in range(i):
        if(l[i]<l[j]):
            nosee = True
            break
    if(not(nosee)):
        v+=1
print(v)


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

typedef long long ll;
#define vec vector<int>
#define vecll vector<ll>
#define vpair vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n)   for(int i=(int)0; i<(int)n; i++)
#define llrep(i,n)   for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n) for(int i=(int)m; i<(int)n; i++)
#define all(var)     (var).begin(), (var).end()
#define prt(var)     cout << var << endl
#define prt_dbl(i,var) cout<<fixed<<setprecision(i)<<var<<endl;
template <typename Val>
Val gcd(Val a, Val b) {
//use ll or int for gcd
    if (b==0) return a;
    else return gcd(b, a%b);
}
template <typename Val>
Val vec_max(vector<Val> v){
  return *max_element(v.begin(),v.end());
}
template <typename Val>
Val vec_min(vector<Val> v){
  return *min_element(v.begin(),v.end());
}



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

int main(){
  int N,M,ans;
  cin>>N>>M;

  ans = (N-M)*100+M*1900;
  ans*= pow(2,M);

  cout<<ans<<endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#include<functional>
//#include<bits/stdc++.h>
using ll = long long;
using namespace std;
const ll INF = 1000000000000000000;//10^18
const ll mod = 1000000007;
//printf("%.10f\n", n);
ll ok[123456];
signed main() {
	ll n = 0, m = 0, k = 0, a, b = 0, cnt = 0, ans = 0; cin >> n;
	vector<ll> v(100001); ans = n;
	for (int h = 0; h < n; h++) {
		cin >> a; v[a]++;
	}
	for (int h = 1; h <= 100000; h++) {
		if (v[h] > 0) { cnt += v[h] - 1; }
	}
	cout << ans - (cnt + 1) / 2 * 2 << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define endl '\n'
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main()
{
    FASTINOUT;
    int x;
    cin>>x;
    int a[x];
    for (int i=0; i<x; i++)
    {
        cin>>a[i];
    }
    ll ans=0;
    sort(a,a+x);
    for (int i=0; i<x; i++)
    {
        for (int j=i+1; j<x; j++)
        {
            for (int k=j+1; k<x; k++)
            {
                int b[3]={a[i],a[j],a[k]};
                sort(b,b+3);
                if (b[0]==b[1]||b[1]==b[2])
                    continue;
                if (b[0]+b[1]>b[2])
                    ans++;
            }
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3652
#include <stdio.h>
int main(void){
    int i, j;
    int h, w;
    while((scanf("%d %d", &h, &w))&&((h != 0)||(w != 0))){
        for(i = 0; i < h; i++){
            for(j = 0; j < w; j++){
                if((i == 0)||(i == h-1)||(j == 0)||(j == w-1))
                    putchar('#');
                else
                    putchar('.');
            }
            putchar('\n');
        }
        putchar('\n');
    }
    return 0;
}


Measured memory_bytes: 572
//0-1 Knapsack Problem
#include <iostream>
#include <algorithm>

using namespace std;

struct Item {
public:
    int v, w;
    Item() {}
    Item(int v, int w): v(v), w(w) {}
};

int main() {
    int N , W, v, w;
    cin >> N >> W;
    Item items[N];
    for(int i = 0; i < N; i++) {
        cin >> v >> w;
        items[i] = Item(v, w);
    }

    int C[N][W + 1];
    for(int i = 0; i < N; i++) {
        C[i][0] = 0;
        if(i == 0) {
            for(int j = 1; j < W + 1; j++) {
                C[i][j] = (j < items[i].w) ? 0 : items[i].v;
            }
        }
        else {
            for(int j = 0; j < W + 1; j++) {
                if(j < items[i].w) {
                    C[i][j] = C[i - 1][j];
                } else {
                    C[i][j] = max(C[i - 1][j], C[i - 1][j - items[i].w] + items[i].v);
                }
            }
        }
    }

    cout << C[N - 1][W] << endl;
}


Measured memory_bytes: 6996
const input = require('fs').readFileSync('/dev/stdin', 'utf8');

const inputs = input.trim().split('\n');
const n = Number(inputs.shift());
const adj = inputs.map((s) => s.split(' ').map(Number));

const G = (new Array(n)).fill(0).map(() => (new Array(n)).fill(0));
for (let i = 0; i < n; i++) {
  const u = adj[i][0];
  const k = adj[i][1];
  const v = adj[i].slice(2);

  for (let j = 0; j < k; j++) {
    G[u - 1][v[j] - 1] = 1;
  }
}

for (let i = 0; i < G.length; i++) {
  console.log(G[i].join(' '));
}



Measured memory_bytes: 16712
/*---------------------------------------------*/
/*
    ABC174 C
 */
/*---------------------------------------------*/

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

typedef long long ll;
typedef int64_t i6;
typedef std::vector<std::vector<int64_t> > Graph;

#define rep(i, n) for (int64_t i = 0; i < n; ++i)
#define rep2(i, n) for (int64_t i = 1; i <= n; ++i)
#define repb(i, l, n) for (int64_t i = l; i < n; ++i)
#define repb2(i, l, n) for (int64_t i = l; i <= n; ++i)
#define ALL(v) (v).begin(), (v).end()
#define Sort(x) sort(ALL(x))
#define Sort_rev(x) Sort(x);reverse(ALL(x))
#define Push_back(p, a, b) (p).push_back( make_pair( (a), (b) ) )

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;  }
template<typename V,typename T> bool find_num(V v, T num) { if ( find(ALL(v), num) == v.end() ) { return false; } return true; }

int main() {
    int64_t n;
    cin >> n;
    if ( n%2 != 0 ) {
        int64_t num = 7;
        repb(i, 1, 10000000) {
            if (num%n == 0) {
                cout << i << endl;
                return 0;
            }
            num = num*10+7;
            num %= n;
        }
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 3608
import java.util.Scanner;

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

		String[] line = sc.nextLine().split(" ");
		int A = Integer.parseInt(line[0]);
		int B = Integer.parseInt(line[1]);

		if (B == 1) {
			System.out.println(0);
			return;
		}
		int cnt = 1;
		while (A + (cnt - 1) * (A - 1) < B) {
			cnt++;
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 23892
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

ll n,a,b;
int main(){
	scanf("%lld%lld%lld",&n,&a,&b);
	if(a%2==b%2){
		printf("%lld",(b-a)/2);
	}else{
		//aが左端でパリティ調整
		ll temp1=a;
		ll aa=1,bb=b-a;
		temp1+=(bb-aa)/2;
		//bが右端で調整
		ll temp2=n-b+1;
		ll aaa=a+temp2,bbb=n;
		temp2+=(bbb-aaa)/2;
		printf("%lld",min(temp1,temp2));
	}
}

Measured memory_bytes: 128
L, R = map(int, input().split())
MOD = 2019

if R - L >= 2019:
    print(0)
    exit()
ans = (L * (L + 1)) % MOD
for i in range(L, R):
    for j in range(i + 1, R + 1):
        ans = min(ans, (i * j) % MOD)

print(ans)


Measured memory_bytes: 2940
#include <iostream>

int main(){
  using namespace std;
  int n;
  cin >> n;
  
  int temp;
  int sum = 0;
  int pre = 100000;
  for (int i = 0; i < n - 1; i++){
    cin >> temp;
    sum += temp < pre? temp:pre;
    pre = temp;
  }
  sum += pre;
  cout << sum << endl;
}

Measured memory_bytes: 256
from collections import defaultdict
from heapq import heappop, heappush

N, K = map(int, input().split())
TD = []

for _ in range(N):
  TD.append(tuple(map(int, input().split())))

TD.sort(key = lambda x:x[1], reverse=True)
TD += [(TD[-1][0], 0)]

D = defaultdict(list)
T = [0]*N
H = []
ans = [0]

for i in range(K):
  t, d = TD[i]
  T[t-1] += 1
  D[t].append(d)
  ans[0] += d

cnt = sum(1 for c in T if c >= 1)
ans[0] += cnt**2

for t, d in TD:
  if T[t-1] >= 2:
    heappush(H, (D[t].pop(), t))
    T[t-1] -= 1

#print(ans, H, T, cnt)
for i in range(K, N):
  if H:
    t1, d1 = TD[i]
    d2, t2 = heappop(H)
    #print(t1, d1, t2, d2)
    if T[t1-1] == 0:
      ans.append(ans[-1] + d1 - d2 + 2*cnt + 1)
      cnt += 1
      T[t1-1] += 1
    else:
      heappush(H, (d2, t2))
    #print(ans, H, T, cnt)

print(max(ans))
#print(ans)

Measured memory_bytes: 34996
<?php
$S=trim(fgets(STDIN));$Sl=strlen($S);
$P=trim(fgets(STDIN));$Pl=strlen($P);

$S.=$S;
$F='No';

for($i=0;$i<$Sl;$i++){
  if($S[$i]!=$P[0]) continue;
  $f=1;for($j=1;$j<$Pl;$j++) if($S[$i+$j]!=$P[$j]){$f=0;break;}
  if($f){$F='Yes';break;}
}

echo $F;
?>

Measured memory_bytes: 15416
#include<stdio.h>
int main(){
 int S, hh, mm, ss;
 scanf("%d", &S);
 hh = S / 3600;
 mm = S % 3600 / 60;
 ss = S % 60;
 printf("%d:%d:%d\n",hh,mm,ss);
 return 0;
}

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

using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl

template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }
// vector
template<class T> istream&
operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream&
operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << "\t" << t; return os << endl; }
// pair
template<class T, class U> ostream&
operator << (ostream &os , const pair<T, U> &v) { return os << "<" << v.first << ", " << v.second << ">"; }

const int INF = 1 << 30;
const ll INFL = 1LL << 60;

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

    int N, C; cin >> N >> C;
    int ans = 0;
    vector<int> used_cnt(31);
    using T = pair<double, int>;
    priority_queue<T, vector<T>, greater<T>> que;
    vector<tuple<double, double>> q[31];
    rep(i, N) {
        double s, t;
        int c;
        cin >> s >> t >> c;
        q[c].emplace_back(s, t);
    }
    rep(i, 31) sort(all(q[i]));
    rep(c, 31) {
        if(q[c].size() == 0) continue;
        auto prev = q[c][0];
        rep(i, q[c].size() - 1) {
            if(get<1>(prev) >= get<0>(q[c][i])) {
                get<1>(prev) = get<1>(q[c][i]);
            } else {
                que.emplace(get<0>(prev) - 0.5, c);
                que.emplace(get<1>(prev), -c);
                prev = q[c][i];
            }
        }
        que.emplace(get<0>(prev) - 0.5, c);
        que.emplace(get<1>(prev), -c);
    }
    while(que.size()) {
        auto p = que.top(); que.pop();
        int c = p.second;
        if(c > 0) used_cnt[c]++;
        else used_cnt[-c]--;
        set_max(ans, accumulate(all(used_cnt), 0));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 8692
N,M = map(int,input().split())

a = [int(input()) for i in range(M)]

wa = (10**9) + 7

#dpを使う

dp = [0]*(N+1)
dp[0]=1
now_a = 0
if len(a)==0:
    now_a = -1
if len(a)!=0:
    a.reverse()
    now_a = a.pop()

for i in range(1,N+1):
    # print(now_a)
    if i==1:
        dp[i]=dp[i-1]
    else:
        dp[i]=dp[i-1] + dp[i-2]
    if i == now_a:
        dp[i]=0
        if len(a)!=0:
            now_a = a.pop()
        else:
            now_a = -1

# print(dp)

print(dp[N]%wa)





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

int main() {
  int s1s2s3;
  cin >> s1s2s3;
  cout << s1s2s3/100+(s1s2s3/10-s1s2s3/100*10)
    +(s1s2s3-s1s2s3/100*100-(s1s2s3/10-s1s2s3/100*10)*10)
    << endl;
}

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

using namespace std;

using ll = long long;

int main(){
    string s;cin >> s;
    string t;cin >> t;
    int cnt = 0;
    for(int i = 0;i < 3;i++)if(s[i] == t[i])cnt++;
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 256
n, k, q = map(int, input().split())
l = [0] * n
katen = []

my_append = katen.append # appendを(間接的に)直接呼び出す
for i in range(q):
    my_append(int(input()))

for j in katen: # pop、insertを使わない、使うとTLE！
    l[j-1] += 1 

for y in range(n):
    if l[y] > q-k:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 8632
#include<stdio.h>
#include<stdlib.h>

int main(void){
	
	int a,g,n,i=0,date[10000];
	long long int add=0;
	scanf("%d",&n);
	
	while(i != n){
		scanf("%d",&date[i]);
		add += date[i];
		++i;
	}
	
	g = 0;
	
	while(g != n){
		i = 0;
		while(i != n-1){
		
			if( date[i] > date[i+1]){
				a = date[i];
				date[i] = date[i+1];
				date[i+1] = a;
			}
			++i;
		}
		++g;
	}
	
	printf("%d %d %lld\n",date[0],date[n-1],add);
	
	return 0;
}

Measured memory_bytes: 636
//#include<bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <sys/types.h>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include<bitset>
#include<fstream>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(x) x.begin(), x.end()
#define rep(a, b, c) for (int a = b; a < c; a++)
#define pb push_back
#define fi first
#define se second
#define INF 1000000000000000000
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
# define M_PI 3.14159265358979323846
const int maxx = 10000002;
const int mod2 = 987654319;
const int maxlog = 20;
const ll mod = 1000000007;
const int mod3 = 998244353;

ll power(ll x, ll y) {
    ll res = 1;
    while (y) {
        if (y & 1) res = (res * x) % mod; 
        y >>= 1;
        x = (x * x) % mod;
    }
    return res;
}


void solve(int test) {
    int N;
    cin >> N;
    vector<int> a(N);
    map<int, int> mp;
    rep(i, 0, N) {
        int x; cin >> x;
        a[i] = x;
        mp[x]++;
    } 
    int ans = 0;
    rep(i, 0, N) {
        int ok = 1;
        for (int j = 2; j * j <= a[i]; j++) {
            if (a[i] % j == 0) {
                int t = a[i] / j;
                if (mp.count(t) || mp.count(j)) {
                    ok = 0;
                    break;
                }
            }
        }
        if (mp[a[i]] > 1 || (a[i] != 1 && mp.count(1))) ok = 0;
        ans += ok;
    }
    cout << ans;
}


int main() {
    IOS
    ifstream ifs;
    ofstream ofs;
    ifs.open("input.txt");
    ofs.open("output.txt");
    //make();
    int tt = 1, test = 1;
    //cin >> tt;
    while (tt--) {
        solve(test);
        test++;
    }
}


Measured memory_bytes: 13328
N = int(input().strip())
H = list(map(int, input().strip().split()))
tof = []
for i in range(N-2, -1, -1):
    if H[i] > H[i+1]:
        H[i] -= 1
    if H[i] > H[i+1]:
        tof.append("FALSE")
        break
if "FALSE" in tof:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 14396
n, m, l = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(n)]
B = [list(map(int, input().split())) for _ in range(m)]
C = [[0 for _ in range(l)] for _ in range(n)]
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += (A[i][k] * B[k][j])

for c_1 in C:
    for i, c2 in enumerate(c_1):
        print(c2, end='')
        if i != l-1:
            print(' ', end='')
    print()


Measured memory_bytes: 7148