akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<unordered_map>
using namespace std;
unordered_map<int,int>bomb[300100];
struct node{
    int index;
    int cnt;
}xx[300100],yy[300100];
bool cmp(node a,node b)
{
    return a.cnt > b.cnt;
}
int main()
{
    int n,m;
    cin >> n >> m;
    int num;
    cin >> num;
    for(int i=1;i<=n;i++)
    {
        xx[i].index = i;
    }
    for(int i=1;i<=m;i++)
    {
        yy[i].index = i;
    }
    for(int i=1;i<=num;i++)
    {
        int x,y;
        cin >> x >> y;
        bomb[x][y] = 1;
        xx[x].cnt++;
        yy[y].cnt++;
    }
    sort(xx+1,xx+n+1,cmp);
    sort(yy+1,yy+m+1,cmp);
    int cntx=n,cnty=m;
    for(int i=2;i<=n;i++)
    {
        if(xx[i].cnt<xx[i-1].cnt)
        {
            cntx = i-1;
            break;
        }
    }
    for(int i=2;i<=m;i++)
    {
        if(yy[i].cnt<yy[i-1].cnt)
        {
            cnty = i-1;
            break;
        }
    }
    int ans=0;
    for(int i=1;i<=cntx;i++)
    {
        for(int j=1;j<=cnty;j++)
        {
            if(bomb[xx[i].index][yy[j].index]==1)
            {
                ans = max(ans,xx[i].cnt+yy[j].cnt-1);
            }
            else
            {
                ans = max(ans,xx[i].cnt+yy[j].cnt);
                break;
            }
            
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 52796
import sys
import math

#https://atcoder.jp/contests/agc008/submissions/15248942
sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

D,T,S = inm()

if D/S <= T:
    print("Yes")
else:
    print("No")



Measured memory_bytes: 9180
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a*b/gcd(a,b);
}


signed main(void) {
    int n;
    cin >> n;
    loop(i,1,10){
        int t = 0;
        rep(_,3){
            t *= 10;
            t += i;
        }
        if(t >= n){
            cout << t << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

// Credits - github.com/EndlessCheng/codeforces-go
func solve(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var n,k int
	Fscan(in, &n,&k)
	a:=make([]int,n)
	for i:=0;i<n;i++ {
		Fscan(in, &a[i])
	}
	for i:=0;i+k<n;i++{
		if a[i]<a[i+k]{
			Fprintln(out,"Yes")
		} else {
			Fprintln(out,"No")
		}
	}
}

func main() { solve(os.Stdin, os.Stdout) }



Measured memory_bytes: 5996
#include <iostream>
#include <string>
#include <cstdint>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <climits>
#include <numeric>
#include <algorithm>
#include <cassert>

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

using namespace std;

void solution()
{
    int n,k;
    cin >> n >> k;
    vector<int> snukes(n);
    rep(i,k){
        int d;
        cin >> d;
        rep(j,d){
            int a;
            cin >> a;
            snukes[a-1] += 1;
        }
    }
    cout << count_if(begin(snukes), end(snukes), [](int x){ return !x; }) << '\n';
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solution();
    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
 
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
 
#define pb push_back 
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second 
#define debug(x)  do{cerr<<#x<<": "<<x<<"\n";}while(0)
#define debugv(x) do{cerr<<#x<<": ";for(auto&e: (x))cerr<<e<<" ";cerr<<"\n";}while(0)
#define fori(i, n) for (int i = 0; i < (int)(n); ++i)
#define forn(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n); i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
#define RETURN(x) do{cout << x << '\n'; return 0;}while(0)
 
const int MAXN = 2e5+3;
const int MOD = 1e9+7;
const int INF = 1e9+1;

int main() {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    LL n;
    cin >> n;
    LL ans = 0;

    if(n%2) RETURN(0);
    n /= 2;
    for (LL i = 5; n/i >= 1; i*=5) {
        ans += n/i;
    }

    //LL k = 10;
    //while(k <= n) {
        //ans += n/k;
        //k *= 10;
    //}

    //for(LL t = 5; t*10 <= n; t*=5) {
        //k = t*10;
        //for(LL k = t*10; k <= n; k*= 10) {
            //ans += n/k;
            //ans -= n/(k*2);
            //k *= 10;
        //}
    //}

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RNG(i,from,to) for(int i=(from); i<(int)(to); i++)
#define gcd(i,j) __gcd((i), (j))
typedef long long ll;
typedef pair<int, int> pii;
template<typename S, typename T> string to_string(pair<S, T> p) { return "("+to_string(p.first)+","+to_string(p.second)+")"; }
template<typename T> string to_string(T p[2]) { return "["+to_string(p[0])+","+to_string(p[1])+"]"; }
template<typename T> void strprint(T e){ cout << to_string(e) << endl; }
template<typename T> void strprint(const vector<T>& v){ cout << "[";for(const auto& e : v){ cout << to_string(e) << ","; }cout << "]";cout << endl; }
template<typename T> void strprint(const vector<vector<T>>& vv){ for(const auto& v : vv){ strprint(v); } }
template<typename Iter> void strprint(Iter first, Iter last){ for(auto it=first; it != last; it++){ cout << *it << " "; }; cout << endl; }
const ll DVSR = 1e9+7;


int main(int argc, char const *argv[])
{
  ll N; cin >> N;
  vector<ll[2]> coord(N);
  REP(i, N) {
    cin >> coord[i][0] >> coord[i][1];
  }
  double res = 1e15;
  if (N==2) {
    strprint(0.5*sqrt((coord[0][0]-coord[1][0])*(coord[0][0]-coord[1][0]) + (coord[0][1]-coord[1][1])*(coord[0][1]-coord[1][1])));
    return 0;
  }
  RNG(i, 0, N-2) {
    RNG(j, i+1, N-1) {
      RNG(k, j+1, N) {
        double M11 = coord[i][0] - coord[j][0], M12 = coord[i][1] - coord[j][1];
        double M21 = coord[j][0] - coord[k][0], M22 = coord[j][1] - coord[k][1];
        double v1 = (coord[i][0]*coord[i][0]+coord[i][1]*coord[i][1]) - (coord[j][0]*coord[j][0]+coord[j][1]*coord[j][1]);
        double v2 = (coord[j][0]*coord[j][0]+coord[j][1]*coord[j][1]) - (coord[k][0]*coord[k][0]+coord[k][1]*coord[k][1]);
        double lmd = 0.5/(M11*M22-M21*M12);
        double a = lmd*(M22*v1 - M12*v2);
        double b = lmd*(-M21*v1 + M11*v2);
        double r = sqrt((coord[i][0]-a)*(coord[i][0]-a) + (coord[i][1]-b)*(coord[i][1]-b));
        // strprint(res);
        bool ok = true;
        REP(l, N) {
          double r2 = sqrt((coord[l][0]-a)*(coord[l][0]-a) + (coord[l][1]-b)*(coord[l][1]-b));
          if (r2 > r + 0.0000001) {
            ok = false;
          }
        }
        // if (ok) strprint(r);
        if (ok && r < 1e15) res = min(r, res);
      }
    }
  }
  RNG(i, 0, N-1) {
    RNG(j, i+1, N) {
      double med_x = (coord[j][0]+coord[i][0])*0.5, med_y = (coord[j][1]+coord[i][1])*0.5;
      double r = 0.5*sqrt((coord[j][0]-coord[i][0])*(coord[j][0]-coord[i][0]) + (coord[j][1]-coord[i][1])*(coord[j][1]-coord[i][1]));
      bool ok = true;
      REP(k, N) {
        ok = ok && sqrt((coord[k][0]-med_x)*(coord[k][0]-med_x) + (coord[k][1]-med_y)*(coord[k][1]-med_y)) < r+0.000001;
      }
      if (ok) res = min(res, r);
    }
  }
  std::cout << std::setprecision(15) << res << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
#import time
import copy
#from collections import deque, Counter, defaultdict
#from fractions import gcd
import bisect
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**20
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))
n = ri()
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
acu=[0]*101
acu[0]=0
for i in range(100):
    acu[i+1]=acu[i]+(i+1)

li=factorization(n)
ans=0
for i in li:
    ans+=bisect.bisect_right(acu,i[1])-1
if n==1:
    print(0)
else:
    print(ans)


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

int main(){
	string s ;
	set<string> check ;
	char c = '0' ;
	int n ; cin >> n ;
	for(int i=0;i<n;i++){
		cin >> s ;
		if(check.count(s)){
			cout << "No" << endl ;
			return 0 ;
		}
		if(c!='0'&&c!=s.at(0)){
			cout << "No" << endl ;
			return 0 ;
		}
		check.insert(s) ;
		c = s.at(s.size()-1) ;
	}
	cout << "Yes" << endl ;
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define endl "\n"
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=998244353;
const int N=3e5+10;
int32_t main()
{
    IOS;
    int h1,m1,h2,m3,k;
    cin>>h1>>m1>>h2>>m3>>k;
    if(m3>=m1)
    {
        int p=(h2-h1)*60+m3-m1;
        cout<<p-k<<endl;
    }
    else
    {
        int p=(h2-h1-1)*60+60+m3-m1;
        cout<<p-k<<endl;
    }
    
    
 
    
 
 
 
    
}

Measured memory_bytes: 3640
#include <iostream>

using namespace std;

int main()
{
    const long m = 1000000000 + 7;
    int N;
    cin >> N;
    long long a = 1, b = 1, c = 1;
    for (int i = 0; i < N; ++i)
    {
        a = (a * 10) % m;
        b = (b * 9) % m;
        c = (c * 8) % m;
    }
    cout << ((a - 2 * b + c) % m + m)%m;

    return 0;
}

Measured memory_bytes: 3616
using System;

namespace B
{
    class Program
    {

        const double EPSILON = 0.0001;
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int N = Convert.ToInt32(input[0]);
            int D = Convert.ToInt32(input[1]);
            int[,] Xi = new int[N, D];
            for (var i = 0; i < N; i++)
            {
                input = Console.ReadLine().Split(' ');
                for (var j = 0; j < D; j++)
                {
                    Xi[i, j] = Convert.ToInt32(input[j]);
                }
            }

            int count = 0;
            for (var i = 0; i < N; i++)
            {
                for (var j = i + 1; j < N; j++)
                {
                    double dist = 0.0f;
                    for (var t = 0; t < D; t++)
                    {
                        dist += Math.Pow(Xi[i, t] - Xi[j, t], 2.0f);
                    }
                    dist = Math.Sqrt(dist);
                    int iDist = (int)dist;
                    if (Math.Abs(iDist - dist) <= EPSILON)
                    {
                        count++;
                    }
                }
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 11220
N,M=map(int,input().split())
if N==1:
  ans=["0"]
else:
  ans=["1"]+["0"]*(N-1)
check=[0]*N
for _ in range(M):
  s,c=map(int,input().split())
  if check[s-1]==0:
    check[s-1]=c
  elif check[s-1]!=c:
    print(-1)
    exit()
  ans[s-1]=str(c)
if len(ans)==1:
  print("".join(ans))
else:
  print("".join(ans) if ans[0]!="0" else -1)


Measured memory_bytes: 9212
#include <iostream>
#include <cstdlib>
#include <time.h>
#include <algorithm>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <array>
#include <string>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define mp make_pair
#define eb emplace_back
#define F first
#define S second
using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ost;

const ll maxN = 1e7;
const ll INF = 1e17;
const ll MOD = 1e9 + 7;

ll xs[] = {-1, 1, 0, 0, -1, 1, 1, -1};
ll ys[] = {0, 0, -1, 1, -1, 1, -1, 1};

ll segtree[maxN << 2];
ll lazy[maxN << 2];
ll A[maxN];

inline ll left(ll x){
	return x << 1;
}

inline ll right(ll x){
	return (x<<1) + 1;
}

void build(ll node, ll start, ll end){
	if(start == end)
		segtree[node] = A[start];
	else{
		ll mid = (start + end)/2;
		build(left(node), start, mid);
		build(right(node), mid+1, end);
		segtree[node] = segtree[left(node)] + segtree[right(node)];
	}
}

void update(ll node, ll start, ll end, ll l, ll r, ll val){
	if(lazy[node] != 0){
		segtree[node] += (end-start+1)*lazy[node];
		if(start != end){
			lazy[left(node)] += lazy[node];
			lazy[right(node)] += lazy[node];
		}
		lazy[node] = 0;
	}
	if(start > end or l > start or r < end)
		return ;
	else if(start >= l and r >= end){
		segtree[node] += val;
		if(start != end){
			lazy[left(node)] += val;
			lazy[right(node)] += val;
		}
	}
	else{
		ll mid=(start + end)/2;
		update(left(node), start, mid, l, r, val);
		update(right(node), mid+1, end, l, r, val);
		segtree[node] = segtree[left(node)] + segtree[right(node)];
	}
}

ll sums(ll node, ll start, ll end, ll l, ll r){
	if(lazy[node] != 0){
		segtree[node] += (end-start+1)*lazy[node];
		if(start != end){
			lazy[left(node)] += lazy[node];
			lazy[right(node)] += lazy[node];
		}
		lazy[node] = 0;
	}
	if(l > end or r < start or start > end)
		return 0;
	if(l <= start and r >= end)
		return segtree[node];
	ll mid = (start+end)/2;
	return sums(left(node), start, mid, l , r) + sums(right(node), mid + 1, end, l , r);
}

ll n, m;

bool isS(ll i, ll j){
	return (i>=0 and i<n) and (j>=0 and j<m);
}

int main(){
	cin.sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> m;
	char tl[n][m];
	for(ll i=0; i<n; i++)
		for(ll j=0; j<m; j++)
			cin >> tl[i][j];
	bool chk = true;
	for(ll i=0; i<n; i++){
		for(ll j=0; j<m; j++){
			if(tl[i][j] == '#'){
				ll ns = 0;
				for(ll k=0; k<4; k++){
					if(isS(i+xs[k], j+ys[k]))
						if(tl[i+xs[k]][j+ys[k]] == '#')
							ns++;

				}
				if(ns < 1)
					chk = false;
			}
		}
	}
	if(chk)
		cout << "Yes";
	else
		cout << "No";
	return 0;
}

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

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

    int ans = 0;
    for (char& c : s) {
        if (c == '+') {
            ans++;
        } else {
            ans--;
        }
    }

    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1000000007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;

int main(){
    int n;  cin >> n;
    vector<ll> a(n);
    for(int i=0; i<n; i++)  cin >> a.at(i);
    sort(a.begin(), a.end());
    
    int ans=1;
    vector<ll> s(n, 0);    s[0] = a[0];
    for(int i=1; i<n; i++)
        s[i] = s[i-1]+a[i]; 

    
    for(int i=n-1; 1<=i; i--){
        if(a[i]<=2*s[i-1]) ans += 1;
        else break;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include<stdio.h>
int main()
{
	int a,b,c,d,e;
	int min1;
	int min2;
	scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);
	
	if(d<e) min1=d;
	else min1=e;
	
	if(a<b) min2=a;
	else min2=b;
	
	if(min2>c) min2=c;
	
	printf("%d\n",min1+min2-50);
}



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

#define ss(a) scanf("%s",a)
#define pi(a) printf("%d\n",a)
#define repi(i, a, b) for(register int i=a;i<=b;++i)
#define vi vector<int>
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;

inline int qr() {
    int f = 0, fu = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-')fu = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        f = (f << 3) + (f << 1) + c - 48;
        c = getchar();
    }
    return f * fu;
}
int d,s,t;
int main(){
    d=qr(),s=qr(),t=qr();
    puts(s*t>=d?"Yes":"No");
    return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 1000000007
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
int ceil2(int a,int b){if(a%b){return a/b+1;}else{return a/b;}}
using namespace std;

int N;

signed main(){
	cin>>N;
	int h;
	for(int n=1;n<=3500;n++){
		for(int w=1;w<=3500;w++){
			if(4*n*w-N*w-N*n==0)continue;
			if((N*w*n)%(4*n*w-N*w-N*n)==0){
				h=(N*w*n)/(4*n*w-N*w-N*n);
				if(h<0)continue;
				cout<<h<<" "<<n<<" "<<w;
				goto seeyou;
			}
		}
	}
	seeyou:;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int n,q,i,m,p[100000];
  long k;
  scanf("%d",&n);
  scanf("%ld",&k);
  scanf("%d",&q);
  for(i=0;i<n;i++){
    p[i]=0;
  }
  for(i=0;i<q;i++){
    scanf("%d",&m);
    p[m-1]++;
  }
  k-=q;
  for(i=0;i<n;i++){
    if(p[i]+k>0){
      printf("Yes\n");
    }else{
      printf("No\n");
    }
  }
  return(0);
}

Measured memory_bytes: 896
#pragma GCC optimze("Ofast")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define mod 1000000007
#define md 998244353
#define trace(...)
#define ll long long int
#define ld long double
#define fi first
#define se second
#define fr(i,a,b) for(ll i=a;i<=b;i++)
#define frr(i,b,a) for(ll i=b;i>=a;i--)
#define mem(a) memset(a, 0, sizeof(a))
#define vpi std::vector<pair<int,int>>
#define pii pair<int,int>
#define pll pair<ll,ll> 
#define pb push_back
#define sall(v) sort(v.begin(),v.end())
#define all(v) (v.begin(),v.end())
#define minf -10000000
#define vi vector<int>
#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
auto clk=clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
    uniform_int_distribution<int> uid(0,lim-1);
    return uid(rang);
}
ll power(ll x, ll y,ll p) { 
    ll res = 1;      // Initialize result 
    x = x % p;  // Update x if it is more than or equal to p 
    while (y > 0) {  
        if (y & 1) // If y is odd, multiply x with result
            res = (res*x) % p;  
        y = y>>1; // y = y/2 // y must be even now
        x = (x*x) % p;   
    } 
    return res; 
}
ll power(ll x, ll y) { 
    ll res = 1;      // Initialize result 
    while (y > 0) {    
        if (y & 1)// If y is odd, multiply x with result 
            res = (res*x) ;  
        y = y>>1; // y = y/2 // y must be even now 
        x = (x*x);   
    } 
    return res; 
}
 
ll max3(ll a,ll b,ll c){
    return max(a,max(b,c));
}
ll min3(ll a,ll b,ll c){
    return min(a,min(b,c));
}
bool isPrime(ll n) { // Corner cases 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
    for (ll i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
    return true; 
}
const int d4i[4]={-1, 0, 1, 0}, d4j[4]={0, 1, 0, -1};
const int d8i[8]={-1, -1, 0, 1, 1, 1, 0, -1}, d8j[8]={0, 1, 1, 1, 0, -1, -1, -1};
const int nax=2e5+10;

void solve(){
    string s,t;cin>>s>>t;
    string p=t.substr(0,s.length());
    if(p==s)cout<<"Yes\n";
    else cout<<"No\n";
    return;
}

int main(){
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    cout<<fixed<<setprecision(8);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    #endif
    int t;
    // cin>>t;
    t=1;
    while(t--){
        solve();
    }
    #ifndef ONLINE_JUDGE
    cout<<endl<<endl<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
    #endif
    return 0;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;;
int main(){
  double N,K,L,G;
  cin >> N >> K >> L >> G;
  double mix=N*K/2;
  cout << setprecision(8) <<mix << " ";
  if(2==N/L&&2==K/G) cout << 1 << endl;
  else cout << 0 <<endl;
}

Measured memory_bytes: 384
#include<stdio.h>
int main(){
    int c=0;
    char b[10];
    gets(b);
    for(int i=0;b[i]!='\0';i++)
    {
        if(b[i]=='7'){ c++; }
    }
if(c>0)printf("Yes\n");
else printf("No\n");
return 0;
}


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

int		main(void)
{
	int N;

	cin >> N;
	double sum = 0;
	for (int i = 0; i < N; i++)
	{
		double x;
		string u;

		cin >> x;
		cin >> u;
		if (u == "JPY")
			sum += x;
		else
			sum += x * 380000.0;
	}
	cout << sum << endl;
}


Measured memory_bytes: 256
//package ABC172;
import java.util.*;
import java.lang.*;
import java.io.*;

class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		long n=sc.nextLong();
		
		long ans=n+(long)Math.pow(n, 2)+(long)Math.pow(n, 3);
		
		System.out.println(ans);
	}

}


Measured memory_bytes: 35620
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <list>
#include <iomanip>
#include <queue>
#include <cmath>
#include <numeric>
#define repl(i, l, r) for (ll i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)

using namespace std;
using ll = long long;
typedef pair<ll, ll> p;
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; }
const long long mod = 1e9 + 7;
ll gcd(ll a, ll b);
ll lcm(ll a, ll b);

int main() {

    ll N, M;

    cin >> N >> M;

    vector<p> C, ans;
    vector<vector<ll>> H(N + 1);

    ll P, Y;

    rep(i, M) {
        cin >> P >> Y;
        C.emplace_back(P, Y);
        H[P].push_back(Y);
    }

    rep(i, N + 1) {
        sort(H[i].begin(), H[i].end());
    }


    rep(i, M) {
        P = C[i].first;      
        Y = lower_bound(H[P].begin(), H[P].end(), C[i].second) - H[P].begin() + 1;
        ans.emplace_back(P, Y);
    }

    char fillSaved = cout.fill('0');

    rep(i, M) {
        cout << setw(6) << ans[i].first << setw(6) << ans[i].second << endl;
    }

    cout.fill(fillSaved);

    return 0;
}



ll gcd(ll a, ll b) {
    if (a % b == 0)return(b);
    else return(gcd(b, a % b));
}
ll lcm(ll a, ll b) {
    return a * b / gcd(a, b);
}

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

int n;
int a[100010];
int broj1[100010];
int broj2[100010];

int main () {

	cin >> n;
	for (int i = 0; i < n; i ++) {
		cin >> a[i];
		if (i % 2 == 0) broj1[ a[i] ] ++;
		else broj2[ a[i] ] ++;
	}
	
	int maxi1 = 0, w = 0, maxi3 = 0, maxi2 = 0, w2 = 0, maxi4 = 0;
	for (int i = 1; i <= 100000; i ++) {
		if (broj1[i] > maxi1) {
			maxi3 = maxi1;
			maxi1 = broj1[i];
			w = i;
		}
		else if (broj1[i] > maxi3) {
			maxi3 = broj1[i];
		}
		
		
		if (broj2[i] > maxi2) {
			maxi4 = maxi2;
			maxi2 = broj2[i];
			w2 = i;
		}
		else if (broj2[i] > maxi4) {
			maxi4 = broj2[i];
		}
	}
	
	if (w == w2) {
		if (maxi3 > maxi4) {
			maxi1 = maxi3;
		}
		else {
			maxi2 = maxi4;
		}
	}
	
	cout << ((n+1)/2 - maxi1) + (n/2 - maxi2);

	return 0;
}

Measured memory_bytes: 1408
#include <stdio.h>

int main(void)
{
	int h, w, i, j;
	while(1) {
		scanf("%d %d", &h, &w);
		if ((h == 0) && (w == 0))
			break;
		for (i=0; i<h; i++) {
			for (j=0; j<w; j++) {
				if ((i+j) % 2 == 0)
					printf("#");
				else
					printf(".");
			}
			printf("\n");
		}
		printf("\n");
	}
						
	return 0;
}

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

int main() {
    int n, ans;
    
    cin >> n;
    
    ans = (n+1)/2;
    
    cout << ans << endl;
    
    return 0;
}




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

local_cnt = 0
max_cnt = 0
prev = H[0]
for i in range(1,N):
    h = H[i]
    if h <= prev:
        local_cnt += 1
    else:
        local_cnt = 0
    max_cnt = max(max_cnt, local_cnt)
    prev = h
print(max_cnt)

Measured memory_bytes: 14252
h,w=STDIN.gets.split(" ").map(&:to_i)
cvs=[]
cvs << Array.new(w+2,".")
h.times do
  cvs << ['.']+STDIN.gets.chomp.split(//)+['.']
end
cvs << Array.new(w+2,".")
def check(cvs,hh,ww)
    (1..hh).each do |h|
      (1..ww).each do |w|
      if cvs[h][w]=="#"
        if [[1,0],[0,1],[-1,0],[0,-1]].any?{ |x,y| cvs[h+x][w+y]=="#"}
        else
          return false
        end
      end
    end
  end
  return true
end
if check(cvs,h,w)
  puts 'Yes'
else
  puts 'No'
end


Measured memory_bytes: 2172
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
using namespace std;
typedef long long ll;

int main(){
  int n; cin >> n;
  vector<int> v(n), w(n);
  for(int i = 0; i < n; i++){
    cin >> v[i] >> w[i];
  }
  const int MAX = 100001;
  int limit = min(512, n);
  vector<vector<int>> dp(limit, vector<int>(MAX));
  for(int j = 0; j < MAX; j++){
    dp[0][j] = (j >= w[0] ? v[0] : 0);
  }
  for(int i = 1; i < limit; i++){
    int p = (i - 1) / 2;
    for(int j = 0; j < MAX; j++){
      dp[i][j] = dp[p][j];
      if(j >= w[i]){
        dp[i][j] = max(dp[i][j], dp[p][j - w[i]] + v[i]);
      }
    }
  }
  int tt; cin >> tt;
  while(tt--){
    int ver, L;
    cin >> ver >> L;
    --ver;
    vector<int> ids;
    while(ver >= limit){
      ids.push_back(ver);
      ver = (ver - 1) / 2;
    }
    int sz = (int) ids.size();
    int ans = 0;
    for(int t = 0; t < (1 << sz); t++){
      int sv = 0, sw = 0;
      for(int i = 0; i < sz; i++){
        if(t & (1 << i)){
          sv += v[ids[i]];
          sw += w[ids[i]];
        }
      }
      if(sw <= L){
        ans = max(ans, dp[ver][L - sw] + sv);
      }
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 206544
let id x = x in
let n = Scanf.scanf "%d\n" id in
let list =  (0,0,0) :: (Array.to_list @@ Array.init n (fun _ ->
    Scanf.scanf "%d %d %d\n" (fun a b c-> a, b, c))) in
   
let rec check : (int*int*int) list -> string =
  fun list ->
  match list with
  | [] -> "Yes"
  |  _ :: [] -> "Yes"
  | (t, x, y) :: ((t', x', y') as next) :: rest ->
     let dift=t'-t in
     let difd=x'-x+(y'-y) in
     if (dift+difd) mod 2 = 0 && difd<=dift
     then check (next :: rest)
     else "No" in

print_string (check list)
;;
  

Measured memory_bytes: 8448
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
char a[101];
bool check()
{
	int len=strlen(a+1);
	for(int i=1;i<=len;i++)
		if(a[i]!=a[len-i+1])
			return false;
	int t=(len-1)/2;
	for(int i=1;i<=t;i++)
		if(a[i]!=a[t-i+1])
			return false;
	t=(len+3)/2;
	for(int i=t;i<=len;i++)
		if(a[i]!=a[len-i+t])
			return false;
	return true;
}
int main()
{
	scanf("%s",a+1);
	if(check())
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define MOD 1000000007

int main(){
  int n,h;
  cin>>n>>h;
  vector<int> a(n),b(n);
  for(int i=0;i<n;i++){
    cin>>a[i]>>b[i];
  }
  sort(a.rbegin(),a.rend());
  sort(b.rbegin(),b.rend());
  int ind=0;
  ll ans=0;
  while(h>0){
    if(b[ind]>a[0]&&ind<n){
      h-=b[ind];
      ind++;
      ans++;
    }else{
      if(h%a[0]){
        ans+=h/a[0]+1;
      }else{
        ans+=h/a[0];
      }
      break;
    }
  }
  cout<<ans<<endl;
  return 0;
}

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

#define int long long int
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define lb lower_bound
#define ub upper_bound
#define srt(a) sort(a.begin(),a.end())
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
#define mxe(a) *max_element(a.begin(),a.end())
#define mne(a) *min_element(a.begin(),a.end())
#define endl '\n'
#define mod 1000000007
#define INF64 1e18

/*int power(int a,int b){
  int res=1;
  while(b>0){
    if(b&1)(res*=a)%=mod;
    (a*=a)%=mod;
    b>>=1;
  }
  return res;
}*/

void solve(){
  int n,w;cin>>n>>w;
  vi wt(n+1),v(n+1);
  for(int i=1;i<=n;i++)
  cin>>wt[i]>>v[i];
  vvi dp(n+1,vector<int>(w+1));
  for(int i=1;i<=n;i++){
    for(int j=0;j<=w;j++){
      if(wt[i]<=j){
        dp[i][j]=max(dp[i-1][j],v[i]+dp[i-1][j-wt[i]]);
      }
      else dp[i][j]=dp[i-1][j];
    }
  }
  cout<<dp[n][w];  
}

int32_t main(){
  #ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
  #endif
  
  ios_base::sync_with_stdio(false);
  cin.tie(0);cout.tie(0);

  int T=1;
  //cin>>T;
  for(int TT=1;TT<=T;TT++){
    solve();
  }
}

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

using namespace std;
using ll =long long;
using db = double;

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

#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define leftunique(v) SORT(v);(v).erase(unique((v).begin(),(v).end()),(v).end())
//leftuniqueは配列から同じ要素のものを取り除く 例 4 6 2 1 3 4 1 2 なら 1 2 3 4 6 になる
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
bool coY() {cout <<"Yes"<<endl;}
bool coN(){cout <<"No"<<endl;}
const int mod = 1e9 + 7;
const ll INF = 1LL << 60;

//ここから書き始める
int main()
{
	cout << setprecision(10);
	int n;
	cin >> n;
	vector<int> withdraw(0);
	withdraw.push_back(1);
	int rok = 6;
	for(rok ; rok <=100000 ; rok *=6){
		withdraw.push_back(rok);
	}
	for(int kyu = 9; kyu <=100000; kyu *= 9){
		withdraw.push_back(kyu);
	}
	SORT(withdraw);
	int k = withdraw.size();

	ll dp[100100];
	rep(i,100100){
		dp[i] = INF ;
	}

	dp[0] = 0; //dp[i] は 1円にするのに必要な最低の操作回数
	rep(i,n+1){
		rep(j,k){
			if(i+withdraw[j]<100100){
				chmin(dp[i+withdraw[j]], dp[i] + 1 );
			}
		}
	}
	cout << dp[n] << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

int main(){
    int n,k;
    string s;
    cin >> n >> k >> s;
    int r = 0,l = 0;
    int sum = 0;
    ll ans = 0;
    for(int l=0;l<n;l++){
        int ma = 2*k - (s[l]=='0');
        while(sum<=ma){
            if(r==n) break;
            else{
                if(s[r]!=s[r+1]) sum++;
                r++;
            }
        }
        if(s[l]!=s[l+1]) sum--;
        //cout << l << " " << r << endl;
        chmax(ans,r-l);
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
import sys
def I(): return int(sys.stdin.readline())
def LI(): return [int(x) for x in sys.stdin.readline().split()]

def main():
    N = I()
    S,T = sys.stdin.readline()[:-1].split()

    ans = ""
    for i in range(N):
        ans += S[i]
        ans += T[i]

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 38256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <string>
#include <numeric>
#include <math.h>
#include <set>
#include <map>
#include <fstream>
#include <sstream>
#include <iterator>
#include <complex>
using namespace std;

int main()
{
	int N,X;
	cin>>N>>X;
	vector<int> D(N+1);
	D[0] = 0;
	int result = N+1;
	for(int i=0; i<N; i++)
	{
		int l;
		cin>>l;
		D[i+1] = D[i] + l;
		if(D[i+1] > X)
		{
			result = i+1;
			break; 
		}
	}
	cout<<result<<endl;

	return 0;
}

Measured memory_bytes: 256
/**
 *   author: malviyanshiv
 *   created: 09 January 2019  23:27:27
**/

#include <bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for(int i = a; i < b; i++)
#define RREP(i, a, b) for(int i = a-1; i >= b; i--)
#define PB push_back
#define MP make_pair
#define MOD 1000000007
#define INF 0x7fffffff
#define MAX 100005

typedef long long ll;
typedef pair< int, int > PII;

void fastscan(int &x){
    bool neg=false;
    register int c;
    x =0;
    c=getchar();
    if(c=='-'){
        neg = true;
        c=getchar();
    }
    for(;(c>47 && c<58);c=getchar())
        x = (x<<1) + (x<<3) +c -48;
    if(neg)
        x *=-1;
}

void optimizeIO(){
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
}

vector<int> adj[MAX];
vector<int> rev[MAX];
int cnt = 0;
vector<int> top(MAX);
vector<int> vis(MAX, 0);
vector<int> dp(MAX, -1);

void dfs(int node){
    vis[node] = 1;
    for(int a : adj[node])
        if( !vis[a] )
            dfs(a);
    vis[node] = 2;
    top[cnt++] = node;
}

int cal(int idx){
    if( vis[idx] )
        return dp[idx];
    int res = 0;
    for(int a: rev[idx])
        if( !vis[a])
            res = max(res, cal(a)+1);
        else
            res = max(res, dp[a]+1);
    vis[idx] = 1;
    return dp[idx] = res;
}


int main(){
	optimizeIO();
    int n, m, a, b;
    cin >> n >> m;
    REP(i, 0, m){
        cin >> a >> b;
        a--, b--;
        adj[a].push_back(b);
        rev[b].push_back(a);
    }
    // finding topological sorting
    REP(i, 0, n)
        if( !vis[i] )
            dfs(i);
    // printing the order
    reverse(top.begin(), top.begin()+n);
    /*cout << "Odering : " << endl;
    REP(i, 0, n)
        cout << top[i] << " ";
    cout << endl;*/
    REP(i, 0, n)
        vis[i] = false;

    int maxi = 0;
    for(int i = n-1; i>=0; i--){
        if( !vis[top[i]] ){
            maxi = max(cal(top[i]), maxi);
            vis[top[i]] = 1;
        }else{
            maxi = max(dp[top[i]], maxi);
        }
    }
    cout << maxi << endl;
	return 0;
}

Measured memory_bytes: 17024
import numpy as np
from scipy.sparse.csgraph import floyd_warshall
n = int(input())
a = np.array([[int(i) for i in input().split()] for i in range(n)])
d,ans = floyd_warshall(a,directed=False),0
if any(a[i][j]!=d[i][j] for i in range(n) for j in range(n)): ans = -1
else:
	inf = 10**10
	for i in range(n): a[i][i] = inf
	for i in range(n):
		for j in range(i+1,n):
			num = np.min(a[i]+a[j])
			if num>a[i][j]: ans+=a[i][j]
print(int(ans))

Measured memory_bytes: 18032
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    string s;
    cin >> s;
    int cur = 0, ans = 0;
    for (auto &&i : s) {
        if(i == 'L') cur--;
        else cur++;
        if(cur == 4) ans++;
        cur %= 4;
    }
    cout << ans << "\n";
    return 0;
}


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

// ---- ----

int main() {
	IN(LL, n);
	LL ans = 0;
	inc(i, n) { ans += (i + 1) * (n - i); }
	inc(i, n - 1) {
		IN(LL, a, b);
		a--; b--;
		if_not(a <= b) { swap(a, b); }
		ans -= (a + 1) * (n - b);
	}
	OUT(ans);
}


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

int main(int argc, char const *argv[]) {
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;

    string ans;
    for (size_t i = 0; i < n; i++) {
        ans += s[i];
        ans += t[i];
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3616
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class Main {

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

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			int n = in.nextInt();
			HashSet<String> dic = new HashSet<String>();
			for (int i = 0; i < n; i++) {
				String command = in.nextString();
				String str = in.nextString();
				if ("insert".equals(command)) {
					dic.add(str);
				} else if ("find".equals(command)) {
					String res = dic.contains(str) ? "yes" : "no";
					out.println(res);
				}
			}
		}

	}

	static class ArrayUtils {
		public static Map<Integer, Integer> getCountMap(int[] array) {
			Map<Integer, Integer> map = new TreeMap<>();
			for (int x : array)
				map.merge(x, 1, Integer::sum);
			return map;
		}

	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

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

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

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

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

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

	}

}



Measured memory_bytes: 130200
n, t = map(int, input().split())
A = list(map(int, input().split()))

min_a = A[0]
diff = 0
count = 0

for i in range(1, len(A)):
    if A[i] <= min_a:
        min_a = A[i]
    elif A[i] - min_a == diff:
        count += 1
    elif A[i] - min_a > diff:
        diff = A[i] - min_a
        count = 1

print(count)
    


Measured memory_bytes: 14292
#include <iostream>
#define int long long
using namespace std;

//(4x + 0)～(4x + 3)のxorは0
int f(int n) {
	if (n <= 0) return 0;
	int ret = 0;
	for (int i = (n / 4) * 4; i <= n; i++) {
		ret ^= i;
	}
	return ret;
}

signed main() {
	int a, b;
	cin >> a >> b;
	cout << (f(b) ^ f(a - 1)) << endl;
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> x;
  for (int i = 0; i <= n-1; ++i) {
    int a;
    cin >> a;
    x.push_back(a);
  }

  int res = 0;
  for(int i = 0; i <= n-3; ++i) {
    res = res + min(x[i],x[i+1]);
  }
  res = res + x[n-2];
  res = res + x[0];
  
     
  cout << res << endl;

}


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

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<map>
#include<stack>
#include<queue>
#include<math.h>


using namespace std;


int main() {

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	long long int n;
	cin >> n;
	if (n >= 400 && n <= 599)
	{
		cout << "8" << endl;
	}
	else if (n >= 600 && n <= 799)
	{
		cout << "7" << endl;
	}

	else if (n >= 800 && n <= 999)
	{
		cout << "6" << endl;
	}

	else if (n >= 1000 && n <= 1199)
	{
		cout << "5" << endl;
	}

	else if (n >= 1200 && n <= 1399)
	{
		cout << "4" << endl;
	}

	else if (n >= 1400 && n <= 1599)
	{
		cout << "3" << endl;
	}

	else if (n >= 1600 && n <= 1799)
	{
		cout << "2" << endl;
	}

	else if (n >= 1800 && n <= 1999)
	{
		cout << "1" << endl;
	}

	return 0;


}

Measured memory_bytes: 3644
#include <iostream>

using namespace std;

#include <stdio.h>

int main()
{
    int a, b;

    cin >> a >> b;
    if (a > b)
        cout << "a > b" << endl;
    else if (a < b)
        cout << "a < b" << endl;
    else
        cout << "a == b" << endl;
}


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

int main() {
    int N, a[300000];
    cin >> N;
    for (int i = 0; i < 3 * N; i++) cin >> a[i];
    sort(a, a + 3 * N, greater<int>());
    long long max_sum_strength = 0;
    for (int i = 0; i < N; i++) {
        max_sum_strength += a[2 * i + 1];
    }
    cout << max_sum_strength << endl;
    return 0;
}

Measured memory_bytes: 1408
def m(L,R):
 T=[]
 for l in L[::-1]:
  while R and R[-1]>l:T+=[R.pop()]
  T+=[l]
 return R+T[::-1]
def d(A):
 l=len(A);global c;c+=l
 s=l//2;return m(d(A[:s]),d(A[s:]))if l>1 else A
c=-int(input())
print(*d(list(map(int,input().split()))))
print(c)


Measured memory_bytes: 61652
function isPrime(n) {
    if (n < 2) {
        return false;
    }
    if (n === 2 || n === 3 || n === 5) {
        return true;
    }
    if (n % 2 === 0 || n % 3 === 0 || n % 5 === 0) {
        return false;
    }
    var prime = 7;
    var step = 4;
    var limit = Math.sqrt(n);
    while (prime <= limit) {
      if (n % prime === 0) return false;
      prime += step;
      step = 6 - step;
    }
    return true;
};

function Main(input) {
    var N = parseInt(input[0], 10);
    
    var sqrt = Math.sqrt(N);
    if (Number.isInteger(sqrt)) {
        console.log(sqrt * 2 - 2);
    } else if (isPrime(N)) {
        console.log(N - 1);
    } else {
        for (var i = Math.ceil(sqrt); i > 0; i--) {
            if (N % i === 0) {
                return console.log(i + (N / i) - 2);
            }
        }
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));

Measured memory_bytes: 7500
unittest
{
	assert( [ "3 8" ].parse.expand.solve == "Yes" );
	assert( [ "2 100" ].parse.expand.solve == "No" );
	assert( [ "1 2" ].parse.expand.solve == "Yes" );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto xy = input.front.split.to!( long[] );
	return tuple( xy[ 0 ], xy[ 1 ] );
}

auto solve( long x, long y )
{
	foreach( i; 0L .. x + 1 )
	{
		if( i * 4 + ( x - i ) * 2 == y ) return "Yes";
	}
	return "No";
}


Measured memory_bytes: 2760
n,k = map(int, input().split())
p = list(map(int, input().split()))
for i in range(n):
    p[i] = (1+p[i])/2
x = 0
for i in range(k):
    x += p[i]
saidai = x
for i in range(n-k):
    x -= p[i]
    x += p[i+k]
    if x > saidai:
        saidai = x
print(saidai)

Measured memory_bytes: 25060
#include<iostream>
#include<math.h>
#include<stdio.h>
using namespace std;

int main(){
    double x1,x2,y1,y2,d;
    cin>>x1>>y1>>x2>>y2;
    d=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    //cout<<d<<endl;
    printf("%.5f\n",d);
    return 0;
}


Measured memory_bytes: 3212
//#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define se second
#define pi 2*acos(0)
#define PI 3.14159265358979323846264338

typedef long long ll;
typedef unsigned long long ull;
typedef pair < int , int > pii;
typedef pair < ll , ll > pll;

const int N = 100009;
const int MX = 123456;
const int mod = (int)1e9 + 7;
const int base = 97;
const ull BS1 = 10000019ULL;
const int INF = (1 << 29);

template < class T > inline void fastScan(T &x){
    register char c = getchar();
    int neg = 0; x = 0;
    for(   ; (c < 48 || c > 57) && (c != '-'); c = getchar());
    if(c == '-') { neg = 1; c = getchar(); }
    for(   ; c > 47 && c < 58; c = getchar()){
        x = (x << 1) + (x << 3) + c - 48;
    }
    if(neg) x = -x;
}

// OrderedSet
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template < typename T > using ordered_set = tree < T, null_type, greater < T >, rb_tree_tag, tree_order_statistics_node_update >;

//typedef uint64_t hash_t;
//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
//const int HASH_COUNT = 2;
//const hash_t HASH_P = (uint32_t)-13337;
//uniform_int_distribution<hash_t> MULT_DIST(0.25 * HASH_P, 0.75 * HASH_P);
//const hash_t HASH_MULT[HASH_COUNT] = {MULT_DIST(rng), MULT_DIST(rng)};

int h, n;

int A[N], B[N];
ll dp[1005][10005];

ll go(int pos, int rem){
  if(rem <= 0) return 0;
  if(pos >= n) return 1e9;
  if(dp[pos][rem] != -1){
    return dp[pos][rem];
  }
  /*ll ret = 1ll * 1e15;
  int turn = (rem / A[pos]) + (rem % A[pos] != 0);
  for(int i = 0; i <= turn; i++){
    ret = min(ret, i * B[pos] + go(pos + 1, rem - i * A[pos]));
  }*/
  return dp[pos][rem] = min(go(pos + 1, rem), B[pos] + go(pos, rem - A[pos]));
}

int main(){
  fastScan(h);
  fastScan(n);
  for(int i = 0; i < n; i++){
    fastScan(A[i]);
    fastScan(B[i]);
  }
  memset(dp, -1, sizeof dp);
  printf("%d\n", go(0, h));
}


Measured memory_bytes: 79360