akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N, M;
    cin >> N >> M;
    vector<ll> info(N, -1);
    rep(i, M) {
        ll s, c;
        cin >> s >> c;
        s--;
        if (info[s] != -1 && info[s] != c) {
            cout << -1 << '\n';
            return;
        }
        info[s] = c;
    }

    ll base = 1;
    rep(i, N - 1) {
        base *= 10;
    }
    ll ne = base * 10;
    if (N == 1) {
        if (M == 0) {
            cout << 0 << '\n';
            return;
        } else {
            cout << info[0] << '\n';
            return;
        }
    }
    vector<ll> ans;
    rep2(i, base, ne) {
        string s = to_string(i);
        bool ok = true;
        rep(j, N) {
            ll b = info[j];
            if (b == -1) continue;
            if (b != (s[j] - '0')) ok = false;
        }
        if (ok) {
            ans.push_back(i);
        }
    }
    if (ans.size() == 0) {
        cout << -1 << '\n';
    }else {
        sort(ans.begin(), ans.end());
        cout << ans[0] << '\n';
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

//Polygon

struct point{
    double x=0,y=0;
    constexpr point(double x=0,double y=0):x(x),y(y){}
    constexpr bool operator==(const point& r)const{return (x==r.x&&y==r.y);};
    constexpr point operator+(const point& r)const{return point(*this)+=r;}
    constexpr point operator+=(const point& r){
        x+=r.x;y+=r.y;
        return *this;
    }
    constexpr point operator-(const point& r)const{return point(*this)-=r;}
    constexpr point operator-=(const point& r){
        x-=r.x;y-=r.y;
        return *this;
    }
    constexpr point operator*(const double& r)const{return point(*this)*=r;}
    constexpr point operator*=(const double& r){
        x*=r;y*=r;
        return *this;
    }
    constexpr point operator/(const double& r)const{return point(*this)/=r;}
    constexpr point operator/=(const double& r){
        x/=r;y/=r;
        return *this;
    }
};

double norm(const point& a){return a.x*a.x+a.y*a.y;}
double abs(const point& a){return sqrt(a.x*a.x+a.y*a.y);}
double dot_product(const point& a,const point& b){return a.x*b.x+a.y*b.y;}
double cross_product(const point& a,const point& b){return a.x*b.y-a.y*b.x;}
point projection(const point& p,const point& b){return b*dot_product(p,b)/norm(b);}
double area(const point& a,const point& b,const point& c){return cross_product(b-a,c-a)/2.0;}

point Point[110];

int main(){
    int n ;
    cin >> n;
    rep(i,n) scanf("%lf %lf",&(Point[i].x),&(Point[i].y));
    double sum = 0.0;
    for(int i=1;i<n-1;i++){
        sum += area(Point[0],Point[i],Point[i+1]);
    }
    printf("%.1f\n",abs(sum));
    return 0;
}


Measured memory_bytes: 3216
#include<stdio.h>
void sort(int *d){
	int i,j,t;
	for(i=0;i<5;i++){
		for(j=i;j<5;j++)
			if(d[i]<d[j]){
				t=d[i];
				d[i]=d[j];
				d[j]=t;
			}
	}
}
int Win(int j,int k){
	if((j==1 &&k==2 )||(j==2 &&k==1))return 1;
	if((j==2 &&k==3 )||(j==3 &&k==2))return 2;
	if((j==3 &&k==1 )||(j==1 &&k==3))return 3;
}
int main(){
	int n,c=0,i,j,k,W,d[5],_d[5];
	for(;scanf("%d",&n)&&n;c=0){
		_d[0]=d[0]=n;
		for(i=1;i<5;i++){
			scanf("%d",&d[i]);
			_d[i]=d[i];
		}
		sort(d);
		for(i=1;i<5;i++){
			if(d[i]!=d[i-1]){
				j=d[i];
				k=d[i-1];
				c++;
			}
		}
		if(c==0||c==2){
			for(i=0;i<5;i++)printf("3\n");
		}
		else {
			W=Win(j,k);
			for(i=0;i<5;i++){
				if(_d[i]==W)printf("1\n");
				else printf("2\n");
			}
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include<string>
#include<algorithm>
#define REP(i,n) for(int i=0; i<int(n); i++)
using namespace std;
int main() {
	int N = 2;
	int	K,Q;
	cin >> N >> K >> Q;
	vector<int> A(Q);
	vector<int> P(N, K - Q);
	for (int i = 0; i <Q; i++) {
		cin >> A[i];
	}
	for (int i = 0; i < Q; i++) {
		P[A[i] - 1] += 1;
	}
	for (int i = 0; i < N; i++) {
		if (P[i] <= 0) {
			cout << "No" << endl;
		}
		else {
			cout << "Yes" << endl;
		}
	}
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

int main() {
    string a,b,A,B;
    cin >> a >> b;

    A = a, B = b;
    FOR(i, 1, int(a[0] - '0')-1){
        B += b;
    }
    FOR(i, 1, int(b[0] - '0')-1){
        A += a;
    }
    cout << min(A, B) << endl;
}

Measured memory_bytes: 3564
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <math.h>
#include <time.h>
using namespace std;
int main() {
	string s;
	cin >> s;
	if (s[0] == 'Y'&&s[1] == 'A'&&s[2] == 'K'&&s[3] == 'I') {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define yn(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YN(ans) if(ans)printf("YES\n");else printf("NO\n")
#define vector1d(type,name,...) vector<type>name(__VA_ARGS__)
#define vector2d(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}
ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }
ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }
ll updivide(ll a,ll b){if(a%b==0) return a/b;else return (a/b)+1;}

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

long long int combination_mod(long long int a,long long int b){
    long long int ans=1;
    b=min(b,a-b);
    for(int i=0;i<b;i++){
        ans*=a-b+i+1;
        ans%=MOD;
        ans*=modinv(i+1,MOD);
        ans%=MOD;
    }
    return ans;
}

ll solve(int x,int y){
    ll distance=x+y;
    if(distance%3!=0)return 0;
    if(x<distance/3||y<distance/3)return 0;
    return combination_mod(distance/3,y-distance/3);
}

int main(){
    INT(x,y);
    out(solve(x,y));
}

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

vector<int> ch[100005];
int n;

int dfs(int at, int par=-1)
{
	int ans = 0;
	for (int u: ch[at]) if (u != par) ans ^= (dfs(u, at)+1);
	return ans;
}

int main()
{
	scanf("%d", &n);
	for (int i = 1;i < n;i++)
	{
		int a, b; scanf("%d%d", &a, &b);
		--a, --b;
		ch[a].push_back(b);
		ch[b].push_back(a);
	}
	if (dfs(0)) printf("Alice\n");
	else printf("Bob\n");
	return 0;
}


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

int main()
{
  int n, k, sum = 1;
  cin >> n >> k;
  
  for (int i = 0; i < n; i++) {
    if (sum*2 > sum+k)
      sum += k;
    else
      sum *= 2;
  }
  
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <strings.h>
using namespace std;

int main()
{
    int A,B,C,D;
    cin >> A >> B>> C >> D;
    while(1){
        C=C-B;
        if(C<=0){
            cout << "Yes";
            break;
        }
        A=A-D;
        if(A<=0){
            cout<<"No";
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
const int maxn = 440;
int n, c, d, l, r, deg[maxn], vis[maxn];
vector<int> g[maxn];
void add_edge(int l, int r) {
	l += maxn/2, r += maxn/2;
	deg[l]++, deg[r]--;
	g[l].push_back(r);
}
void dfs(int v) {
	vis[v] = 1;
	for(auto &i : g[v]) if(!vis[i]) dfs(i);
}
bool check() {
	dfs(0);
	for(int i = 0; i < maxn; i++) if(g[i].size() && (!vis[i] || deg[i])) return false;
	return true;
}
int main() {
	cin >> n >> r;
	map<int, int> L, R;
	while(n--) {
		cin >> l >> r >> c >> d;
		if(c > 0) l = -c;
		if(d > 0) r = -d;
		add_edge(l, -r);
		if(l < 0) R[-l]--;
		else L[l]++;
		if(r < 0) L[-r]--;
		else R[r]++;
	}
	for(auto i : L) {
		if(i.second < 0) return cout << "NO", 0;
		while(i.second--) add_edge(-220, i.first);
	}
	for(auto i : R) {
		if(i.second < 0) return cout << "NO", 0;
		while(i.second--) add_edge(-i.first, -220);
	}
	cout << (check()?"YES":"NO");
}


Measured memory_bytes: 1412
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include <algorithm>
#include <utility>
#include <set>
#include <queue>
#include <map>
#include <cmath>
#include <numeric>

using namespace std;

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

int main() {

    
    int n, kk;
    cin >> n >> kk;
    vector<int> v(n);
    for (int i = 0;i < n; ++i)
    {
        cin >> v[i];
    }
    vector<vector<ll>> all(n + 1, vector<ll>(n + 1, 0));
    
    for (int i = 0; i <= n; ++i)
    {
        for (int j = 0; j <= n; ++j)
        {
            vector<int> use;
            for (int k = 0; k < i; ++k)
            {
                use.push_back(v[k]);
            }
            for (int k = n - 1; k > max(n - 1 - j, i); --k)
            {
                use.push_back(v[k]);
            }
            sort(use.begin(), use.end());
            int c = 0;
            int can = kk - i - j;
            if (can < 0)
            {
                continue;
            }
            for (int k = 0; k < min(can, (int)use.size()); ++k)
            {
                if (use[k] < 0)
                {
                    c += 1;
                }
            }
            
            all[i][j] = accumulate(use.begin() + c, use.end(), 0ll);

        }
    }
    ll ret = 0;
    for (int i = 0; i <= n; ++i)
    {
        for (int j = 0; j <= n; ++j)
        {
            ret = max(ret, all[i][j]);
        }
    }
    
    cout << ret << endl;
    
    return 0;
}

Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0

using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/

map< int64_t, int64_t > prime_factor(int64_t n) {//素因数分解
	map< int64_t, int64_t > ret;
	for (int64_t i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

int main() {

	ll n, p;
	scanf("%lld%lld", &n, &p);
	auto a = prime_factor(p);
	ll ans = 1;
	for (auto aa : a) {
		if (aa.second >= n)ans *= pow(aa.first, aa.second / n);
	}
	printf("%lld\n", ans);

	Please AC;
}


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



if N==K:
    print(1)
elif K==2:
    print(N-1)
elif K==3:
    tmp = N//(K-1)
    if N%(K-1) == 2:
        print(tmp+1)
    else:
        print(tmp)
else:
    tmp = N//(K-1)
    print(tmp + (1 if N%(K-1) != 0 else 0))




Measured memory_bytes: 14008
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;

int main()
{
	int n, a, b;
	cin >> n >> a >> b;
	if ((n*a) < b)cout << n * a << endl;
	else cout << b << endl;

	return 0;
}

Measured memory_bytes: 256
S = str(input())

N_half_S = len(S) // 2
half_S = S[0:N_half_S]
convS = S[::-1]
convS = convS[0:N_half_S]

N_quoter_S = N_half_S // 2
quoter_S = half_S[0:N_quoter_S]
conv_quoter_S = half_S[::-1]
conv_quoter_S = conv_quoter_S[0:N_quoter_S]

if half_S == convS and quoter_S == conv_quoter_S :
  print("Yes")
else :
  print("No")
  


Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    int h,w;
    cin>>h>>w;
    char a[h][w];
    for (int i = 0; i <h ; ++i) {
        for (int j = 0; j < w; ++j) {
            cin>>a[i][j];
        }
    }

    int dp[h][w]={0};
    int x=1;
    for (int i = 0; i <h ; ++i) {
        if(a[i][0]=='#')
            x=0;
        dp[i][0]=x;
    }
    x=1;
    for (int i = 0; i < w; ++i) {
        if(a[0][i]=='#')
            x=0;
        dp[0][i]=x;
    }

    int z=pow(10,9)+7;

    for (int i = 1; i < h; ++i) {
        for (int j = 1; j < w; ++j) {
            if(a[i][j]=='#')
                dp[i][j]=0;
            else
            dp[i][j]=(dp[i][j-1]+dp[i-1][j])%z;
        }
    }
    cout<<dp[h-1][w-1];
}

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

#define ll long long
#define pb push_back
#define endl '\n'
#define fcin ios::sync_with_stdio(false); cin.tie(nullptr);
#define inf 0x3f3f3f3f

int main(){
    fcin;
    int a[5];
    for(int i = 0; i < 5; i++) cin >> a[i];
    int k;  cin >> k;
    for(int i = 0; i < 5; i++){
        for(int j = i+1; j < 5; j++){
            if(a[j] - a[i] > k) return cout << ":(", 0;
        }
    }
    cout << "Yay!";
    return 0;
}




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


using namespace std;

const int MAXN = 200010;
string S;
vector<pair< char, char> > Q;
int t;
int N;

bool check(int index, bool direcction) {
    char c = S[index];
   
    for (auto it: Q) { 
        //cout << c << " " << index << endl;
        if (c == it.first) {
            
            if (it.second == 'L') {
                index--;
            } else {
                index++;
            }

            if (direcction) {
                if (index < 1) return true;
            } else {
                if (index > N) return true;
            }
            // if (index < 1 || index > N) return true; 
            c = S[index];
        }
    }

    return false;
}

int find_me(int left ,int right, bool direction) {
    int ans = left - 1;
    if (!direction) ans = right + 1;
    while (left <= right) {
        int mid = (left + right) / 2;
        if (check(mid, direction)) {
            ans = mid;
            if (direction) {
                left = mid + 1;
            } else {
                right = mid - 1;
            }
        } else {
            if (direction) {
                right = mid - 1;
            } else {
                left = mid + 1;
            }
        }
    } 
    

    return ans;
}

int main() {

    cin >> N >> t;
    cin >> S;

    S = "0" + S + "0";
    for (char a,b;t--;) {
        cin >> a >> b;
        Q.push_back({a,b});
    }
    int rs = find_me(1, N, true);
    int lim = rs;

    // for (int i = 1; i <= N; i++) {
    //     if (check(i, true)) {
    //         rs = i;
    //         lim = i;
    //     } else {
    //         break;
    //     }
    // }

     int rs2 = N - find_me(lim + 1, N, false) + 1;
    // for (int i = N; i > lim; i--) {
    //     if(check(i, false)) {
    //         rs2 = N - i  + 1;
    //     } else break;
    // }

    //cout << rs << " " << rs2 <<endl;

    cout<< N - (rs +rs2);
    //cout << check(2, true);

    return 0;
}

Measured memory_bytes: 1240
n=int(input())
def moji(x):
    s=list(x)
    s.sort()
    return "".join(s)
li=[moji(input()) for i in range(n)]
li.sort()
k=1
res=0
for i in range(1,n):
    if li[i]==li[i-1]:
        k+=1
    else:
        res+=k*(k-1)//2
        k=1
res+=k*(k-1)//2
print(res)

Measured memory_bytes: 85228
#include <bits/stdc++.h>
using namespace std;
#define PI 3.14159265358979323846264338327950L
 
int main() {
    long double A, B, H, M;
    cin >> A >> B >> H >> M;
    long double deg = max((30.0L*H + 30.0L*M/60.0L)-6.0L*M, 6.0L*M-(30.0L*H + 30.0L*M/60.0L));
    if(deg > 180.0L) {
        deg = 360.0L - deg;
    }
    
    long double deg_r;

	deg_r  = deg * PI/180.0L;

    long double rsq;
    rsq = A*A + B*B -2.0L*A*B*cos(deg_r);
    
    printf("%20.20Lf\n", sqrtl(rsq));
    return 0;
}

Measured memory_bytes: 4060
#include <stdio.h>
#include <string.h>
#include <set>
#include <string>

using namespace std;

int main()
{
    int n;
    char command[10];
    char str[20];
    set< string > S;
    scanf("%d", &n);

    for ( int i = 0; i < n; i++ ) {
	scanf("%s", command);
	scanf("%s", str);
	if ( !strcmp( command, "insert" ) ) {
	    S.insert( str );
	}
	else if ( !strcmp( command, "find" ) ) {
	    set<string>::iterator it = S.find( str );
	    if ( it == S.end() ) {
		printf("no\n");
	    }
	    else {
		printf("yes\n");
	    }
	}
    }
    
    return 0;
}

Measured memory_bytes: 26892
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> list(n);
    int num = 0;
    rep(i, n) cin >> a[i];
    rep(i, n)
    {
        int tmp = 0;
        for (int j = 0; (n - i) * (1 + j) <= n;j++)
            tmp += list[(n - i) * (1 + j) - 1];
        if (tmp % 2 != a[n - i - 1])
        {
            list[n - i - 1]++;
            num++;
        }
    }
    cout << num << endl;
    rep(i, n) if (list[i]) cout << i + 1 << ' ';
}

Measured memory_bytes: 2432
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.*;
import java.util.*;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

import static java.util.stream.Collectors.*;
import static java.util.Map.Entry.*;

public class Main {

	public static void main(String[] args) throws IOException {
		FastReader in = new FastReader(System.in);
		PrintWriter out = new PrintWriter(System.out);
		double n= in.nextDouble();
		double k = in.nextDouble();
		out.println(n/k);
		
		out.flush();
		out.close();

	}

	static class FastReader {
		StringTokenizer st;
		BufferedReader br;

		public FastReader(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public FastReader(FileReader fileReader) {
			br = new BufferedReader(fileReader);
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

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

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}

}

Measured memory_bytes: 24660
#include <bits/stdc++.h>
using namespace std;
string ans;
const int MAXN = 3002;

void lcs(string s, string t, int n, int m, string res)
{
    if (n == 0 || m == 0)
    {
        if (ans.length() < res.length())
        {
            ans = res;
        }
        return;
    }
    if (s[n - 1] == t[m - 1])
        lcs(s, t, n - 1, m - 1, string(1, s[n - 1]) + res);
    else
    {
        lcs(s, t, n - 1, m, res);
        lcs(s, t, n, m - 1, res);
    }
}

string lcs(const string &s, const string &t)
{
    int n = s.length();
    int m = t.length();
    int dp[n + 1][m + 1];
    for(int i = 0;i<=n;i++) dp[i][0] = 0;
    for(int j = 0;j<=m;j++) dp[0][j] = 0;
    
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
        {
            if (s[i - 1] == t[j - 1])
            {
                dp[i][j] = dp[i - 1][j - 1] + 1;
            }
            else
            {
                dp[i][j] = max(dp[i - 1][j], dp[i][j-1]);
            }
        }
    }
/*
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
            cout << dp[i][j] << " ";
        cout << "\n";
    }
  */  
    string ans = "";
    
    int i = n;
    int j = m;
    int len = dp[n][m];
    while (i > 0 && j > 0 && len)
    {
        while (dp[i][j] == dp[i - 1][j - 1]) //go diagonally up
            --i, --j;
        while (dp[i][j] == dp[i - 1][j]) //go vertically up
            --i;
        while (dp[i][j] == dp[i][j - 1]) //go horizontally left
            --j;
        if (s[i - 1] == t[j - 1])
        {
            ans = s[i - 1] + ans;
            --i, --j;
            --len;
        }
    }
    
    return ans;
}

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

    cout << lcs(s, t) << "\n";
    return 0;
}

Measured memory_bytes: 35456
n, m = map(int, input().split())
h = list(map(int, input().split()))
l = [0]*n
 
for i in range(m):
    a, b = map(int, input().split())
    l[a-1] = max(l[a-1], h[b-1])
    l[b-1] = max(l[b-1], h[a-1])
 
count = 0
for i in range(n):
    if h[i] > l[i]:
        count += 1
 
print(count)

Measured memory_bytes: 20080
#include <stdio.h>
#define MAX_N 25
#define NIL -1
typedef struct Node { int parent, left, right;} Node;

void setDepth(Node tree[MAX_N],int depth_list[MAX_N],int node,int depth){
	if(node==NIL){
		return; 
	}
	depth_list[node]=depth;
	setDepth(tree,depth_list,tree[node].left,depth+1);
	setDepth(tree,depth_list,tree[node].right,depth+1);
}

int setHeight(Node tree[MAX_N],int height_list[MAX_N],int node){
	int h_left,h_right;
	if(node==NIL){
		return -1;
	}
	h_left=setHeight(tree,height_list,tree[node].left)+1;
	h_right=setHeight(tree,height_list,tree[node].right)+1;
	if(h_left>h_right){
		height_list[node]=h_left;
	}else{
		height_list[node]=h_right;
	}
	return height_list[node];
}

int getSibling(Node tree[MAX_N],int node){
	if(tree[node].parent==NIL){
		return NIL;
	}
	Node parentNode = tree[tree[node].parent];
	if(parentNode.left != node && parentNode.left != NIL){
		return parentNode.left;
	}
	if(parentNode.right != node && parentNode.right != NIL){
		return parentNode.right;
	}
	return NIL;
}

int getDegree(Node tree[MAX_N],int node){
	int deg=0;
	if(tree[node].left!=NIL){
		deg++;
	}
	if(tree[node].right!=NIL){
		deg++;
	}
	return deg;
}
void print(Node tree[MAX_N],int depth_list[MAX_N], int height_list[MAX_N],int node){
	printf("node %d: ",node);
	printf("parent = %d, ",tree[node].parent);
	printf("sibling = %d, ",getSibling(tree,node));
	printf("degree = %d, ",getDegree(tree,node));
	printf("depth = %d, ",depth_list[node]);
	printf("height = %d, ",height_list[node]);
	
	if(tree[node].parent==NIL){
		printf("root\n");
	}else if(tree[node].left == NIL && tree[node].right == NIL ){
		printf("leaf\n");
	}else{
		printf("internal node\n");
	}
	
}
int main(){
	int n,root_node;
	int node,left,right;
	int i;
	int depth_list[MAX_N],height_list[MAX_N];
	Node tree[MAX_N];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		tree[i].parent=NIL;
	}
	for(i=0;i<n;i++){
		scanf("%d %d %d",&node,&left,&right);
		tree[node].left=left;
		tree[node].right=right;
		if(left!=NIL){
			tree[left].parent=node;
		}
		if(right!=NIL){
			tree[right].parent=node;
		}
	}
	
	for(i=0;i<n;i++){
		if(tree[i].parent==NIL){
			root_node=i;
		}
	}
	setDepth(tree,depth_list,root_node,0);
	setHeight(tree,height_list,root_node);
	
	for(i=0;i<n;i++){
		print(tree,depth_list,height_list,i);
	}
	return 0;	
}

Measured memory_bytes: 612
#include <iostream>
#include <string>
#include <algorithm>
#include <ctype.h>
using namespace std;

int main(){
	string str;
	getline(cin,str);
	for(int i = 0; i < str.size(); i++){
		if(isupper(str[i])){
			str[i] = tolower(str[i]);
		}else if(islower(str[i])) {
			str[i] = toupper(str[i]);
		}
		cout << str[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3128
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;


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


Measured memory_bytes: 256
#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>
#include <random>
#include <ctime>
#include <chrono>

using namespace std;

long long t, n, m, u, v, q, k, p;
const int N = 1e6 + 1e5 + 500;
const long long mod = 1e9 + 7;
const long long INF = 1LL << 57;



int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  if (m % 2 != 0) {
    cout << "No" << endl;
  } else if (m >= 2 * n and m <= 4 * n) {
    cout << "Yes\n";
  }else cout << "No\n";
}





















Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
struct UnionFind{
    vector<int> par;//親(根)
    vector<int> rank;//木の深さ

    UnionFind(int n){//初期化関数
        par.resize(n);
        rank.resize(n);
        for(int i = 0; i < n; i++){
            par[i] = i;//初めはノード一個の木なので根は自身
            rank[i] = 1;
        }
    }

    int root(int x){//木の根を求める
    if(par[x] == x) return x;
    else return par[x] = root(par[x]);
    }

    bool same(int x, int y){//同じ木かどうか判定
        return root(x) == root(y);//同じ木ならtrue
    }

    void unite(int x, int y){
        x = root(x);
        y = root(y);
        if(x == y) return;//もし同じ木に属していたら何もしない
        if(rank[x] < rank[y]) swap(x, y);//数が大きい方に小さい方を結合させる
        par[y] = x;
        rank[x] += rank[y];//深さが同じ時だけ結合後深さが増える
    }

    int size(int x) {//深さを返す関数
        return rank[root(x)];
    }
};
int main(){
    int N;
    cin >> N;
    vector<int> x(N), y(N);
    for(int i = 0; i < N; i++) cin >> x[i] >> y[i];
    vector<int> ind(N);
    for(int i = 0; i < N; i++) ind[i] = i;
    sort(ind.begin(), ind.end(), [&](int i, int j){
        return x[i] < x[j];
    });
    vector<int> yind(N);
    for(int i = 0; i < N; i++){
        yind[y[ind[i]] - 1] = ind[i];
    }
    UnionFind U(N);
    set<int> s;
    for(int i = 0; i < N; i++){
        int flag = 0;
        if(i == 0) s.insert(y[ind[i]]);
        else{
            for(auto ite = s.begin(); ite != s.end();){
                if(*ite > y[ind[i]]) break;
                else{
                    int t = U.root(yind[*ite - 1]);
                    U.unite(yind[*ite - 1], ind[i]);
                    flag = 1;
                    if(U.root(yind[*ite - 1]) != t) ite = s.erase(ite);
                    else ite++;
                }
            }
            if(flag == 0) s.insert(y[ind[i]]);
        }
    }
    for(int i = 0; i < N; i++){
        cout << U.size(i) << endl;
    }
}

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

const int maxn = 100010, P = 998244353;
int n, ans, cnt1[maxn], cnt2[maxn], cnt3[maxn];
int mx, m, sg[maxn];
vector<int> G[maxn];

int qp(int x, int y) {
    int z = 1;
    for (; y; y >>= 1, x = 1LL * x * x % P) {
        if (y & 1) z = 1LL * z * x % P;
    }
    return z;
}

int main() {
    scanf("%d", &n);
    auto solve = [&](int *cnt) {
        memset(sg, 0, sizeof(sg));
        for (int i = 1; i <= n; i++) {
            G[i].clear();
        }
        scanf("%d", &m);
        for (int i = 1, u, v; i <= m; i++) {
            scanf("%d %d", &u, &v);
            G[min(u, v)].push_back(max(u, v));
        }
        for (int i = n; i; i--) {
            unordered_set<int> S;
            for (int j : G[i]) S.insert(sg[j]);
            while (S.count(sg[i])) sg[i]++;
            mx = max(mx, sg[i]);
            (cnt[sg[i]] += qp(10, 18 * i)) %= P;
        }
    };
    solve(cnt1), solve(cnt2), solve(cnt3);
    for (int i = 0; i <= mx; i++) {
        for (int j = 0; j <= mx; j++) {
            ans = (ans + 1LL * cnt1[i] * cnt2[j] % P * cnt3[i ^ j]) % P;
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 5632
#include<stdio.h>
#include<stdlib.h>
int cmp(const void *a,const void *b)
{
	return *(char *)a - *(char *)b;
}
int main(void)
{
	char ch[4];
	scanf("%s",ch);
	int i;
	int flag = 1;
	qsort(ch,4,sizeof(ch[0]),cmp);
	for(i = 0;i<4;i+=2)
	{
		if(ch[i] != ch[i+1])
		{
				flag = 0;
				break;
		}
	}
	if(ch[0] == ch[2])
	{
			flag = 0;
	}
	printf(flag == 1?"Yes":"No");
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

void main()
{
    int len = pow(5,10);
    char S[len];
    char T[len];
    int n=0;
    fgets(S, sizeof(S),stdin);
    fgets(T, sizeof(T),stdin);

    for (int i = 0; i < strlen(T); i++)
    {
        if (S[i] != T[i])
        {
            n++;
        }
    }
    putchar('\n');
    printf("%d\n", n);
}

Measured memory_bytes: 2008
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
		if len(os.Args) > 2 {
			wfp, _ = os.Create(os.Args[2])
		}
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	n := getNextInt(scanner)
	aa := make([]int, n)

	for i := 0; i < n; i++ {
		aa[i] = getNextInt(scanner)
	}
	sort.Ints(aa)

	l := 0
	r := n - 1
	sl := n
	sr := n + 1

	bb := make([]int, n*2+2)
	for l <= r {
		if l == r {
			if absint(aa[l]-bb[sl+1]) > absint(aa[l]-bb[sr-1]) {
				bb[sl] = aa[l]
				sl--
			} else {
				bb[sr] = aa[l]
				sr++
			}
			break
		}
		if l%2 == 0 {
			bb[sl] = aa[l]
			bb[sr] = aa[r]
		} else {
			bb[sl] = aa[r]
			bb[sr] = aa[l]
		}
		l++
		r--
		sl--
		sr++
	}

	var sum int64

	for i := sl + 2; i < sr; i++ {
		sum += int64(absint(bb[i] - bb[i-1]))
	}

	fmt.Fprintln(writer, sum)
	writer.Flush()
}
func absint(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 4352
#include <vector>
#include <algorithm>
#include <stdio.h>
#include  <iostream>

typedef long long int llint;

using namespace std;



int main()
{
    llint n,k;
    scanf("%d %d",&n,&k);
    vector<llint> h(n);
    for(int i=0;i<n;i++) {
        llint tmp;
        scanf("%lld",&tmp);
        h.at(i)=tmp;
    }

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

    llint sum=0;
    for(int i=0;i<n-k;i++) sum+=h.at(i);
    printf("%lld\n",sum);
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
 
using namespace std;
 
#define int long long
#define F first
#define S second
#define all( x ) x.begin() , x.end()
#define pb push_back
#define mp make_pair
#define uniq( x ) sort( all( x ) ) , x.resize( unique( all( x ) ) - x.begin())
 
const int maxn = 2e5 + 10 ;
const int INF = 1e18 ;
 
int n , a , b , c , d , t , dp[ maxn ] ;
vector< int > vv ;
 
void solve()
{
 cin >> n >> a >> b >> c >> d ;
 
 for(int i = 1 ; i <= n ; i *= 2){
   for(int j = i ; j <= n ; j *= 3){
      for(int k = j ; k <= n ; k *= 5){
         vv.pb( n/k ) ;
         vv.pb( (n+k-1)/k ) ;
      }
   }
 }
 
 
 uniq( vv );
 
// cout << vv.size() << "\n" ;
 
 dp[ 0 ] = d ;
 for(int i = 1 ; i < vv.size() ; i ++){
   int x = vv[ i ];
 
   dp[ i ] = 9*INF ;
 
   long double xx = x , dd = d , check = 9e18 ;
   long double val = xx*dd ;
   if( val < check ){
     dp[ i ] = x*d ;
   }
 
   int x1 = x/2 , y1 = (x+1)/2 , dx1 = x%2 , dy1 = (2-(x%2))%2 ;
   int x2 = x/3 , y2 = (x+2)/3 , dx2 = x%3 , dy2 = (3-(x%3))%3;
   int x3 = x/5 , y3 = (x+4)/5 , dx3 = x%5 , dy3 = (5-(x%5))%5;
 
   int indx1 = lower_bound( all( vv ) , x1 ) - vv.begin() ;
   int indx2 = lower_bound( all( vv ) , x2 ) - vv.begin() ;
   int indx3 = lower_bound( all( vv ) , x3 ) - vv.begin() ;
   int indy1 = lower_bound( all( vv ) , y1 ) - vv.begin() ;
   int indy2 = lower_bound( all( vv ) , y2 ) - vv.begin() ;
   int indy3 = lower_bound( all( vv ) , y3 ) - vv.begin() ;
 
 //  if( indx1 == vv.size() || indx2 == vv.size() || indx3 == vv.size()|| indy1 == vv.size()|| indy2 == vv.size()|| indy3 == vv.size())
 //     cout << "NOOOOOOOo\n" ;
 
   dp[ i ] = min( dp[ i ] , dp[ indx1 ] + dx1*d + a ) ;
   dp[ i ] = min( dp[ i ] , dp[ indx2 ] + dx2*d + b ) ;
   dp[ i ] = min( dp[ i ] , dp[ indx3 ] + dx3*d + c ) ;
   dp[ i ] = min( dp[ i ] , dp[ indy1 ] + dy1*d + a ) ;
   dp[ i ] = min( dp[ i ] , dp[ indy2 ] + dy2*d + b ) ;
   dp[ i ] = min( dp[ i ] , dp[ indy3 ] + dy3*d + c ) ;
 
 }
 
// cout << vv[ vv.size()-1 ] << "\n" ;
 
 cout << dp[ vv.size()-1 ] << "\n" ;
}
 
signed main()
{
 ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
 
 cin >> t ;
 
 while( t -- ){
  solve();
 }
 
    return 0;
}

Measured memory_bytes: 3796
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define ft first
#define sd second
#define pb push_back
#define pob pop_back()
#define pf push_front
#define pof pop_front()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<char,char> pcc;
typedef pair<long long,long long> pll;

int main() {
    fastIO;
    cout << fixed << setprecision(6);
    int n;
    long double rta = 0;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = 0; i < n; i++){
        rta += 1.0/a[i];
    }
    rta = 1/rta;
    cout << rta << endl;
    return 0;
}



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

int main(){
  int N, M;
  cin >> N >> M;
  
  vector<int> H(N);
  vector<int> high(N, 1);
  for (int i=0 ; i<N ; i++){
    cin >> H.at(i);
  }
  
  vector<int> A(M);
  vector<int> B(M);
  for (int i=0 ; i<M ; i++){
    cin >> A.at(i) >> B.at(i);
    if (H.at(A.at(i)-1) > H.at(B.at(i)-1))
      high.at(B.at(i)-1) = 0;
    else if (H.at(A.at(i)-1) < H.at(B.at(i)-1))
      high.at(A.at(i)-1) = 0;
    else{
      high.at(A.at(i)-1) = 0;
      high.at(B.at(i)-1) = 0;
    }
  }
  
  int ans = 0;
  for (int i=0 ; i<N ; i++){
    if (high.at(i) == 1)
      ans++;
  }
  cout << ans << endl;
}

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

int main() {
  int N,a,b,c,d;
  cin>>N;
  a=N/1000,b=(N-a*1000)/100,c=(N-a*1000-b*100)/10,d=N-a*1000-b*100-c*10;
  if (b==c){
    if(a==b || c==d){cout<<"Yes"<<endl;}
    else{cout<<"No"<<endl;}
  }
  else{cout<<"No"<<endl;}
}


Measured memory_bytes: 256
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7



def main():
    int1 = lambda x: int(x) - 1
    N, A, B, C, D = map(int1, input().split())
    S = input()

    if "##" not in S[A:B + 1] and "##" not in S[C:D + 1]:
        if C > D and "..." not in S[B - 1:D + 2]:
            print("No")
        else:
            print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  int d[110];
  cin >> N;
  for (int i = 0; i < N; i++) cin >> d[i];
  int num[110] = {0};
  for (int i = 0; i < N; i++) {
    num[d[i]]++;
  }
  int res = 0;
  for (int i = 1; i <= 100; i++) {
    if (num[i]) res++;
  }
  cout << res << endl;
}

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

int main()
{
  string s;
  cin >> s;
  bool ok = true;
  int n = s.size();
  for(int i = 0; i < n; i++){
    if (i % 2 == 0 && s.at(i) == 'L') ok = false;
    if (i % 2 == 1 && s.at(i) == 'R') ok = false;
  }
  if (ok == true){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef LOCAL
#include <pprint.hpp>
#endif
#define endl "\n";
#define pb push_back
#define md 1000000007
#define ll long long int
#define all(v) v.begin(),v.end()
ll power(ll a,ll b){ll z=1;while(b){if(b&1){z*=a;z%=md;}a*=a;a%=md;b/=2;}return z%md;}
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main(){
	//You need to change array size!
	#ifndef LOCAL
	ios_base::sync_with_stdio(false);	cin.tie(NULL);
	#endif 
	
	ll n,k;
	cin>>n>>k;
	ll dp[k+1];
	dp[0]=0;
	ll v[n];
	for(int i=0;i<n;++i){
		cin>>v[i];
	}	
	
	for(int i=1;i<=k;++i){
		ll ans=1;
		for(int j=0;j<n;++j){
			if(i-v[j]>=0)
				ans *= dp[i-v[j]];
		}
		dp[i]=!ans;
	}
	
	cout<<(dp[k]?"First":"Second");
	
	return 0;	
}

Measured memory_bytes: 4400
def main():
    from itertools import permutations
    import math
    import numpy as np
    tot = 0

    N = int(input())
    locs = np.array([
        [int(x) for x in input().split()]
        for _ in range(N)
    ], dtype=float)

    for order in permutations(range(N)):
        order = list(order)
        loc0 = locs[order[:-1]]
        loc1 = locs[order[1:]]
        delta = loc1 - loc0
        tot += np.sum(np.linalg.norm(delta, axis=1))
    print(tot/math.factorial(N))


if __name__ == '__main__':
    main()

Measured memory_bytes: 14444
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
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(a > b){ a = b; return 1; } return 0; }
int main()
{
  int a,b; cin >> a >> b;
  cout << a*b << "\n";
  return 0;
}


Measured memory_bytes: 3620
import numpy as np

n = int(input())
a = map(int, input().split())

border = list(range(400, 3201, 400))
cnt = [0] * (len(border) + 1)
for aa in a:
    for i, k in enumerate(border):
        if aa < k:
            cnt[i] += 1
            break
    else:
        cnt[i+1] += 1

k = np.count_nonzero(cnt[:-1])
print(k, k + cnt[-1]) if k != 0 else print(1, cnt[-1])

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

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;

int main() {
    ll N; cin >> N;
    string s; cin >> s;
    ll ans = 0;
    for(ll i = 1; i < s.length(); i++){
        ll tmp = 0;
        vector<bool > X(26, false);
        vector<bool > Y(26, false);
        for(ll j = 0; j < i; j++){
            X[s[j]-'a'] = true;
        }
        for(ll j = i; j < s.length(); j++){
            Y[s[j]-'a'] = true;
        }

        for(ll j = 0; j < 26; j++){
            if(X[j] == true && Y[j] == true){
                tmp++;
            }
        }

        ans = max(ans, tmp);

    }

    cout << ans << endl;

}

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

int main() {
	int N, S=0;
	cin >> N;
	long long a = 1000000000, b;
	int M = N;
	while (1) {
		b = N / a;
		N -= a * b;
		S += b;
		a /= 10;
		if (a == 0) break;
	}
	if (M % S == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
using namespace std;
char mp1[55][55], mp2[55][55];
int main()
{
    int n, m, i, j, o, p;
    scanf("%d%d", &n, &m);
    for(i = 0; i < n; ++i) scanf("%s", mp1[i]);
    for(i = 0; i < m; ++i) scanf("%s", mp2[i]);
    for(i = 0; i < n; ++i)
    {
        for(j = 0; j < n; ++j)
        {
            if(i + m <= n && j + m <= n)
            {
                for(o = 0; o < m; ++o)
                {
                    for(p = 0; p < m; ++p)
                    {
                        if(mp1[i + o][j + p] != mp2[o][p])
                        {
                            goto c;
                        }
                    }
                }
                printf("Yes\n");
                goto d;
                c:;
            }
        }
    }
    printf("No\n");
    d:;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <cstring>
using namespace std;
int d[140][140];
bool blocked[140][140];
int X_OFFSET = 60;
int Y_OFFSET = 60;
int X_size = 140;
int Y_size = 140;
int move_x[6] = {-1, 1, 0, 0, -1, 1};
int move_y[6] = {0, 0, -1, 1, -1, 1};
int main(){
  while(true){
    int t;
    int n;
    cin >> t >> n;
    if(t == 0 && n == 0){
      break;
    }

    for(int i = 0; i <= X_size; i++){
      for(int j = 0; j <= Y_size; j++){
        d[i][j] = INT_MAX;
        blocked[i][j] = false;
      }
    }

    for(int i = 0; i < n; i++){
      int x;
      int y;
      cin >> x >> y;
      blocked[x + X_OFFSET][y + Y_OFFSET] = true;
    }

    int start_x;
    int start_y;
    cin >> start_x >> start_y;
    start_x += X_OFFSET;
    start_y += Y_OFFSET;

    d[start_x][start_y] = 0;
    queue <pair <int, int> > q;
    q.push(make_pair(start_x, start_y));

    int ans = 1;
    while(!q.empty()){
      int cur_x = q.front().first;
      int cur_y = q.front().second;
      q.pop();

      if(d[cur_x][cur_y] < t){
        for(int i = 0; i < 6; i++){
          int next_x = cur_x + move_x[i];
          int next_y = cur_y + move_y[i];
          if(!blocked[next_x][next_y] && d[next_x][next_y] == INT_MAX){
            d[next_x][next_y] = d[cur_x][cur_y] + 1;
            ans ++;
            q.push(make_pair(next_x, next_y));
          }
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef long long ll;
const long long MOD=1e09+7;



#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define vi vector<int>


int main(){
  

  ll l,r;
  cin>>l>>r;
  
  
  
  int answer=2019;
  
  if (r-l>=2018){
    answer=0;
  }
  
  
  
  l%=2019;
  r%=2019;
  
  
  if (l>=r){
    answer=0;
  }
  
  else {
    for (int i=l;i<=r-1;i++){
      for (int j=i+1;j<=r;j++){
        int tmp;
        tmp=(i*j)%2019;
        answer=min(answer,tmp);
      }
    }
  }
  
  
  cout<<answer<<endl;
  
      

  
  
  
      
 

  
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int N,A,B;
	cin>>N;
	if(N==1){
		cout<<"Hello World"<<endl;
		return 0;
	}else{
		cin>>A>>B;
		cout<<A+B<<endl;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		
		String str;
		String cupA, cupB;
		boolean[] cup = new boolean[3];
		cup[0] = true;
		while(scan.hasNext()){
			char[] a = scan.next().toCharArray();
			int s = a[0]-'A';
			int t = a[2]-'A';
			boolean b = cup[s];
			cup[s] = cup[t];
			cup[t] = b;
		}
		for(int i=0;i<3;i++){
			if(cup[i]){System.out.println((char)(i+'A'));break;}
		}
	}
}

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

using namespace std;

int main(){
    ios_base::sync_with_stdio(0);
    int A,B,C,X, count = 0;
    cin>>A>>B>>C>>X;
    for(int i=0; i<=A ; i++){
        for(int j=0 ; j<=B ; j++){
            for(int k=0 ; k<=C ; k++){
                if((500*i + 100*j + 50*k)==X)
                    count++;
            }
        }
    }
    cout<<count<<'\n';
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <array>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <utility>
#include <iomanip>
#include <numeric>
#include <climits>
#include <algorithm>
#include <cstdint>
using namespace std;

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

    if (a <= 5)
        cout << "0";
    else if (a >= 6 && a <= 12)
        cout << b/2;
    else cout << b;
}

Measured memory_bytes: 3568