akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define lop(i,n) for(ll i=0;i<n;i++)
#define lop1(i,n) for(ll i=1;i<=n;i++)
#define lopr(i,n) for(ll i=n-1;i>=0;i--)
#define ll long long int
#define pb push_back
#define all(v) v.begin(),v.end()
#define IOS  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
//#define endl "\n"
#define F first
#define S second	
#define mem(arr,val) memset(arr,val,sizeof(arr))
#define pii pair<int,int>
#define pll pair<ll,ll>
#define LCM(a,b) (a*b)/__gcd(a,b)
#define mii map<int,int>
#define mll map<ll,ll>
#define ub upper_bound
#define lb lower_bound
#define sz(x) (ll)x.size()
#define ld long double
#define pcnt(x) __builtin_popcountll(x)
const long long I1=1e9;
const long long I2=1e18;
const int32_t M1=1e9+7;
const int32_t M2=998244353;
template<typename T,typename T1>T maxn(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T minn(T &a,T1 b){if(b<a)a=b;return a;}

void solve()
{
  //code begins from here//
  int n;
  cin>>n;
  ld a[n+1];
  lop1(i,n) cin>>a[i];
  //cout<<a[1]<<endl;
  ld dp[n+1][n+1];
  lop(i,n+1) dp[0][i]=0.0;
  dp[0][0]=1.0;
  lop1(i,n) dp[i][0]=dp[i-1][0]*(1-a[i]);
  lop1(i,n)
  {
      for (int j=1;j<=n;j++)
      {
      if(j>i) {dp[i][j]=0;continue;}
      dp[i][j]=a[i]*dp[i-1][j-1]+(1.0-a[i])*dp[i-1][j];
      }
  }
  ld ans=0;
  for (int i=n/2+1;i<=n;i++) ans+=dp[n][i];
  cout<<fixed<<setprecision(10)<<ans<<endl;
}

signed main()
{
    IOS;
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #ifdef MODULO
        initialize();
    #endif
    #ifdef SIEVE
        sieve();
    #endif
    int testcase=1;
    //cin>>testcase;
    while(testcase--) solve();
    return 0;
}


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

using namespace std;

int main(){
    string S, T; cin >> S >> T;
    int res=0;
    for(int i=0; i<3; i++){
        if(S[i]==T[i]){
            res++;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int N;
	double v,y,t;

	while(scanf("%lf",&v) != EOF){
		t = v/9.8;
		y = 4.9*t*t;

		y += 5.0;
		N = y/5.0;

		printf("%d\n",N+1);
	}

	return 0;
}

Measured memory_bytes: 628
#include<bits/stdc++.h>
#define lli long long int
#define mod 1000000007
#define pb push_back
#define pf push_front
#define ulli unsigned long long int
#define what_is(x) cerr << #x << " is " << x << endl;
#define pi 2*acos(0.0)
#define F  first
#define S  second
//#define endl '\n'
#define all(x) x.begin(),x.end()
using namespace std;
const lli INF = 1e18L+5;
/*
lli power(lli x,lli y)
{
    lli res=1;
    while(y>0)
    {
        if(y%2==1)
            res=(res*x)%mod;
        x=(x*x)%mod;
        y=y/2;
    }
    return res;
}
*/
/*
lli C[100001];
lli ncr(lli n, lli k) 
{ 
	if(C[k]!=0)
	return C[k];	
	memset(C, 0, sizeof(C)); 
    C[0] = 1;  // nC0 is 1 
  
    for (lli i = 1; i <= n; i++) 
    { 
        for (lli j = min(i, k); j > 0; j--) 
            C[j] = (C[j]%mod + C[j-1]%mod)%mod; 
    } 
    return C[k]%mod; 
}*/
/*
void dfs(lli node,vector<lli> graph[],lli *arr)
{
	arr[node]=1;
	for(lli i=0;i<graph[node].size();i++)
	{
		lli child=graph[node][i];
		if(arr[child]!=1)
		dfs(child,graph,arr);
	}
	return ;
}*/
int main()
{
//cout.precision(10);
//cout.setf(ios::fixed,ios::floatfield);
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
	lli T=1;
    //cin>>T;
	while(T--)
	{
		lli n,i,z,ans=0;
		cin>>n;
		vector<lli> a,b,c;
		a.pb(0);
		b.pb(0);
		c.pb(0);
		for(i=0;i<n;i++)
		{
			cin>>z;
			a.pb(z);
		}
		for(i=0;i<n;i++)
		{
			cin>>z;
			b.pb(z);
		}
		for(i=0;i<n-1;i++)
		{
			cin>>z;
			c.pb(z);
		}
		ans=b[a[1]];
		for(i=2;i<=n;i++)
		{
			ans+=b[a[i]];
			if(a[i]-a[i-1]==1)
			ans+=c[a[i-1]];
		}
		cout<<ans<<endl;
	}
}
/*
*/



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const ll INF = 1000000000;

int main() {
    int n,k; cin >> n;
    string s; cin >> s >> k; k --;
    char c = s[k];
    REP(i,s.length()) s[i] = (s[i]==c ? s[i] : '*');
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

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

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

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(12);
    ll L,R,d;
    cin >> L >> R >> d;
    cout << R/d - (L+d-1)/d + 1 << "\n";
}

Measured memory_bytes: 3656
N,M=map(int,input().split())
if N==M+1:
    A=N
    B=M
    ans=1
elif N+1==M:
    A=M
    B=N
    ans=1
elif N==M:
    A=N
    B=M
    ans=2
else:
    print(0)
    exit()
ansa=1
ansb=1
for i in range(1,A+1):
    ansa=(ansa*i)%(10**9+7)
for j in range(1,B+1):
    ansb=(ansb*j)%(10**9+7)

print((ansa*ansb*ans)%(10**9+7))

    


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

    int tmp1,tmp2;

int main(){
    int A,B,C;
    long long int count=0;
    cin >> A >> B >> C;
    if(A==B && A==C){
        if(A%2) count=0;
        else count=-1;
    }
    else{
        while(1){
        if(A%2 || B%2 || C%2) break;
        count++;
        tmp1=A; 
        tmp2=B;
        A=B/2+C/2;
        B=tmp1/2+C/2;
        C=tmp1/2+tmp2/2;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 3572
n, m, x = gets.chomp.split(" ").map(&:to_i)
a = gets.chomp.split(" ").map(&:to_i)
ans = 1000000
u = 0
d = 0
x.upto (n) do |i|
    if a.include?(i)
        u += 1
    end
end
aa = [ans,u].min
x.downto (1) do |i|
    if a.include?(i)
        d += 1
    end
end
ans = [aa,d].min
puts ans

Measured memory_bytes: 14272
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#define ALL(a)  (a) c;.begin(),(a).end()
 
const ll mod = 1000000007;
const ll LINF = 1e13;
const ll LLINF = 1e18;
const ll ALPHABET = 26;
 
template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}
 
template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x; //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいい
  return is;
}


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

  string ans = "ABC";
  if (a=="ABC")ans="ARC";

  cout << ans;

}


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

int64_t f1(int64_t a, int64_t b) {
  if(a % b == 0) {
    return b;
  }
  else {
    return f1(b, a % b);
  }
}

int main() {
  int64_t A, B, C, D;
  cin >> A >> B >> C >> D;
  int64_t x = B / C - A / C;
  if(A % C == 0) {
    x += 1;
  }
  int64_t y = B / D - A / D;
  if(A % D == 0) {
    y += 1;
  }
  int64_t E = C * D / f1(max(C, D), min(C, D));
  int64_t z = B / E - A / E;
  if(A % E == 0) {
    z += 1;
  }
  cout << B - A + 1 - x - y + z << endl;
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int rem=n%10;
	n/=10;
	int rem1=n%10;
	if(rem==9 || rem1==9)
	cout<<"Yes"<<"\n";
	else
	cout<<"No"<<"\n";
}

Measured memory_bytes: 256
import bisect
ans = 0
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
for i in range(N):
  tmp_1 = bisect.bisect_right(C, B[i])
  tmp_2 = bisect.bisect_left(A, B[i])
  ans += (N - tmp_1) * tmp_2
print(ans)


Measured memory_bytes: 23232
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;

int main()
{
	//Flength:環状線の円周 store:店の数 order:注文の数 ans:answer
	ll Flength, store, order, ans;
	vector<ll> locate;

	while(cin >> Flength)
	{
		if(Flength == 0) break;
		
		cin >>store >> order;
		
		ans = 0;
		locate.clear();

		ll wk;
		for(int i = 0; i < store - 1; i++)
		{
			cin >> wk;
			locate.push_back(wk);
		}
		locate.push_back(0);
		locate.push_back(Flength);

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

		for(int i = 0; i < order; i++)
		{
			cin >> wk;
			ans += min(abs(*(lower_bound(locate.begin(), locate.end(), wk)) - wk), abs(wk - *(lower_bound(locate.begin(), locate.end(), wk)-1)));
		}
		cout << ans << endl;
	}
}

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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

class UnionFind {
public:
    vector <ll> par; // 各元の親を表す配列
    vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)

    // Constructor
    UnionFind(ll sz_): par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    // Member Function
    // Find
    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};

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

  int N, M, K;
  cin >> N >> M >> K;
  vector<vector<int>> fr(N), bl(N);

  int a, b;

  UnionFind uf(N);
  rep(i, M){
    cin >> a >> b;
    a--;
    b--;
    fr[a].push_back(b);
    fr[b].push_back(a);
    uf.merge(a, b);

  }

  rep(i, K){
    cin >> a >> b;
    a--;
    b--;
    bl[a].push_back(b);
    bl[b].push_back(a);
  }

  rep(i, N){

    int total = uf.size(i);
    total--;
    for(int j = 0; j < fr[i].size(); j++){
      if(uf.issame(i, fr[i][j])){
        total--;
      }
    }

    for(int j = 0; j < bl[i].size(); j++){
      if(uf.issame(i, bl[i][j])){
        total--;
      }
    }
    cout << total << " ";

  }

  cout << endl;

  return 0;
}


Measured memory_bytes: 13432
#include <iostream>
#include <vector>
#include <array>

class Point{
private:
    u_int x;
    u_int y;
public:
    Point(){ x = 0; y = 0;} //constructor
    Point(u_int a, u_int b){ x = a; y = b; } //constructor
    u_int get_x(){ return x; } //get x
    u_int get_y(){ return y; } //get y
};

class Street{
private:
    Point goal;
    std::array<std::array<bool, 16>, 16> uc_list; //under-construction, 2-dimention array
public:
    Street(u_int x, u_int y); //constructor
    void add_uc_place(u_int x, u_int y); //add the places under construction
    int get_conbination(); //get the conbination(output)
};

Street::Street(u_int x, u_int y){
    Point g(x - 1, y - 1);
    goal = g;
    for(int i = 0;i < 16;++i){
        for(int j = 0;j < 16;++j){
            uc_list.at(i).at(j) = true;
        }
    }
}
void Street::add_uc_place(u_int x, u_int y){
    uc_list.at(x-1).at(y-1) = false;
}
int Street::get_conbination(){
    std::array<std::array<int, 16>, 16> num; 
    int x = (int)goal.get_x(), y = (int)goal.get_y();
    for(int i = 0;i <= x;++i){
        for(int j = 0;j <= y;++j){
            if (uc_list.at(i).at(j) == false) {
                num.at(i).at(j) = 0;
            } else if (i == 0 && j == 0){
                num.at(i).at(j) = 1;
            } else if (i == 0){
                num.at(i).at(j) = num.at(i).at(j - 1);
            } else if (j == 0){
                num.at(i).at(j) = num.at(i - 1).at(j);
            } else {
                num.at(i).at(j) = num.at(i - 1).at(j) + num.at(i).at(j - 1);
            }
        }
    }
    return num.at(x).at(y);
}
int main(){
    u_int x, y, n, a, b;
    while(std::cin >> x >> y){
        if(x == 0 && y == 0){
            return 0;
        }
        Street s(x, y);
        std::cin >> n;
        for(int i = 0;i < n;i++){
            std::cin >> a >> b;
            s.add_uc_place(a, b);
        }
        std::cout << s.get_conbination() << std::endl;
    }
}


Measured memory_bytes: 3076
#include "bits/stdc++.h"
using namespace std;
const int N = 2e6 + 6;
const int mod = 1e9 + 7;
int x[7];
int y[7];
int fact[N];
int ifact[N];
int ans;
void pre(){
	fact[0] = 1;
	for(int i = 1 ; i < N ; ++i){
		fact[i] = (1LL * fact[i - 1] * i) % mod;
	}
	ifact[N - 1] = 834903713;
	for(int i = N - 2 ; i >= 0 ; --i){
		ifact[i] = (1LL * ifact[i + 1] * (i + 1LL)) % mod;
	}
}
inline int get(int x , int y){
	return (1LL * ((1LL * ifact[x] * ifact[y]) % mod) * fact[x + y]) % mod;
}
inline int get(int x1 , int y1 , int x2 , int y2){
	return get(x2 - x1 , y2 - y1);
}
int solve2(int x1 , int y1 , int x2 , int y2){
	int res = 0;
	for(int i = x[3] ; i <= x[4] ; ++i){
		int tmp;
		tmp = (1LL * get(x1 , y1 , i , y[4]) * get(i , y[4] + 1 , x2 , y2)) % mod;
		res = (res + 1LL * tmp * (i + y[4])) % mod;
		tmp = (1LL * get(x1 , y1 , i , y[3] - 1) * get(i , y[3] , x2 , y2)) % mod;
		res = (res - 1LL * tmp * (i + y[3] - 1LL)) % mod;
	}
	for(int i = y[3] ; i <= y[4] ; ++i){
		int tmp;
		tmp = (1LL * get(x1 , y1 , x[4] , i) * get(x[4] + 1 , i , x2 , y2)) % mod;
		res = (res + 1LL * tmp * (x[4] + i)) % mod;
		tmp = (1LL * get(x1 , y1 , x[3] - 1 , i) * get(x[3] , i , x2 , y2)) % mod;
		res = (res - 1LL * tmp * (x[3] - 1LL + i)) % mod;
	}
	return res;
}
int solve1(int x1 , int y1){
	int res = 0;
	res = (res + solve2(x1 , y1 , x[6] + 1 , y[6] + 1)) % mod;
	res = (res - solve2(x1 , y1 , x[5] + 0 , y[6] + 1)) % mod;
	res = (res - solve2(x1 , y1 , x[6] + 1 , y[5] + 0)) % mod;
	res = (res + solve2(x1 , y1 , x[5] + 0 , y[5] + 0)) % mod;
	return res;
}
int main(){
	pre();
	for(int i = 1 ; i <= 6 ; ++i){
		cin >> x[i];
	}
	for(int i = 1 ; i <= 6 ; ++i){
		cin >> y[i];
	}
	ans = (ans + solve1(x[1] - 1 , y[1] - 1)) % mod;
	ans = (ans - solve1(x[1] - 1 , y[2] - 0)) % mod;
	ans = (ans - solve1(x[2] - 0 , y[1] - 1)) % mod;
	ans = (ans + solve1(x[2] - 0 , y[2] - 0)) % mod;
	ans += (ans < 0) * mod;
	cout << ans << endl;
}

Measured memory_bytes: 15872
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <climits>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <complex>
#include <functional>
#include <utility>
#include <iterator>

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define INF 2000000000

#ifdef LOCAL
  #define eprintf(...) fprintf(stdout, __VA_ARGS__)
#else
  #define eprintf(...) 0
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;

const double PI = 3.1415926535897932384626433832795;

int main() {
  int x, y, z;
  cin >> x >> y >> z;
  x -= 2 * z;
  int ans;
  ans = x / (y + z);
  if(x % (y + z) >= y) {
    ans++;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
n,*abc=map(int,input().split())
ip=[0]*n
for i in range(n):
	tmp=input()
	if tmp=="AB":
		ip[i]=[0,1]
	elif tmp=="BC":
		ip[i]=[1,2]
	else:
		ip[i]=[0,2]
ans="Yes"
res=[0]*n
s=sum(abc)
if s==0:
	ans="No"
elif s==1:
	for i in range(n):
		i1=ip[i][0]
		i2=ip[i][1]
		ABC=[abc[i1],abc[i2]]
		if ABC==[0,0]:
			ans="No"
		elif ABC==[0,1]:
			abc[i1]+=1
			abc[i2]-=1
			res[i]=i1
		else:
			abc[i1]-=1
			abc[i2]+=1
			res[i]=i2
else:
	i1=ip[0][0]
	i2=ip[0][1]
	if abc[i1]+abc[i2]==0:
		ans="No"
	else:
		for i in range(n):
			i1=ip[i][0]
			i2=ip[i][1]
			if abc[i1]*abc[i2]==0:
				if abc[i1]==0:
					abc[i1]+=1
					abc[i2]-=1
					res[i]=i1
				else:
					abc[i1]-=1
					abc[i2]+=1
					res[i]=i2
			elif i+1<n and ip[i+1]!=ip[i]:
				c=list(set(ip[i])&set(ip[i+1]))[0]
				if i1==c:
					abc[i1]+=1
					abc[i2]-=1
					res[i]=i1
				else:
					abc[i1]-=1
					abc[i2]+=1
					res[i]=i2
			else:
				abc[i1]+=1
				abc[i2]-=1
				res[i]=i1
print(ans)
dic={0:"A",1:"B",2:"C"}
if ans=="Yes":
	for i in range(n):
		print(dic[res[i]])
		'''
		if res[i]==0:
			print("A")
		elif res[i]==1:
			print("B")
		else:
			print("C")
		'''

Measured memory_bytes: 18568
N,T=[int(i)for i in input().split()]
c=[]
t=[]
for i in range(N):
    a,b=[int(j)for j in input().split()]
    c.append(a)
    t.append(b)

ans=1<<30
for i in range(N):
    if t[i]<=T and c[i]<ans:ans=c[i]
if ans==1<<30:ans="TLE"
print(ans)

Measured memory_bytes: 3064
n, c, k = map(int, input().split())
T = [int(input()) for _ in range(n)]
T.sort()

bus = 0
time = 0
i = 0

while i < n:
    bus += 1  # とりあえず一番早く乗れる乗客を載せる
    time = T[i]
    passenger = 1
    while i < n - 1:  # 他の乗客が乗れるかチェック
        if T[i + 1] - time > k:  # 遠いところにいると乗せれない
            break
        if passenger >= c:  # 乗客がいっぱいだと乗せれない
            break
        passenger += 1
        i += 1
    i += 1

print(bus)


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

int main(){
	int c[5];
	while( scanf(" %d,%d,%d,%d,%d", &c[0], &c[1], &c[2], &c[3], &c[4]) != EOF ){
		sort(c, c+5);
		
		//four card
		bool flag=true;
		for(int i=0; i<=2; ++i){
			if(c[i] != c[i+1]) flag=false;
		}
		if(flag){
			printf("four card\n");
			continue;
		}
		flag=true;
		for(int i=1; i<=3; ++i){
			if(c[i] != c[i+1]) flag=false;
		}
		if(flag){
			printf("four card\n");
			continue;
		}
		
		//full house
		flag=false;
		if(c[0]==c[1] && c[2]==c[3] && c[3]==c[4]) flag=true;
		if(c[0]==c[1] && c[1]==c[2] && c[3]==c[4]) flag=true;
		if(flag){
			printf("full house\n");
			continue;
		}
		
		//straight	
		flag=true;	
		for(int j=0; j<=4; ++j){
			if(c[j]!=c[0]+j) flag=false;
		}
		if(flag){
			printf("straight\n");
			continue;
		}

		if(c[0]==1){
			flag=true;
			for(int i=1; i<=4; ++i){
				if(c[i]!=9+i) flag=false;	
			}	
		}
		if(flag){
			printf("straight\n");
			continue;
		}
		
		//three card
		flag=false;
		for(int i=0; i<=2; ++i)
			if(c[i]==c[i+1] && c[i+1]==c[i+2]) flag=true;
		if(flag){
			printf("three card\n");
			continue;
		}	
		
		//two pair
		flag=false;
		if(c[0]==c[1] && c[2]==c[3]) flag=true;
		if(c[0]==c[1] && c[3]==c[4]) flag=true;
		if(c[1]==c[2] && c[3]==c[4]) flag=true;
		if(flag){
			printf("two pair\n");
			continue;
		}	

		//one pair
		flag=false;
		for(int i=0; i<=3; ++i)
			if(c[i]==c[i+1]) flag=true;		
	
		if(flag){
			printf("one pair\n");
			continue;
		}	

		//null
		printf("null\n");
	}
}

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

int main(void)
{
    int sx;
    int sy;
    int tx;
    int ty;

    scanf("%d", &sx);
    scanf("%d", &sy);
    scanf("%d", &tx);
    scanf("%d", &ty);
    // Loop 1 x direction//
    if(tx > sx)
    {
        for(int i = 0; i < (tx - sx); i++)
        {
            printf("R");
        }
    }
    else if(tx < sx)
    {
        for(int j = 0; j < sx - tx; j++)
        {
            printf("L");
        }
    }
    // Loop 1 y direction//
    if(ty > sy)
    {
        for(int k = 0; k < (ty - sy); k++)
        {
            printf("U");
        }
    }
    else if(ty < sy)
    {
        for(int l = 0; l < sy - ty; l++)
        {
            printf("D");
        }
    }
    // Loop 1 -x direction//
    if(tx > sx)
    {
        for(int i = 0; i < (tx - sx); i++)
        {
            printf("L");
        }
    }
    else if(tx < sx)
    {
        for(int j = 0; j < sx - tx; j++)
        {
            printf("R");
        }
    }

    //Lopp 1 -y direction
    if(ty > sy)
    {
        for(int k = 0; k < (ty - sy); k++)
        {
            printf("D");
        }
    }
    else if(ty < sy)
    {
        for(int l = 0; l < sy - ty; l++)
        {
            printf("U");
        }
    }
    // Loop 2 Y
    if (tx > sx)
    {
        sx = sx -1;
        printf("L");
    }
    else if(tx < sx)
    {
        sx = sx +1;
        printf("R");
    }

    if(ty > sy)
    {
        for(int k = 0; k < (ty - sy) + 1; k++)
        {
            printf("U");
        }
    }
    else if(ty < sy)
    {
        for(int l = 0; l < sy - ty + 1; l++)
        {
            printf("D");
        }
    }
    // loop2 x dir
    if(tx > sx)
    {
        for(int i = 0; i < (tx - sx ); i++)
        {
            printf("R");
        }
    }
    else if(tx < sx)
    {
        for(int j = 0; j < sx - tx ; j++)
        {
            printf("L");
        }
    }
    if (ty > sy)
    {
        printf("D");
    }
    else if(ty < sy)
    {
        printf("U");
    }
    //resetting coords//

    if (tx > sx)
    {
        sx = sx +1;
    }
    else if(tx < sx)
    {
        sx = sx -1;
    }

    //loop 2 -ve Y

    if (tx > sx)
    {
        sx = sx -1;
        printf("R");
    }
    else if(tx < sx)
    {
        sx = sx +1;
        printf("L");
    }

    if(ty > sy)
    {
        for(int k = 0; k < (ty - sy) + 1; k++)
        {
            printf("D");
        }
    }
    else if(ty < sy)
    {
        for(int l = 0; l < sy - ty + 1; l++)
        {
            printf("U");
        }
    }
    // loop2 -x dir
    if(tx > sx)
    {
        for(int i = 0; i < (tx - sx ); i++)
        {
            printf("L");
        }
    }
    else if(tx < sx)
    {
        for(int j = 0; j < sx - tx ; j++)
        {
            printf("R");
        }
    }
    if (ty > sy)
    {
        printf("U");
    }
    else if(ty < sy)
    {
        printf("D");
    }


    printf("\n");

    return 0;
}

Measured memory_bytes: 128
n = input()
l = list(map(int, input().split()))

s = sorted(l)

dif = 0
for i in range(len(l)):
    if l[i]!=s[i]:
        dif += 1

if dif == 0:
    print("YES")
elif dif == 2:
    print("YES")
else:
    print("NO")




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

using namespace std;

int main() {
  int dp[11][101]{};
  dp[0][0] = 1;
  for (int i = 0; i < 10; ++i) {
    for (int j = i; j >= 0; --j) {
      for (int k = 0; k + i <= 100; ++k) dp[j + 1][k + i] += dp[j][k];
    }
  }
  int n, s;
  while (true) {
    cin >> n >> s;
    if (n == 0 && s == 0) break;
    cout << dp[n][s] << endl;
  }
}

Measured memory_bytes: 3052
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
p = list(map(lambda x: int(x)-1, input().split()))

def init(bit, values):
    for i,v in enumerate(values):
        add(bit,i+1,v)
#a1 ~ aiまでの和 O(logn)
def query(bit,i):
    res = 0
    while i > 0:
        res += bit[i]
        i -= i&(-i)
    return res

#ai += x(logN)
def add(bit,i,x):
    if i==0:
        raise RuntimeError
    while i <= len(bit)-1:
        bit[i] += x
        i += i&(-i)
    return

def index(bit, v):
    """a1,...,aiの和がv以上になる最小のindexを求める
    存在しないとき配列サイズを返す
    """
    i = 0
    n = len(bit)-1
    k = 1<<((n-1).bit_length())
#     k = 1
#     while 2*k<n:
#         k *= 2
    while k>0:
        if i+k<n+1 and bit[i+k]<v:
            v -= bit[i+k]
            i += k
        k //= 2
    if v==1:
        return i+1
    else:
        return n+1

ind = [None]*n
for i,num in enumerate(p):
    ind[num] = i
bit = [0]*(n+1)
l = [None]*n
l2 = [None]*n
r = [None]*n
r2 = [None]*n
for num in range(n-1, -1, -1):
    i = query(bit, ind[num])
    if i==0:
        l[ind[num]] = -1
        l2[ind[num]] = -1
    elif i==1:
        l[ind[num]] = index(bit, i) - 1
        l2[ind[num]] = -1
    else:
        l[ind[num]] = index(bit, i) - 1
        l2[ind[num]] = index(bit, i-1) - 1
    r[ind[num]] = index(bit, i+1) - 1
    r2[ind[num]] = index(bit, i+2) - 1
    add(bit, ind[num]+1, 1)

    
ans = 0
for i, (num, li, li2, ri, ri2) in enumerate(zip(p, l, l2, r, r2)):
    v = 0
    if li>=0:
        v += (ri-i)*(li-li2)
    if ri<n:
        v += (i-li)*(ri2-ri)
#     print(i,li,li2, ri, ri2,v)
    ans += v * (num+1)
print(ans)

Measured memory_bytes: 91976
S = input()
T = input()
s = len(S)
t = len(T)

ans = float('inf')
for i in range(s - t + 1):
    cnt = 0
    for j in range(t):
        if S[i+j] == T[j]:
            cnt += 1
    
    ans = min(ans, t - cnt)

print(ans)

Measured memory_bytes: 67576
n, k = map(int, input().split())
d = [i for i in range(10)]
[d.remove(int(x)) for x in input().split()]
n_len = len(str(n))

def rec_define_digit(s):
    v = int(s)
    # print(s)
    if v >= n:
        return v
    ans = 999999
    if len(s) >= n_len + 2:
        return ans
    for i in d:
        ans = min(rec_define_digit(s + str(i)), ans)
    return ans

print(rec_define_digit("0"))


Measured memory_bytes: 42844
#include<stdio.h>
#include<string.h>

#define M 1100886 // 素数
#define L 14

char H[M][L]; /* Hash Table */

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
  else return 0;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M - 1)); }

int find(char str[]){
  long long key, i, h;
  key = getKey(str);
  for( i = 0; ; i++){
    h = (h1(key) + i * h2(key)) % M;
    if( strcmp(H[h], str) == 0) return 1;
    else if( strlen(H[h]) == 0) return 0;
  }
  return 0;
}

int insert(char str[]){
  long long key, i, h;
  key = getKey(str);
  for( i = 0; ; i++){
    h = (h1(key) + i * h2(key)) % M;
    if( strcmp(H[h], str) == 0) return 1;
    else if( strlen(H[h]) == 0){
      strcpy(H[h], str);
      return 0;
    }
  }
  return 0;
}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';

    scanf("%d", &n);

    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);

	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str)){
		printf("yes\n");
	    } else {
		printf("no\n");
	    }
	}
    }

    return 0;
}



Measured memory_bytes: 16764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//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; }
  
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

int main(){
    int N; cin >> N;
    vector<string> s(2);
    cin >> s[0] >> s[1];

    const ll mod = 1000000007;
    ll ans = 1;
    int id = 0;
    bool flg;
    if(s[0][0] == s[1][0]){
        id = 1;
        ans = 3;
        flg = true;
    } else {
        id = 2;
        ans = 6;
        flg = false;
    }

    while(id<N){
        if(flg == true && s[0][id] == s[1][id]){
            ans = ans*2%mod;
            id++;
        } else if(flg == true && s[0][id] != s[1][id]){
            ans = ans*2%mod;
            id += 2;
            flg = false;
        } else if(flg == false && s[0][id] == s[1][id]){
            id++;
            flg = true;
        } else if(flg == false && s[0][id] != s[1][id]){
            ans = ans*3%mod;
            id += 2;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n;
long long dp[26000000];
long long a[4],b[4];
long long v;
vector<int> ok;
int main(){
	cin>>n;
	for(int i=1;i<=3;i++)
		cin>>a[i];
	for(int i=1;i<=3;i++)
		cin>>b[i];
	if(a[1]<b[1]) ok.push_back(1);
	if(a[2]<b[2]) ok.push_back(2);
	if(a[3]<b[3]) ok.push_back(3);
	memset(dp,-1,sizeof(dp)),dp[n]=0;
	for(int i=n;i>=1;i--){
		if(dp[i]==-1) continue;
		for(int j=0;j<ok.size();j++)
			if(i>=a[ok[j]])
				dp[i-a[ok[j]]]=max(dp[i-a[ok[j]]],dp[i]+b[ok[j]]);
		v=max(v,dp[i]+i);
	}
	v=max(v,dp[0]),n=v,memset(dp,-1,sizeof(dp)),dp[n]=0;
	ok.clear();
	if(a[1]>b[1]) ok.push_back(1);
	if(a[2]>b[2]) ok.push_back(2);
	if(a[3]>b[3]) ok.push_back(3);
	for(int i=n;i>=1;i--){
		if(dp[i]==-1) continue;
		for(int j=0;j<ok.size();j++)
			if(i>=b[ok[j]])
				dp[i-b[ok[j]]]=max(dp[i-b[ok[j]]],dp[i]+a[ok[j]]);
		v=max(v,dp[i]+i);
	}
	v=max(v,dp[0]);
	cout<<v<<endl;
	return 0;
}


Measured memory_bytes: 206776
n = int(input())
# n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
# abc = [int(input()) for i in range(5)]
if min(a) == max(a):
    print(0)
    exit()

ans = (max(a)*max(a))*n
for i in range(min(a), max(a)+1):
    total = 0
    for j in range(n):
        total += (a[j]-i)*(a[j]-i)
    if total < ans:
        ans = total


print(ans)


Measured memory_bytes: 3060
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Threading.Tasks;

class Program
{
	//Main
	static void Main(string[] args)
	{
		//出力準備（AutoFlushを切る）
		var sw = new StreamWriter(Console.OpenStandardOutput()){AutoFlush = false};
		Console.SetOut(sw);
		//解答
		Solve();
		//出力終了
		Console.Out.Flush();
	}

	//与えられた整数n以下の素数をリストで返す関数
	//所謂「エラトステネスの篩」を使う。
	//タイプはintとする
	static List<int> SieveOfEratosthenes(int n)
	{
		//素数を格納するリスト
		List<int> primeNumbers = new List<int>();

		//検索用の配列を初期化
		int[] searchArr = new int[n+1];
		for(int i=0; i<n+1; i++){
			searchArr[i] = i;
		}

		//入力値の平方根
		int root = (int)Math.Sqrt(n);

		//現在の最小の素数
		int p = 2;

		//平方根を超えるまでループ
		while(p <= root){
			//素数ではない場合、次へ
			if(searchArr[p] == 0){
				p ++;
				continue;
			}
			//素数の場合
			else{
				//素数リストに加える
				primeNumbers.Add(p);

				//当該素数pで割り切れる数を全て排除
				//p^2から始めれば良い
				for(int i=p*p; i<n+1; i++){
					if(i % p == 0){
						searchArr[i] = 0;
					}
				}

				//pを次へ
				p++;
			}
		}

		//平方根を超えた以降も加える
		for(int i=root+1; i<n+1; i++){
			if(searchArr[i] != 0){
				primeNumbers.Add(i);
			}
		}

		//出力
		return primeNumbers;
	}

	//2017に似た数の合計数（累積和）
	static int[] numArr;

	//クエリに応答
	static void Answer(){
		string[] S = Console.ReadLine().Split(' ');
		int L = int.Parse(S[0]);
		int R = int.Parse(S[1]);

		//累積和から、個数を計算
		int ans = numArr[R-1];
		if(L > 1){
			ans -= numArr[L-2];
		}

		Console.WriteLine(ans);
	}

	static void Solve(){
		//読み込む
		int Q = int.Parse(Console.ReadLine());

		//素数のリストを取得
		int max = 100000;
		List<int> primeLs = SieveOfEratosthenes(max);

		//素数リストに含まれているかのフラグ
		bool[] isPrime = new bool[max+1];
		foreach(int p in primeLs){
			isPrime[p] = true;
		}

		//累積和の配列を埋める
		numArr = new int[max];
		for(int i=1; i<max; i++){
			numArr[i] += numArr[i-1];

			//i+1が2017に似た数かどうか調べる
			int num = i+1;
			//そもそも素数でない場合、次へ
			if(!isPrime[num]){
				continue;
			}
			else{
				//(N+1)/2が素数でない場合は飛ばす
				if(!isPrime[(num+1)/2]){
					continue;
				}
				else{
					numArr[i] ++;
				}
			}
		}

		/*debug
		for(int i=0; i<max; i++){
			Console.Write("arr[{0}]={1}, ", i, numArr[i]);
		}
		*/

		//クエリに応答
		for(int i=0; i<Q; i++){
			Answer();
		}
	}
}



Measured memory_bytes: 22952
#include<stdio.h>
void main()
{
	int i,n,a[n];
	scanf("%d",&n);
	float sum=0;
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		sum+=(float) 1/a[i];
	}
	sum= (float) 1/sum;
	printf("\n%f\n",sum);
}


Measured memory_bytes: 128
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████   
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████  
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define INF (1LL<<60)
#define fs first
#define sc second
#define pb push_back
#define int long long
#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 RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<vector<P> > Graph;

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(0);  
  //問題文を読む時間をケチらない！！

  int n,m;
  cin >> n >> m;

  vector<int> tmp(m,0);
  REP(i,n){
    int k;
    cin >> k;
    REP(j,k){
      int x;
      cin >> x;
      tmp[x-1]++;
    }
  }

  int ans = 0;
  REP(i,m) if(tmp[i] == n) ans++;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// マクロ
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
// 型エイリアス
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;

int main() {
    int n;
    cin >> n;
    if(n % 2 == 0) cout << n / 2.0 / n << endl;
    else cout << (n /2 + 1.0) / n << endl;
}

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

int main() {
    int s;
    cin >> s;
    vector<int> a(2);
    a[0] = s/100;
    a[1] = s-(s/100)*100;
    
    if (1 <= a[0] && a[0] <= 12 && 1 <= a[1] && a[1] <= 12) {
        cout << "AMBIGUOUS" << endl;
    } 
    else if (1 <= a[0] && a[0] <= 12) cout << "MMYY" << endl;
    else if (1 <= a[1] && a[1] <= 12) cout << "YYMM" << endl;
    else cout << "NA" << endl;
}

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

const int MOD = 1000000007;
const int INF = 1e9;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n, i##_len=(n); i>=0; i--)
#define FOR(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)

//最大公約数 
 ll gcd(ll a,ll b){
 if(b == 0) return a;
 return gcd(b,a%b);
 }

//最小公倍数
 ll lcm(ll a,ll b){
 ll g = gcd(a,b);
 return a / g * b; // Be careful not to overflow  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
} 




int main() {

vector<int>K(3);
REP(i, 3) cin >> K.at(i);

sort(all(K));

if(K.at(0) + K.at(1) == K.at(2)) yes;
else no;

}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define me memset
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
using namespace std;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;

int x;

int main() {
    //ios::sync_with_stdio(false);cin.tie(0);
    scanf("%d",&x);
    if(x>=30) puts("Yes");
    else puts("No");

    return 0;
}

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

using namespace std;

int main() {
  long long n, s; cin >> n >> s;
  long long best = 2e18;

  auto check = [&](long long b) {
    if (b <= 1) return;
    long long ans = 0;
    for (long long nn = n; nn; nn /= b)
      ans += nn % b;
    if (ans == s) 
      best = min(best, b);
  };
  
  check(n);
  check(n + 1);
  for (int b = 1; b <= 1000000; ++b) {
    check(b);
    check((n - (s - b)) / b);
  }
  
  if (best == 2e18) {
    cout << -1 << endl;
    return 0;
  }
  cout << best << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] A = new long[n];
        for(int i=0;i<n;i++) A[i]=sc.nextLong();
        Arrays.sort(A);
        long[] sum = new long[n];
        sum[0]=A[0];
        for(int i=1;i<n;i++) sum[i]=sum[i-1]+A[i];
        int ans = 1;
        for(int i=n-1;i>=1;i--){
            if(A[i]<=2*sum[i-1]) ans++;
            else break;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 51240
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
 
#include<bits/stdc++.h>
 
using namespace std;
#define ll long long 
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define ull unsigned long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ff first
#define ss second
#define fast ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0); 
#define nl "\n"
#define sz(a) (int)(a).size() 
#define all(a) (a).begin(),(a).end()
#define fl(a,x) memset(a,x,sizeof(a));
#define pt(a,x) cout << get<x>(a) << " " ;  
#define mt make_tuple 
#define vec vector
 
#define int long long 
 
const int mod = (int) 1e9 + 7 ;
const int MOD = (int) 998244353 ;
const int INF = (int) 1e18 ;
 
typedef vector<int> vii;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef vector<vector<int> > vv;
 
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
 
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

void solve(int test) {
	int h,w; cin >> h >> w ;
	int a,b,x,y; cin >> a >> b >> x >> y ;
	--a , --b, --x, --y ; 
	char c[h][w] ; rep(i,0,h) rep(j,0,w) cin >> c[i][j] ;

	deque<pii> dq; 

	int dist[h][w]; rep(i,0,h) rep(j,0,w) dist[i][j] = INF; 
	dist[a][b] = 0 ; 

	dq.push_back({a,b});

	while(not dq.empty()) {
		int row = dq.front().ff, col = dq.front().ss; 
		dq.pop_front() ;

		if(row == x and col == y ) {
			break ; 
		}

		for(int dr = -2 ; dr <=2 ; ++dr) {
			for(int dc = -2 ; dc<=2 ; ++dc){
				int new_row = row + dr ;
				int new_col = col + dc ;

				if(new_row == row and new_col == col ) continue ; 
				if(min(new_col,new_row) < 0 or new_row >= h or new_col >= w ) continue ;
				if(c[new_row][new_col] == '#') continue ;
				int W = 1; 
				if((abs(new_col-col) == 0 and abs(new_row-row) == 1 ) or (abs(new_col-col) == 1 and abs(new_row-row) == 0)) W = 0 ;
				
				if(dist[new_row][new_col] > dist[row][col] + W) {
					dist[new_row][new_col] = W + dist[row][col] ;
					if(W == 0 ) dq.push_front({new_row,new_col}) ;
					else dq.push_back({new_row,new_col}); 
				}
			}	
		}
	}

	// rep(i,0,h) {
	// 	rep(j,0,w) cout << dist[i][j] << " " ; cout << nl; 
	// }

	if(dist[x][y] == INF) cout << -1 ; 
	else cout << dist[x][y] ; 
}
 
int32_t main() {


    fast;
	int t=1;
	// cin>>t;
	rep(i,1,t+1) {
		solve(i) ;
	}
 
	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}

Measured memory_bytes: 12536
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<cctype>
using namespace std;

int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	int n;
	cin>>n;
	cout<<n*800-n/15*200<<endl;
	
	
	
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int a, t;
    scanf("%d", &a);
    int b, c;
    scanf("%d %d", &b, &c);
    t = c / a;
    a = a * t;
    if(a >= b && a <= c)
        printf("OK\n");
    else
        printf("NG\n");
    return 0;
}

Measured memory_bytes: 1640
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

using pll = pair<ll, ll>;

set<pll> xs, ys;

int main(){
	ll n, q; scanf("%lld%lld", &n, &q);
	xs.emplace(n, n);
	ys.emplace(n, n);
	ll ans = (n-2) * (n-2);
	REP(iq, q){
		ll t, x; scanf("%lld%lld", &t, &x);
		if(t == 2){
			swap(xs, ys);
		}

		ll y = ys.upper_bound(MP(x, 0))->second;
		ans -= y-2;

		DEBUG("%lld %lld => %lld\n", t, x, y);

		if(x < ys.begin()->first){
			ys.emplace(x, y);
			xs.emplace(y, x);
		}

		if(t == 2){
			swap(xs, ys);
		}
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 28664
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef  long long ll;
ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}
using namespace std;
int main(){ 
   int x,y,z;
   cin>>x>>y>>z;

   int sum=y+2*z;
   for(int i=1;i<100000;i++){
      if((sum+y+z)>x){
         cout<<i;
         break;
      }
      else sum+=y+z;
   }
   



   
   return 0;
}

Measured memory_bytes: 256
open Printf
open Scanf

let rec gcd a b =
  if b = 0 then a
  else gcd b (a mod b)

let solve n =
  let rec loop i j k sm =
    if i > n then sm
    else if j > n then loop (i + 1) 1 1 sm
    else if k > n then loop i (j + 1) 1 sm
    else loop i j (k + 1) (sm + gcd i (gcd j k)) in
  loop 1 1 1 0
   
let () =
  scanf "%d " solve |> printf "%d\n"


Measured memory_bytes: 3808
inpl = lambda: list(map(int,input().split()))
N = int(input())
A = inpl()
C = [0]*(N+1)
for i in range(N):
    C[A[i]] += 1
total = sum([ c*(c-1)//2 for c in C])
for k in range(N):
    c = C[A[k]]
    print(total - c + 1)


Measured memory_bytes: 89292
#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << "\n"
using namespace std;
using ll = long long;

signed main() {
    IO;
    vector<ll> s(10000005, 0);
	s[1] = 1;
    for(ll i = 2; i * i < 10000005; ++i) {
    	if(s[i] == 0) {
    		s[i] = i;
    		for(ll j = 2 * i; j < 10000005; j += i) {
    			if(s[j] == 0) s[j] = i;
    		}
    	}
    }
    for(ll i = 2; i < 10000005; ++i) {
    	if(s[i] == 0) s[i] = i; 
    }
    ll n;
    cin >> n;
    ll ans = 1;
    for(ll i = 2; i <= n; ++i) {
    	ll num = i, cnt = 1;
    	map<int, int> m;
    	assert(s[num] != 0);
    	while(s[num] != num) {
    		++m[s[num]];
    		num /= s[num];
    		assert(s[num] != 0);
    	}
    	++m[s[num]];
    	assert(s[num] != 0);
    	for(auto it: m) {
    		cnt = cnt * ll(it.second + 1);
    	}

    	ans += cnt * i;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 81280
c = []
for i in range(3):
    a = list(map(int,input().split()))
    c.append(a)
flag = True
b = [[0]*3]*3
B = dict()
for i in range(3):
    for j in range(3):
        if i == j:
            continue
        l = []
        for k in range(3):
            x = c[k][i] - c[k][j]
            if len(l) < 1:
                l.append(x)
            else:
                for m in range(len(l)):
                    if x != l[m]:
                        flag = False
                l.append(x)
if flag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char c;
  cin >> c;
  if (c == 'a') {
    cout << "vowel" << endl;
  }
    else if (c == 'i') {
    cout << "vowel" << endl;
  }
      else if (c == 'u') {
    cout << "vowel" << endl;
  }
      else if (c == 'e') {
    cout << "vowel" << endl;
  }
      else if (c == 'o') {
    cout << "vowel" << endl;
  }
  else {
        cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256