akhauriyash/Code-Regression huggingface dataset:
#include <numeric>
#include<iostream>
#include<set>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include<algorithm>
#include <sstream>
#include<string>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
#include<string.h>
#include<memory.h>
using namespace std;
#define inf 100000000007
#define int long long
#define rep(i,j,n) for(int i=j;i<n;i++)
typedef pair<int,int>  P;
struct edge{int from,to,cost;};
double pi = 3.141592653589793;
//ここから下
int v,e;
edge es[11451];
int d[114];
bool find_negative_loop(){
    memset(d,0,sizeof(d));
    rep(i,0,v){
        rep(j,0,e){
            edge e=es[j];
            if(d[e.to]>d[e.from]+e.cost){
                d[e.to]=d[e.from]+e.cost;
                if(i==v-1)return true;
            }
        }
    }
    return false;
}

void shortest_path(int s){
    rep(i,0,v)d[i]=inf;
    d[s]=0;
    while(true){
        bool update=false;
        rep(i,0,e){
            edge e=es[i];
            if(d[e.from]!=inf&&d[e.to]>d[e.from]+e.cost){
                d[e.to]=d[e.from]+e.cost;update=true;
            }
        }
        if(!update)break;
    }
}
signed main(){
    cin>>v>>e;
    if(v==1){
        cout<<0<<endl;
        return 0;
    }
    rep(i,0,e){
        int a,b,c;cin>>a>>b>>c;
        es[i]=edge{a,b,c};
    }
    if(find_negative_loop()){
        cout<<"NEGATIVE CYCLE"<<endl;
        return 0;
    }
    rep(i,0,v){
        shortest_path(i);
        rep(j,0,v-1){
            if(d[j]==inf)cout<<"INF"<<" ";
            else cout<<d[j]<<" ";
        }if(d[v-1]==inf)cout<<"INF"<<endl;
        else cout<<d[v-1]<<endl;
    }
    return 0;
}


Measured memory_bytes: 3268
#include<iostream>
#include<stdio.h>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#pragma warning(disable: 4996)
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;;
using ll = long long;

int main() {
	
	int N;
	ll LOW = 15000000000;
	cin >> N;
	vector<int> X(N);
	rep(i, N) cin >> X[i];
	rep(i, 100) {
		int P = i + 1;
		int ans = 0;
		rep(j, N) {
			ans += pow(X[j] - P, 2);
		}
		if (ans < LOW) { LOW = ans; }
	}
	cout << LOW << endl;
	return 0;
}

Measured memory_bytes: 256
s = list(input())
t = list(input())
a = 0

s.sort()
t.sort()
t = t[::-1]

if len(s) < len(t):
    for i in range(len(s)):
        if s[i] < t[i]:
            print("Yes")
            break
        elif s[i] == t[i]:
            a += 1
            continue
        else:
            print("No")
            break
    if a == len(s):
        print("Yes")

else:
    for i in range(len(t)):
        if s[i] < t[i]:
            print("Yes")
            break
        elif s[i] == t[i]:
            a += 1
            continue
        else:
            print("No")
            break
    if a == len(t):
        print("No")


Measured memory_bytes: 3064
#include<stdio.h>
#include<string.h>
#include<ctype.h>

int main(void){

char W[15],T[1005];
int c,i;

scanf("%s",W);
for(i=0;i<15;i++){
	if(W[i]=='\0')break;
	if(islower(W[i])){W[i]=toupper(W[i]);}
}
c=0;
while(1){
	scanf("%s",T);
	if(strcmp(T,"END_OF_TEXT")==0){break;}
	for(i=0;i<1005;i++){
		if(T[i]=='\0')break;
		if(islower(T[i])){T[i]=toupper(T[i]);}
	}

	if(strcmp(W,T)==0){c++;}
	}
printf("%d\n",c);
return 0;
}

Measured memory_bytes: 544
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long m = sc.nextLong();
        int[] arr = new int[n];

        for (int i=0; i<n; i++) arr[i] = sc.nextInt()/2;

        long lcm = arr[0];

        int cnt = 0;
        int tmp = 0;

        while (arr[0]%2==0) {
            cnt++;
            arr[0] /= 2;
        }


        for (int i=1; i<n; i++){
            tmp = 0;
            while (arr[i]%2==0){
                    tmp++;
                    arr[i] /= 2;
                }
//            System.out.println(cnt);
//            System.out.println(tmp);
            if (cnt!=tmp){
                System.out.println(0);
                return;
            }
            lcm = lcm(lcm, arr[i]);
            if (lcm>m){
                System.out.println(0);
                return;
            }
        }


        System.out.println((m/lcm+1)/2);



    }

    public static long lcm(long m, long n){
        return m/gcd(m ,n)*n;
    }
    public static long gcd(long m, long n){
        if (m<n) gcd(n,m);
        if (n==0) return m;
        return gcd(n, m%n);
    }
}

Measured memory_bytes: 50652
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        int W,H,x,y,r;
        boolean result = true;//??????????????¨
        //?¨??????\??????????????????????????§????????????
    	Scanner scanner = new Scanner(System.in);
    	//??\????????????int??????????????????
    	W = scanner.nextInt();
    	H = scanner.nextInt();
    	x = scanner.nextInt();
    	y = scanner.nextInt();
    	r = scanner.nextInt();
    	//?¨??????????????????????
    	if((x+r) > W || (x-r) <0){
    		result = false;
    	}
    	//????????????????????????
    	if((y+r) > H || (y-r) <0){
    		result = false;
    	}
    	//????????????
    	if(result){
    		System.out.println("Yes");
    	}
    	else{
    		System.out.println("No");
    	}
    }
}

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

#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;

TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;
TPL<TNM T> using vec4 = vec<vec3<T>>;
TPL<TNM T> using vec5 = vec<vec4<T>>;

TPL<TNM T> inline istream& operator >> (istream& is, vector<T>& vec) { for (T& x : vec) is >> x; return is; }
TPL<TNM V, TNM H> void resize(vector<V>& _v, const H _h) { _v.resize(_h); }
TPL<TNM V, TNM H, TNM ... T> void resize(vector<V>& _v, const H& _h, const T& ... _t) { _v.resize(_h); for (auto& __v : _v) resize(__v, _t ...); }
TPL<TNM V, TNM T> TNM enable_if<!is_class<V>::value>::type fill(vector<V>& _v, const T &_t) { std::fill(ALL(_v), _t); }
TPL<TNM V, TNM T> TNM enable_if<is_class<V>::value>::type fill(vector<V>& _v, const T &_t) { for (auto &_e : _v) fill(_e, _t); }
TPL<TNM T> inline void UNIQUE(vector<T>& _v) { sort(ALL(_v)); _v.erase(unique(ALL(_v)), _v.end()); }
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(6); } } pre__;

int main(void) {
	int P, Q, R;
	cin >> P >> Q >> R;
	int m = min({ P + Q, P + R, Q + R });
	cout << m << endl;
	return 0;
}

Measured memory_bytes: 256
use std::cmp::{max, min};
use std::io::{stdin, Read};
use std::str::FromStr;

// https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn main() {
    let n = read::<usize>();
    let a = read::<usize>();
    let b = read::<usize>();
    let c = read::<usize>();
    let d = read::<usize>();
    let e = read::<usize>();
    let &neck = [a, b, c, d, e].iter().min().unwrap();

    let team = if n % neck == 0 {
        n / neck
    } else {
        n / neck + 1
    };
    println!("{}", 5 + (team - 1))
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define MAX 50
#define NIL -1
using namespace std;
struct Node{
    int parent;
    int left;
    int right;
};
Node T[MAX];
int H[MAX],D[MAX],n;
void setDepth(int node,int deep){
    D[node]=deep;
    if(T[node].left!=NIL)
        setDepth(T[node].left,deep+1);
    if(T[node].right!=NIL)
        setDepth(T[node].right,deep+1);
}
int setHeight(int node){
    int h1=0,h2=0;
    if(T[node].left!=NIL)
        h1 = setHeight(T[node].left) + 1;
    if(T[node].right!=NIL)
        h2 = setHeight(T[node].right) + 1;
    return H[node]=(h1>h2)?h1:h2;
}
int getSibling(int node){
    if(T[node].parent==NIL) return NIL;
    if(T[T[node].parent].left!=node&&T[T[node].parent].left!=NIL)
        return T[T[node].parent].left;
    if(T[T[node].parent].right!=node&&T[T[node].parent].right!=NIL)
        return T[T[node].parent].right;
    return NIL;
}
void print(int node){
    cout<<"node "<<node<<": ";
    cout<<"parent = "<<T[node].parent<<", ";
    cout<<"sibling = "<<getSibling(node)<<", ";
    
   	int deg=0;
	if(T[node].left!=NIL)	
	    deg++;
	if(T[node].right!=NIL)
	    deg++;
	
	cout<<"degree = "<<deg<<", ";
	cout<<"depth = "<<D[node]<<", ";
	cout<<"height = "<<H[node]<<", ";
	
	if(T[node].parent==NIL)
		cout<<"root"<<endl;
	else if(T[node].left==NIL&&T[node].right==NIL)
		cout<<"leaf"<<endl;
	else
		cout<<"internal node"<<endl;
}
void init(){
    int node,l,r;
    for(int i=0;i<n;i++){
        cin>>node>>l>>r;
        T[node].left=l;
        T[node].right=r;
        if(T[node].left!=NIL)
            T[l].parent=node;
        if(T[node].right!=NIL)
            T[r].parent=node;
    }
}
int main(){
    cin>>n;
    for(int i=0;i<n;i++)
        T[i].parent=NIL;
    init();
    int root;
    for(int i=0;i<n;i++){
        if(T[i].parent==NIL)
            root=i;
    }
    setDepth(root,0);
    setHeight(root);
    for(int i=0;i<n;i++)
        print(i);
    return 0;
    
}


Measured memory_bytes: 3084
/**
SXR0aXAkI0JwbXptI3FhI3Z3I293bCNqY2IjUG0jMCNicG0jVHFkcXZvLyNCcG0jQW10bjBhY2phcWFicXZvLyNNYm16dml0MSNWdyNhdGN1am16I2tpdiNhbXF9bSNQcXUjVnd6I0F0bW14MSNQcWEjaXptI2l0dCNicHF2b2EjUXYjYnBtI3BtaWRtdmEjaXZsI3d2I21pemJwMSNFcHcjcWEjYnBtem0ja2l2I3F2Ym16a21sbSNRdiNQcWEjeHptYW12a20jbXtrbXhiI0lhI3BtI3htenVxYmJtYnBHI1BtI3N2d2VtYnAjRXBpYiMraXh4bWl6bWJwI2J3I1BxYSNrem1pYmN6bWEjSWEsI0ptbnd6bSN3eiNJbmJteiN3eiNKbXBxdmwjYnBtdTEjVnd6I2FwaXR0I2JwbXwja3d1eGlhYSNJY29wYiN3biNwcWEjc3Z3ZXRtbG9tI017a214YiNpYSNQbSNlcXR0bWJwMSNQcWEjYnB6d3ZtI2x3YnAjbXtibXZsI1dkbXojYnBtI3BtaWRtdmEjSXZsI3d2I21pemJwLyNpdmwjUG0jbm1tdG1icCNWdyNuaWJxb2NtI3F2I29jaXpscXZvI0l2bCN4em1hbXpkcXZvI2JwbXUvI053eiNQbSNxYSNicG0jVXdhYiNQcW9wMSNCcG0jQWN4em11bSMrcXYjb3R3enwsMQ==
*/
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>

#define F first
#define S second
#define endl '\n'
#define pb push_back

const long long MOD = 1e9 + 7;
const long long MAXN = 1e6 + 1;
using namespace std;

typedef long long ll;

long long readInt() {
    bool minus1 = false;
    long long result = 0;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus1 = true; else result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }
    if (minus1)
        return -result;
    else
        return result;
}

int main() {
	#ifdef IZI_KATKA
	assert(freopen("input", "r", stdin));
    assert(freopen("output", "w", stdout));
    #endif
    int n = 3, m = 3;
    for (int i = 1; i <= n; i++) {
    	for (int j  =1 ; j <= m; j++) {
    		char x = getchar();
			if (i == j) cout << x;
    	}
    	char x = getchar();
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

void Main() {
	int N, M; cin >> N >> M;
	vvi years(N);
	vector<pair<int, int>> pys(M);
	REP(i, M) {
		int p, y; cin >> p >> y;
		--p;
		pys[i] = make_pair(p, y);
		years[p].push_back(y);
	}
	REP(i, N) {
		sort(ALL(years[i]));
	}
	for (auto pa : pys) {
		int order = lower_bound(ALL(years[pa.first]), pa.second) - years[pa.first].begin();
		// debug(order);
		printf("%06d%06d\n", pa.first + 1, order + 1);
	}
}

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


Measured memory_bytes: 7808
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

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

int par[400*400];
int find(int x) {
  return par[x] == x ? x : (par[x] = find(par[x]));
}
void merge(int x, int y) {
  par[find(x)] = find(y);
}

int dx[4]{-1,0,1,0};
int dy[4]{0,1,0,-1};
string g[400];
void solve() {
  int r, c;
  cin >> r >> c;
  for(int i = 0; i < r; i++) {
    cin >> g[i];
  }
  for(int i = 0; i < 400*400; i++) par[i] = i;
  for(int i = 0; i < r; i++) {
    for(int j = 0; j < c; j++) {
      for(int k = 0; k < 4; k++) {
        int nx = i + dx[k];
        int ny = j + dy[k];
        if(nx < 0 || ny < 0 || nx >= r || ny >= c || g[nx][ny] == g[i][j]) continue;
        merge(i*c+j, nx*c+ny);
      }
    }
  }
  map<int, int> black, white;
  for(int i = 0; i < r; i++) {
    for(int j = 0; j < c; j++) {
      (g[i][j] == '#' ? black : white)[find(i*c+j)]++;
    }
  }
  ll ret = 0;
  for(auto x: black) {
    ret += x.second * (ll)white[x.first];
  }
  cout << ret << "\n";
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  /*
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
  */
  solve();
}


Measured memory_bytes: 14080
#include<bits/stdc++.h>
using namespace std;
int n,i,a[1000010],ans;
vector<int> que;
int bs(int l,int r,int num){
	if(l==r) return l;
	int mid=(l+r)/2;
	if(num<=que[mid]) bs(mid+1,r,num);
	else bs(l,mid,num);
}
int main(){
	cin>>n;
	for(i=1;i<=n;i++) scanf("%d",&a[i]);
	for(i=1;i<=n;i++){
		if(!que.empty()&&que[que.size()-1]<a[i]){
			que[bs(0,que.size()-1,a[i])]=a[i];
		}
		else{
			que.push_back(a[i]);
			ans++;
		}
	}
	cout<<ans;
}

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

int main() {
  int A, B;
  scanf("%d %d", &A, &B);

  if ((A + B) % 2 == 0) {
    printf("%d", (A + B) / 2);
  } else {
    printf("IMPOSSIBLE");
  }

  return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  for(int i=0; i<N; i++) cin >> a.at(i);
  sort(a.begin(), a.end());
  cout << a.at(N-1) - a.at(0) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
ll  mod = 1e9 + 7;

int main() {
    int h,w,n;cin >> h >> w >> n;
    int m = max (h,w);
    int ans = n / m + (n % m != 0);
    cout << ans << endl;
}

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

#include <stdio.h>
#include <stdlib.h>

using namespace std;

int main(int argc, char *argv[]){
  int R, G;
  cin  >> R;
  cin >> G;

  cout << 2*G-R << endl;




  return 0;
}


Measured memory_bytes: 256
n,m = map(int, input().split())
h = [0]
h.extend(list(map(int,input().split())))
way = [[] for _ in range(n+1)]
for i in range(m):
    a,b = map(int, input().split())
    way[a].append(h[b])
    way[b].append(h[a])
cnt = 0
for i in range(1,n+1):
    if way[i] == []:
        cnt += 1
    elif h[i] > max(way[i]):
        cnt += 1
print(cnt)

Measured memory_bytes: 93668
#include <bits/stdc++.h>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,Q,K,A,B;
string S;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
typedef pair<ll, ll> P;
const ll INF = (1LL<<58);
template <long long mod> class mint{
    public:
        ll x;
        long long mod_plus;
        mint(){x = 0;}
        mint(ll _x){
            mod_plus = (LLONG_MAX / mod) * mod;
            x = (_x < 0 ? ((_x += mod_plus) < 0 ? _x + mod_plus : _x) : _x)%mod;
        }

        mint operator-(){
            return x == 0 ? 0 : mod - x;
        }
        mint& operator+=(const mint& a){
            if((x += a.x) >= mod) x -= mod;
            return *this;
        }
        mint operator+(const mint& a) const{
            return (*this) += a;
        }
        mint& operator-=(const mint& a){
            if((x -= a.x) < 0) x += mod;
            return *this;
        }
        mint operator-(const mint& a) const{
            return (*this) -= a;
        }
        mint& operator*=(const mint& a){
            (x *= a.x)%=mod;
            return *this;
        }
        mint operator*(const mint& a) const{
            return (*this) *= a;
        }
        mint pow(unsigned long long pw) const{
            mint res(1), comp(*this);
            while(pw){
                if(pw&1) res *= comp;
                comp *= comp;
                pw >>= 1;
            }
            return res;
        }
        //以下、modが素数のときのみ
        mint inv() const{
            mint res(*this);
            return res.pow(mod - 2);
        }
        mint& operator/=(const mint &a){
            (x *= a.inv().x)%=mod;
            return *this;
        }
        mint operator/(const mint &a) const{
            return (*this) /= a;
        }
};

using mint1 = mint<998244353>;
using mint2 = mint<1000000007>;
using mykey = tuple<int, int, ll, ll>;

int main(){
    set<mykey> hash_num;
    cin>>N;
    vector<string> s(N);
    vector<vector<mint1> > memo1(N, vector<mint1>(1, mint1(0)));
    vector<vector<mint2> > memo2(N, vector<mint2>(1, mint2(0)));
    rep(i,N){
        cin>>s[i];
        reverse(ALL(s[i]));
        mint1 a1(0);
        mint2 a2(0);
        rep(j, s[i].size() - 1){
            (a1 *= 26) += s[i][j] - 'a';
            (a2 *= 26) += s[i][j] - 'a';
            memo1[i].push_back(a1);
            memo2[i].push_back(a2);
        }
        mykey now_key = make_tuple(*s[i].rbegin() - 'a', s[i].size() - 1, a1.x, a2.x);
        hash_num.insert(now_key);
    }
    ll res = 0;
    rep(i,N){
        vector<bool> exist(26, false);
        Rrep(j, s[i].size()){
            exist[s[i][j] - 'a'] = true;
            rep(k, 26){
                if(exist[k] && hash_num.find(make_tuple(k, j, memo1[i][j].x, memo2[i][j].x)) != hash_num.end()){
                    ++res;
                }
            }
        }
    }
    cout<<res - N<<endl;
}


Measured memory_bytes: 77956
a,b,c,d = map(int, input().split())
import fractions
r = b-a+1
g = c * d // fractions.gcd(c, d)
ans_c = b//c - (a-1)//c
ans_d = b//d - (a-1)//d
ans_r = b//g - (a-1)//g
print(r - ans_c - ans_d + ans_r)


Measured memory_bytes: 5048
#include <stdio.h>

int main(){
  long long  n, q, s[10001], t, c = 0, i;
  scanf("%lld", &n);
  for(i = 0; i < n; ++i) scanf("%lld", s + i);

  scanf("%lld", &q);
  while(q--){
    scanf("%lld", &t);
    for(i = 0; i < n; ++i)
      if(t == s[i]){
        c++;
        break;
      }
  }

  printf("%lld\n", c);
  return 0;
}



Measured memory_bytes: 2048
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string sS = System.Console.ReadLine().Trim();

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            string sOut = "NO";
            if (sS == "7" || sS == "5" || sS == "3") { sOut = "YES"; }

            // 出力
            System.Console.WriteLine("{0}", sOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


Measured memory_bytes: 13268
package main
import(
	"fmt"
)
func main(){
	var a,b string
	fmt.Scan(&a,&b)
	res := 0
	for i := 0;i<len(a);i++ {
		if a[i] == b[i] {
			res ++
		}
	}
	fmt.Println(res)
}

Measured memory_bytes: 512
N,A,B,C,D=list(map(int,input().split()))
l=list(input())
if "##" in "".join(l[A-1:max(C,D)-1]):
   print("No")
   exit()
if C>D:
   pass
else:
   print("Yes")
   exit()
if "..." in "".join(l[B-2:D+1]):
   print("Yes")
else:
   print("No")

Measured memory_bytes: 11992
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main(){
    string s;
    cin>>s;
    string t;
    s+="#";
    rep(i,s.size()){
        if(s[i]=='B'&&s[i+1]=='C'){
            t+='X';
            i++;
        }
        else t+=s[i];
    }

    ll ans=0,cnt=0;
    rep(i,t.size()){
        if(t[i]=='A') cnt++;
        else if(t[i]=='X') ans+=cnt;
        else cnt=0;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 776
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main(){
  int N;
  cin >> N;
  int K;
  cin >> K;
  map<int, int> ball;
  
  for(int i = 0; i < N; i++){
    int t;
    cin >> t;
    ball[t]++;
  }
  
  int div = 0;
  vector<int> V;
  for(auto itr = ball.begin(); itr != ball.end(); itr++){
    V.push_back(itr->second);
    div++;
  }
  sort(V.begin(), V.end());
  int ans = 0;
  for(int i = 0; i < div - K; i++) ans += V[i];
  cout << ans;
}


Measured memory_bytes: 10748
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
constexpr bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
constexpr bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll n;
  cin >> n;
  string s;
  cin >> s;
  vll r(n+1, 0), g(n+1, 0), b(n+1, 0);
  rep(i, n){
    r[i+1] = r[i] + (s[i] == 'R');
    g[i+1] = g[i] + (s[i] == 'G');
    b[i+1] = b[i] + (s[i] == 'B');
  }
  ll ans = 0;
  rep(i, n){
    repr(k, i+2, n){
      if(s[i] == s[k]){
        continue;
      }
      if(s[i] != 'R' && s[k] != 'R'){
        ans += r[k]-r[i+1];
        if((i+k)%2==0 && s[(i+k)/2] == 'R') ans--;
      }
      if(s[i] != 'G' && s[k] != 'G'){
        ans += g[k]-g[i+1];
        if((i+k)%2==0 && s[(i+k)/2] == 'G') ans--;
      }
      if(s[i] != 'B' && s[k] != 'B'){
        ans += b[k]-b[i+1];
        if((i+k)%2==0 && s[(i+k)/2] == 'B') ans--;
      }
    }
  }
  print(ans);
}


Measured memory_bytes: 3748
def solve(ns, k):
    n = len(ns)
    tot = 1
    for i in xrange(k):
        tot += ns[i]
    res = []
    pre = tot
    for i in xrange(k, n):
        a = ns[i - k]
        b = ns[i]
        if a > b:
            # tot = tot / a * b
            tot = tot - 1
        elif a < b:
            tot = tot + 1
        else:
            pass
        if tot > pre:
            res.append(True)
        else:
            res.append(False)
        pre = tot
    return res

assert solve([1001, 869120, 1001], 2) == [False]
assert solve([96, 98, 95, 100, 20], 3) == [True, False]
assert solve([3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9], 7) == [True, True, False, True, True, False, True, True]


n, k = map(int, raw_input().split())
ns = map(int, raw_input().split())

res = solve(ns, k)
for item in res:
    print 'Yes' if item else 'No'




Measured memory_bytes: 101072
#include <iostream>
#include <algorithm>

using namespace std;

class peace{
public:
  int pw;
  int pd;
};

main(){
  int n, w, d;

  while(1){
    peace p[105];
    cin >> n >> w >> d;
    if(n==0 && w==0 && d==0) break;
    p[1].pw=w;
    p[1].pd=d;
    int end=1;
    for(int i=0;i<n;i++){
      int a, b;
      
      cin >> a >> b;
      end++;
      int pos;
      int l;
      int t=p[a].pw+p[a].pd;
      b%=t;
      if(b>p[a].pw){
	pos=2;
	l=b-p[a].pw;
      }
      else{
	pos=1;
	l=b;
      }
      peace tmp;
      peace tmp2;
      int s1, s2;
      if(pos==1){
	tmp.pw=p[a].pw-l;
	tmp.pd=p[a].pd;
	p[a].pw=l;

	s1=p[a].pw*p[a].pd;
	s2=tmp.pw*tmp.pd;
	tmp2=p[a];
	for(int j=1, k=1;j<=i+1;j++){
	  if(j!=a){
	    p[k++]=p[j];
	  }
	}
	if(s1<=s2){
	  p[end]=tmp;
	  p[end-1]=tmp2;
	}
	else{
	  p[end]=tmp2;
	  p[end-1]=tmp;
	}
      }
      else{
	tmp.pw=p[a].pw;
	tmp.pd=p[a].pd-l;
	p[a].pd=l;

	s1=p[a].pw*p[a].pd;
	s2=tmp.pw*tmp.pd;
	tmp2=p[a];
	for(int j=1, k=1;j<=i+1;j++){
	  if(j!=a){
	    p[k++]=p[j];
	  }
	}
	if(s1<=s2){
	  p[end]=tmp;
	  p[end-1]=tmp2;
	}
	else{
	  p[end]=tmp2;
	  p[end-1]=tmp;
	}
      }
    }
    int size[105];
    for(int i=0;i<=n;i++){
      size[i]=p[i+1].pw*p[i+1].pd;
    }
    
    sort(size, size+n+1);
    
    cout << size[0];
    for(int i=1;i<=n;i++){
      cout << ' ' << size[i];
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 0
N=int(input())
X=[[] for _ in range(N)]
Y=[[] for _ in range(N)]
for i in range(N):
    m=int(input())
    for j in range(m):
        x,y=map(int,input().split())
        X[i].append(x-1)
        Y[i].append(y)
max_=0
for i in range(2 ** N):
    op = [0] * N  
    for j in range(N):
        if ((i >> j) & 1):
            op[N - 1 - j] = 1  
    #print(op)
    exit=False
    for j in range(N):
        if op[j] == 1:
            for k in range(len(X[j])):
                if Y[j][k]!=op[X[j][k]]:
                    #print("no",j,k)
                    exit=True
                    break
        if exit:
            break
    else:
        #print("yes",j,k)
        max_=max(max_,sum(op))
print(max_)

Measured memory_bytes: 45168
#include <bits/stdc++.h>
#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 REP(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
#define FI first
#define SE second
#define PB push_back
#define EB emplace_back
#define SZ(x) (int)(x).size()
#define BN(x) ((1<<x)-1)
#define DUP(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

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

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

  vi to[200005];

  int N, Q; cin >> N >> Q;
  REP(i,N-1) {
    int a, b; cin >> a >> b;
    --a; --b;
    to[a].PB(b);
    to[b].PB(a);
  }

  vi ans(N);
  //ans.resize(N);
  REP(i,Q) {
    int p, x; cin >> p >> x;
    --p;
    ans[p] += x;
  }

  vector<bool> checked(N,false);
  queue<int> que;
  que.push(0);
  checked[0] = true;

  while (!que.empty()) {
    int node = que.front();
    que.pop();
    int point = ans[node];
    for (auto &next : to[node]) {
      if (!checked[next]) {
        ans[next] += point;
        que.push(next);
        checked[next] = true;
      }
    }
  }

  REP(i,N) {
    cout << ans[i] << endl;
  }
  
  return 0;
}

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

using namespace std;

typedef long long ll;

void solve() {
    int A, B, L, R; scanf("%d%d%d%d", &A, &B, &L, &R);
    ll k = (A + B) / (min(A, B) + 1);
    if (k == 1) {
        bool start_with_A = A >= B;
        for (int i = L; i <= R; i++)
            printf(i & 1 ^ start_with_A ? "B" : "A");
        printf("\n");
        return;
    }
    int n = min(min(A / k, ll(B)), (A * k - B) / (k * k - 1));
    for (int i = max(1, L); i <= min(n * int(k + 1), R); i++) {
        printf(i % (k + 1) ? "A" : "B");
    }
    L -= n * (k + 1); R -= n * (k + 1);
    A -= n * k; B -= n;
    int m = B / k;
    int cntA = A - m;
    for (int i = max(L, 1); i <= min(cntA, R); i++) {
        printf("A");
    }
    L -= cntA; R -= cntA;
    A -= cntA;
    int cntB = B % k;
    for (int i = max(L, 1); i <= min(cntB, R); i++) {
        printf("B");
    }
    L -= cntB; R -= cntB;
    B -= cntB;
    for (int i = max(L, 1); i <= R; i++) {
        printf(i % (k + 1) == 1 ? "A" : "B");
    }
    printf("\n");
}

int main() {
    int T; scanf("%d", &T);
    for (int i = 1; i <= T; i++) {
        solve();
    }
} 


Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int n, th, tw, h, w, ans=0;
int main() {
   cin >> n >> th >> tw;
   while (n--) {
       cin >> h >> w;
       if (th<=h&&tw<=w) ans++;
   }
   cout << ans;
}

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

using namespace std;

int DisNum[15];

void init(){

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

        DisNum[i] = 0;

    }

}

bool checkNumber(int Number){

    while(Number > 0){

        int LastDigit = Number %10 ;

        if(DisNum[LastDigit] == 1){

            return false;

        }

        Number = Number / 10;
    }

    return true;

}

int main(){

   // freopen("input.txt","r",stdin);

    init();

    int Number, N;
    int x;

    cin >> Number >> N;

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

        cin >> x;
        DisNum[x] = 1;

    }

    bool found = false;

    Number = Number - 1;

    while(!found){

        Number++;
        found = checkNumber(Number);

    }

    cout << Number << endl;


    return 0;
}


/*

105 = 105/10 = 10
      105%10 = 5


*/




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

int main(){
  int n;
  string s;
  cin >>n >>s;
  int wcnt = 0, ans = 0;
  rep(i,n) if(s[i]=='W') wcnt++;
  for(int i = n-1; i>=n-wcnt; i--) if(s[i]=='R') ans++;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3768
#include<iostream>
#include<cmath>
#include<cstdio>
#include<cstring>
using namespace std;
 
int n,d;
long long v[20],maxv[30];
 
long long qpow(int x,int y){
    long long ans=1;
    while(y){
        if(y&1)ans*=x;
        y>>=1,x*=x;
    }
    return ans;
}
 
long long dfs(long long x,int p){
    if(p==n)return (x==d);
    if(d<x-maxv[p]||d>x+maxv[p])return 0;
    long long ans=0;
    for(int i=-9;i<=9;i++){
        if(p)ans+=dfs(x+v[p]*i,p+1)*(10-abs(i));
        else if(i^9)ans+=dfs(x+v[p]*i,p+1)*(i>=0?9-i:10+i);
    }
    return ans;
}
 
int main(){
    scanf("%d",&d);
    long long ans=0;
    for(int i=1;i<=18;i++){
        memset(maxv,0,sizeof(maxv));
        n=i+1>>1;
        for(int j=0;j<n;j++)v[j]=qpow(10,i-j)-qpow(10,j);
        for(int j=0;j<n;j++)
        for(int k=j;k<n;k++)maxv[j]+=v[k]*9;
        ans+=dfs(0,0)*(i&1?1:10);
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define rep(i, n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
 
int main(void){
    int n;
    cin>>n;
    vector<string> v(n);
    rep(i, n) cin>>v[i];
    map<char, ll> mp;
    string s = "MARCH";
    rep(i, n){
        char c = v[i][0];
        if(c == s[0] || c == s[1] || c == s[2] || c == s[3] || c == s[4]){
            mp[c]++;
        }
    }
    ll ans = 0;
    for(int i = 0;i<=2;i++){
        for(int j = i+1;j<=3;j++){
            for(int k = j+1;k<=4;k++){
                ans += mp[s[i]]*mp[s[j]]*mp[s[k]];
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
const int NIL = -1;
const ld PI = acosl(-1);

#define rep(i,n) for(int i=0; i<(n); ++i)
#define all(n) n.begin(),n.end()

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//cout << fixed << setprecision(6);
	ll n, d;
	cin >> n >> d;

	d *= d;
	int ans = 0;
	rep(i, n){
		ll x, y;
		cin >> x >> y;

		if((x*x + y*y) <= d ) ans++;
	}

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

Measured memory_bytes: 3568
/*
created at 4.9.2015 by charis
last edited at 5.9.2015 by charis

*/

#include<iostream>
#include<stack>
using namespace std;

stack<int> order;
stack<pair<int, int> > area;

void pool(){
	while(1){
		pair<int ,int> x = area.top(); area.pop();
		if(area.empty()) {
			area.push(x);	
			break;
		}
		pair<int ,int> y = area.top();
		if(x.first > y.first){
			area.push(x);
			break;
		}
		else{
			int s = x.second + y.second;
			area.pop(); // pop(y)
			area.push(make_pair(x.first, s)); //new area
		}	
	}	
}

int main(){
	char ch;
	int i=0;
	int S=0;
	while(cin>>ch){
		i++;
		if(ch=='e') break;
		if(ch=='/') {
			if(order.empty()==0){
				int t = order.top(); order.pop();
				int l = i - t + 1 ;
				int a = l - 1 ;
				S+=a;
				area.push(make_pair(t, a));
				pool();
			}
		}
		else if(ch=='_'){			
		}
		else {		
			order.push(i);
		}
	}
	
	cout << S << endl;
	int n = area.size();
	
	if (n == 0) cout << "0" << endl;
	else {
		cout << n << " ";
		int A[n];
		for(int j=0; j<n; j++){
			pair<int, int> t = area.top(); area.pop();
			A[n-j-1] = t.second;
		}
		for(int j=0; j<n-1; j++){
			cout << A[j] << " ";
		}
		cout << A[n-1] << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1288
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string st;
	cin>>st;
	if(st[0]=='A' && st[1]=='A' && st[2]=='A' || st[0]=='B' && st[1]=='B' && st[2]=='B' )
		cout<<"No";
	else 
		cout<<"Yes";
	return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int64_t INF=1e18+1;
const int mod = 1000000007;

int main() {
  int A,B,C,X,Y;
  cin>>A>>B>>C>>X>>Y;
  C*=2;
  int ab=0;
  if(X==Y){ab=X;}
  else if(X>Y){ab=Y;}
  else{ab=X;}
  int ans=min({A*X+B*Y,(X-ab)*A+(Y-ab)*B+C*ab,C*max(X,Y)});
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3468
#include <iostream>
#include <string.h>
#include <string>


using namespace std;
int main() {




	int N;
	cin >> N ;
	string s;
	cin >> s;
	int countA = 0;
	int countB = 0;
	bool isRed = false;
	for (int i = 0; i < N; i++) {
		if (s[i] == 'R') {
			countA += 1;
			//if(count > int(N/2)){ cout << "Yes" << endl; }
			

		}
		else {
			countB += 1;
		}
		
	}
	if(countA> countB) { cout << "Yes" << endl; }
	else { cout << "No" << endl; }







	return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
x = list(map(int, input().split()))
ans = 10**10
for i in range(N-K+1):
    ans = min(ans, abs(x[i]) + abs(x[i] - x[i+K-1]))
    ans = min(ans, abs(x[i+K-1]) + abs(x[i+K-1] - x[i]))
print(ans)


Measured memory_bytes: 14568
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N; long long int K; 
	cin >> N >> K; 
	long long int A[200010] = {}; 
	long long int F[200010] = {}; 
	for(int i = 0; i < N; i++) cin >> A[i]; 
	for(int i = 0; i < N; i++) cin >> F[i]; 
	sort(A, A+N, greater<long long>()); 
	sort(F, F+N); 
	long long int ng = -1; long long int ok = 1e13; 
	long long L[200010] = {}; 
	while(ok - ng > 1){
		long long int mid = (ok + ng) / 2; 
		long long int num = 0; 
		for(int i = 0; i < N; i++){
			L[i] = mid / F[i]; 
			if(L[i] > A[i]) continue; 
			num += A[i] - L[i]; 
		}
		if(num <= K) ok = mid; 
		else ng = mid; 
	}
	cout << ok << endl; 
}

Measured memory_bytes: 3328
# @author 

import sys


class PIndependentSet:
    def solve(self):
        from collections import defaultdict
        import sys
        sys.setrecursionlimit(10 ** 5 + 5)
        MOD = 10 ** 9 + 7

        def dfs(s):
            done[s] = 1
            dp[s][0] = 1
            dp[s][1] = 1
            for x in adj[s]:
                if done[x]:
                    continue
                dfs(x)
                dp[s][0] = (dp[s][0] * dp[x][1]) % MOD
                dp[s][1] = (dp[s][1] * (dp[x][0] + dp[x][1])) % MOD

        n = int(input())
        adj = defaultdict(list)

        for i in range(n - 1):
            x, y = [int(_) for _ in input().split()]
            x -= 1
            y -= 1
            adj[x].append(y)
            adj[y].append(x)

        dp = [[0, 0] for _ in range(n)]
        done = [0] * n
        dfs(0)

        print((dp[0][0] + dp[0][1]) % MOD)

solver = PIndependentSet()
input = sys.stdin.readline

solver.solve()


Measured memory_bytes: 133340
#include<iostream>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int *S = new int[n];
	for (int i = 0; i < n; i++)
		cin >> S[i];
	int q;
	cin >> q;
	int *T = new int[q];
	for (int i = 0; i < q; i++)
		cin >> T[i];
	int count = 0;
	for(int i=0;i<q;i++)
		for(int j=0;j<n;j++)
			if (S[j] == T[i])
			{
				count++;
				break;
			}
	cout << count << endl;
	delete[] S;
	delete[] T;
}


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

int main(){
  int N;
  cin >> N;
  vector<pair<long,long>> AB(N);
  for(int i=0; i<N; i++){
    cin >> AB.at(i).second >> AB.at(i).first;
  }
  sort(AB.begin(),AB.end());
  
  int T=0,S=0;
  for(int i=0; i<N; i++){
    T+=AB.at(i).second;
    S+=AB.at(i).first-T;
    if(S<0){
      cout << "No" << endl;
      break;
    }
    else if(S>=0&&i==N-1){
      cout << "Yes" << endl;
    }
    S=0;
  }
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MAXN=1010,MAXSIZ=100100;
int vis[MAXSIZ]={1,1},prime[MAXSIZ],cnt;
int a[MAXN][MAXN],n;
inline void GetPrime()
{
	for(int i=2;;i++)
	{
		if(!vis[i]) prime[++cnt]=i;
		if(cnt==1000) break;
		for(int j=1;j<=cnt&&(i*prime[j]<=100000);j++)
		{
			vis[i*prime[j]]=1;
			if(!(i%prime[j])) break;
		}
	}
	return;
}
inline int __lcm(int x,int y)
{
	if(!(x&&y)) return x|y;
	return x/__gcd(x,y)*y;
}
signed main()
{
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	GetPrime();
	cin>>n;
	if(n==2) return cout<<"4 7\n 23 10"<<endl,0;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			if(!((i+j)&1)) a[i][j]=prime[(i+j)>>1]*prime[n+(i-j)/2+((n+1)>>1)];
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			if(!a[i][j]) a[i][j]=__lcm(__lcm(a[i-1][j],a[i][j-1]),__lcm(a[i+1][j],a[i][j+1]))+1;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++) cout<<a[i][j]<<(j==n?"\n":" ");
	return 0;
}

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

using namespace std;

typedef long long ll;

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

    int n = S.size();
    vector<ll> count(n, 0);
    int c;
    for (int i = 0; i < n; i++) {
        if (S[i] == 'R') c++;
        else {
            count[i] += c / 2;
            count[i-1] += (c+1) / 2;
            c = 0;
        } 
    }
    for (int i = n-1; i >= 0; i--) {
        if (S[i] == 'L') c++;
        else {
            count[i] += c / 2;
            count[i+1] += (c+1) / 2;
            c = 0;
        } 
    }

    for (int i = 0; i < n; i++) {
        cout << count[i];
        if (i < n-1) cout << " ";
        else cout << endl;
    }
}


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

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define fst first
#define snd second

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

    int n = s.size();
    string s2 = s.substr(0, (n - 1) / 2);
    string s3 = s.substr((n + 3) / 2 - 1, n - ((n + 3) / 2) + 1);
    string copyS = s;
    reverse(s.begin(), s.end());
    string copyS2 = s2;
    reverse(s2.begin(), s2.end());
    string copyS3 = s3;
    reverse(s3.begin(), s3.end());

    if(s == copyS && s2 == copyS2 && s3 == copyS3)
        cout << "Yes";
    else
        cout << "No";

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define ll long long
using namespace std;

const ll mod = 1e9 + 7;

ll C[2005][2005];
ll dp[100005][13];


int main(){
    ll H,N,M,sum=0;
    cin >> H >> N;
    vector<int>A(N+5);
    for(int i=0; i<N; i++){
        cin >> A[i];
        sum += A[i];
    }
    if(sum < H){
        cout << "No" << endl; 
    }else{
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;



int main()
{	
	int n,a[3];
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[0]>>a[1]>>a[2];
		sort(a,a+3);
		if(a[2]*a[2]==a[0]*a[0]+a[1]*a[1])cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;	
}


Measured memory_bytes: 3152
function lower_bound(d,a,b,e){for(var c;1<b-a;)d[c=0|(a+b)>>1]<e?a=c:b=c;return d[a]<e?b:a};

function compareNumbers(a, b) { //for sort
    return a-b;
}

function Main(arg) {
 
    var N = arg.split("\n")[0]-0;
    var L = arg.split("\n")[1].split(" ").map(v=>v-0);
 
    var ans = 0;

    var a, b, c;
    L.sort(compareNumbers);
    for (var i = 0; i < N - 2; i++){
        a = L[i];
        for (var j = i+1; j < N - 1; j++){
            b = L[j];
            var tmp = lower_bound(L, j + 1, N, a + b) - 1;
            ans += (tmp - j);
        }
    }


    console.log(ans)

    return;
}

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

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

int main()
{
	int N, K;
	cin >> N >> K;
	int ans = 0;
	int h;
	for(int i=0;i<N;++i){
		cin >> h;
		if(h >= K) ans++;
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 384
import java.util.*;

public class Main {
  static long mod = 1000000007;

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    HashMap<Integer, Integer> p = new HashMap<>();
    for (int i = 2; i * i <= M; i++) {
      while (M % i == 0) {
        if (p.containsKey(i)) {
          p.put(i, p.get(i) + 1);
        } else {
          p.put(i, 1);
        }
        M /= i;
      }
    }
    if (M != 1) {
      if (p.containsKey(M)) {
        p.put(M, p.get(M) + 1);
      } else {
        p.put(M, 1);
      }
    }
    long ans = 1;
    for (Integer b : p.values()) {
      ans *= calcComb(b + (N - 1), b);
      ans %= mod;
    }
    System.out.println(ans);
  }

  // べき乗の計算
  public static long calcPow(long b, long n) {
    if (n == 0) {
      return 1;
    }
    if (n % 2 == 0) {
      long tmp = calcPow(b, n / 2);
      tmp %= mod;
      return tmp * tmp % mod;
    } else {
      b %= mod;
      long tmp = calcPow(b, n - 1);
      tmp %= mod;
      return b * tmp % mod;
    }
  }

  // 逆元の計算
  public static long calcInv(long n) {
    // a^{-1}=a^{p-2}(mod p)
    return calcPow(n, mod - 2) % mod;
  }

  // 組合せの計算
  public static long calcComb(long n, long r) {
    long divA = 1; // nPrの部分
    long divB = 1; // r!^{-1}の部分
    for (int i = 0; i < r; i++) {
      divA *= n - i;
      divA %= mod;
    }
    for (int i = 0; i < r; i++) {
      divB *= r - i;
      divB %= mod;
    }
    divB = calcInv(divB);
    divB %= mod;
    return divA * divB % mod;
  }
}

Measured memory_bytes: 22612
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <assert.h>
#include <functional>
#include <unordered_map>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						(int)2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef unsigned long long int	QWORD;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
int main()
{
	string S;
	cin >> S;

	int ans = 0;
	bool isBlk = S[0] == 'B' ? true : false;
	for (int i = 0; i < (int)S.size(); i++) {
		if (isBlk) {
			if (S[i] == 'W') {
				ans++;
				isBlk = false;
			}		
		} else {
			if (S[i] == 'B') {
				ans++;
				isBlk = true;
			}		
		}
	}

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


Measured memory_bytes: 512