akhauriyash/Code-Regression huggingface dataset:
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 1e18
#define MOD 100000007
#define SIZE 10005
#define PI 	3.14159265358979323846

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c;
    cin >> a >> b >> c;
    cout << min(b/a,c) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define forn(i, a, n) for (int i = (int)(a); i < (int)(n); ++i)
#define ford(i, a, n) for (int i = (int)(n) - 1; i >= (int)(a); --i)
#define fore(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define fs first
#define sn second
#define trace(a)\
    for (auto i : a) cerr << i << ' ';\
    cerr << '\n'
#define eb emplace_back

#ifndef M_PI
const ld M_PI = acos(-1.0);
#endif

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

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

const ld eps = 1e-9;
const int INF = 2000000000;
const ll LINF = 1ll * INF * INF;
const ll MOD = 1000000007;

ll grundy(ll n) {
    if (n == 0) return 0;
    ll ans = 1;
    while (n % 2 == 0) {
        n /= 2;
        ans *= 2;
    }
    return ans;
}

void pre(int n) {
    vector<int> dp(n);
    dp[0] = 0;
    forn(i, 1, n) {
        set<int> vals;
        int cur = 0;
        ford(j, 0, i) {
            cur ^= dp[j];
            vals.insert(cur);
        }
        vals.insert(0);
        for (int j = 0; ; ++j)
            if (vals.find(j) == vals.end()) {
                dp[i] = j;
                break;
            }
    }
    trace(dp);
    forn(i, 0, n) cerr << grundy(i) << ' ';
}

const int N = 1e5 + 10;
int go[N][2], dpt[N];
int nxt = 0;

void add(string s) {
    int cur = 0;
    for (char c : s) {
        int x = c - '0';
        if (go[cur][x] == -1) {
            go[cur][x] = ++nxt;
            dpt[nxt] = 1 + dpt[cur];
        }
        cur = go[cur][x];
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); 
    srand((unsigned)chrono::high_resolution_clock::now().time_since_epoch().count());
    //pre(30);
    memset(go, -1, sizeof go);
    int n;
    ll l;
    cin >> n >> l;
    forn(i, 0, n) {
        string s;
        cin >> s;
        add(s);
    }
    ll val = 0;
    fore(i, 0, nxt) {
        if ((go[i][0] == -1) ^ (go[i][1] == -1)) {
            val ^= grundy(l - dpt[i]);
        }
    }
    cout << (val ? "Alice\n" : "Bob\n");
}


Measured memory_bytes: 1616
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    
    auto B = A;
    int ans1 = 0, ans2 = 0;
    rep(i, N - 1){
        if(A[i] == i + 1) {
            swap(A[i], A[i + 1]);
            ans1++;
        }
        

    }
    if(A[N - 1] == N) ans1++;
    for(int i = N - 1; i >= 1; i--){
        if(B[i] == i + 1) {
            swap(B[i], B[i - 1]);
            ans2++;
        }
    }
    if(B[0] == 1) ans2++;
    
    output(min(ans1, ans2));
    return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int gcd(int a,int b){
  if (b>a){
    b^=a;
    a^=b;
    b^=a;
  }
  while (b!=0){
    int c=a%b;
    a=b;
    b=c;
  }
  return a;
}
int main(){
  int n,x,ans=0;
  cin>>n>>x;
  rep(i,n){
    int t;
    cin>>t;
    ans=gcd(abs(t-x),ans);
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    int N;
    cin >> N;
    cout << (N-2) * 180 << endl;
    return 0;
}


Measured memory_bytes: 256
# coding: utf-8
import re
import bisect
from datetime import datetime as dt
import bisect
import math

def gcd(a, b):
    return math.gcd(a, b)

def lcm(a, b):
    return a * b / gcd(a, b)

class slist(list):
    def __init__(self, *args, **kw):
        list.__init__(self, *args, **kw)
        self.sort()

    def append(self, value):
        bisect.insort(self,value)

    def index_left(self, value):
        return bisect.bisect_left(self, value)


if __name__ == '__main__':
    x, a = map(int, input().split())
    if x < a:
        print('0')
    else:
        print('10')

Measured memory_bytes: 3700
/// Kazuki Hoshino


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
//#define endl '\n'
typedef tree<
int,
null_type,less<int>,
rb_tree_tag,tree_order_statistics_node_update>
ordered_set;
int n,a[202020];
map<int,int> mp;

bool chk(int x){
       mp.clear();
       int cur = 0;
       bool ans = true;
       for(int i=1;i<=n;i++){
              if(a[i]>cur){
                     cur = a[i];
                     continue;
              }
              else {
                     while(!mp.empty() && mp.rbegin()->fs>=a[i]){
                            mp.erase(mp.rbegin()->fs);
                     }
                     mp[a[i]-1]++;
                     cur = a[i]-1;
                     while(mp[cur]>=x){
                            mp.erase(cur);
                            cur--;
                            mp[cur]++;
                            if(cur<0){
                                   ans = false;
                            }
                     }
              }
              if(!ans)break;
              cur = a[i];
       }
       return ans;
}

signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);

cin >> n ;
for(int i=1;i<=n;i++){
       cin >> a[i];
}
bool flag = true;
for(int i=1;i<=n;i++){
       if(a[i]>a[i-1])continue;
       else flag = false;
}
if(flag){
       cout << 1 << endl;
       return 0;
}

int l = 1, r = n+1;
while(r-l>1){

       int mid = (l+r)/2;
       if(chk(mid)){
              r = mid;
       }
       else l = mid;
}

cout << r << endl;

return 0;}
///....


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
	int n;
    cin >> n;
    int a[100];
    for (int i = 0; i < n; i++) cin >> a[i];

    for(int i = 0; i < n; i++){
    	if(a[i] % 2 == 0){
    		if(a[i] % 3 == 0 || a[i] % 5 == 0){
    			continue;
    		}
    		else{
    			cout << "DENIED" <<endl;
    			return 0;
    		}
    	}
    	continue;
    }
    cout << "APPROVED" <<endl;
    return 0;
}


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

#define MAX 100000

int main() {
	int n, a[MAX];
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	int L[MAX], l;
	L[0] = a[0];
	l = 1;
	for (int i = 1; i < n; i++) {
		if (L[l - 1] < a[i]) {
			L[l++] = a[i];
		} else {
			*lower_bound(L, L + l, a[i]) = a[i];
		}
	}
	cout << l << endl;
	return 0;
}



Measured memory_bytes: 3864
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,n,m) for(int i=n;i<=(int)(m);i++)
#define RFOR(i,n,m) for(int i=(int)(n);i>=m;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
ll modinv(ll a, ll m) {
    ll b=m,u=1,v=0;
    while(b){
        ll t = a/b;
        a -= t*b; swap(a,b);
        u -= t*v; swap(u,v);
    }
    u %= m;
    if (u<0) u += m;
    return u;
}
vector<ll> kaijou(1000001);
ll comb(int x,int y){
    if(x<y || y<0)  return 0;
    return (kaijou[x]*modinv((ll)kaijou[x-y]*kaijou[y],(ll)MOD))%MOD;
}
int main(){
    kaijou[0]=1;
    FOR(i,1,1000000) kaijou[i]=(kaijou[i-1]*i)%MOD;
    
    int n;
    cin>>n;
    vector<int> a(n+1);
    ll sum=0;
    rep(i,n+1){
        cin>>a[i];
        sum+=(ll)a[i];
    }
    ll x=sum-(ll)n*(n+1)/2;
    int i1=0,i2=0;
    rep(i,n+1){
        if(a[i]==x){
            i1=i2;
            i2=i;
        }
    }
    FOR(k,1,n+1){
        cout<<(comb(n+1,k)-comb(n-i2+i1,k-1)+MOD)%MOD<<endl;
    }
}



Measured memory_bytes: 9472
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define pb push_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define chmin(x,y) if(x>y)x=y
#define chmax(x,y) if(x<y)x=y
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll,vector<ll>,greater<ll>> SPQ;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
using vc=vector<char>;
using vvc=vector<vector<char>>;
const ll inf=100100100100;
const int Inf=1001001001;
const int mod=1000000007;
int main(){
    string s;cin>>s;
    int n=s.size();
    int ans=0;
    rep(i,n){
        if(s[i]-'0'==i%2)ans++;
    }
    cout<<min(ans,n-ans)<<endl;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;


int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);

    vector<int> a(n);
    int i;
    for(i=0; i<n; i++) {
        scanf("%d", &a[i]);
    }
    //sort(a.begin(),a.end());

    vector<int> s(n+1,0);
    for(i=0; i<n; i++) {
        s[i+1]=s[i]+a[i];
    }

    int ans=INF;
    for(i=0; i<=n; i++) {
        int tmp = abs(s[i]-(s[n]-s[i]));
        ans = MIN(ans,tmp);
    }
    printf("%d\n", ans);


    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <array>
#include <bitset>
#define rep(i,r) for(int i = 0; i < (r); i++)
#define pb push_back
#define all(a) a.begin(), a.end()
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int long long
#define uint unsigned long long
#define inf 0x3f3f3f3f3f3f3f3f
#define endl '\n'
using namespace std;

signed main() {
    fastio;
    int n; cin >> n;
    int res = 0;
    for (int i = 1; i <= n-1; i++) {
        res += (n-1) / i;
    }
    cout << res << endl;
}

Measured memory_bytes: 3192
n = gets.to_i
p = gets.chomp.split(" ", n).map(&:to_i)
q = gets.chomp.split(" ", n).map(&:to_i)

aaa = n.times.map{|i| i + 1}.permutation(n).to_a
pp = aaa.find_index{|a| a==p}
qq = aaa.find_index{|a| a==q}
ans = (pp - qq).abs
p ans

Measured memory_bytes: 6908
N,M=[int(x) for x in input().split()]
dic={}
for i in range(N):
    A,B=[int(x) for x in input().split()]
    try:
        dic[A]+=B
    except:
        dic[A]=B
        
s_dic=sorted(dic.items(), key=lambda x: x[0])

cost=0
for e in s_dic:
    if M-e[1]<0:
        cost+=e[0]*M
        break
    else:
        M-=e[1]
        cost+=e[0]*e[1]

print(cost)


Measured memory_bytes: 24160
M, D = input().split()


SUM = 0
for m in range(4, int(M)+1) :
    for d in range(22, int(D)+1) :
        if ( int(d % 10) ) * ( int(d / 10) ) == m \
            and int(d % 10) != 1 and int(d / 10) != 1:
            SUM+=1
        
print(SUM)

Measured memory_bytes: 3060
import Control.Monad

all_pat::[Int]->[([Int],[Int],[Int],[Int])]
all_pat [] = [([],[],[],[])]
all_pat (x:rest) = concat [[(x:a,b,c,n),(a,x:b,c,n),(a,b,x:c,n),(a,b,c,x:n)]|(a,b,c,n)<-all_pat rest]


single_cost::(Int,[Int])->Int
single_cost (a,x) = (max 0 ((length x) - 1))*10 + (abs ((sum x)-a))

tot_cost::Int->Int->Int->([Int],[Int],[Int],[Int])->Int
tot_cost a b c (x,y,z,_) = sum((map single_cost) (zip [a,b,c] [x,y,z]))

solver::Int->Int->Int->[Int]->Int
solver a b c ls = minimum (map (tot_cost a b c) (filter (\(x,y,z,_)-> and [x/=[],y/=[],z/=[]]) (all_pat ls)))

main::IO()
main=do
  (n:a:b:c:[])<-return.map read.words=<<getLine
  dat<-forM [1..n] (\_-> return.read=<<getLine)
  print (solver a b c dat)

Measured memory_bytes: 1020
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;
const ld PI = 3.14159265358979323846;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//






int main(void) {

    ld a, b; cin >> a >> b;
    ll ans = a * b;
    out(ans);



    return 0;
}









Measured memory_bytes: 3784
class SegmentTree:
    def __init__(self, n, init_val, ide_ele=0):
        self.num = 2 ** (n - 1).bit_length()
        self.seg = [ide_ele] * 2 * self.num
        self.ide_ele = ide_ele
        for i in range(n):
            self.seg[i + self.num - 1] = init_val[i]
        for i in range(self.num - 2, -1, -1):
            self.seg[i] = self.seg_func(self.seg[2 * i + 1], self.seg[2 * i + 2])

    def update(self, k, x):
        k += self.num - 1
        self.seg[k] = x
        while k:
            k = (k - 1) // 2
            self.seg[k] = self.seg_func(self.seg[2 * k + 1], self.seg[2 * k + 2])

    def query(self, p, q):
        if q <= p:
            return self.ide_ele
        p += self.num - 1
        q += self.num - 2
        res = self.ide_ele
        while q - p > 1:
            if p & 1 == 0:
                res = self.seg_func(res, self.seg[p])
            if q & 1 == 1:
                res = self.seg_func(res, self.seg[q])
                q -= 1
            p = p // 2
            q = (q - 1) // 2
        if p == q:
            res = self.seg_func(res, self.seg[p])
        else:
            res = self.seg_func(self.seg_func(res, self.seg[p]), self.seg[q])
        return res

    def seg_func(self, x, y):
        return x + y


def p_c():
    n, q = map(int, input().split())
    s = input().replace("AC", "01")
    li = list(map(lambda x: 1 if x == "0" else 0, s))
    seg = SegmentTree(n, li)
    ans = []
    for _ in range(q):
        l, r = map(int, input().split())
        ans.append(str(seg.query(l - 1, r - 1)))
    print("\n".join(ans))
    
p_c()

Measured memory_bytes: 71020
#include <stdio.h>


int main(void) {
	int h, n, a, ans;
	ans = 0;
	scanf("%d %d", &h, &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d", &a);
		ans += a;
	}
	printf(ans >= h ? "Yes" : "No");

	return 0;
}

Measured memory_bytes: 128
import math

def solve():
    ms = h*60 + m
    angle1 = 2 * math.pi * (ms % (12 * 60)) / float (12 * 60)
    angle2 = 2 * math.pi * (ms % (60)) / float (60)
    pos1 = [math.sin(angle1) * a, math.cos(angle1) * a]
    pos2 = [math.sin(angle2) * b, math.cos(angle2) * b]
    dist = math.sqrt((pos1[0] - pos2[0])**2 + (pos1[1] - pos2[1])**2)
    print(dist)
    return

a,b,h,m = [int(ii) for ii in input().split()]
solve()

Measured memory_bytes: 62684
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
  int A[100];
  int N;
  int max = 0;
  int cnt = 0;

  cin >> N;
  for ( int i = 0; i < N; ++i ) {
    scanf("%d", &A[i]);
  }

  sort(A,A+N);

  for ( int i = 0; i < N; ++i ) {
    if ( A[i] > max ) {
      max = A[i];
      ++cnt;
    }
  }

  cout << cnt << "\n";
}


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

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set
#define pll pair<ll, ll>
#define vll vector<ll>
#define mll map<ll, ll>

using namespace std;

const ll MOD = 1000000007LL;
const ll INF = (1LL << 60LL);

int main() {
  ll N, M;
  scanf("%lld %lld", &N, &M);

  vector<pair<ll, ll>> list;
  for (ll i = 0; i < M; i++) {
    ll a, b;
    scanf("%lld %lld", &a, &b);
    list.emplace_back(make_pair(a, b));
  }
  auto sorted_list = list;

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

  map<ll, map<ll, string>> m;

  for (ll i = 0; i < sorted_list.size(); i++) {
    auto v = sorted_list[i];

    ll seq = m[v.first].size() + 1;

    char buff[1024];
    sprintf(buff, "%06d%06d", (int)v.first, (int)seq);
    m[v.first][v.second] = buff;
    // cout << buff << endl;
  }

  for (ll i = 0; i < list.size(); i++) {
    auto v = list[i];

    string a = m[v.first][v.second];
    cout << a << endl;
  }
}


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

using namespace std;

const int N = 1e6 + 6;
const long long inf = 1e10;
long long d[N], x;
long long b[N];
int n;
bool ans[N];

int main() {
  scanf("%d %lld", &n, &x);
  for (int i = 0; i < n; i++)
    scanf("%lld", d+i);
  long long now = 1;
  for (int i = n-1; i >= 0; i--) {
    b[i] = now;
    if (d[i] < 2LL * now)
      now += d[i];
    now = min(now, x+1);
  }
  now = x;
  for (int i = 0; i < n; i++) {
    ans[i] = (now >= b[i]);
    // cerr << i << " " << now << " " << b[i] << endl;
    now = min(now, abs(now-d[i]));
  }
  if (now != 0)
    for (int i = 0; i < n; i++)
      ans[i] = 1;
  int q;
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    int id;
    scanf("%d", &id);
    puts(ans[id-1] ? "YES" : "NO");
  }
  return 0;
}

Measured memory_bytes: 13696
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))};
const main=()=>{
  let n=tn()
  let ar=asc(tnn(n)),ans=0
  to(ar[n/2]-ar[n/2-1])
}
main()


Measured memory_bytes: 27196
var a  :char;
    s,t  :array[0..200010]of integer;
    n,i,j,k,ans  :integer;
    
function min(a,b:integer):integer;
begin
  if a>b then min:=b
  else min:=a
end;

begin
  readln(n);
  s[0]:=0;
  for i:=1 to n do begin
    read(a);
    if a='#' then s[i]:=s[i-1]+1
    else s[i]:=s[i-1];
    end;
  ans:=210000;
  for i:=0 to n do t[i]:=s[i]+n+s[i]-i-s[n];
  for i:=0 to n do ans:=min(ans,t[i]);
  writeln(ans)
end.

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

int main() {
    int n,m;
    cin >> n >> m;
    int l=1,r=n;
    for(int i=0;i<m;i++){
        int ltemp, rtemp;
        cin >> ltemp >> rtemp;
        if(ltemp>l){
            l = ltemp;
        }
        if(rtemp < r){
            r = rtemp;
        }
    }
    if(r<l){
        cout << 0 << endl;
    }else{
        cout << r-l+1 << endl;
    }
}

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

int main(){
  int h, w;
  cin >> h >> w;
  
  vector<string> s(h);
  vector<int> u(h, 0);
  vector<int> v(w, 0);
  
  for (int i = 0; i < h; i++){
    cin >> s.at(i);
  }
  
  for (int i = 0; i < h; i++){
    for (int j = 0; j < w; j++){
      if (s.at(i).at(j) == '#'){
        u.at(i) = 1;
        v.at(j) = 1;
      }
    }
  }
  
  for (int i = 0; i < h; i++){
    if (u.at(i) == 1){
      for (int j = 0; j < w; j++){
        if (v.at(j) == 1){
          cout << s.at(i).at(j);
        }
      }
      cout << endl;
    }
  }
}
  
  
    
  

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

int main () {
    unordered_map<string, int> to_sunday 
    {
        {"SUN",  7},
        {"MON",  6},
        {"TUE",  5},
        {"WED",  4},
        {"THU",  3},
        {"FRI",  2},
        {"SAT",  1}
    };
    string s; 
    cin >> s;
    cout << to_sunday[s] << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int W,H,x,y,r;
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	if(x >= r && y >= r && x + r <= W && y + r <= H)
	{
		printf("Yes\n");
	}else
	{
		printf("No\n");
	}
 	return 0;
}

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

int main()
{
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (a != i + 1) {
            ans++;
        }
    }
    if (ans <= 2) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ll long long

using namespace std;

bool is_prime(ll n){
    switch(n){
        case 0: // fall-through
        case 1: return false;
        case 2: return true;
    }

    for(unsigned i=2;i*i<n;++i){
        if(n%i == 0) return false;
    }

    return true;
}

int main(){
  ll n;cin>>n;

  rep(i,100000){
    ll cn = i+n;
    if(is_prime(cn)){
      cout<<cn;
      return 0;
    }
  }

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b;
cin >> a >> b;
vector<int> vec={0,13,1,2,3,4,5,6,7,8,9,10,11,12};
if(vec.at(a)>vec.at(b))
cout << "Alice" << endl;
else if (vec.at(a) < vec.at(b))
cout << "Bob" << endl;
else 
cout << "Draw" << endl;
}

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

int main() {
    long long N, D;
    cin >> N >> D;
    double X, Y;
    long long ans = 0;
    for (int i =0; i < N; i++) {
        cin >> X >> Y;
        if (sqrt(X*X+Y*Y) <= D) {
            ans ++;
        }
    }
    cout << ans << endl;
 
    
}



Measured memory_bytes: 3840
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <unordered_set>
#include <bitset>
#include <cmath>
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
static const int INF = 1000010000;
static const int NIL = -1;
static const int MOD = 1000000007;
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb push_back
#define mp make_pair
#define np next_permutation
#define pq priority_queue
 
int gcd(int a, int b) { int c; while (b != 0) { c = a%b; a = b; b = c; }return a; }
int lcm(int a, int b) { int c = gcd(a, b); a /= c; return a*b; }
int nCr(int a, int b) { int i, r = 1; for (i = 1; i <= b; i++) { r *= (a + 1 - i); r /= i; }return r; }
int pow(int a, int b) { int i, r = 1; for (i = 1; i <= b; i++) { r *= a; }return r; }
long long llpow(long long a, long long b) { long long i, r = 1; for (i = 1; i <= b; i++) { r *= a; }return r; }
long long llgcd(long long a, long long b) { long long c; while (b != 0) { c = a%b; a = b; b = c; }return a; }
long long lllcm(long long a, long long b) { long long c = llgcd(a, b); a /= c; return a*b; }
long long llnCr(long long a, long long b) { long long i, r = 1; for (i = 1; i <= b; i++) { r *= (a + 1 - i); r /= i; }return r; }
 
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(a + b == c || b + c == a || c + a == b){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <cinttypes>
#include <climits>
#include <cmath>
#include <complex>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

struct Blk {
  int w, s, v, n;
};

int main() {
  int N;
  scanf("%d", &N);
  static Blk A[1000];
  for (auto i = 0; i < N; ++i) {
    scanf("%d%d%d", &A[i].w, &A[i].s, &A[i].v);
    A[i].n = i;
  }
  sort(A, A + N, [](const Blk& a, const Blk& b) {
    return a.w + a.s != b.w + b.s ? a.w + a.s > b.w + b.s : a.n < b.n;
  });
  static long long F[10001];
  for (auto i = 0; i < N; ++i) {
    for (auto j = A[i].w; j <= 10000; ++j)
      F[min(j - A[i].w, A[i].s)] = max(F[min(j - A[i].w, A[i].s)], F[j] + A[i].v);
    for (auto j = 10001; j <= 10000 + A[i].w; ++j)
      F[min(j - A[i].w, A[i].s)] = max(F[min(j - A[i].w, A[i].s)], (long long) A[i].v);
  }
  printf("%lld\n", F[0]);
  return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <string.h>
char s[100000];
int i, f, count0, count1;
int main(void)
{
    scanf("%s", &s);
    i = strlen(s);
    for (f = 0; f < i; f++)
    {
        if (s[f] == '0')
        {
            count0++;
        }
        else
        {
            count1++;
        }
    }
if(count0<count1){
    printf("%d",i - (count1-count0));
}else{
    printf("%d",i-(count0-count1));
}
    

    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 2e18

#define mod 1000000007

struct BIT{
  ll bit[101010+1];

  void init(){
    memset(bit,0,sizeof(bit));
  }

  ll sum(ll i){
    ll s=0;
    while(i>0){
      (s+=bit[i])%=mod;
      i-=i&-i;
    }
    return s;
  }

  void add(ll i,ll v){
    if(i==0)return ;
    while(i<=101010){
      (bit[i]+=v)%=mod;
      i+=i&-i;
    }
  }
};

ll n,a,b;
ll s[101010];

int main(){
	cin>>n>>a>>b;
  s[0]=-INF;
  repl(i,1,n+1)cin>>s[i];
  if(a>b)swap(a,b);

  rep(i,n-1){
    if(s[i+2]<s[i]+a){
      cout<<0<<endl;
      return 0;
    }
  }

  BIT bit;
  bit.init();
  ll lidx=0;
  bit.add(0+1,1);
  repl(i,1,n+1){

    ll ridx=upper_bound(s,s+n+1,s[i]-b)-s;
    bit.add(i+1,bit.sum(ridx));

    if(s[i]<s[i-1]+a){
      while(lidx<i-1){
        bit.add(lidx+1,(-(bit.sum(lidx+1)-bit.sum(lidx))+mod*2)%mod);
        lidx++;
      }
    }

  }
  cout<<bit.sum(n+1)%mod<<endl;
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

const ll mod = 1e9+7;
const ll maxn = 1e6+9;
ll fat[maxn];



template <typename T>
T extGcd(T a, T b, T& x, T& y) {
    if (b == 0) {
        x = 1; y = 0; return a;
    }
    else {
        T g = extGcd(b, a % b, y, x);
        y -= a / b * x; return g;
    }
}
 
template <typename T>
T modInv(T a, T m) {
    T x, y;
    extGcd(a, m, x, y);
    return (x % m + m) % m;
}
 
template <typename T>
T modDiv(T a, T b, T m) {
    return ((a % m) * modInv(b, m)) % m;
}

template<typename T>
T modMul(T a, T b, T m) {
	T x = 0, y = a % m;
	while (b > 0) {
		if (b % 2 == 1) x = (x + y) % m;
		y = (y * 2) % m; b /= 2;
	}
	return x % m;
}

void calc(ll n){
    fat[0] = 1;
    
    rep(i, 1, n){
        fat[i] = (i*fat[i-1])%mod;
        //cout << fat[i] << ' ';
    }
    //cout << '\n';
    }


int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);
    ll x, y;
    cin >> x >> y;
    if ((x + y) % 3){
        cout << 0 << '\n';
        return 0;
    }
    
    
    ll n = (x+y)/3, k = (2*y - x)/3;
    if (x < n || x > 2*n || y < n || y > 2*n){
        cout << 0 << '\n';
        return 0;
    }
    calc(n + 1);
    ll num = fat[n], den = modMul(fat[k], fat[n-k], mod);
    cout << modDiv(num, den, mod) << '\n';
    return 0;
}

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

int main(){
    
    int X,A,B; cin >> X >> A >> B;
    if((B-A+1) %2 == 0 ) cout << "Borys" << endl;
    else cout << "Alice" << endl;
}

Measured memory_bytes: 3612
N,M = [int(i) for i in input().split(" ")]
A = [int(i) for i in input().split(" ")]

cnt = 0
sum1 = sum(A)
p = 1/(4*M)

for i in range(len(A)):
    A[i] = A[i]/sum1

for i in A:
    if i >= p:
        cnt = cnt + 1


if cnt >= M:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <unordered_map>
using namespace std;

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  int count = 0;

  for (int i = 1; i <= N; i++) {
    int total = 0;
    int num = i;
    while (num > 0) {
      total += num % 10;
      num /= 10;
    }
    // cout << i << ":" << total << endl;
    if (A <= total && total <= B)
      count += i;
  }
  cout << count << endl;
}


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

using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf("%.12lf\n",mid);
// __builtin_popcount(int) count 1's in binary
// get decimal pert of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
int mod = 1000000007;

long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}

/*string sentence = "And I feel fine...";
    istringstream iss(sentence);
*/  

double eps = .000000001;
string s;
bool memoo[100000][13];
long long memo[100000][13];
int pows[100000];
long long func(int ind, int modd){
    if (ind >= s.size() && modd == 5){
        return 1;
    }
    if (ind >= s.size()){
        return 0;
    }
    if (memoo[ind][modd]){
        return memo[ind][modd];
    }
    if (s[ind] == '?'){
        // what times pow plus modd
        int pownum = pows[s.size()-1-ind];
        long long curcnt = 0;
        for (int i=0; i<10; i++){
            curcnt += func(ind+1, ((pownum*i)%13+modd)%13);
            curcnt %= mod;
        }
        memoo[ind][modd] = true;
        memo[ind][modd] = curcnt;
        return curcnt;
    }else{
        memoo[ind][modd] = true;
        memo[ind][modd] = func(ind+1, modd);
        return memo[ind][modd];
    }
}
int sumalready = 0;
int main ()
{
  prep();
  
  cin >> s;
  int poww = 1;
  int cnt = 0;
  for (int i=s.size()-1; i>=0; i--){
      if (s[i] != '?'){
          sumalready += poww*(s[i]-'0');
          sumalready %= 13;
      }
      pows[cnt] = poww;
      poww *= 10;
      poww %= 13;
      cnt++;
  }
  cout << func(0, sumalready);
  return 0; 
 
}


Measured memory_bytes: 20048
#include <iostream>
#include <cmath>

using namespace std;

int N,A,B,Nr;

inline int lg(int x)
{
    return int(log10(x) + 1);
}

inline int sum_cif(int k, int N)
{
   /// cout << k << " ";4
    switch(k)
    {
    case 1:
        return N;
    case 2:
        return N % 10 + N / 10 % 10;
    case 3:
        return N % 10 + N / 10 % 10 +  N / 100 % 10;
    case 4:
        return N % 10 + N / 10 % 10 +  N / 100 % 10 + N / 1000 % 10;
    default:
        return 1;
    }
}

int main()
{
    cin >> N >> A >> B;
    for(int i = 1; i <= N; ++i)
    {
        int X = sum_cif(lg(i),i);
       /// cout <<i << " "<< X << '\n';
        if(A <= X && X <= B)
            Nr += i;
    }
    cout << Nr;
    return 0;
}


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

#ifdef LOCAL
#include "../debug.h"
#else
#define debug(x...) 141
#endif
#define forn(i,x,n) for(int i = x; i < n; ++i)
#define forit(it, m) for(auto it = m.begin(); it!=m.end(); ++it)
typedef long long ll;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n,ans=0,i;
    cin>>n;
    map<ll,int> m;
    while (n % 2 == 0)  
    {  
        m[2]++;  
        n = n/2;  
    }    
    for (int i = 3; i <= sqrt(n); i = i + 2)  
    {  
        while (n % i == 0)  
        {  
            m[i]++;  
            n = n/i;  
        }  
    }  
    if (n > 2)  
        m[n]++;
    forit(it,m){
    	i=0;
    	while(i*(i+1)/2<=it->second)
    		i++;
    	ans+=i-1;
    }
    cout<<ans<<'\n';
    return 0;
}	

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


int main() {
  int x;
  cin >>x;
  
  if(x==0){
    cout <<1<<endl;
  }
  else{
    cout << 0 <<endl;
  }
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
 
#define ALL(l)  (l).begin(),(l).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
//const ll mod =  1000000007;
//const ll maxn = 1000000000;

//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vll = vector<ll>; // intの1次元の型に vi という別名をつける
using vvll = vector<vll>; // intの2次元の型に vvi という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pll = pair<ll, ll>; // これ以降 pii という型名はpair<ll, ll> と同じ意味で使える
//---------------------------------------------------------------------------------------------------

int main(){
    ll a,ans=0;
    cin>>a;
    rep(i,a){
        if(!((i+1)%3==0)&&!((i+1)%5==0))ans+=(i+1);
    }
    cout<<ans<<endl;
}
   



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

int main(){
  int n,ans;
  cin >> n ;
  for(int i=1;i<=n;i++){
    for(int j=1;j<i;j++){
      if(i%2 == 0 && j %2 == 1){
        ans ++;
      }
      else if(i % 2 == 1 && j % 2 == 0){
        ans ++;
      }
    }
  }
  cout << ans << endl;
}


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

using namespace std;

const int MOD = 1e9 + 7;

int perm(int n) {
	if (n == 0) return 1;
	return 1LL * n * perm(n - 1) % MOD;
}

int main() {
	int n, m;

	cin >> n >> m;

	if (n > m) {
		swap(n, m);
	}

	if (n == m) {
		cout << 2LL * perm(n) % MOD * perm(m) % MOD << endl;
	} else if (n == m - 1) {
		cout << 1LL * perm(n) * perm(m) % MOD << endl;
	} else {
		cout << 0 << endl;
	}


	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;



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

	int N, M;
	cin >> N >> M;
	vector<string> A(N), B(M);
	REP(i, N) cin >> A[i];
	REP(i, M) cin >> B[i];
	for (int i = 0;i <= N - M;i++) {
		for (int j = 0;j <= N - M;j++) {
			bool flag = true;
			for (int k = 0;k < M;k++) {
				if (B[k] != A[i + k].substr(j, M)) {
					flag = false;
					break;
				}
			}
			if (flag) {
				cout << "Yes\n";
				return 0;
			}
		}
	}
	cout << "No\n";

	return 0;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var vals = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var n = vals[0];
            var m = vals[1];
            var d = vals[2];

            //m=2の場合
            var m2 = (double)CaseMEquals2(n, d) / Math.Pow((double)n, 2);
            //これのm-1倍
            var result = m2 * (double)(m - 1);

            Console.WriteLine(result);
        }

        static int CaseMEquals2(int n, int d)
        {
            if (d == 0) return n;
            else return 2 * (n - d);
        }
    }
}


Measured memory_bytes: 13268
n,T=map(int,input().split())
c=[]
t=[]
for i in range(n):
    c_,t_ = map(int,input().split())
    c.append(c_)
    t.append(t_)
mi=max(c)
f=False
for i in range(n):
    if t[i]<=T:
        if mi>=c[i]:
            f=True
            mi=c[i]
print(mi if f else 'TLE')

Measured memory_bytes: 3064
def op(a,b):
    return max(a,b)

class segmentTree:
    def __init__(self,n,op,init_value):
        dataLen=1 << (n - 1).bit_length()
        self.data=[init_value]*(2*dataLen)
        self.op=op
        self.length=dataLen
    def getIdx(self,left,right):
        idxs=[]
        l=left
        r=right
        while True:
            idx=1
            valueL=0
            valueR=self.length-1
            while l!=valueL or valueR>=r:
                if l<=(valueR+valueL)//2:
                    valueR-=(valueR-valueL+1)//2
                    idx*=2
                else:
                    valueL+=(valueR-valueL+1)//2
                    idx=idx*2+1
            idxs.append(idx)
            if valueR==r-1:
                break
            l=valueR+1
        return idxs
    def get(self,n):
        return self.data[self.getIdx(n,n+1)[0]]

    def set(self,n,value):
        if n<0 or n>=self.length:
          return False
        idx1=self.getIdx(n,n+1)[0]
        self.data[idx1]=value
        while idx1!=1:
            idx2=idx1^1
            if idx1>idx2:
                idx1,idx2=idx2,idx1
            self.data[idx1//2]=self.op(self.data[idx1],self.data[idx2])
            idx1//=2
        return True
    def query(self,l,r):
        idxs=self.getIdx(l,r)
        ret=self.data[idxs[0]]
        for idx in idxs:
            ret=self.op(ret,self.data[idx])
        return ret


N,K=map(int,input().split())
A=[]
for i in range(N):
  A.append(int(input()))

N=300000
seg = segmentTree(N, op, 0)

for i in A:
  l=min(N,max(0,i-K))
  r=max(0,min(N,i+K))
  v=seg.query(l,r+1)
  seg.set(i,v+1)
print(seg.query(0,N))

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

int main() {
    int A;
    int B;
    cin >> A >> B;
    if (A - B > 1) {
        cout << A * 2 - 1 << endl;
    }
    else if (B - A > 1) {
        cout << B * 2 - 1 << endl;
    }
    else if (A - B == 1 || B - A == 1) {
        cout << A + B << endl;
    }
    else if (A == B) {
        cout << A + B << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<62)-1
#define MAX 1000000000
signed main(){
    int N; cin>>N;
    vector<pii> A(N);
    rep(i,0,N){
        cin>>A[i].first;
        A[i].second=i;
    }
    vii dp(N+1,vi(N+1));
    sort(ALL(A),greater<pii>());
    REP(i,1,N){
        rep(j,1,i){
            dp[i][j]=max(dp[i-1][j]+A[i-1].first*abs(A[i-1].second-(N-i+j)),dp[i-1][j-1]+A[i-1].first*abs(A[i-1].second-(j-1)));
        }
        dp[i][0]=dp[i-1][0]+A[i-1].first*abs(A[i-1].second-(N-i));
        dp[i][i]=dp[i-1][i-1]+A[i-1].first*abs(A[i-1].second-(i-1));
    }
    int ans=0;
    REP(i,0,N) ans=max(ans,dp[N][i]);
    cout<<ans<<endl;
}


Measured memory_bytes: 34676
n,m=map(int,input().split())
accepted=[False for _ in range(n)]
submitted=[0 for _ in range(n)]
for _ in range(m):
    p,s=input().split()
    p=int(p)-1
    if s=='AC':
        accepted[p]=True
    if not accepted[p]:
        submitted[p]+=1
print(sum(accepted),sum(submitted[p] for p in range(n) if accepted[p]))

Measured memory_bytes: 4656
#include <iostream>
#include <vector>
#include <string.h>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
#include <cmath>
#include <map>
#include <set>
#include <assert.h>
#include <stdio.h>
#define REP(i,n) for(ll i=0;i<(n);i++)
#define MOD 1000000007
#define int long long
#ifdef int
const long long INF = LLONG_MAX / 10;
#else
const int INF = 1010101010;
#endif
using namespace std;
typedef long long ll;
typedef vector<vector<ll> > mat;
typedef pair<int, int> P;
//typedef pair<double, double> P;
const int dx[9] = {-1, 0, 0, 1, -1, -1, 1, 1, 0};
const int dy[9] = {0, -1, 1, 0, -1, 1, -1, 1, 0};
 
int x, y;
 
signed main() {
  cin >> x >> y;
  
  int ans = 0;
  if (abs(x) < abs(y)) {
    if (x < 0) {
      ans++;
      x *= -1;
    }
    ans += abs(y) - x;
    if (y < 0) ans++;
  } else {
    if (0 < x) {
      ans++;
      x *= -1;
    }
    ans += abs(abs(y) - abs(x));
    if (0 < y) ans++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        // 初期状態（ソート前）の要素を表示
        for (int i = 0; i < a.length; i++) {
            if (i < a.length - 1) {
                System.out.print(a[i] + " ");
            } else {
                System.out.println(a[i]);
            }
        }
        // 挿入ソート
        for (int i = 1; i < n; i++) {
            int v = a[i];
            int j = i - 1;
            for (; j >= 0 && a[j] > v; j--) {
                a[j + 1] = a[j];
            }
            a[j + 1] = v;
            // 表示
            for (int k = 0; k < a.length; k++) {
                if (k < a.length - 1) {
                    System.out.print(a[k] + " ");
                } else {
                    System.out.println(a[k]);
                }
            }
        }

    }

}


Measured memory_bytes: 31436
// Code for C - XYZ Triplets
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define FOR(i,x,y) for(ll i=x;i<(ll)(y);i++)

#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

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

  map<int, int> m;

  FOR(x, 1, 100) {
    FOR(y, 1, 100) {
      FOR(z, 1, 100) {
        m[x * x + y * y + z * z + x * y + y * z + z * x] += 1;
      }
    }
  }


  FOR(i, 1, N + 1) {
    cout << m[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 5296
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for (int i = 1; i<(n); i++)
#define in(n) cin >> (n)
#define out(ans) cout << (ans) << endl;
#define keta(n) cout << fixed << setprecision((n));
using ll = int64_t;
using v = vector<int>;


int main() {
  ll A, B, N;
  cin >> A >> B >> N;
  ll o, p, q, r, s, t, u, ans;
  o = A*N/B;
  p = N/B;
  q = p*A;
  o -= q;
  

  r = N - (N%B+1);
  s = A*r/B;
  t = r/B;
  u = t*A;
  s -= u;
  
  ans = max(o, s);
  cout << ans << endl;

}

Measured memory_bytes: 3636