akhauriyash/Code-Regression huggingface dataset:
//#define _GLIBCXX_DEBUG
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
//const ll MOD=998244353;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);
int dx[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};
int dy[9] = {0, 1, 0, -1, 1, -1, -1, 1, 0};

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



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

  ll N,M; cin>>N>>M;
  vector<ll> A(N),B(M); rep(i,N) cin>>A[i]; rep(i,M) cin>>B[i];
  
  auto c=convolution(A,B);
  
  rep(i,N+M-1) {if(i!=0) cout<<" "; cout<<c.at(i);} cout<<'\n';

  
  return 0;
}

Measured memory_bytes: 27236
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>

using namespace std;

/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
*/

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

void solve() {
    ll n;
    cin >> n;
    vll a(n);
    ll x = 0;
    for(ll i = 0; i < n; i++) {
        cin >> a[i];
        x ^= a[i];
    }
    vll ans;
    for(ll i = 0; i < n; i++) {
        ans.push_back(x ^ a[i]);
    }
    ll m = ans.size();
    for(ll i = 0; i < m; i++) {
        if(i == m-1) cout << ans[i] << endl;
        else cout << ans[i] << ' ';
    }
    return;
}

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

Measured memory_bytes: 6856
package main

import "fmt"

func main() {
	var n int
	var s string
	fmt.Scan(&n, &s)
	var count int
	for i := 0; i < n-2; i++ {
		if s[i:i+3] == "ABC" {
			count++
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reprev(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;

int main()
{
    ll a, b;
    cin >> a >> b;

    auto aa = ceil(a / 0.08);
    auto aau = (a + 1) / 0.08;
    auto bb = ceil(b / 0.1);
    auto bbu = (b + 1) / 0.1;

    if (aa <= bb && bb < aau && bb < bbu)
    {
        cout << bb << endl;
        return (0);
    }

    if (bb <= aa && aa < bbu && aa < aau)
    {
        cout << aa << endl;
        return (0);
    }

    cout << -1 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
using namespace std;
typedef long long ll;
// cd test ; rm -R ./*; cd .. 

const int MOD = 1000000007;

int main(void) {
  int n;
  cin >> n;
  int a[n];
  vector<int> check(n + 10, 0);
  rep (i, n) {
    cin >> a[i];
    check[a[i]]++;
  }
  //rep (i, n) cout << check[i] << endl;
  bool stop = false;
  if (n % 2 == 0) {
    for (int i = 1; i <= n - 1; i += 2) {
      
      if (check[i] != 2) stop = true;  
      
    }

  }
  else {
    if (check[0] != 1) stop = true;
    for (int i = 2; i <= n - 1; i += 2) {
      if (check[i] != 2) stop = true;
    }
  }
  if (stop) {
    cout << 0 << endl;
    return 0;
  }

  n /= 2;

  ll ans = 1;
  rep (i, n) {
    ans = (ll) ans * 2;
    ans %= MOD;
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 1024
#include "iostream"
#define ll long long int
using namespace std;
ll gcd(ll a,ll b)
{
    if(a==0)
        return b;
    else
        return gcd(b%a,a);
    
}
int main()
{

    ll a,b;
    cin>>a>>b;
    ll x= (a*b)/gcd(a,b);
    
    cout<<x<<endl;
    
}


Measured memory_bytes: 256
import math
N = int(input())
n = 1000

x = [None] * N
y = [None] * N
for i in range(N):
    x[i], y[i] = map(int, input().split())

ans = 0
for i in range(n):
    theta = (2 * math.pi / n) * i
    c = math.cos(theta)
    s = math.sin(theta)
    tmp_x = 0
    tmp_y = 0
    for j in range(N):
        if x[j] * c + y[j] * s > 0:
            tmp_x += x[j]
            tmp_y += y[j]
    if tmp_x**2 + tmp_y**2 > ans**2:
        ans = math.sqrt(tmp_x**2 + tmp_y**2)

print(ans)


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

using namespace std;

typedef long long ll;
typedef long double ld;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n,k;
    cin>>n>>k;
    vector<int>v(n);
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
    }
    sort(v.begin(),v.end());
    int a=(1<<30);
    for(int i=0;i+k-1<n;i++)
    {
        a=min(a,v[i+k-1]-v[i]);
    }
    cout<<a<<"\n";
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
const int tot=26+26+10;
inline void read (int &x) {
	char ch = getchar(); x = 0;
	while (!isdigit(ch)) ch = getchar();
	while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar();
} 
char ch[tot];
char enc(int t){
	if(t<10)return '0'+t;
	t-=10;
	if(t<26)return 'a'+t;
	t-=26;
	return 'A'+t;
}
 
string s[tot];
int sum=tot;
int ttm=0;
inline int query (string str){
	if (str.size() > 128) return 1e9;
	cout << '?' << ' ' << str << '\n';
	fflush(stdout); int ans = 0; read (ans); return ans;
}
 
 
int len=0x3f3f3f3f;
int q[tot];
 
string merge(string a,string b){
	int i=0,j=0;
	int la=a.length(),lb=b.length();
	string fir=string();
	while(i<la&&j<lb){
		string qr=fir;
		qr+=a[i];
		for(int k=j;k<lb;k++){
			qr+=b[k];
		}
		if(query(qr)+qr.length()==len){
			fir+=a[i++];
		}else {
			fir+=b[j++];
		}
	}
	while(i<la)fir+=a[i++];
	while(j<lb)fir+=b[j++];
	return fir;
}
 
int main()
{
	for (int i = 0; i < tot; ++i) ch[i] = enc (i);
	for(int i=0;i<tot;i++){
		s[i]+=ch[i];
		q[i]=query(s[i])+1;
		len=min(len,q[i]);
	}
	for(int i=0;i<tot;i++){
		if(q[i]==len){
			while(query(s[i]+ch[i])+s[i].length()+1==len)s[i]+=ch[i];
		}else s[i]=string();
	}
	while(1){
    	for(int i=0;i<tot;i++)for(int j=i+1;j<tot;j++)if(s[i].length()>s[j].length())swap(s[i],s[j]);
		int t=0;
		while(!s[t].length())++t;
		if(t+1==tot)break ;
		s[t+1]=merge(s[t],s[t+1]); s[t]=string();
	}
	assert(query(s[tot-1])==0);
	cout << "! "<< s[tot-1] << endl;
	fflush(stdout);
}


Measured memory_bytes: 3800
N = int(input())
A = list(map(int, input().split()))

s = 0
c = 0
for i in range(1,N):
    d = A[i] - A[i-1]
    if d * s < 0:
        c += 1
        s = 0
        continue
    if d != 0:
        s = d
print(c+1)


Measured memory_bytes: 15020
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include <sstream>
#include<map>
#include<cmath>
#include<queue>

using namespace std;

int main() {

	int L,R;
	cin >> L >> R;

	int ans = 2020;
	R = min(R, L + 2020);
	for (long long i = L; i <= R; i++)
	{
		for (long long j = L; j <= R; j++)
		{
			if (i == j)
			{
				continue;
			}
			int tmp = (i * j) % 2019;
			ans = min(ans, tmp);
		}
	}


	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin >> n;
    vi X(n); for(auto& e : X) cin >> e;

    int res = inf;
    rep(i, 101){
        int cur = 0;
        for(auto& e : X){
            cur += (e - i) * (e - i);
        }
        chmin(res, cur);
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <iomanip>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iterator>
#include <unordered_map>
#include <unordered_set>
#include <sstream>

using namespace std;

typedef long long lint;

using namespace std;

void test_case() {
    int n;
    lint s = 0;
    cin >> n;
    vector<lint> a;
    a.resize(n);
    for(int i = 0; i < n; ++i) {
        cin >> a[i];
        s^=a[i];
    }
    for(int i = 0; i < n; ++i) {
        cout << (s^a[i]) << " ";
    }
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int tests=1;
    //cin >> tests;
    for(int test = 0; test < tests; ++test) {
        test_case();
    }
    return 0;
}


Measured memory_bytes: 4780
from bisect import bisect_left
import sys
input = sys.stdin.readline

N, M, Q = map(int, input().split())

dp = [[0] * (N + 1) for _ in range(N + 1)]
for _ in range(M) :
    L, R = map(int, input().split())
    dp[L][R] += 1

for i in range(N + 1) :
    for j in range(N + 1) :
        if 0 <= i - 1 :
            dp[i][j] += dp[i-1][j]
        if 0 <= j - 1 :
            dp[i][j] += dp[i][j-1]
        if 0 <= i - 1 and 0 <= j - 1 :
            dp[i][j] -= dp[i-1][j-1]

for _ in range(Q) :
    p, q = map(int, input().split())
    print(dp[q][q]-dp[p-1][q]-dp[q][p-1]+dp[p-1][p-1])

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

int main() {
    int n; cin >> n;
    vector<int> h(n);
    for(int i = 0; i < n; i ++) cin >> h[i];
    vector<int> dp(n);
    dp[0] = 0;
    dp[1] = abs(h[1]-h[0]);
    for(int i = 2; i < n; i ++) {
        dp[i] = min(abs(h[i]-h[i-1]) + dp[i-1], abs(h[i]-h[i-2]) + dp[i-2]);
    }
    cout << dp[n-1] <<endl;
}

Measured memory_bytes: 1024
//
#include <vector>
#include <set>
#include <array>
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <numeric>
#include <bitset>
#include <string>
//
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
inline void yes(bool cond) { cond ? puts("Yes") : puts("No"); }
template<typename Type> inline void chmin(Type& a, Type b) { if (a > b) a = b; }
template<typename Type> inline void chmax(Type& a, Type b) { if (a < b) a = b; }
template<typename Arr, typename Type> inline void fill(Arr& arr, Type v) { std::fill(arr.begin(), arr.end(), v); }
template<typename Type> inline void sort(Type& arr) { std::sort(arr.begin(), arr.end()); }
template<typename Type> inline Type nth(vector<Type>& arr, size_t pos) { std::nth_element(arr.begin(), arr.begin() + pos, arr.end()); return arr[pos]; }
constexpr double BIGP = 1000000007L;
constexpr double INF_I = std::numeric_limits<double>::max();
constexpr double INF_F = std::numeric_limits<float>::infinity();
constexpr double PI = 3.14159265358979323846L;
//
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    ll N;
    string S;
    cin >> N >> S;
    if (N % 2 == 1)
    {
        yes(false);
        return 0;
    }
    yes(S.substr(0, N / 2) == S.substr(N / 2, N));
    return 0;
}

Measured memory_bytes: 3080
#include <algorithm>
#include <string>
#include <iostream>
#include <vector>
#include <map>
#include <bitset>

using namespace std;

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

int n;
string s;

using i64 = int64_t;
const i64 B = 100000007;
const i64 MOD[3] = {999999937, 1000000007, 1000000009};
i64 t[3] = {1, 1, 1};
i64 sz;
vector<vector<i64>> Table;

bool func(int x) {

  map<i64, int> M[3];
  bool res = true;
  bitset<5000 + 10> bs[3];

  for (int i = 0; i < 3; i++) {

    int flag = 0;

    i64 mod = MOD[i];
    i64 t = 1;
    for (int j = 0; j < x; j++) {
      t = (t * B) % mod;
    }

    i64 h = 0;
    for (int j = 0; j < x; j++) {
      h = ((h * B) % mod + s[j]) % mod;
    }

    M[i][h] = x;

    for (int j = x; j < n; j++) {
      h = ((h * B) % mod + s[j]) % mod;
      h = (h + mod - ((s[j - x] * t) % mod)) % mod;
      if (M[i].count(h) && (j + 1 - M[i][h]) >= x) {
        bs[i][j] = 1;
      }
      if (!M[i][h]) M[i][h] = (j + 1);
    }

    bs[0] &= bs[i];
  }
  return bs[0].count() >= 1;
}

int main(void) {
  cin >> n >> s;
  int l = 0, r = n + 1;
  while (l + 1 != r) {
    int mid = (l + r) / 2;
    if (func(mid)) l = mid;
    else r = mid;
  }
  cout << l << '\n';
}



Measured memory_bytes: 4556
import sys
input = sys.stdin.readline
#N, K = (int(i) for i in input().split())
#B = [int(x) for x in input().split()]
#A = [[int(i) for i in input().split()] for i in range(N)]

N, K = (int(i) for i in input().split())
A = [int(x) for x in input().split()]

for i in range(K, N):
    if A[i - K] < A[i]:
        print("Yes")
    else:
        print("No")


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

int main()
{
  int N;
  cin >> N;
  vector<int> l(N);
  for(int i=0; i<N; ++i) cin>>l[i];
  int max_idx = distance(l.begin(), max_element(l.begin(), l.end()));
  int sum=0;
  for(int i=0; i<N; ++i)
 {
   if(i != max_idx)
     sum += l[i];
 }
  printf("%s\n", l[max_idx]<sum?"Yes":"No");
  return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
//import javafx.util.Pair;
import static java.lang.System.*;
import static java.lang.Math.*;

public class Main
{
	public static void main(String []args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

		long X=Long.parseLong(br.readLine());
		long ans=0;
		
		long c500=(X/500)*1000;
		long c50=((X%500)/5)*5;
		ans=c500+c50;

		out.println(ans);
		
		
	}
	
	
}




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

using namespace std;

#define N 205

int n, m, e;

bitset<N> vis;
vector<int> to[N];
array<int, N> match;

bool hungary(int u)
{
	if (u == -1)
		return true;
	
	for (auto v : to[u])if (!vis[v])
	{
		vis.set(v);
		if (hungary(match[v]))
			return match[v] = u, true;
	}
			
	return false;
}

signed main(void)
{
	cin >> n >> m >> e;
	
	for (int i = 1, x, y; i <= e; ++i)
	{
		cin >> x >> y; y += n;
		to[x].push_back(y);
		to[y].push_back(x);
	}
	
	for (auto &i : match)
		i = -1;
	
	int answer = 0;
	
	for (int i = 0; i < n; ++i)
	{
		vis.reset();
		if (hungary(i))
			++answer;
	}
	
	cout << answer << endl;
}

Measured memory_bytes: 3296
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define pb push_back
 
#define rep(i,n) for(ll i=0;i<n;i++)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
 
void solve()
{
    int x,y;
    cin >> x >> y;
    int a=x*2;
    int b=x*4;
 
    if(y>=a && y<=b)
    {
        if(y%2==0)
            cout << "Yes" << "\n";
        else
            cout << "No" << "\n";
    }
    else
        cout << "No" << "\n";
}
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
 
    int t=1;
    while(t--)
    {
        solve();
    }
}

Measured memory_bytes: 3640
///Nahid Hasan Raju
#include <bits/stdc++.h>

#define MS(ARRAY,VALUE) memset(ARRAY,VALUE,sizeof(ARRAY))
#define Fin freopen("input.txt","r",stdin)
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define Fout freopen("output.txt","w",stdout)
#define rep(i,a,b) for(i=a;i<=b;i++)
#define EPS 0.00000001
#define INF INT_MAX
#define PI 2*acos(0.0)
#define P1(XX) cout<<"db1: "<<XX<<endl
#define P2(XX,YY) cout<<"db2: "<<XX<<" "<<YY<<endl
#define P3(XX,YY,ZZ) cout<<"db3: "<<XX<<" "<<YY<<" "<<ZZ<<endl
#define set(XX,POS) XX|=(1<<POS)
#define reset(XX,POS) XX&=(~(1<<POS))
#define check(XX,POS) (bool)(XX&(1<<POS))
#define toggle(XX,POS) (XX^(1<<POS))
#define SORT(v) sort(v.begin(),v.end())
#define REVERSE(V) reverse(v.begin(),v.end())
#define VALID(X,Y,R,C) X>=0 && X<R && Y>=0 && Y<C
#define SIZE(ARRAY) sizeof(ARRAY)/sizeof(ARRAY[0])
#define RT printf("Run Time : %0.3lf seconds\n", clock()/(CLOCKS_PER_SEC*1.0))
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>


using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
typedef tree< pair<int,int> , null_type, less< pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> odrst;

#define MOD 1000000007LL
#define MX 200005


/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/

ll m, n;
queue<ll>s1,s2;
int main()
{
    int test, tc=0, i, j;
    ll a,b;
    //scanf("%d", &test);
    test=1;
    while(test--)
    {
        char ch;
        cin>>ch;
        if(ch<=90)puts("A");
else puts("a");
    }
    return 0;
}


Measured memory_bytes: 3556
H, W, M = map(int, input().split())
h_list = [0 for _ in range(H + 1)]
w_list = [0 for _ in range(W + 1)]
bomb = set([])
for _ in range(M):
    h, w = map(int, input().split())
    h_list[h] += 1
    w_list[w] += 1
    bomb.add((h, w))
h_max = max(h_list)
w_max = max(w_list)
h_index = []
w_index = []
for i in range(H + 1):
    if h_list[i] == h_max:
        h_index.append(i)
for i in range(W + 1):
    if w_list[i] == w_max:
        w_index.append(i)
tmp = -1        
for h in h_index:
    for w in w_index:
        if (h, w) not in bomb:
            tmp = 0
            break
print(h_max + w_max + tmp)

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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define ture ture
#define flase false
#define falg flag

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;//llの最大9*10^18
const int INF = pow(2, 30) - 1;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

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

    ll N;
    string S;
    cin >> N;
    vector<ll> B(N-1);
    REP(i,N-1){
        cin >> B.at(i);
    }
    vector<ll> A(N);
    A.at(0) = B.at(0);
    REPS(i,N-2){
        A.at(i) = min(B.at(i - 1), B.at(i));
    }
    A.at(N - 1) = B.at(N - 2);

    ll ans = 0;
    REP(i, N)
    {
        ans += A.at(i);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3652
#include<iostream>

using namespace std;


int main() {
	int N, A, B;
	int sum = 0;
	cin >> N >> A >> B;
	
	for (int i = 1; i <= N; i++) {
		int j = i;
		int remainder = 0;
		while (j != 0) {
			remainder += j % 10;
			j /= 10;
		}
		if (A <= remainder && remainder <= B) {
			sum += i;
		}
	}
	cout << sum << endl;


	return 0;
}


Measured memory_bytes: 3132
import math
a,b,h,m = map(int,input().split())

theta = abs((30*h + 0.5*m) - (6*m))
theta = min(theta,abs(360-theta))

c = (a**2 + b**2 -2*a*b*math.cos(math.radians(theta)))**0.5

print(c)

Measured memory_bytes: 9592
#n=int(input())
a,b=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

def prime_factorize(n):
    n_origin=n+0
    primelist=[]
    a=2
    while a*a<=n_origin:
        if n%a!=0:
            a+=1
            continue
        ex=0
        while n%a==0:
            ex+=1
            n=n//a
        primelist.append([a,ex])
        a+=1
    if n!=1:
        primelist.append([n,1])
    return primelist

import math
gcd=math.gcd(a,b)#最大公約数
primelist=prime_factorize(gcd)
print(len(primelist)+1)


Measured memory_bytes: 9080
#include<bits/stdc++.h>
#define     fast                    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define     ll                      long long
#define     pb                      push_back
#define     M                       1000000007
using namespace std;
int main()
{
    ll m,n,x,y,sum=0;
    cin>>n>>x>>y;
    m = x%n;
    if(x%n==0) cout<<"OK"<<endl;
    else if((n-m)<=(y-x)) cout<<"OK"<<endl;
    else cout<<"NG"<<endl;


}


Measured memory_bytes: 3588
import java.util.Scanner;


public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        //System.out.print("入力してください > ");
        String input_text = scanner.nextLine();
        int r = Integer.parseInt(input_text);
        
        System.out.println(r*r);

        // Scannerクラスのインスタンスをクローズ
        scanner.close();
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define fs first
#define sc second

int main(void){
  ll n;
  cin >> n;
  cout << (n/500)*1000 + (n%500)/5*5 << endl;
}

Measured memory_bytes: 256
fun main() {
    val n:Int = readLine()!!.toInt()
    val alll:List<Int> = readLine()!!.split(" ").map(String::toInt)
    val al:List<Int> = alll.map({it-1})
    var a:MutableList<Int> = mutableListOf()
    var count:Int = 0
    for (x in 1..n) {
        a.add(0)
    }
    for (x in al) {
        a[x] += 1
        count++
    }
    for (x in a) {
        println("${x}")
    }
}

Measured memory_bytes: 70472
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<N;i++)
int main(){
  long long a,b;
  cin>>a>>b;
  if(a>0)
    cout<<"Positive"<<endl;
  else if(a*b<=0)
    cout<<"Zero"<<endl;
  else{
    int m_num = abs(a)-abs(b)+1;
    if(m_num%2)
      cout<<"Negative"<<endl;
    else
      cout<<"Positive"<<endl;
  }
  return 0;
}


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

int main() {
  string n;
  cin >> n;
  
  if (n[0] == n[1] && n[1] == n[2]) cout << "Yes" << endl;
  else if (n[1] == n[2] && n[2] == n[3]) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char d[4];
int main()
{
string a,b,c;
cin>>a>>b>>c;
if(a[0]>64&&a[0]<92)d[0]=a[0];
else d[0]=a[0]-32;
if(b[0]>64&&b[0]<92)d[1]=b[0];
else d[1]=b[0]-32;
if(c[0]>64&&c[0]<92)d[2]=c[0];
else d[2]=c[0]-32;
cout<<d<<endl;
return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define rep1(i,n)for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=(int)(n)-1;0<=i;i--)
#define rrep1(i,n) for(int i=(int)(n);1<=i;i--)

#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 

#define pcount __builtin_popcount
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())

#define dump(x)  cerr << #x << " = " << (x) << endl;

#define endl "\n"

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

typedef long long lint;

using namespace std;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	lint a,b,k;
	cin>>a>>b>>k;
	rep(i,k){
		if(i%2==0){
			a/=2;
			b+=a;
		}else{
			b/=2;
			a+=b;
		}
	}
	cout<<a<<" "<<b<<endl;
}

Measured memory_bytes: 256
def permutation(lst):
 
    # If lst is empty then there are no permutations
    if len(lst) == 0:
        return []
 
    # If there is only one element in lst then, only
    # one permuatation is possible
    if len(lst) == 1:
        return [lst]
 
    # Find the permutations for lst if there are
    # more than 1 characters
 
    l = [] # empty list that will store current permutation
 
    # Iterate the input(lst) and calculate the permutation
    for i in range(len(lst)):
       m = lst[i]
 
       # Extract lst[i] or m from the list.  remLst is
       # remaining list
       remLst = lst[:i] + lst[i+1:]
 
       # Generating all permutations where m is first
       # element
       for p in permutation(remLst):
           l.append([m] + p)
    return l
 
 
# Driver program to test above function
data = list(map(int, input().split()))
maxn = 4000
for p in permutation(data):
	ans = abs(p[1] - p[0]) + abs(p[2] - p[1])
	if ans < maxn:
		maxn = ans
print(maxn)
    


Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>

using namespace std;

typedef long long ll;
#define x first
#define y second
#define mp make_pair

long double l, sol;

int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> l;
l /= (3.0);
sol = l * l * l;
cout << fixed;
cout << setprecision(10);
cout << sol << endl;

return 0;
}



Measured memory_bytes: 256
def main():
    A, V = map(int, input().split())
    B, W = map(int, input().split())
    T = int(input())

    if V < W:
        print('NO')
        return

    if V == W:
        if A == B:
            print('YES')
        else:
            print('NO')
        return

    d = abs(A - B)
    dv = abs(V - W)

    if d <= dv * T:
        print('YES')
    else:
        print('NO')
    return


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok


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

using namespace std;

const int N = 2e5 + 5;
const int mod = 1e9 + 7;

int h, w, a, b, fact[N], inv_fact[N], ans = 0;

int binPow (int x, int y) {
    int ans = 1;
    while (y > 0) {
        if (y & 1) ans = (1LL * ans * x) % mod;
        x = (1LL * x * x) % mod;
        y >>= 1;
    }

    return ans;
}

void prep(){
    fact[0] = inv_fact[0] = 1;
    for (int i = 1; i < N; i++) {
        fact[i] = 1LL * i * fact[i - 1] % mod;
        inv_fact[i] = binPow(fact[i], mod - 2);
    }
}

int C (int n, int k) {
    return (1LL * fact[n] * inv_fact[k] % mod * inv_fact[n - k]) % mod;
}

int ways (int x1, int y1, int x2, int y2) {
    return C(x2 - x1 + y2 - y1, x2 - x1);
}

void add (int &x, int y) {
    x = (x + y) % mod;
}

int main(){
    scanf("%d %d %d %d", &h, &w, &a, &b);
    prep();

    for (int i = 1; i <= h - a; i++) add(ans, 1LL * ways(1, 1, i, b) * ways(i, b + 1, h, w) % mod);
    printf("%d", ans);
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long left,right,num,s,e;
    scanf("%lld%lld%lld",&left,&right,&num);
    if(left%num==0)
        s=left/num;
    else
        s=left/num+1;
    e=right/num;
    printf("%lld\n",e-s+1);
    return 0;
}

Measured memory_bytes: 256
import math
a, b = map(int, input().split())
lsta = list(range(math.ceil(a/0.08), math.ceil((a+1)/0.08)))
lstb = list(range(math.ceil(b/0.1), math.ceil((b+1)/0.1)))
for la in lsta:
  for lb in lstb:
    if la==lb:
      print(la)
      exit()
print(-1)

Measured memory_bytes: 3060
using System;

class Program {
    static void Main (string[] args) {
        var str = Console.ReadLine ().Split (' ');
        int A = int.Parse (str[0]);
        int B = int.Parse (str[1]);
        int ans = 0;

        for (var i = 0; i < 2; i++) {
            if (A > B) {
                ans = ans + A;
                A = A - 1;
            } else {
                ans = ans + B;
                B = B - 1;
            }
        }
        Console.WriteLine (ans);
    }
}


Measured memory_bytes: 13140
N = int(input())
A,B = map(int,input().split())
P = list(map(int,input().split()))
C = [0 for i in range(3)]
for i in range(N):
    a = P[i]
    if a<=A:
        C[0] += 1
    elif A+1<=a<=B:
        C[1] += 1
    elif a>=B+1:
        C[2] += 1
print(min(C))

Measured memory_bytes: 61360
#include <iostream>
#include <stdio.h>
#include <iomanip>
#include <bits/stdc++.h>
using namespace std;

int main(){
  
  int N;
  cin >> N;
  
  long long a;
  long long minNum = 1000000;
  long long maxNum = -1000000;
  long long sum = 0;
  
  for(int i = 0; i < N; i++){
    cin >> a;
    if(a < minNum ) minNum = a;
    if(a > maxNum ) maxNum = a;
    sum += a;
  }
  cout << minNum << " " << maxNum << " " << sum << endl;
  
  return 0;
}


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

using namespace std;

int n, a[25];

int main() {
	scanf("%d", &n);
	
	for (int i = 0; i < n; i++) scanf("%d", &a[i]);
	
	int res = 0;
	int mx = 0;
	
	for (int i = 0; i < n; i++) {
		mx = max(mx, a[i]);
		if (mx == a[i]) res++;
	}
	
	printf("%d\n", res);
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int a,b,c=0;
  scanf("%d%d",&a,&b);
  for(int i=a;i<=b;i++)if(i/10000==i%10&&(i/1000)%10==(i%100)/10)c++;
  printf("%d",c);
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define SORT(v,n) sort(v,v+n)
#define rep(i,n) FOR(i,0,n)
#define EPS (1e-7)
#define INF (1e9)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef priority_queue<int> PQI;
typedef priority_queue<int,vector<int>,greater<int> > PQSI;
typedef priority_queue<ll> PQL;
typedef priority_queue<ll,vector<ll>,greater<ll> > PQSL;

const int MOD = 1000000007;
struct mint { int n; mint(int n_ = 0) : n(n_) {} };
mint operator-(mint a) { return -a.n + MOD * (a.n != 0); }
mint operator+(mint a, mint b) { int x = a.n + b.n; return x - (x >= MOD) * MOD; }
mint operator-(mint a, mint b) { int x = a.n - b.n; return x + (x < 0) * MOD; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }
istream &operator>>(istream &i, mint &a) { return i >> a.n; }
ostream &operator<<(ostream &o, mint a) { return o << a.n; }

vector<mint> F_{1, 1}, R_{1, 1}, I_{0, 1};
void check_fact(int n) {
  for (int i = I_.size(); i <= n; i++) {
    I_.push_back(I_[MOD % i] * (MOD - MOD / i));
    F_.push_back(F_[i - 1] * i);
    R_.push_back(R_[i - 1] * I_[i]);
  }
}

mint I(int n) { check_fact(abs(n)); return n >= 0 ? I_[n] : -I_[n]; }
mint F(int n) { check_fact(n); return n < 0 ? 0 : F_[n]; }
mint R(int n) { check_fact(n); return n < 0 ? 0 : R_[n]; }
mint C(int n, int r) { return F(n) * R(n - r) * R(r); }
mint P(int n, int r) { return F(n) * R(n - r); }
mint H(int n, int r) { return n == 0 ? (r == 0) : C(n + r - 1, r); }

template<typename T>
T gcd(T x, T y){
    if (y == 0) return x;
    else return gcd(y, x % y);
}

template<typename T>
T lcm(T x, T y){
    return (x / gcd(x, y)) * y;
}

template<typename T>
T ceil(T x, T y){
    return (x + (y - 1)) / y;
}

int N, D;
int main(void){
    cin >> N >> D;
    cout << ceil(N / (2*D+1.0)) << endl;

    return 0;
}



















Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ul;
typedef signed long long ll;
ul over = 1000000007;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  int r, g;
  cin >> r >> g;
  cout << g * 2 - r << endl;
  return 0;
}


Measured memory_bytes: 896
#include <cstdio>
using namespace std;

bool prime[50010];
int ans[50010];

int main(){
	for(int i = 2; i <= 50000; ++i){
		prime[i] = true;
	}
	for(int i = 2; i < 300; ++i){
		if(prime[i]){
			for(int j = i * i; j <= 50000; j += i){
				prime[j] = false;
			}
		}
	}
	
	for(int i = 2; i <= 25000; ++i){
		if(prime[i]){
			for(int j = i; j + i <= 50000; ++j){
				if(prime[j]){
					++ans[i + j];
				}
			}
		}
	}

	int n;
	while(scanf("%d", &n), n){
		printf("%d\n", ans[n]);
	}
}

Measured memory_bytes: 1272
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author aakas
 */
import java.util.*;
public class Main {
    static int n;
    static int m;
    static ArrayList<Integer>[] adjList;
    static boolean[] v;
    static int[] dp;
    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        m = sc.nextInt();
        adjList = new ArrayList[n+1];
        //visited = new boolean[n];
        v = new boolean[n+1];
        dp = new int[n+1];
        for(int i=0;i<=n;i++)
            adjList[i] = new ArrayList<Integer>();
        for(int i=0;i<m;i++)
            adjList[sc.nextInt()].add(sc.nextInt());
        int temp = Integer.MIN_VALUE;
        for(int i=1;i<=n;i++)
        {
            //boolean[] visited = new boolean[n+1];
            temp = Math.max(dfs(i),temp);
        }
        System.out.println(temp);
    }
    public static int dfs(int s)
    {
        //System.out.println("call for "+s+" "+visited[s]);
        //if(visited[s])
          //  return 0;
        if(v[s])
            return dp[s];
        v[s] = true;
        //visited[s] = true;
        for(int i=0;i<adjList[s].size();i++)
        {
            int v = adjList[s].get(i);
            //System.out.println(s+ " -> "+v);
            //if(!visited[v])
            //{
                 dp[s] = Math.max(1+dfs(v),dp[s]);
                 //System.out.println(s+" "+dp[s]);
            
        }
        //System.out.println(s+" "+dp[s]);
        return dp[s];
    }
}


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

void dfs(int i, vector<int> &v, vector<char> &op){
    if(i==4){
        int sum = 0;
        REP(i, 4){
            if (op[i] =='-') sum -= v[i];
            else sum += v[i];
        }
        if (sum == 7){
            cout << v[0];
            REP2(i, 1, 4){
                cout << op[i] << v[i];
            }
            cout << "=" <<sum<< endl;
            exit(0);
        }
        return;
    }

    op[i] = '+';
    dfs(i+1, v, op);

    op[i] = '-';
    dfs(i+1, v, op);

    return;
}

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

    int N =4;
    vector<int> v(N);
    for(int i=0; i<N; i++){
        v[i] = s[i] - '0';
    }
    vector<char> op(N);
    dfs(1, v, op);


   return 0;
}

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

ans = 0
step = 0
height = H[0]
for h in H[1:]:
    if (height >= h):
        height = h
        step += 1
        ans = max(ans, step)
    else:
        height = h
        step = 0

print(ans)


Measured memory_bytes: 63984
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //int:2*10**9
typedef long double ld;
typedef pair<ll,ll> P;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define REPS(i,n) for (ll i = 1; i<=(ll)(n); i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define vec2(name,i,j) vector<vector<ll>> name(i,vector<ll>(j))
#define vec2f(name,i,j,k) vector<vector<ll>> name(i,vector<ll>(j,k))
#define vec3(name,i,j,k) vector<vector<vector<ll>>> name(i,vector<vector<ll>>(j,vector<ll>(k)))
#define vec3f(name,i,j,k,l) vector<vector<vector<ll>>> name(i,vector<vector<ll>>(j,vector<ll>(k,l)))
#define vec4(name,i,j,k,l) vector<vector<vector<vector<ll>>>> name(i,vector<vector<vector<ll>>>(j,vector<vector<ll>>(k,vector<ll>(l))))
#define vec4f(name,i,j,k,l,m) vector<vector<vector<vector<ll>>>> name(i,vector<vector<vector<ll>>>(j,vector<vector<ll>>(k,vector<ll>(l,m))))
#define pb push_back
#define MOD 1000000007
#define MOD2 998244353
#define PI 3.141592653
#define INF 100000000000000 //14
//cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);

int main(){
    ll x; cin >> x;
    ll y = 360/gcd(x,360);
    cout << y << endl;
}

Measured memory_bytes: 3584
n=int(input())
a=list(map(int,input().split()))

i=0
f1=f2=f3=f4=f5=f6=f7=f8=f9=0

while i<n:

    if 1<=a[i]<=399:

        f1=1

    elif 400<=a[i]<=799:

        f2=1

    elif 800<=a[i]<=1199:

        f3=1

    elif 1200<=a[i]<=1599:

        f4=1

    elif 1600<=a[i]<=1999:

        f5=1

    elif 2000<=a[i]<=2399:

        f6=1

    elif 2400<=a[i]<=2799:

        f7=1

    elif 2800<=a[i]<=3199:

        f8=1

    elif 3200<=a[i]:

        f9+=1

    i+=1

if f1==f2==f3==f4==f5==f6==f7==f8==0 and f9!=0:
    ans1=1
else:
    ans1 = f1+f2+f3+f4+f5+f6+f7+f8

ans2 = f1+f2+f3+f4+f5+f6+f7+f8+f9

print(str(ans1)+' '+str(ans2))

Measured memory_bytes: 9080
/*
 * Author: .-O_O-.
 */
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
//#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nx cout<<"\n"
#define int long long
// void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
                                                     
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]"<<endl;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
const ll mod = 1000000007;
const ll maxn = 300005;
const ll mm = 1e+18;
void solve()
{
    string s1,s2;
    cin>>s1>>s2;
    s2.pop_back();
    if(s1==s2) cout<<"Yes";
    else cout<<"No";
}
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    // srand(time(0));
    //freopen("sp.txt","r",stdin);
    //cin>>t;
    rep1(_i,t){
        //cout<<"Case #"<<_i<<": ";
        solve();
        //nx;
    }
    return 0;
}


Measured memory_bytes: 3656
#AIsing2020 d

def f(n):
        cnt = 0
        while n:
            cnt+= 1
            n = n%bin(n).count('1')
        return cnt

def main():
    N = int(input())
    X = input()
    X10 = int(X,2)
    X10_num1 = X.count('1')
    X10_pulse = X10%(X10_num1+1)
    X10_ninus = X10%(X10_num1-1) if X10_num1 >1 else 0


    for i in range(N,0,-1):
        j = N-i
        if (X[j] == '1') and X10_num1 >1:
            mod = X10_num1-1
            amari = (X10_ninus - pow(2,i-1,mod))%(mod) 
        elif (X[j] == '1') and X10_num1 ==1:
            print(0)
            continue
        else:
            mod = X10_num1+1
            amari = (X10_pulse + pow(2,i-1,mod))%(mod)

        print(1+f(amari))


main()


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

int main(){
  int W,H,x,y,r;
  cin >> W >> H >> x >> y >> r;
  if (x-r>=0 && x+r <= W && y-r >= 0 && y+r <=H) cout << "Yes\n";
  else cout << "No\n";
  return 0;
}


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

using namespace std;

int main(){
    int N,q;
    cin >> N >> q;
    vector<vector<int>> graph(N);
    vector<long long int> add(N,0),ans(N,0),color(N,-1);

    for(int i=0;i<N-1;i++){
        int a,b;
        cin >> a >> b;
        a--;
        b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }

    for(int i=0;i<q;i++){
        long long int p,x;
        cin >> p >> x;
        p--;
        add[p] += x;
    }

    long long int sum = 0;

    queue<pair<int,long long int>> Q;

    Q.push({0,0});
    color[0] = 0;

    while(!Q.empty()){
        int now = Q.front().first;
        int sum = Q.front().second;
        Q.pop();
        sum += add[now];
        ans[now] = sum;
        for(int i=0;i<graph[now].size();i++){
            if(color[graph[now][i]]==-1){
                Q.push({graph[now][i],sum});
                color[graph[now][i]]=0;
            }
        }
    }

    for(int i=0;i<N;i++){
        cout << ans[i] << " ";
    }
}

Measured memory_bytes: 21876
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int mod = 1000000007;
const int INF = 1001001001;
vector<vector<int>> dp;

int main(){
    int h,n;
    cin >> h >> n;
    vector<int> a(n,0);
    vector<int> b(n,0);
    int amax = 0;
    rep(i,n){
      cin >> a.at(i) >> b.at(i);
      amax = max(amax,a.at(i));
    }
    vector<vector<int>> dp(n+1,vector<int>(h+1+amax,INF));

    rep(i,h+1+amax){
        if(i%a[0] == 0) dp.at(0).at(i) = (i/a[0])*b[0];
    }
 
    for(int i=1;i<n;i++){
        for(int j=0;j<=h+amax;j++){
            if(j<a[i]){
                dp[i][j] = dp[i-1][j];
                continue;
            }
            dp[i][j] = min(dp[i-1][j], dp[i][j-a[i]]+b[i]);
        }
    }
    int minans=INF;
    for(int j=h;j<h+amax;j++){
      minans = min(minans,dp[n-1][j]);
    }
    cout << minans << endl;
    
    /*
    rep(i,h+1){
        cout << dp[1][i] << " " ;
    }
    */
}

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

#define MAX 101
#define T 1
#define F -1
void push(int);
int pop(void);
int isEmpty(void);
int isFull(void);
void initialize(void);

int top=0;
int S[MAX];
int main(){
  int i=0,num,x;
  char a[1000];
  initialize();
  while(scanf("%s",a)!=EOF){
    if(a[0]=='*'){
      x = pop();
      x = x*pop();
      push(x);
    }
    else if(a[0]=='+'){
      x=pop();
      x=x+pop();
      push(x);
    }
    else if(a[0]=='-'){
      x=pop();
      x=pop()-x;
      push(x);
    }
    else {
      num = atoi(&a[0]);
      push(num);
    }
  }
  printf("%d\n",S[top]);
return 0;
}

void initialize(void){
  top = 0;
}

int isEmpty(void){
  if(top==0){
    return F;
  }
  else return T;
}

int isFull(void){
  if(top>=MAX-1) return F;
  else return T;
}

void push(int x){
  if(isFull()==F){
    fprintf(stderr,"overflow\n");
  }
  top++;
  S[top] = x;
}

int pop(void){
  if(isEmpty()==F){
    fprintf(stderr,"underflow\n");
  }
  top--;
  return S[top+1];
}



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

using namespace std;

#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x)                                                                        \
	sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<(c i) \
	{
sim > struct rge
{
	c b, e;
};
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug
{
#ifdef LOCAL
	~debug()
	{
		cerr << endl;
	}
	eni(!=) cerr << boolalpha << i;
	ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d)
{
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d)
{
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
	sim dor(const c &)
	{
		ris;
	}
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define forn(i, n) for (ll i = 0; i < int(n); i++)
#define rfor(n, i) for (ll i = (n - 1); i >= 0; --i)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define M_PI 3.14159265358979323846
#define EPS 1e-7

int cnt = 0;


void solve()
{
	string s; cin >> s;
	ll k; cin >> k;
	int ind = 0;
	for (int i = 0; i < s.length(); ++i)
	{
		if (s[i] != '1') 
		{
			ind = i;
			break;
		}
	}
	if (k > ind) cout << s[ind];
	else cout << 1;
}

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


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

int main() {
	int n,W;
	cin>>n>>W;
	vector<int> w(n), v(n);
	int val = 0;
	for(int i=0;i<n;i++) {
		cin>>w[i]>>v[i];
		val += v[i];
	}
	vector<vector<long long int>> dp(n+1, vector<long long int> (val+1,0));
	dp[0][0] = 0;
	for(int i=1;i<=val;i++) {
		dp[0][i] = 1e18;
	}
	int ans = 0;
	for(int i=0;i<n;i++) {
		for(int j=0;j<=val;j++) {
			dp[i+1][j] = dp[i][j];
			if(j>=v[i]) {
				dp[i+1][j] = min(dp[i][j], w[i] + dp[i][j-v[i]]);
			}
			if(dp[i+1][j]<=W) {
				ans = max(ans, j);
			}
		}
	}
	cout<<ans<<endl;
	
	return 0;
}


Measured memory_bytes: 80256
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin>>n;
int ans=0;
int cnt=1;
while(n>0)
{
    ans+=cnt;
    n/=2;
    cnt*=2;
}
cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
N,W = map(int,input().split())

li = [list(map(int,input().split())) for i in range(N)]

dp = [[0]*(W+1) for i in range(N)]
#dp[i][w] indexi 番目まででwになるような価値の最大値

w = li[0][0]
if w<=W:
    dp[0][w]= li[0][1]

for i in range(N-1):
    wi =  li[i+1][0]
    for w in range(W+1):
        if w>=wi:
            dp[i+1][w] = max(dp[i][w],dp[i][w-wi]+li[i+1][1])
        else:
            dp[i+1][w] = dp[i][w]

print(max(dp[N-1]))


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

int main() {
  int N;
  cin >> N;
  
  vector<double> A(N);
  for(int i = 0; i < N; i++){
    cin >> A.at(i);
  }
  
  double x;
  
  for(int i = 0; i < N; i++){
    x += 1 / A.at(i);
  }
  
  cout << 1 / x << endl;
  
  
  
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int sum=0;
    if (a<=b) {
        sum+=a;
    } else {
        sum+=b;
    }
    if (c<=d) {
        sum+=c;
    } else {
        sum+=d;
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 256