akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<set>
#include<string>
#include<stdio.h>
#include<cmath>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repn(i, n) for(int i = 1; i <= n; i++)
#define all(x) (x).begin(), (x).end()
#define lint long long


int main(){
    int n, t; cin >> n >> t;
    vector<int> c;
    rep(i, n){
        int cost, time;
        cin >> cost >> time;
        if (time <= t) c.push_back(cost);
    }
    if(c.size() == 0){
        cout << "TLE" << endl;
        return 0;
    }
    sort(all(c));
    cout << c[0] << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(void)
{
  int N, M, understanding;
  int min_price = 10000000;
  
  cin >> N >> M >> understanding;
  
  vector< vector<int>> und(N, vector<int>(M, 0));
  vector<int> price(N);
  
  for(int i = 0; i < N; i++)
  {
    cin >> price[i];
    
      for(int j = 0; j < M; j++)
      {
          cin >> und[i][j];
      }
  }
  
  for(int mask = 0; mask < (1 << N); mask++)
  {
      int total_price = 0;
      vector<int> level(M, 0);
      for(int i = 0; i < N; i++)
      {
          if(mask & (1 << i) )
          {
              total_price += price[i];
              for(int j = 0; j < M; j++)
              {
                  level[j] += und[i][j];
              }
          }
      }
    
      int achievecnt = 0;
      for(int j = 0; j < M; j++)
      {
          if(level[j] >= understanding) achievecnt++;
      }
    
      if(achievecnt == M)
      {
          if(min_price > total_price)
          {
              min_price = total_price;
          }
      }
  }
  
  if(min_price == 10000000)
  {
      cout << -1 << endl;
  }
  else
  {
      cout << min_price << endl;
  }
  return 0;
}


Measured memory_bytes: 3584
N,K=map(int,input().split())
L=list(map(int,input().split()))
ans=float("inf")
for i in range(N-K+1):
	ans=min(ans,abs(L[i])+abs(L[i+K-1]-L[i]),abs(L[i+K-1])+abs(L[i+K-1]-L[i]))
print(ans)

Measured memory_bytes: 14224
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<vector>

int main() {
   
   int N, D, X;
   std::cin >> N >> D >> X;
   int A[N];
   int sum = 0;
   for (int i = 0; i < N; i++) {
      std::cin >> A[i];
   }
  
   for (int i = 0; i < N; i++) {
      for (int d = 1; d <= D; d++) {
         if ((d - 1)%A[i] == 0) sum++;
      }
   }
   sum += X;
   std::cout << sum << std::endl;
   return 0;
}


Measured memory_bytes: 256
# DAGの最長経路...トポロジカルソートもどきか？
# 普通にDAGに沿ったdpをすればいいのでは?
# 再帰だと実装楽そうだけどどうしよう
# 問題は終了と最初がわからんこと
# いや最初は全部長さ0をセットすればいいだろ
import sys
sys.setrecursionlimit(1 << 25)
readline = sys.stdin.buffer.readline
read = sys.stdin.readline  # 文字列読み込む時はこっち
ra = range
enu = enumerate


def exit(*argv, **kwarg):
    print(*argv, **kwarg)
    sys.exit()


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと


def ints(): return list(map(int, readline().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, readline().split())))
    return tuple(map(list, zip(*ret)))


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter, xor, add
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right
from functools import reduce

N, M = ints()
dag = defaultdict(lambda: [])
indeg = [0] * N
for _ in ra(M):
    x, y = mina(*ints())
    indeg[y] += 1
    dag[x].append(y)

q = deque()
for u, inn in enu(indeg):  # 多点DFS初期化
    if inn == 0:
        q.append((u, 0))

dp = [0] * N
while q:  # トポロジカル順序でdpテーブルを埋めていく
    u, l = q.popleft()
    # dp[u] = max(dp[u], l)
    dp[u] = l
    for nx in dag[u]:
        indeg[nx] -= 1
        if indeg[nx] == 0:
            q.append((nx, l + 1))
print(max(dp))


Measured memory_bytes: 96896
#include<bits/stdc++.h>
//#define int long long
using namespace std;





int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    string s;
    cin >> s;
    if(s == "keyence"){
        return cout << "YES", 0;
    }
    for(int i = 0; i < (int)s.size(); i++){
        for(int j = i; j < (int)s.size(); j++){
            string t;
            for(int k = 0; k < (int)s.size(); k++){
                if(i <= k && k <= j){

                }
                else{
                    t += s[k];
                }
            }
            if(t == "keyence"){
                return cout << "YES", 0;
            }
        }
    }
    cout << "NO";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
  string s;
  cin >> a >> s;
  bool ans = false;
  
  if(a>=3200)
    ans = true;
  
  if(ans)
    cout << s << endl;
  else
    cout << "red" << endl;
}

Measured memory_bytes: 256
s=list(input())
l=[0]*2019
t=0
ans=0
for i in range(len(s)):
    t=(t+pow(10,i,2019)*int(s[-1-i]))%2019
    l[t]+=1
for i in l:
    ans+=(i*(i-1))//2
print(ans+l[0])

Measured memory_bytes: 82900
#include <iostream>
//#include <iomanip>
#include <string>
//#include <vector>
#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
//#define all(v) v.begin(),v.end()
//ll mod = 1000000007 ;
//long double pie = acos(-1) ;
//ll INF = 1000000000000 ;

void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

int main(){
	ll a,b,c,d ;
	cin >> a >> b >> c >> d ;
	while(1){
		c -= b ;
		if(c<=0) break ;
		a -= d ;
		if(a<=0) break ;
	}
	yorn(c<=0) ;
}


Measured memory_bytes: 3624
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
#include <complex>
#include <cstdint>
#define _USE_CMATH_DEFINES

const long INF = (1l << 30);
const long LINF = (1l << 60); //1.15*10^18

long n, x, t;

int main(){
    scanf("%ld%ld%ld", &n, &x, &t);
    printf("%ld\n", ((n-1)/x+1) * t);
}


Measured memory_bytes: 3788
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int main()
{
    ll n;
    cin >> n;
    map<int, int> m;
    for(ll i = 2; i * i <= n; i++)
    {
        while(n % i == 0)
        {
            m[i]++;
            n /= i;
        }
    }
    if(n != 1) m[n] = 1;
    int ans = 0;
    for(auto itr = m.begin(); itr != m.end(); itr++)
    {
        int num = itr->second;
        int count = 1;
        while(true)
        {
            num -= count;
            count++;
            if(num >= 0) ans++;
            else break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <functional>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <queue>
using namespace std;
typedef long long ll;
static const int max_n = 10010;
// static const llong max_cost = 2000000000000000;
// // vector<vector<llong>> matrix(max_n, vector<llong>(max_n, 0));
// // vector<vector<llong>> adj_matrix(max_n, vector<llong>(max_n, max_cost));
// vector<vector<pair<llong, int>>> adj_list(max_n);
// vector<llong> distance_table(max_n, max_cost);
// set<pair<llong, int>> points_sort_x;
// set<pair<llong, int>> points_sort_y;
vector<ll> homework_list(max_n);
// int N;



int main(){
    // int u, v;
    // bool updated = false;
    ll N, M, A;
    scanf("%lld %lld\n", &N, &M);
    // printf("%lld\n", total_num);
    ll total_home_work_day = 0;
    for(ll i=0;i<M;i++){
        scanf("%lld", &A);
        homework_list[i] = A;
        total_home_work_day += A;
    }

    if(total_home_work_day>N){
        printf("%lld\n", (ll)-1);
    }else{
        printf("%lld\n", N-total_home_work_day);
    }


    return 0;

}

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

string solution(string r){
	if(r.size() == 1 || r.size()%2 != 0) return "No";
	string ans = "Yes";
	for(int i = 0; i < r.size()/2; i++){
	if(r[i] != r[(r.size()/2)+i]){
	ans = "No";
	break;
	} 
	else continue;
	}
	return ans;
}
int main(){
	string word;
	int n;
	cin >> n >> word;
	
	cout << solution(word);
	
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

class Program
{

    static void Main(string[] args)
    {
        var inputs = Console.ReadLine().Split(' ');
        var N = int.Parse(inputs[0]);
        var K = long.Parse(inputs[1]);
        inputs = Console.ReadLine().Split(' ');
        var A = new long[N];
        for (int i = 0; i < N; i++)
        {
            A[i] = long.Parse(inputs[i]);
        }

        const int maxDigits = 40;
        long X = 0;
        // X <= K   < 2^40のため、40桁が最大
        // 10^3 < 2^10 = 1024　であるため
        // 10^12 = (10^3)^4 < (2^10)^4 = 2^40
        for (int d = maxDigits; d >= 1; d--)
        {
            // 2進数でd桁目の値の1の数を数える
            long mask = 1;
            var oneCount = 0L;
            var shiftBit = d - 1;
            var k = (K >> shiftBit) & mask;

            for (int i = 0; i < N; i++)
            {
                // d桁の値を取り出す
                var value = (A[i] >> shiftBit) & mask;
                oneCount += value;
            }

            byte currentBit;
            // 0の数が多い
            if (oneCount < N - oneCount)
            {
                currentBit = 1;
            }
            else
            {
                // 1の数が多い
                currentBit = 0;
            }

            // 上位桁から決めるので、左シフトして今回分を加算する
            long preX = X;
            X = (X << 1) | currentBit;
            // Kの上位40～d桁目まで
            long comp = K >> shiftBit;
            // Kを超えてしまった場合、強制的に0にする
            if (X > comp)
            {
                currentBit = 0;
                X = (preX << 1) | currentBit;
            }
        }

        var f = 0L;
        for (int i = 0; i < N; i++)
        {
            f += X ^ A[i];
        }

        Console.WriteLine(f);
    }

}



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

int main(){
	int a, b, c, d;
  	cin>>a>>b>>c>>d;
  
  	int n1=a/d, n2=c/b;
  	if(a%d>0) n1++;
  	if(c%b>0) n2++;
  
  	if(n1>=n2){
    	cout<<"Yes"<<endl;
    }else{
    	cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3620
readlines.each do |l|
  *a,v1,v2 = l.split(",").map(&:to_i)
  d = (a.inject(:+).to_f / (v1+v2)) * v1
  s = 0
  puts a.each_with_index.find{|l,i| s+=l; s>=d}[1] + 1
end

Measured memory_bytes: 6128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#define ll long long int
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
using namespace std;

int mx8[] = {0,0,1,-1,-1,1,-1,1};
int my8[] = {-1,1,0,0,-1,-1,1,1};
int mx4[] = {1,-1,0,0};
int my4[] = {0,0,-1,1};
const int MOD = 1000000007;

int main() {
    int n; cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    ll x = a[0];
    for(int i = 1; i< n; i++){
        x ^= a[i];
    }
    rep(i,n){
        ll ans = x ^ a[i];
        cout << ans << " ";
    }
}




Measured memory_bytes: 4772
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    vector< vector<int> > c(3, vector<int>(3));
    for (int i = 0; i < 3; ++i) cin >> c[i][0] >> c[i][1] >> c[i][2];

    int dif;
    bool f = true;
    for (int i = 1; i < 3; ++i) {
        dif = c[i-1][0] - c[i][0];
        for (int j = 1; j < 3; ++j) {
            int dif2 = c[i-1][j] - c[i][j];
            if (dif != dif2) {
                f = false;
                break;
            }
        }
        if (!f) break;
    }

    if (f) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#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>;
ll N,K;
ll A[200005];
ll sosuu[200005];
bool found;
string ans;
ll si;
priority_queue<ll> so[200005];
ll m;
map<ll,ll> mm;
char a;
int main() {
    cin >> N;
    int i=0;
    while(N>0){
        N -= 1;
        A[i] = N % 26 ;
        N /= 26;
        i++;
    }
    char b;
    for(int k=0;k<i;k++){
        b = A[i-k-1] + 'a';
        cout << b;
        
    }
}


Measured memory_bytes: 9888
//k_tourist
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define mx 500005
#define non __builtin_popcount
#define ml map<ll, ll> 
#define uml unordered_map<ll, ll>
#define ms map<string , ll> 
#define all(a) (a).begin(),(a).end()
#define ff first
#define ss second
#define pl pair<ll, ll>
#define vl vector<ll>
#define vll vector<pl>
#define tpl pair<ll, pl>
#define vlll vector<tpl>
#define vs vector<string>
#define pb push_back
#define mk make_pair
#define M_PI 3.14159265358979323846
#define endl '\n'
#define fst ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%I64d",&x)
#define inf ((ll)1e18 + 1)
#define bs binary_search
#define pq priority_queue
#define ub upper_bound
#define lb lower_bound
#define pow powr
#define sp(a) setprecision(a)
#define rep(i,a,b)  for (i=(a);i<(b);i++)
#define nrep(i,a,b) for (i=(a);i>(b);i--)
using namespace std;
using namespace __gnu_pbds;  

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>  ordered_set;
 
ll powr(ll a,ll b)
{
	ll res=1;
	while(b)
	{
		if(b&1)res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}

void flag(ll fl){

	if(fl)
	cout<<"NO";
	else
	cout<<"YES";
}

ll a[mx], n, dp[mx], k;

ll frog1(ll i){

	if(i == n-1)
	return 0;

	if(dp[i] != -1)
	return dp[i];

	// if(i == n-2)
	// return (dp[i] =  abs(a[i+1] - a[i]) );

	ll ans= inf, j, m= min(n-1, i + k);

	rep(j, i+1, m+1 )
	ans= min(ans, abs(a[j] - a[i]) + frog1(j));

	return (dp[i] = ans);
	// return (dp[i]=  min(abs(a[i+1] - a[i]) + frog1(i+1), abs(a[i+2] - a[i]) + frog1(i+2)));
}

void bta_de_yarr(){

	ll i, j, fl=0, ans, m;
	// ll a[mx];
	cin>>n>>k;

	rep(i, 0, n)
	{
		cin>>a[i];
		dp[i] = -1;
	}

	ans= frog1(0);
	// cin>>m;

	
	cout<<ans;
	// flag(fl);
	cout<<endl;
}

int main(){
    fst

	// freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
	ll t;
    t= 1;
	//cin>>t;
    while(t--){
        bta_de_yarr();
    }
    return 0;
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Measured memory_bytes: 9856
// Code by Nguyen Huu Lam
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

typedef int LL;
typedef pair<LL, LL> II;

#define y0 Sword_Art_Online
#define y1 Your_lie_in_April
#define yn Darling_in_the_Franxx
#define tm Plastic_Memories
#define lr Charlotte
#define norm Weathering_with_you
#define left Violet_Evergarden
#define have Date_a_live
#define ends Your_name
#define prev Five_centimeters_per_second
#define hash Silent_voice
#define endl "\n"

template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

LL Rand(LL l, LL h){
    return uniform_int_distribution<LL>(l, h)(rng);
}

template <typename T> void read(T &t){
    t = 0; char ch = getchar(); int f = 1;
    while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); }
    do { (t *= 10) += ch - '0'; ch = getchar(); } while (isdigit(ch)); t *= f;
}

const LL MaxN = 1 + 5e5;

LL n, a[MaxN], q, bloc, mark[MaxN], ans[MaxN], vt[MaxN];
vector<pair<LL, LL> > query[MaxN];

class Tree{

    LL TNode[4 * MaxN], ri[4 * MaxN], le[4 * MaxN], leaf[MaxN], qi, qj;

    LL Find(LL node){
        if(le[node] > qj || ri[node] < qi) return 0;
        if(qi <= le[node] && ri[node] <= qj) return TNode[node];
        return (Find(node * 2) + Find(node * 2 + 1));  
    }

    public:
        void createTree(LL node, LL l, LL r){
            le[node] = l;
            ri[node] = r;
            if(l == r){
                leaf[l] = node;
                TNode[node] = 0;
                return;
            }
            createTree(node * 2, l, (l + r) / 2);
            createTree(node * 2 + 1, (l + r) / 2 + 1, r);
        }

        void update(LL node, LL val){
            LL h = leaf[node];
            TNode[h] = (TNode[h] + val);
            for(h /= 2 ; h ; h/= 2) TNode[h] = (TNode[h * 2] + TNode[h * 2 + 1]);
        }

        LL query(LL l, LL r){
            qi = l;
            qj = r;
            return Find(1);
        }
} tr;

void InOut(){
    #define TASK "ABC"
    freopen(TASK".inp","r",stdin);
    freopen(TASK".out","w",stdout);
}

int main(){
    // InOut();
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> q;
    for(int i = 1 ; i <= n ; ++i) cin >> a[i];
    for(int i = 0 ; i < q ; ++i){
        LL x, y;
        cin >> x >> y;
        query[y].push_back({x, i});
    }
    tr.createTree(1, 1, n);
    for(int i = 1 ; i <= n ; ++i){
        if(mark[a[i]]) tr.update(mark[a[i]], -1);
        tr.update(i, 1);
        mark[a[i]] = i;
        for(int j = 0 ; j < LL(query[i].size()) ; ++j){
            ans[query[i][j].second] = tr.query(query[i][j].first, i);
        }
    }
    for(int i = 0 ; i < q ; ++i) cout << ans[i] << endl;

    return 0;
}

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

bool isPrime(int x){
    if(x==2)return true;
    else if(x<2||x%2==0)return false;
    else{
        int i=2;
        while(i<=pow(x,0.5)){
            if(x%i==0)return false;
            i++;
        }
    }
    return true;
}

int main(){
    int n;
    cin>>n;
    int cnt=0;
    int x;
    for(int i=0;i<n;i++){
        cin>>x;
        if(isPrime(x))cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}


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

int main()
{
	int n, k, x;
	cin >> n >> k;
	int ans = 0;
	for (int i = 0; i < n; ++i)
	{
		cin >> x;
		ans += 2*min(x, k-x);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<stack>
using namespace std;
int f(int x) {
  return x*x;
}

int main() {
  int d;
  while(cin >> d) {
    int S = 0;
    for(int x = d; x <= 600-d; x += d) {
      S += f(x) * d;
    }
    cout << S << endl;
  }
  return 0;
}

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

int main() {
  string S; cin >> S;

  int ans = 0;
  for (int i = 0; i < S.size() / 2; i++) {
    if (S[i] != S[S.size() - 1 - i]) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string S;
    cin >> S;
    if (S=="SAT"){
        cout << 1 << endl;
    }
    if(S == "FRI"){
        cout << 2 << endl; 
    }
    if (S=="THU"){
        cout << 3 << endl;
    }
    if (S=="WED"){
        cout << 4 << endl;
    }
    if (S=="TUE"){
        cout << 5 << endl;
    }
    if(S=="MON"){
        cout << 6 << endl;
    }
    if(S == "SUN"){
        cout << 7 << endl;
    }
}


Measured memory_bytes: 256
#pragma GCC optimize("O2,unroll-loops")
#pragma GCC target("avx,popcnt")
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
const int maxn = 1<<17, mod = 1e9 + 7;
int n, m, p[17], dp[1<<15], d[20][20], h[1<<15][15], cl[1<<15], f[1<<15][15], pr[1<<15], tot = 0;
void ret(int x) {
	cout << bitset<15>(x^pr[x]) << '\n';
	if(!pr[x]) return;
	ret(pr[x]);
}
int main() {
	cin.tie(0)->sync_with_stdio(0);
	p[0] = 1;
	cin >> n >> m;
	memset(d, -0x3f, sizeof d);
	for(int i = 0; i < n; i++) d[i][i] = 0;
	for(int f, t, c, i = 0; i < m; i++) {
		cin >> f >> t >> c;
		--f, --t;
		d[f][t] = d[t][f] = c;
		tot += c;
	}
	for(int i = 0; i < 1<<n; i++) {
		for(int j = 0; j < n; j++) {
			for(int k = 0; k < n; k++) {
				if(i >> k & 1) if(d[j][k] >= 0) h[i][j] += d[j][k];
			}
		}
	}
	for(int i = 0; i < 1<<n; i++) {
		for(int j = 0; j < n; j++) if(i >> j & 1){
			for(int k = 0; k < j; k++) if(i >> k & 1) {
				 if(d[j][k] >= 0) cl[i] += d[j][k];
			}
		}
	}
	memset(f, -0x3f, sizeof f);
	memset(dp, -0x3f, sizeof dp);
	f[1][0] = 0;
	for(int i = 0; i < 1<<n; i++) {
		for(int j = 0; j < n; j++) {
			if(~i >> j & 1) continue;
			if((i&1) && j == n-1)
				dp[i] = max(dp[i], f[i][j]);
			//if(f[i][j] >= 0) cout << i << " " << j << " " << f[i][j] << '\n';
			//cout << i << " " << j << " == " << f[i][j] << '\n';
			for(int k = 0; k < n; k++) {
				//cout << i << " " << j << " to " << (i|1<<k) << " " << k << " - " <<f[i][j] << " " << - h[i][k] + 2*d[j][k] << " das\n";
				if(d[j][k] >= 0)
				if(~i >> k & 1) f[i | 1<<k][k] = max(f[i | 1<<k][k], f[i][j] + d[j][k]);
			}
		}
	}
	for(int i = 0; i < 1<<n; i++) {
		int t = i;
		t ^= (1<<n)-1;
		for(int j = t; j > 0; j = (j-1)&t) {
			for(int k = 0; k < n; k++) {
				if(i >> k & 1) {
					dp[i|j] = max(dp[i|j], dp[i] + h[j][k] + cl[j]);
					if(dp[i|j] == dp[i] + h[j][k] + cl[j]) pr[i|j] = i;
				}
			}
		}
	}
	cout << tot - dp[(1<<n)-1] << '\n';
	//ret((1<<n) - 1);
	return 0;
}


Measured memory_bytes: 4480
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<vector>
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<double> V(N);
    for (int i = 0; i < N; ++i) cin >> V[i];
    sort(V.begin(), V.end());
    double ans = V[0];
    for (int i = 1; i < N; ++i) {
        ans = (ans + V[i]) / 2;
    }
    cout << fixed << setprecision(6);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<58;
const ll mod=1e9+7;

int main(){
  int i,j;
  int n,k;
  cin>>n>>k;
  ll h[n+3];
  h[0]=0;
  for(i=1;i<=n;i++) cin>>h[i];
  h[n+1]=0;
  vector<vector<map<ll,ll> > > dp(n+3,vector<map<ll,ll> >(k+2));
  dp[0][0][0]=0;
  for(i=0;i<n;i++){
    for(j=0;j<=k;j++){
      for(auto it=dp[i][j].begin();it!=dp[i][j].end();++it){
        if(it->first<h[i+1]){
          if(dp[i+1][j].find(h[i+1])==dp[i+1][j].end()) dp[i+1][j][h[i+1]]=it->second+h[i+1]-it->first;
          else dp[i+1][j][h[i+1]]=min(dp[i+1][j][h[i+1]],it->second+h[i+1]-it->first);
          if(dp[i+1][j+1].find(it->first)==dp[i+1][j+1].end()) dp[i+1][j+1][it->first]=it->second;
          else dp[i+1][j+1][it->first]=min(dp[i+1][j+1][it->first],it->second);
        }
        else {
          if(dp[i+1][j].find(h[i+1])==dp[i+1][j].end()) dp[i+1][j][h[i+1]]=it->second;
          else dp[i+1][j][h[i+1]]=min(dp[i+1][j][h[i+1]],it->second);
          if(dp[i+1][j+1].find(it->first)==dp[i+1][j+1].end()) dp[i+1][j+1][it->first]=it->second;
          else dp[i+1][j+1][it->first]=min(dp[i+1][j+1][it->first],it->second);
        }
      }
    }
  }
  ll ans=INF;
  for(j=0;j<=k;j++){
    for(auto it=dp[n][j].begin();it!=dp[n][j].end();++it){
      ans=min(ans,it->second);
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 288640
//Radhe Radhe
#include<bits/stdc++.h>
#define ll long long
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
using namespace std;

int main()
{
    fast_io
    ll i,j,n,x,ans=0;
    string s;
    bool fA=0,fc=0,noAZ=0;
    cin>>s;
        if(s[0]!='A'||(s[1]>='A'&&s[1]<='Z')||(s[s.length()-1]>='A'&&s[s.length()-1]<='Z'))
   return cout <<"WA"<<endl,0;
    ll cntc=0,cap=0;
    for(i=1; i<s.length()-1; i++)
    {
    if(i>=2&&i<s.length()-1)
    {
        if(s[i]=='C') cntc++;
    }
    if(s[i]>='A'&&s[i]<='Z') cap++;
    }

if(cap>1)
   return cout <<"WA"<<endl,0;
    if(cntc!=1)
   return cout <<"WA"<<endl,0;
   return cout <<"AC"<<endl,0;
    return 0;
}





Measured memory_bytes: 3572
function parseInt(x) parse(Int, x) end


function main()
  n = parseInt.(split(readline()))
  a = parseInt.(split(readline()))
	q = (n[1]-1)%(n[2]-1)
    p = convert(Int, (n[1]-1-q)/(n[2]-1))
    if q == 0
      print(p)
    else
	  print(p+1)
    end
  end

main()

Measured memory_bytes: 120020
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int x=0,p=1;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]!=p)x++;
        else p++;
    }
    if(x<n)cout<<x<<endl;
    else cout<<"-1"<<endl;
    return 0;
}

Measured memory_bytes: 4420
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int main(){
    string s, t;
    cin >> s;
    t = "keyence";
    int cnt = s.size() - t.size();
    int n = s.size();
    for(int j = 0; j <= 7; j++){
        string k = "";
        k += s.substr(0, j);
        k += s.substr(j+cnt, 7-j);
        if (k == t){
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 3600
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
    int D, L, sum = 0;
    scanf("%d %d", &D, &L);
    if (D >= L) { sum = D / L; D %= L; }
    sum+= D;
    printf("%d\n", sum);
    return 0;
}


Measured memory_bytes: 2760
N = int(input())
S = str(input())

len_e = 0
len_w = 0
for i in range(N):
    if S[i] == 'W':
        len_e += 1
    else:
        len_w += 1
# 今東の総数が求まった
ans = [[0, len_e]]  # 西の数が求まった
for i in range(N):
    if S[i] == 'W':
        ans.append([ans[-1][0], ans[-1][1]-1])
    else:
        ans.append([ans[-1][0]+1, ans[-1][1]])

hoge = 1e+9
for a in ans:
    hoge = min(hoge, len_w+len_e-sum(a))

print(hoge)


Measured memory_bytes: 43552
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
// #pragma comment(linker,"/stack:200000000")
#include <bits/stdc++.h>
using namespace std;

#define PI 2*acos(0.0)
#define print(x) return cout<<x<<endl,0
#define watch(x) cerr<<#x<<"-> "<<x<<endl
#define CLEAR(x,val) memset(x,val,sizeof(x))
// #define int long long

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;

const int INF = 1000000000;
const int MOD = 1000000007; //998244353

map<pii,int> res;

vector<vector<int>> adj;

void dfs(int parent, int source, int color)
{
	int cur = 1;
	for(int node : adj[source])
	{
		if(node != parent)
		{
			if(cur==color)
				++cur;
			res[{source,node}] = cur;
			res[{node,source}] = cur;
			dfs(source, node, cur);
			++cur;
		}
	}
}
signed main()
{	
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	cin.tie(0), cout.tie(0);
	ios::sync_with_stdio(0);
	int n;
	cin >> n;
	adj.resize(n+2);
	vector<pii> v;
	for(int i = 0; i < n-1; i++)
	{
		int x,y;
		cin >> x >> y;
		adj[x].push_back(y);
		adj[y].push_back(x);
		// cout<<x<<endl;
		// cout<<adj[x].size()<<endl;
		v.push_back({x,y});
	}	

	dfs(-1,1,0);

	set<int> s;
	for(pii x : v)
		s.insert(res[{x.first,x.second}]);
	cout<<s.size()<<endl;
	for(pii x : v)
		cout<<res[{x.first,x.second}]<<endl;
	return 0;
}

Measured memory_bytes: 19452
'use strict';
function Main(input){
  
  let val = Number(input.trim());
  let result = 0;
  let exponents = [];
  
  /*指数を求める
  * target:指数を求める対象の数
  * base:基数
  */
  const getExponent = (target,base) =>{
    let num = target, count = 0;
    while(num%base === 0){
      num = num/base;
      count++;
    }
    if(count !== 0){
      exponents.push(count);
    }
    return num;
  };

  if(val !== 1){
    for(let i = 2; i <= Math.sqrt(val); i++){
      if(val !== 1){
      val = getExponent(val,i);
      } else {
        break;
      }
    }
    if(val !== 1){
      exponents.push(1);
    }
    exponents.forEach((data) => {
      for(let k = 1; k <= data; k++){
        data -= k;
        result++;
      }
    });
  }
  console.log(result);
}

// 固定
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 32272
#include <bits/stdc++.h>
/*
#include<algorithm>
#include<array>
#include<cassert>
#include<cmath>
#include<cstdlib>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<typeinfo>
#include<utility>
#include<vector>
*/
#define int long long int
#define double long double
using namespace std;
#define MOD 1000000007
#define INF 1000000000000000007
const int MAX_N = 1 << 17;
#define rep(i, n) for (int(i) = 0, i##_len = (n); (i) < i##_len; (i)++)
#define reps(i, x) for (int(i) = 1; (i) <= (int)(x); (i)++)
#define rrep(i, x) for (int(i) = ((int)(x)-1); (i) >= 0; (i)--)
#define rreps(i, x) for (int(i) = ((int)(x)); (i) > 0; (i)--)
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define pb push_back
#define mp make_pair
#define bit(n) ((int)(1) << (n))
#define all(x) (x).begin(), (x).end()
#define debug(x) std::cout << #x << ": " << (x) << std::endl
#define nint int
using namespace std;

int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
typedef pair<int, int> pii;
typedef pair<double, double> dop;
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;
}
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
struct aaa {
    aaa()
    {
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout << fixed << setprecision(20);
    };
} aaaaaaa;


signed main()
{
    int n, m;
    cin >> n >> m;
    std::vector<int> s(n);
    std::vector<int> t(m);
    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }
    for (int i = 0; i < m; i++) {
        cin >> t[i];
    }
    int out = 1;

    std::vector<int> sumarray(n, 0);
    for (int i = 0; i < m; i++) {
        int temp = 0;
        for (int j = 0; j < n; j++) {
            if (j == 0) {
                temp += sumarray[j];
                if (t[i] == s[j]) {
                    sumarray[j] += 1;
                }
            } else {
                if (t[i] == s[j]) {
                    int prev = temp + sumarray[j];
                    sumarray[j] += (temp + 1) % MOD;
                    temp = prev;
                } else {
                    temp += sumarray[j];
                }
            }
        }
    }
    for (int i = 0; i < n; i++) {
        out += sumarray[i];
        out %= MOD;
    }
    cout << out << endl;
    return 0;
}

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

int main(){
  int i;
  cin >> i;
  float data[40] = {}; 
  for(int j=0; j<i; ++j){
    cin >> data[j];
  }
  sort(data, data+i);
  int j=0;
  cout << "1:";
  while(data[j]<165 && data[j]!=0){
    cout << "*";
    ++j;
  }
  cout << endl << "2:";
  while(data[j]<170 && data[j]!=0){
    cout << "*";
    ++j;
  }
  cout << endl << "3:";
  while(data[j]<175 && data[j]!=0){
    cout << "*";
    ++j;
  }
  cout << endl << "4:";
  while(data[j]<180 && data[j]!=0){
    cout << "*";
    ++j;
  }
  cout << endl << "5:";
  while(data[j]<185 && data[j]!=0){
    cout << "*";
    ++j;
  }
  cout << endl << "6:";
  while(data[j]!=0){
    cout << "*";
    ++j;
  }
  cout << endl;
  return 0;
}



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

int main() {
	string s;
	cin >> s;
	int n = s.size(), flag = 1;
	for (int i = 0;i < n;i++) {
		if (flag) {
			if (s[i] == 'C')flag = 0;
		}
		else if (s[i] == 'F')flag = 2;
	}
	if (flag == 2)cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()   {
int n;
cin >> n;
vector<int> a(n);
for(int i = 0; i < n; i++) {
    cin >> a.at(i);
}
vector<int> data(100000, 0);
int count = 0;
 
for(int i = 0; i < (n - 1); i++) {
    if (a.at(i) >= a.at(i + 1)) {
        count = count + 1;
    }
    else if (a.at(i) < a.at(i + 1)) {
        data.at(i) = count;
        count = 0;
    }
}
 
sort(data.begin(), data.end());
cout << max(data.at(99999), count)  << endl;
 
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>

using namespace std;



int main(void){
    int a,b,x;
    string str;
    cin>>a>>b>>x;
    
    str=((x>=a) && (x<=(a+b)))?"YES":"NO";
    cout<<str<<endl;
    return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc042/tasks/arc058_a

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  ll N, K;
  cin >> N >> K;

  VL ds(K);
  rep(i, K) cin >> ds[i];

  ll res = N;

  while (true) {
    string str = to_string(res);
    bool is_ok = all_of(all(ds), [str](ll k) {
      return str.find(to_string(k)) == string::npos;
    });

    if (is_ok) break;

    res++;
  }

  cout << res << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 256
#include <stdio.h>
 
int main(void)
{
  int X;
  int i;
  int ans = 1;
  
  scanf("%d", &X);
  
  if(X == 1) {
    printf("1\n");
    return 0;
  }
  for(i = 2; i * i <= X; i++) {
    int tmp = i * i * i;
    while(tmp <= X) tmp *= i;
    tmp /= i;
    if(tmp > ans) ans = tmp;    
  }
  printf("%d\n", ans);
  
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define MAXN	100005
int value[MAXN][3], n;
int a[MAXN], type[MAXN];
int bit[MAXN];
void modify(int x) {
	for (int i = x; i <= n; i += i & -i)
		bit[i]++;
}
int query(int x, int y) {
	int ans = 0;
	for (int i = y; i; i -= i & -i)
		ans += bit[i];
	for (int i = x - 1; i; i -= i & -i)
		ans -= bit[i];
	return ans;
}
int func(int x) {
	return (x - 1) / 3 + 1;
}
int main() {
	scanf("%d", &n);
	for (int j = 0; j <= 2; j++)
	for (int i = 1; i <= n; i++)
		scanf("%d", &value[i][j]);
	for (int i = 1; i <= n; i++) {
		if (func(value[i][0]) != func(value[i][1]) || func(value[i][0]) != func(value[i][2])) {
			printf("No\n");
			return 0;
		}
		if (value[i][1] % 3 != 2) {
			printf("No\n");
			return 0;
		}
		a[i] = func(value[i][0]);
		if (a[i] % 2 != i % 2) {
			printf("No\n");
			return 0;
		}
		type[i] = value[i][0] % 3 == 1;
	}
	bool type_odd = false, a_odd = false;
	memset(bit, 0, sizeof(bit));
	for (int i = 1; i <= n; i += 2) {
		if (type[i] == false) type_odd = !type_odd;
		if (query(a[i], n) & 1) a_odd = !a_odd;
		modify(a[i]);
	}
	bool type_even = false, a_even = false;
	memset(bit, 0, sizeof(bit));
	for (int i = 2; i <= n; i += 2) {
		if (type[i] == false) type_even = !type_even;
		if (query(a[i], n) & 1) a_even = !a_even;
		modify(a[i]);
	}
	if (type_odd == a_even && a_odd == type_even) printf("Yes\n");
	else printf("No\n");
	return 0;
}

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

int main() {
	string s;
	cin >> s;
	long long k;
	cin >> k;
	char ans='0';
	long double no=0;
	int i=0;
	long double index=0;
	while(true){
		no=s[i]-'0';
		index+=pow (no, 5*pow(10,15)-1);
		if(index>=k){
			ans=s[i];
			break;
		}else
			i++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3632
class Node
  def initialize(i, key)
    @index = i
    @key = key
    @parent_key = nil
    @left_key = nil
    @right_key = nil
  end

  def to_s
    str = "node #{index}: key = #{key}, "
    str += "parent key = #{@parent_key.key}, " unless @parent_key.nil?
    str += "left key = #{@left_key.key}, " unless @left_key.nil?
    str += "right key = #{@right_key.key}, " unless @right_key.nil?
    str
  end

  attr_accessor :index, :key
  attr_writer :parent_key, :right_key, :left_key
end

h = gets.to_i
input = gets.split(' ').map(&:to_i)
heap = []
input.each_with_index do |value, index|
  heap << Node.new(index + 1, value)
end

heap.each do |value|
  value.parent_key = heap[value.index / 2 - 1] unless heap[value.index / 2 - 1].nil? || value.index == 1
  value.right_key = heap[value.index * 2] unless heap[value.index * 2].nil?
  value.left_key = heap[value.index * 2 - 1] unless heap[value.index * 2 - 1].nil?
end

puts heap.map(&:to_s)




Measured memory_bytes: 6880
# coding: utf-8
# Your code here!
def solve():
	mod = 10 ** 9 + 7
	#input
	N, M, *a = map(int, open(0).read().split())

	dp = [0] * (N + 2)
	dp[0] = 0 # i = -1 don't exist 
	dp[1] = 1
	
	#not destroyed
	ok = sorted(set(range(1, N + 1)) - set(a))

	for i in ok:
		dp[i + 1] += (dp[i] + dp[i - 1]) % mod
	print(dp[-1])
solve()

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

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back

typedef long long ll;

const ll MOD = 1e9+7;
const ll INF = 1e9+5;

int main() {
	int k, x;
	scanf("%d%d", &k, &x);
	if (500*k >= x) printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 256
N = int(input())
L = list(map(int, input().split()))
L.sort()
p = []
d = {}
for i in range(N):
  if(L[i] in d):
    d[L[i]] += 1
  else:
    p.append(L[i])
    d[L[i]] = 1
ans = 0
if(len(p)<3):
  print(0)
else:
  for i in range(len(p)-2):
    for j in range(i+1,len(p)-1):
      for k in range(j+1,len(p)):
        if(p[i]+p[j]>p[k] and p[i]+p[k]>p[j] and p[k]+p[j]>p[i]):
          ans += d[p[i]]*d[p[j]]*d[p[k]]
  print(ans)

Measured memory_bytes: 9240
tmp = input().split()
N = int(tmp[0])
M = int(tmp[1])

tmp2 = input().split()
TotalDays = 0

for i in tmp2:
    TotalDays = TotalDays + int(i)

if TotalDays <= N:
    print(N-TotalDays)
else:
    print(-1)

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

int main()
{
    int list[5];
    int num = 5;
    int answer = 0;

    for (int i = 0; i<num; i++)
    {
        scanf("%d", &list[i]);
        if (list[i] == 0)
        {
            answer = i;
        }
    }

    printf("%d", (answer + 1));

    return 0;
}

Measured memory_bytes: 1724
#define _USE_MATH_DEFINES
#pragma region include

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
#pragma endregion //#include
/////////

#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
//////////////

void solve() {
	int N, P;
	string S;
	cin >> N >> P >> S;
	LL ans = 0;
	if (P == 2 || P == 5) {
		for (int i = 0; i < N; ++i) {
			int ter = S[i] - '0';
			if (ter % P == 0) {
				ans += i + 1;
			}
		}
		cout << ans << endl;
		return;
	}
	
	vector<LL> ama(P, 0);
	LL ket = 1;
	LL prev = 0;
	for (int i = N - 1; i >= 0; --i) {
		LL ter = S[i] - '0';
		int temp = ((ter * ket) % P + prev) % P;
		ama[temp]++;

		ket = (ket * 10) % P;
		prev = temp;
	}
	for (int i = 0; i < P; ++i) {
		LL temp = ama[i];
		temp = temp * (temp + 1) / 2;
		if (i) {
			temp -= ama[i];
		}
		ans += temp;
	}
	
	cout << ans << endl;
}

#pragma region main
signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


Measured memory_bytes: 720
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <limits>
#include <string>
#include <algorithm>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include "math.h"
#include "assert.h"

using namespace std;

#define ll long long

#define BUFF ios::sync_with_stdio(false)
#define epsilon 1e-07
#define pi 2 * acos(0.0);
#define mod 1000000007   // 1e9+7
#define cerr if(false)cerr
#define watch(x) cerr << #x << " = " << x << endl;

#define inf std::numeric_limits<int>().max();

int main() {
	string s, t;
	cin >> s >> t;
	cout << ((int)(s[0]==t[0]) + (int)(s[1]==t[1]) + (int)(s[2]==t[2])) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ff first
#define ss second
#define ll long long
#define pb push_back
using namespace std;

const int N = 1e6 + 6,mod = 998244353 ;

ll k = 1e18;

int fix[N];
vector<ll>primes;

inline void test_case(){
        ll n;
        cin >> n;

        ll res = 0;

        for(ll i = 2; i <= 1e6; i++){
                if(fix[i]) continue;
                primes.pb(i);//cout << i << endl;
                for(ll j = i*i; j <= 1e6; j+=i){
                        fix[j] = 1;
                }
        }

        for(int i = 0; i < primes.size() && primes[i] * primes[i] <= n; i++){
                int cnt = 0;
                while(n%primes[i] == 0){
                        n /= primes[i];
                        cnt++;
                }
                if(cnt == 0) continue;
                //cout << cnt << " "<< primes[i] << endl;
                int l = 1, r = 1e6, answer = 1;
                while(l <= r){
                        ll mid = (l+r)/2;
                        if(mid*(mid+1)/2 <= cnt){
                                answer = mid;
                                l = mid +1;
                        } else {
                                r = mid-1;
                        }
                }

                res += answer;
        }

        if(n>1){res++;}

        cout << res << endl;
}
int main(){
        ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

        int T = 1;
        //cin >> T;
        while(T--){
                test_case();
        }
}


Measured memory_bytes: 8176
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
const long long MAXN=100005;
long long n;
long long d[MAXN],rd[MAXN],yd[MAXN];
vector<int>w[MAXN];
long long key=0;
void dfs(long long u,long long f)
{
	if(key)
		return ;
	long long cnt=0,MX=0,e=0;
	for(long long i=0;i<int(w[u].size());i++)
	{
		long long v=w[u][i];
		if(v!=f)
		{
			e=1;
			dfs(v,u);
			cnt+=d[v];
			MX=max(MX,d[v]);
		}
	}
	if(!e)
		return ;
	if(key)
		return ;
	if(d[u]>cnt)
	{
		key=1;
		return ;
	}
	long long o=cnt-d[u];
	long long yb=min(cnt/2,cnt-MX);
	if(yb<o)
	{
		key=1;
		return ;
	}
	d[u]=cnt-2*o;
	if(d[u]<0)
	{
		key=1;
		return ;
	}
}
int main()
{
	//freopen("tree.in","r",stdin);
	//freopen("tree.out","w",stdout);
	scanf("%lld",&n);
	for(long long i=1;i<=n;i++)
		scanf("%lld",&yd[i]);
	for(long long i=1;i<n;i++)
	{
		long long u,v;
		scanf("%lld %lld",&u,&v);
		w[u].push_back(v);
		w[v].push_back(u);
		rd[u]++;
		rd[v]++;
	}
	for(long long i=1;i<=n;i++)
		d[i]=yd[i];
	dfs(1,0);
	for(long long i=1;i<=n;i++)
		d[i]=yd[i];
	dfs(n,0);
	if(key)
		printf("NO\n");
	else
		printf("YES\n");
	fclose(stdin);
	fclose(stdout);
}

Measured memory_bytes: 15232
#include <bits/stdc++.h>
#include <vector>
#include<math.h>
#include<string.h>
using namespace std;
#define MAX 300005
#define MOD 1000000007
#define INF 1000000000000000000
#define EPS 0.0000000001
#define CHAINS 18
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL)
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
int main()
{
    long long a,b,c,d;
    scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
    long long ans=max(max(a*c,b*d),max(b*c,a*d));
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 3824
import java.util.*;
 
public class Main {
	
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int H = sc.nextInt();
    	int W = sc.nextInt();
    	char[][] Si = new char[H][W];
    	for (int i = 0; i < H; i++) {
    		Si[i] = sc.next().toCharArray();
    	}
    	int[][] dir = {{-1, -1},{-1, 0},{-1,1},{0, -1},{0, 1},{1,-1},{1,0},{1,1}};
    	for (int i = 0; i < H; i++) {
    		for (int j = 0; j < W; j++) {
    			if (Si[i][j] == '.') {
    				int count = 0;
    				for (int k = 0; k < dir.length; k++) {
    					int h = i + dir[k][0];
    					int w = j + dir[k][1];
    					if (0 <= h && h < H &&
    						0 <= w && w < W && Si[h][w] == '#') {
    						count++;
    					}
    				}
    				Si[i][j] = (char) (count + '0');
    			}
    			
    		}
    	}
    	for (char[] si :Si) {
    		System.out.println(si);
    	}
    }
}

Measured memory_bytes: 22996