akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long int
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t;
    //cin>>t;
    t=1;
    while(t--)
    {
        int a[6];
        int ans;
        for(int i=1;i<=5;i++)
        {
            cin>>a[i];
            if(a[i]==0)
                ans=i;
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 3604
from itertools import accumulate
from collections import Counter

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

B = [0] + list(accumulate(A))
C = Counter(B)

ans = 0
for i in set(B):
    p = C[i]
    ans += p*(p-1)//2

print(ans)


Measured memory_bytes: 53096
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll h,w;cin>>h>>w;
  string MP[h];
  for(int i=0;i<h;i++)
    cin>>MP[i];
  for(int i=0;i<h;i++){
    bool kai=true;
    for(int j=0;j<w;j++){
      bool can=true,can2=true;
      for(int ii=0;ii<h;ii++){
	if(MP[ii][j]=='#')can=false;
      }
      for(int jj=0;jj<w;jj++){
	if(MP[i][jj]=='#')can2=false;
      }
      if(!(can||can2)){
	cout<<MP[i][j];kai=false;
      }
    }
    if(kai==false)
      cout<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define R(i,c,n) for(int i=c;i<n;i++)
#define DEBUG(x) cerr << #x << ": " << x << endl;
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v)  sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back
using namespace std;
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,a,b;
  cin >> n >> a >> b;
  cout << min(a,b) << " ";
  if(a+b<n){
      cout << "0" << endl;
  }else{
      cout << a+b-n << endl;
  }
  return 0;
}

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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N; cin >> N;
	vector<int>a(N); rep(i, 0, N) { cin >> a[i]; }
	map<int, int>mp;
	for (auto x : a) {
		mp[x]++;
	}

	if (mp.size() == 3) {
		int flag = 0;
		vector<int>y;
		for (auto p : mp) {
			y.eb(p.second);
			flag ^= p.first;
		}
		Yes(y[0] == y[1] and y[1] == y[2] and flag == 0);
	}
	else if (mp.size() == 2) {
		Yes(mp[0] == N / 3);
	}
	else {
		Yes(mp[0] == N);
	}

	return 0;
}


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

int main() {
    int N, D;
    cin >> N >> D;
    vector<vector<int>> X(N, vector<int>(D));
    for (int i=0; i<N; i++) {
        for (int j=0; j<D; j++) cin >> X.at(i).at(j);
    }
    int ans = 0;
    for (int i=0; i<N; i++) {
        for (int j=i+1; j<N; j++) {
            int wa = 0;
            for (int k=0; k<D; k++) wa+=pow(X.at(i).at(k)-X.at(j).at(k),2);
            double dist = pow(wa,0.5);
            if (dist==floor(dist)) ans++;
        }
    }
    cout << ans;
}

Measured memory_bytes: 512
start, num_move, distance = map(int, input().split())

# move toward
desired_move = abs(start) // distance

another_move = num_move - desired_move
if another_move <= 0:
    ans_abs = abs(start) - num_move * distance
    print(ans_abs)

else:
    if another_move % 2 == 0:
        ans_abs = abs(start) - desired_move * distance
        print(ans_abs)
    else:
        ans_abs = abs(abs(start) - (desired_move+1) * distance)
        print(ans_abs)


Measured memory_bytes: 9160
N = input()
keta = len(N)
candidate = []

def dfs(s, level):
    if level == keta + 1:
        return
    
    if s=='':
        pass
    else:
        candidate.append(int(s))

    dfs(s + '3', level+1)
    dfs(s + '5', level+1)
    dfs(s + '7', level+1)

dfs('', 0)
ans = 0
for d in candidate:
    group = set(str(d))
    if (group == {'3', '5', '7'}) and (d<=int(N)):
        ans += 1
print(ans)

Measured memory_bytes: 4308
#include<bits/stdc++.h>
using namespace std;
int main () {
  int x, y;
  cin >> x >> y;
  for (int i = 0; i <= x; i ++) {
    int j = x - i;
    if ((2 * i + 4 * j) == y) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 3588
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;
//UnionFind
struct UnionFind {
    vector<int> par; // iの親の番号

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};
int main(){
    int n, m;
    scanf("%d %d", &n, &m);
    UnionFind sGroup(n + 1);
    for(int i = 0; i < m; i++){
        int a, b;
        scanf("%d %d", &a, &b);
        if(a < b){
            swap(a,b);
        }
        sGroup.unite(a,b);
    }
    vector<int> viCount(n+1, 0);
    for(int i = 1; i <= n; i++){
        viCount[sGroup.root(i)]++;
    }
    
    int nAns = 0;
    for(int i = 1; i <= n; i++){
        nAns = max(nAns, viCount[i]);
    }
    printf("%d", nAns);
    return 0;
}


Measured memory_bytes: 5372
#include<stdio.h>
#include<math.h>
int main(void){
    int n;
    double d;
    scanf("%d %lf",&n,&d);
    double x[n];
    double y[n];
    double D;
    int count=0;
    for(int i=0;i<n;++i){
        scanf("%lf %lf",&x[i],&y[i]);
    }
    for(int i=0;i<n;++i){
        D=sqrt(((x[i]*x[i])+(y[i]*y[i])));
        if(D<=d){
            ++count;
        }
    }
    printf("%d\n",count);
    return 0;
}

Measured memory_bytes: 5320
a = [list(map(int, input().split())) for _ in range(3)]

mark = [[False] * 3 for _ in range(3)]

n = int(input())

for _ in range(n):
    x = int(input())

    for i in range(3):
        for j in range(3):
            if a[i][j] == x:
                mark[i][j] = True

a = mark

for i in range(3):
    if all(a[i][j] == True for j in range(3)) or all(a[j][i] == True for j in range(3)):
        print('Yes')
        break
else:
    if all(a[i][i] == True for i in range(3)) or all(a[i][3-i-1] == True for i in range(3)):
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 3064
#define DEB
#include<bits/stdc++.h>
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;


#ifdef DEB
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

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

typedef long long int lint;
typedef pair<int,int> pi;

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fr<<','<<a.sc<<')';
    return out;
  }
}

//const int INF=5e8;

static const int MAX_NODE=400005;
static const int CHNUM=26;
struct node{
  node* nxt[CHNUM];
  int sum;
  bool term;
  void init(){
    memset(nxt,0,sizeof(nxt));
  }
};
node tree[MAX_NODE];
int cnt=1;
node* root=&tree[0];
void insert(const char *s){
  int len=strlen(s);
  node* cur=root;
  REP(j,len){
    cur->sum++;
    if(cur->nxt[s[j]-'a']==NULL){
      cur->nxt[s[j]-'a']=&tree[cnt++];
    }
    cur=cur->nxt[s[j]-'a'];
  }
  cur->term=1;
  cur->sum++;
}

int sml[100005][26][26];
int n;
string s[100005];
int base[100005];


void srch(const char* s,int id){
  int len=strlen(s);
  node* cur=root;
  REP(j,len){
    base[id]+=cur->term?1:0;
    int c=s[j]-'a';
    REP(k,26) if(c!=k && cur->nxt[k]!=NULL){
      sml[id][k][c]+=cur->nxt[k]->sum;
    }
    cur=cur->nxt[c];
  }
}

int main(){
  cin>>n;
  REP(i,n){
    cin>>s[i];
    insert(s[i].c_str());
  }
  REP(i,n){
    srch(s[i].c_str(),i);
  }
  int q;cin>>q;
  REP(i,q){
    int id;
    char perm[30];
    scanf("%d%s",&id,perm);
    --id;

    int res=0;
    REP(j,26) REPN(k,26,j+1) res+=sml[id][perm[j]-'a'][perm[k]-'a'];

    res+=base[id];

    cout<<res+1<<endl;
  }
  return 0;
}





Measured memory_bytes: 295680
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

using ll = long long;
using P = pair<int, int>;

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main() {
  // 入力
  int N, a, b;
  cin >> N >> a >> b;

  int ans = 0;
  for (int i = 1; i <= N; i++) {
    int sum = 0;
    int n = i;
    while (n) {
      int tmp = n % 10;
      sum += tmp;
      n /= 10;
    }
    if (a <= sum && sum <= b) ans += i;
  }

  // 解答
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
from decimal import Decimal
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
from decimal import *

N = INT()

ans = 0
a = 0
b = 0
ba = 0

for _ in range(N):
	s = input()
	ans += s.count("AB")
	if s[0] == "B" and s[-1] == "A":
		ba += 1
	elif s[0] == "B":
		b += 1
	elif s[-1] == "A":
		a += 1

if 1 < ba:
	ans += ba-1
	ba = 1

if a != 0 or b != 0:
	if ba == 1:
		ans += min(a, b) + 1
	else:
		ans += min(a, b)

print(ans)

Measured memory_bytes: 10488
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

import static java.lang.Integer.parseInt;

/**
 * Rectangle
 */
public class Main {

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

		StringTokenizer st = new StringTokenizer(br.readLine());

		int[] sides = new int[4];
		int total = 0;

		for (int i = 0; i < 4; i++) {
			sides[i] = parseInt(st.nextToken());
			total += sides[i];
		}

		Arrays.sort(sides);

		if (sides[0] == sides[1] && sides[2] == sides[3]) {
			System.out.println("yes");
		} else {
			System.out.println("no");
		}

	} // end main
}

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

int main(){
    string s;
    cin >> s;
    int ansm = 0,cnt = 0;
    for(int i = 0;i < s.size();i++){
        if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T')cnt++;
        else{
            ansm = max(ansm,cnt);
            cnt = 0;
        }
    }
    ansm = max(ansm,cnt);
    cout << ansm << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MAX 1000000000
#define fast_read ios::sync_with_stdio(0);cin.tie(0);
using namespace std;
ll n,ans;
int main()
{
    fast_read;
    cin>>n;
    vector< vector<int> >v(3);
    ll a[3][n];
    memset(a,0,sizeof(a));
    for (int i = 0;i<3;i++) {
        v[i].resize(n);
        for (int j = 0;j<n;j++)cin>>v[i][j];
        sort(v[i].begin(),v[i].end());
    }
    ll co = 0;
    for (int i = 0;i<n;i++) {
        a[1][i] = co;
        while (v[0].size() != 0&&v[0][0] < v[1][i]  ) {
            co++;
            a[1][i]++;
            v[0].erase(v[0].begin() + 0);
        }
    }
    co = 0;
    ll in = 0;
    for (int i = 0;i<n;i++) {
        a[2][i] = co;
        while ( v[1].size() != 0&&v[1][0] < v[2][i] ) {
            co+=a[1][in];
            a[2][i]+=a[1][in];
            v[1].erase(v[1].begin() + 0);
            in++;
        }
        ans += a[2][i];
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3840
x, n = list(map(int, input().split()))
if n >= 1:
    p = list(map(int, input().split()))

    sample = list(range(0,max(p)+2)) 
    reject = list(set(p))

    for i in range(len(reject)):
        sample.remove(reject[i])

    champ = abs(sample[0] - x)
    ans = sample[0]
    for i in range(1, len(sample)):
        if abs(sample[i] - x) < champ:
            champ = abs(sample[i] - x)
            ans = sample[i]
        elif abs(sample[i] - x) == champ:
            if ans >= sample[i]:
                ans = sample[i]
            else:
                pass
        else:
            pass

    print(ans) 

else:
    print(x)

Measured memory_bytes: 9232
n, m = map(int, input().split())

a = []
for _ in range(m):
    a.append(int(input()))
a.append(n+1)

def solve(a,n,m):
    for i in range(len(a)-1):
        if a[i+1] == a[i] + 1:
            return 0

    a_diff = [a[0]-1]
    for i in range(1, m+1):
        a_diff.append(a[i] - a[i-1] - 2)
    ans = 1
    for y in a_diff:
        if y == 0 or y == 1:
            continue
        ans *= count_way(y)
    return ans

def count_way(n):
    memo = [0]*(n+1)
    memo[0] = 1
    memo[1] = 1
    for j in range(n-1):
        memo[j+2] = memo[j+1] + memo[j]
    return memo[n]

print(solve(a,n,m)%1000000007)


Measured memory_bytes: 504344
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		int y = sc.nextInt();
		int osatu[] = { 10000, 5000, 1000 };
		int ans[] = { -1, -1, -1 };
		for (int i = 0; i <= n; i++) {
			if (y - i * osatu[0] > 5000 * (n - i)) {
			} else {
				for (int j = 0; j + i <= n; j++) {
					if (y - i * osatu[0] - j * osatu[1] - (n - i - j) * osatu[2] == 0) {
						ans[0] = i;
						ans[1] = j;
						ans[2] = n - i - j;
					}
				}
			}
		}
		System.out.println(ans[0] + " " + ans[1] + " " + ans[2]);
	}
}


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

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

int R, C; //行、列
int s[10][10000]; //せんべい
int s2[10][10000];
bool g[10][2047]; //組み合わせ

//組み合わせの生成
void gen(int n, int x) { //上からn+1列目、配列の格納番号
	if (n == R) return;

	REP(i, n) {
		g[i][x * 2 - 2] = g[i][x - 2];
		g[i][x * 2 - 1] = g[i][x - 2];
	}

	g[n][x * 2 - 2] = true;
	gen(n + 1, x * 2);
	g[n][x * 2 - 1] = false;
	gen(n + 1, x * 2 + 1);
	return;
}

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

	while (1) {
		int tori = 1; //2^R
		int ans = 0; //答え

		cin >> R >> C;
		if (R == 0 && C == 0) break;

		REP(i, R) tori *= 2; //tori = 2^R

		//組み合わせを生成
		gen(0, 1);

		REP(i, R) {
			REP(j, C) {
				cin >> s[i][j];
				s2[i][j] = s[i][j];
			}
		}

		REP(i, tori) {
			//その列の組み合わせでの最大個数
			int ma = 0;

			//行の反転
			REP(j, R) {
				if (g[j][i + tori - 2]) {
					REP(k, C) (s[j][k] == 0) ? s[j][k] = 1 : s[j][k] = 0;
				}
			}

			//全ての列について、多いほうをとる
			REP(j, C) {
				int O = 0, U = 0;//表の枚数、裏の枚数
				REP(k, R) (s[k][j] == 0) ? O++ : U++;
				ma += max(O, U);
			}

			if (ma > ans) ans = ma;

			REP(j, R) {
				REP(k, C) {
					s[j][k] = s2[j][k];
				}
			}
		}

		cout << ans << "\n";
	}

	return 0;
}


Measured memory_bytes: 3928
#include<iostream>
#include<string>
#include<math.h>
using namespace std;

int get_digit(int num){
  int digit = 0;
  if(num==0) digit++;
  else{
    while(num!=0){
      num /= 10;
      digit++;
    }
  }
  return digit;
}

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

  c = a*pow(10,get_digit(b)) + b;

  int count = 2;
  while(true){
    int pow_ = pow(count,2);
    if(pow_>c){
      cout << "No" << endl;
      break;
    }
    if(c==pow_){
      cout << "Yes" << endl;
      break;
    }
    count++;
  }
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<string>
using namespace std;

int main()
{
	int n, k, sum = 0;
	int multi=1,tmp=1;
	cin >> n >> k;

	for (int i = 1; i <= n; i++) {
		tmp = 1;
		while (i*tmp < k) tmp = tmp << 1;
		if (i == 1) multi = n * tmp;
		sum += multi / (n * tmp);
	}

	printf("%.15lf\n", (double)sum / multi);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<string>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<limits.h>
#define rep(i,n) for(ll i = 0; i < (ll)n; i++)
#define swap(a,b) a^=b;b^=a;a^=b;
#define chmax(a,b) {if(a < b) a = b;}
#define chmin(a,b) {if(a > b) a = b;}
using namespace std;
typedef long long ll;
ll gcd(ll, ll);
vector<bool> to_binary(int);
int sum(vector<int>);
int min(vector<int>);
int max(vector<int>);
ll nCr(ll n, ll r);

const ll INF = 1LL << 60;

typedef tuple<ll, ll> mtupl;

bool mycomp(mtupl x, mtupl y) {
	return get<1>(x) < get<1>(y);
}

vector<vector<ll>> memo;

ll get(int x, int y) {
	if (memo[x][y] != -1)
		return memo[x][y];

	if (x == 0) return 1;
	if (y < x) return 0;

	memo[x][y] = get(x, y - 1) + get(x - 1, y - 1);
	return memo[x][y];
}

ll mpow(ll a, ll b) {
	ll ans = 1;
	for (ll i = 0; i < b; i++) {
		ans *= a;
		ans %= 1000000007;
	}
	return ans;
}

ll nCr(ll n, ll r) {
	ll res = 1;
	for (int i = 0; i < r; i++) {
		res *= (n - i);
	}
	for (int i = 1; i <= r; i++) {
		res /= i;
	}
	return res;
}

int vsum(vector<int> v) {
	int res = 0;
	for (auto it = v.begin(); it != v.end(); it++)
		res += *it;
	return res;
}
int vmin(vector<int> v) {
	int min = INT32_MAX;
	for (auto it = v.begin(); it != v.end(); it++)
		min = std::min(min, *it);
	return min;
}
int vmax(vector<int> v) {
	int max = 0;
	for (auto it = v.begin(); it != v.end(); it++)
		max = std::max(max, *it);
	return max;
}

ll gcd(ll A, ll B) {
	if (A == 0 || B == 0) return max(A, B);
	int r = A % B;
	while (r != 0) {
		A = B;
		B = r;
		r = A % B;
	}

	return B;
}

vector<bool> to_binary(int x) {
	vector<bool> res;
	while (x != 0) {
		res.push_back(x % 2);
		x /= 2;
	}
	return res;
}

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//Program Start	

	int A, B;
	cin >> A >> B;
	cout << (A - B + 1) << endl;

ProgramEndPointLabel:;

	//Program End
	system("pause");

	return 0;
}




Measured memory_bytes: 504
#include <iostream>
#include <vector>
#include <algorithm> // sort
#include <map>       // pair
using namespace std;

int main()
{
    int A,B,C;
    cin>>A>>B>>C;
    int times;
    times = B/A;
    if(times>C)
    {
        cout<<C;
    }
    else
    {
        cout<<times;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <set>
#include <string.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REP3(i,st,en) for(ll (i)=(st);(i)<(en);(i)++)

using P = pair<ll, ll>;
const int MOD = 1e9+7;
const ll INF = 1e+14;
const double PI = 3.14159265349;




int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  
  if (S=="Sunny") cout << "Cloudy" << "\n";
  if (S=="Cloudy") cout << "Rainy" << "\n"; 
  if (S=="Rainy") cout << "Sunny" << "\n";

  return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/10;
    public static final int inf = Integer.MAX_VALUE/10;

    static void solve(InputReader in, PrintWriter out){
        int n = in.ni(), T = in.ni(), c = 0, t = 0;
        int min = inf;
        for (int i = 0; i < n; i++) {
            c = in.ni();
            t = in.ni();
            if(t<=T) min = Math.min(min, c);
        }
        out.println(min==inf?"TLE":min);
    }

    public static void main(String[] args) throws Exception{
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public Double nd(){
            return Double.parseDouble(ns());
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 23252
#pragma GCC Optimize("Ofast")
#pragma GCC Optimize "trapv"
#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> 

using namespace std;
//using namespace boost::multiprecision; 

#define FAST ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define TC int t; cin >> t; while(t--)
#define li long int
#define ll long long
#define ull unsigned long long 
#define Vec(x) vector <x>
#define Pai(x,y) pair <x,y>
#define Map(x,y) map <x,y>
#define UMap(x,y) unordered_map <x,y>
#define Set(x) set <x>
#define Sta(x) stack <x>
#define Qu(x) queue <x>
#define DQ(x) deque(x)
#define PriorQ(x)	priority_queue <x>
#define bg begin()
#define ed end()
#define sz size()
#define ct(x) count(x)
#define len length()
#define F first
#define S second
#define Makep make_pair
#define ins(x) insert(x)
#define ers(x) erase(x)
#define endl "\n";
#define MOD 1000000007
#define PI 2*acos(0.0)
#define clr() clear()
#define fori0(n) for(int i=0;i<n;i++)
#define foriab(a,b) for(int i=a;i<b;i++)
#define mem0(x) memset(x,0,sizeof(x))
#define mem1(x) memset(x,1,sizeof(x))
#define autoit(x) for(auto it=x.beg;it!=x.ed;it++)
#define count0(x) __builtin_popcount(x)
#define ret return 
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());

const ll Inf=1e9+5;

ll a[100005],freq[1000006],mx=INT_MIN;

namespace funset{
bool checkvow(char x){
	return ((0x208222)>>(x&(0x1f)))&1;
	}
ll highpow2(ll x){
	return (x&~(x-1));
	}
bool chk2(ll x){
		return (x&(x-1));
	}	
}

using namespace funset;

ll n, w;
ll wei[101],val[101],dp[1001][10001];

string s;


void solve(){
	ll n,d;
	cin >> n >> d;
	ll ans=0;
	while(n--){
		ll x,y;
		cin >> x >> y;
		if(x*x+y*y<=d*d)
				ans++;
	}
	cout << ans << endl;
}

int main(){
	auto beg=clock();
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif	
	FAST
	srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    solve();
	auto ted=clock();
	#ifndef ONLINE_JUDGE
	cout << (double)(ted-beg)/CLOCKS_PER_SEC << endl;
	#endif
	ret 0;
}

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

void solve(string s, string t)
{
    int sn = s.size(), tn = t.size();
    vector<vector<int>> positions(26);
    for (int i = 0; i < sn; i++)
    {
        positions.at(s.at(i) - 'a').push_back(i);
    }
    for (int i = 0; i < sn; i++)
    {
        positions.at(s.at(i) - 'a').push_back(sn + i);
    }

    for (int i = 0; i < tn; i++)
    {
        if (positions.at(t.at(i) - 'a').size() == 0)
        {
            cout << -1 << endl;
            return;
        }
    }

    int64_t res = 0, p = 0;
    for (int i = 0; i < tn; i++)
    {
        int p_n = *lower_bound(positions.at(t.at(i) - 'a').begin(), positions.at(t.at(i) - 'a').end(), p) + 1;
        if (p_n >= sn)
        {
            res += sn;
            p_n -= sn;
        }
        p = p_n;
    }
    res += p;
    cout << res << endl;
}

int main()
{
    string s, t;
    cin >> s >> t;
    solve(move(s), move(t));
    return 0;
}


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

#define rep(i,N) repv(i,0,N)
#define reps(i,N) repvs(i,0,N)
#define repv(i,a,b) for(int i=a;i<b;i++)
#define repvs(i,a,b) for(int i=a+1;i<=b;i++)
#define repr(i,N) for(int i=N-1;i>=0;i--)
#define reprs(i,N) for(int i=N;i>0;i--)

#define debug(a) if(isDebugMode) cout<<#a<<"="<<a<<","
#define debug2(a,b) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b
#define debug3(a,b,c) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c
#define debug4(a,b,c,d) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<","<<#d<<"="<<d
#define debugarr(arr,N){if(isDebugMode){ rep(i,N+1)\
	{if(arr[i]==INF)printf("INF ");\
		else cout<<arr[i]<<" ";} cout<<endl;}}
#define debugarr2(arr,N,M){if(isDebugMode) rep(i,N+1){rep(j,M+1)\
	{if(arr[i][j]==INF)printf(" INF");\
		else printf(" %3d",arr[i][j]);} cout<<endl;}}
#define pb push_back
#define pob pop_back
#define show(a) cout<<a<<endl;

auto chmax =[](int &a,int b){a=max(a,b);};
auto chmin =[](int &a,int b){a=min(a,b);};

typedef long long ll;
typedef pair<int,int> P;
const int INF=100000000;
const int dx[4]={ 0, 1, 0,-1};
const int dy[4]={ 1, 0,-1, 0};

bool isDebugMode=true;
//--------------------------------------//
string s[2];

int a[2][200000];
int main(){
	cin>>s[0]>>s[1];
	rep(i,2){
		int c=1;
		int d[30]={0};
		rep(j,s[0].size()){
			if(d[s[i][j]-'a']==0){
				d[s[i][j]-'a']=c;
				a[i][j]=c;
				c++;
			}
			else{
				a[i][j]=d[s[i][j]-'a'];
			}
		}
	}
	rep(i,s[0].size()){
		if(a[0][i]!=a[1][i]){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}


Measured memory_bytes: 2312
n=int(input())
s=input()
ans=0
import collections
for i in range(10):
  i=str(i)
  x=s.find(i)
  st=s[x+1::]
  if x<0 or n-x<3:pass
  else:
    for j in range(10):
      j=str(j)
      y=st.find(j)
      if y<0 or len(st)-y<2:pass
      else:
        ans+=len(set(st[y+1::]))
print(ans)

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

constexpr int inf = 1e9;
constexpr ll linf = 1e18;

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

    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max(0, min(b,  d) - max(a, c)) << endl;
    return 0;
}

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

int main(int argc, char *argv[]) {
  std::string s;
  cin >> s;
  int K;
  cin >> K;

  std::vector<std::string> v;

  for(int i = 1; i <= K; i++) {
    for(int j = 0; j <= s.size() - 1 ; j++) {
      v.push_back(s.substr(j, i));
    }
  }
  sort(v.begin(), v.end());
  unique(v.begin(), v.end());
  cout << v[K-1] << endl;
  return 0;
}


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

int main () {
      char s[1005];
      cin >> s;
      int n = strlen(s);
      if (s[n-1]=='s') {
            cout << s << "es" << endl;
      }
      else {
            cout << s << "s" << endl;
      }
      return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define _MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) _MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define pb push_back
#define all(x) begin(x),end(x)
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cerr<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cerr<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.first<<","<<p.second<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
#else
#define dbg(...) {}
#endif

class SCC {
private:
  vector<vector<int>> &G;
  vector<vector<int>> &rG;
  vector<bool> used;
  vector<int> vs;
  int n;
  void dfs(int v){
    used[v] = true;
    for(auto to : G[v]) if(!used[to]) dfs(to);
    vs.pb(v);
  }
  void rdfs(int v, int k){
    used[v] = true;
    cmp[v] = k;
    groups.back().pb(v);
    for(auto to : rG[v]) if(!used[to]) rdfs(to, k);
  }
public:
  vector<int> cmp; //頂点iが属するSCCのID
  vector<vector<int>> groups; // SCCのトポロジカル順i番目に属する頂点番号群
  int gc = 0; // group count
  SCC(vector<vector<int>> &g, vector<vector<int>> &r) : G(g), rG(r){
    n = G.size();
    used = vector<bool>(n, false);
    cmp.resize(n);
    rep(i,n) if(!used[i]) dfs(i);
    fill(all(used), false);
    for(int i=vs.size()-1; i>=0; i--) if(!used[vs[i]]){
      groups.pb(vector<int>());
      rdfs(vs[i], gc++);
    }
  }
  inline bool same(int i, int j){ return cmp[i]==cmp[j]; }
  inline int operator[](int i){ return cmp[i]; }
};

int main(){
  int n;
  cin>>n;
  map<pair<int,int>, int> num;
  rep(i,n) rep(j,i) {
    int x = num.size();
    num[{j,i}] = x;
  }

  vector<vector<int>> to(num.size());
  vector<vector<int>> from(num.size());

  rep(i,n){
    vector<int> tmp;
    rep(j,n-1){
      int k; cin>>k;
      k--;
      tmp.pb(num[{min(i,k), max(i,k)}]);
    }
    rep(j,n-2) {
      to[tmp[j]].pb(tmp[j+1]);
      from[tmp[j+1]].pb(tmp[j]);
    }
  }

  // SCC scc(to, from);

  // for(auto &v : scc.groups) if(v.size() > 1) {
  //   cout << -1 << endl;
  //   return 0;
  // }

  vector<int> nxt;
  vector<int> d(num.size());
  rep(i,num.size()) {
    d[i] = from[i].size();
    if(d[i]==0) nxt.pb(i);
  }

  int ans = 0;
  int visited = num.size();
  while(visited > 0) {
    ans++;
    vector<int> tmp;
    if(nxt.size() == 0) {
      cout << -1 << endl;
      return 0;
    }
    for(auto v : nxt) {
      visited--;
      for(auto i : to[v]) {
        d[i]--;
        if(d[i]==0) tmp.pb(i);
      }
    }
    swap(tmp, nxt);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 88064
#include<bits/stdc++.h>
using namespace std;
long long n,m,k,ans=0;
string s;
int main(){
  cin >> n >> m >> k;
  for(int i=n;i<=m;i++){
    if(i<=n+k-1||i>=m-k+1){
      cout << i << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

const MOD = 1000000007

func ModAdd(a, b int64) int64 {
	return (a + b) % MOD
}

func ModMul(a, b int64) int64 {
	return a * b % MOD
}

func ModSub(a, b int64) int64 {
	r := (a%MOD - b%MOD) % MOD
	if r < 0 {
		r += MOD
	}
	return r
}

func ModDiv(a, b int64) int64 {
	return a % MOD * ModInv(b) % MOD
}

func ModPow(a, n int64) int64 {
	var r int64 = 1
	for n > 0 {
		if n&1 == 1 {
			r = r * a % MOD
		}
		a = a * a % MOD
		n >>= 1
	}
	return r
}

func ModInv(a int64) int64 {
	var b, u, v int64 = MOD, 1, 0
	for b > 0 {
		t := a / b
		a -= t * b
		a, b = b, a
		u -= t * v
		u, v = v, u
	}
	u %= MOD
	if u < 0 {
		u += MOD
	}
	return u
}

func main() {
	var N, K, Q int
	fmt.Scanf("%d %d %d\n", &N, &K, &Q)

	m := map[int]int{}
	for i := 0; i < Q; i++ {
		var a int
		fmt.Scan(&a)
		m[a] += 1
	}
	for i := 1; i <= N; i++ {
		if K-(Q-m[i]) > 0 {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}
}


Measured memory_bytes: 8448
#include <bits/stdc++.h>
#define INF 1e9
#define endl '\n'
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define FORE(i, a, b) for (int i = (a), e = (b); i < e; ++i)
#define RFORE(i, a, b) for (int i = (b)-1, e = (a); i >= e; --i)
#define ALL(x) (x).begin(), (x).end()
#define SORT(c) sort((c).begin(), (c).end())
#define SORTR(c) sort((c).begin(), (c).end(), greater<int>())
using namespace std;
typedef long long ll;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    cin >> N;
    // int even = 0;
    int odd = 0;
    for (int i = 0; i < N; i++) {
        int tmp;
        cin >> tmp;
        if (tmp % 2 == 1) { ++odd; }
        // if (tmp % 2 == 0) {
        //     ++even;
        // } else {
        //     ++odd;
        // }
    }
    // even += odd / 2;
    // even %= 2;
    // odd %= 2;
    if (odd % 2 == 1) {
        cout << "NO" << endl;
    } else {
        cout << "YES" << endl;
    }
}


Measured memory_bytes: 3632
#include <iostream>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> pii;
typedef pair<ll,ll> pll;
 
 
/*bool compare_function(const pair<int, int> a, const pair<int, int> b)
{
    return a.first < b.first;
}*/
// use case
//sort(V.begin(), V.end(), compare_function);
 
/*struct compare
{
    bool operator ()(const pair<int, int> &a, const pair<int, int> &b) {
    if (a.second-a.first==b.second-b.first)
    {
        return a.first>b.first;
    }
    return a.second-a.first < b.second-b.first;}
};
priority_queue <pair<int,int>, vector <pair<int,int>>, compare> Q;*/
 
void print(vector <int> X)
{
    for (int i=2; i<X.size(); i++)
    {
        cout<<X[i]<<endl;
    }
    return;
}
 


void solve(vector <set<int>> &G, int n) {
	vector <int> A(n+1,0);
	queue <int> Q;
	A[1]=1;
	Q.push(1);
	while (!Q.empty()) {
		int a=Q.front();
		Q.pop();
		for (int u:G[a]) {
			if (A[u]==0) {A[u]=a; Q.push(u);}
			}
		}
	A[1]=0;
	for (int i=2;i<=n;i++) {
		if (A[i]==0) {cout<<"No"<<endl; return;}
		}
	cout<<"Yes"<<endl;
	print(A);
	return;
	}
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n,m;
    cin>>n>>m;
    vector <set<int>> G(n+1);
    for (int i=0;i<m;i++) {
		int a,b;
		cin>>a>>b;
		G[a].insert(b);
		G[b].insert(a);
		}
	solve(G,n);
    return 0;
}


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

int main(void){
  int w, h, n;
  vector<int> x(100), y(100), a(100);

  cin >> w >> h >> n;

  int wu = 0, hu = 0;

  for(int i = 0; i < n; i ++)
      cin >> x.at(i) >> y.at(i) >> a.at(i);

  for(int i = 0; i < n; i ++){
    if(a.at(i) == 1) wu = (wu < x.at(i)) ? x.at(i) : wu;
    if(a.at(i) == 2) w = (w > x.at(i)) ? x.at(i) : w;
    if(a.at(i) == 3) hu = (hu < y.at(i)) ? y.at(i) : hu;
    if(a.at(i) == 4) h = (h > y.at(i)) ? y.at(i) : h;
  }
  
  if((w - wu) <= 0 || (h - hu) <= 0) cout << 0 << endl;
  else cout << (w-wu) * (h-hu) << endl;

  return 0;
}


Measured memory_bytes: 256
import math
h, w = map(int, input().split())

if h % 2 == 1:
    ch1 = math.ceil(h/2)
    ch2 = math.floor(h/2)
else:
    ch1 = h//2
    ch2 = h//2
    
if w % 2 == 1:
    cw1 = math.ceil(w/2)
    cw2 = math.floor(w/2)
else:
    cw1 = w//2
    cw2 = w//2
    
ans = ch1 * cw1 + ch2 * cw2

if h == 1 or w == 1:
    ans = 1
print(int(ans))

Measured memory_bytes: 3064
from collections import deque
K = int(input())
d = deque(range(1, 10))
for i in range(K):
    x = d.popleft()
    if x % 10 != 0:
        d.append(10*x+(x % 10)-1)
    d.append(10*x+(x % 10))
    if x % 10 != 9:
        d.append(10*x+(x % 10)+1)
print(x)

Measured memory_bytes: 11908
#include<stdio.h>
#include<string.h>
#define M 1046527
#define NIL (-1)
#define L 14
char H[M][L];
int getChar(char ch){
  if(ch == 'A') return 1;
  else if(ch == 'C') return 2;
  else if(ch == 'G') return 3;
  else if(ch == 'T') return 4;
  else return 0;
}
long long getKey(char str[]){
  long long sum = 0,p = 1, i;
  for(i=0;i<strlen(str);i++){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}
int h1(int key){ return key % M;}
int h2(int key){ return 1 + (key % (M-1));}
int find(char str[]){
    long long key,i,h;
    key = getKey(str);
    for(i=0;;i++){
      h = (h1(key)+i*h2(key))%M;
      if(strcmp(H[h],str)==0) return 1;
      else if(strlen(H[h])==0) return 0;

    }
    return 0;
}
int insert(char str[]){
  long long key,i,h;
  key = getKey(str);
  for(i=0;;i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h],str)==0) return 1;
    else if(strlen(H[h])==0){
      strcpy(H[h],str);
      return 0;
    }
  }
  return 0;
}
int main(){
  int i,n,h;
  char str[L],com[9];
  for(i=0;i<M;i++) H[i][0]='\0';
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s %s",com,str);
    if(com[0]=='i'){
      insert(str);
    }else{
      if(find(str)){
	printf("yes\n");
      }else{
	printf("no\n");
      }
    }
  }
  return 0;
}



Measured memory_bytes: 16036
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include <set>
#include <cmath>
#include <array>
#include <bitset>
using namespace std;

typedef long long ll;
const ll mod=1000000007;

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


array<ll,2> inv(ll a,ll m){
    array<ll,2> val;
    a=a%m;
    if(a==1){
        val[0]=1;
        val[1]=0;
    }else{
        array<ll,2> hoge;
        ll k=m/a,mm=m%a;
        hoge=inv(mm,a);
        val[1]=hoge[0]-k*a;
        val[0]=hoge[1]-k*hoge[0]+k*m;
    }
    if(val[0]>m-1){
        ll n=val[0]/m;
        val[0]=val[0]%m;
        val[1]=val[1]+n*a;
    }
    return val;
}

int main(){
    int N,A,B,C;
    cin>>N>>A>>B>>C;
    ll frac[200000],pa[100001],pb[100001],fracinv[100001];
    frac[0]=pa[0]=pb[0]=fracinv[0]=1;
    ll invab=inv(A+B,mod)[0];
    ll Atot=(A*invab)%mod,Btot=(B*invab)%mod;
    Rep(i,N){
        pa[i]=(pa[i-1]*Atot)%mod;
        pb[i]=(pb[i-1]*Btot)%mod;
    }
    Rep(i,2*N-1){
        frac[i]=(frac[i-1]*i)%mod;
        if(i<=N){
            fracinv[i]=inv(frac[i],mod)[0];
        }
    }
    ll ans=0,t;
    rep(x,N){
        t=(pa[N]*pb[x]+pb[N]*pa[x])%mod;
        t=(t*frac[N+x])%mod;
        t=(t*fracinv[N])%mod;
        t=(t*fracinv[x])%mod;
        ans=(ans+t)%mod;
    }
    ans=(ans*N)%mod;
    ans=((ans*100%mod)*invab)%mod;
    cout<<ans<<endl;
    return 0;
}

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

const int M = 55555;
int d[M + 1];
vector<int> v;

int main() {
	inc1(i, M) {
		for(int j = i; j <= M; j += i) { d[j]++; }
	}
	
	incII(i, 2, M) { if(d[i] == 2 && i % 10 == 1) { v.PB(i); } }
	
	int n;
	cin >> n;
	inc(i, n) { cout << (i == 0 ? "" : " ") << v[i]; }
	cout << endl;
	
	return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

double getcog(vi& ps,vi& ws)
{
	int size=ps.size();
	int temp=0;
	rep(i,size)
		temp+=(i+1)*ws[ps[i]];
	return (double)temp/accumulate(allof(ws),0);
}

int main()
{
	for(int n;cin>>n,n;){
		vs ns(n);
		vi ws(n),cs(n);
		rep(i,n)
			cin>>ns[i]>>ws[i]>>cs[i];
		
		double cog=1e10;
		vi ps(n),res(n);
		vi ss(n);
		rep(i,n) ps[i]=i;
		do{
			for(int i=n-2;i>=0;i--)
				ss[i]=ss[i+1]+ws[ps[i+1]];
			bool ok=true;
			rep(i,n)
				ok&=ss[i]<=cs[ps[i]];
			if(ok){
				double temp=getcog(ps,ws);
				if(temp<cog){
					cog=temp;
					res=ps;
				}
			}
		}while(next_permutation(allof(ps)));
		
		rep(i,n)
			cout<<ns[res[i]]<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 916
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
#define endl '\n'
#define ld long double
#define all(a) a.begin(),a.end()
#define int long long
#define pb push_back
#define pii pair <int, int>
#define ff first
#define ss second
#define sz(v) (int)v.size()
#define UB upper_bound
#define LB lower_bound
#define BP(x) __builtin_popcountll(x)
#define PQS priority_queue <int, vector<int>, greater<int> >
#define OST tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update>
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int getRand(int l, int r) {
  uniform_int_distribution<int> uid(l, r);
  return uid(rng);
}

const int INF = 1e18 + 0;
const int mod = 1e9 + 7;
//const int mod = 998244353;

int mul(int a, int b) {
  a += mod; b += mod;
  a %= mod; b %= mod; return ((a * b) % mod);
}
void solve(){
    int n,k;
    cin>>n>>k;
    int K=k;
    vector<int>pos,neg,zero;
    vector<pair<int,int>>v(n);
    for(int i=0;i<n;i++){
        int d;
        cin>>d;
        if(d>0)pos.push_back(d);
        else if(d<0)neg.push_back(abs(d));
        else zero.push_back(d);
        int s;
        if(d>=0)s=1;
        else s=-1;
        v[i]={abs(d),s};
    }
    sort(pos.begin(),pos.end());sort(neg.begin(),neg.end());sort(v.begin(),v.end());
    int ans=1;
    int pcur=(int)pos.size()-1,ncur=(int)neg.size()-1;
    if(k%2){
        if(pos.size()){
            ans=mul(ans,pos[pcur]);
            pcur--;
            k--;
        }
    }
    while(k && (pcur>0 || ncur>0)){
        ll val1=-INF,val2=-INF;
        if(pcur>=1){
            val1=pos[pcur] * pos[pcur-1];
        }
        if(ncur>=1){
            val2=neg[ncur] * neg[ncur-1];
        }
        if(val1>val2){
            ans=mul(ans,val1);
            pcur-=2;
        }
        else{
            ans=mul(ans,val2);
            ncur-=2;
        }
        k-=2;
    }
    if(k){
        if(!zero.empty()){
            ans=0;
        }
        else{
            ans=1;
            for(ll i=0;i<K;i++){
                ans=mul(ans,v[i].first * v[i].second);
            }
        }
    }
    cout<<ans<<endl;
    return;
}
signed main() {
  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
   int t = 1;  //cin >> t;
   for(int i = 1; i <= t; i++) {
     solve();
  }
}



Measured memory_bytes: 8464
#include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
// #include <ext/rope>
// using namespace __gnu_cxx;
typedef long long int ll;
typedef long double ld;
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mxe(v) *max_element(v.begin(), v.end())
#define mne(v) *min_element(v.begin(), v.end())
#define ve vector
#define lb lower_bound
#define ub upper_bound
#define bb break
#define cc continue
#define rem 1000000007
#define PI 3.141592653589793238462643383279502
ll power(ll x, ll y, ll p)
{
    ll res = 1; // Initialize result
    x = x % p;  // Update x if it is more than or
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1; // y = y/2
        x = (x * x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p)
{
    return power(n, p - 2, p);
}
struct point
{
    ll x, y;
};
int main()
{
    FAST
    // freopen("input1.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    /*ll tests;
    cin>>tests;
    rep (gg,0,tests)
    {}*/
    ll n;
    cin>>n;
    ve <ll> arr(n);
    ll val=0;
    rep (i,0,n)
    {
        cin>>arr[i];
        val=(val^arr[i]);
    }
    rep (i,0,n)
    {
        cout<<(val^arr[i])<<" ";
    }

}


Measured memory_bytes: 4704