akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
using namespace std;

int T[250000000] = {0};

void insert(string s){
    int key=0;
    for(int i=0;i<s.size();i++){
        switch(s[i]){
        case 'A': key += 1; break;
        case 'T': key += 2; break;
        case 'C': key += 3; break;
        case 'G': key += 4; break;
        }
        key *= 5;
    }
    T[key]++;
}

void find(string s){
    int key=0;
    for(int i=0;i<s.size();i++){
        switch(s[i]){
        case 'A': key += 1; break;
        case 'T': key += 2; break;
        case 'C': key += 3; break;
        case 'G': key += 4; break;
        }
        key *= 5;
    }
    if(T[key] >0) cout << "yes" << endl;
    else cout << "no" << endl;
}

int main(){
    int n;
    cin >> n;
    for(int i=0;i<n;i++){
        string t;
        cin >> t;
        if(t == "insert"){
            string r;
            cin >> r;
            insert(r);
        }
        else{
            string r;
            cin >> r;
            find(r);
        }
    }
}


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

int main() {
	int N ;
    cin >> N;
    int M = N;
    int sum = 0;
    int A;
    for(int i = 0; i < 9 ; i++){
    	A = N % 10;
        sum += A;
        N /= 10;
    }
    if(M % sum == 0){
    	cout << "Yes" << endl;
    }else{
    	cout << "No" << endl;
    }
}


Measured memory_bytes: 3636
#include <iostream>
# include <string>
using namespace std;
int main(void){
    // Your code here!
    int a,b,c,x;
    cin>>a>>b>>c>>x;
    int count=0;
    /*for(int i=0;i<a;i++){
       if(x==i*500){
        count++;
       } 
    }
    for(int i=0;i<b;i++){
       if(x==i*100){
        count++;
       } 
    }
    for(int i=0;i<c;i++){
       if(x==i*50){
        count++;
       } 
    }
    for(int i=0;i<a;i++){
        for(int j=0;j<b;j++){
            if(x==i*500+j*100){
                count++;
            }
        }
    }
    for(int i=0;i<b;i++){
        for(int j=0;j<c;j++){
            if(x==i*100+j*50){
                count++;
            }
        }
    }
    for(int i=0;i<a;i++){
        for(int j=0;j<c;j++){
            if(x==i*500+j*50){
                count++;
            }
        }
    }*/
    
    int ii,jj,kk;
    int iti,ni,san;
    if(a>=b&&a>=c){
        if(b>=c){
            iti=a;
            ii=500;
            ni=b;
            jj=100;
            san=c;
            kk=50;
        }
        if(c>=b){
            iti=a;
            ii=500;
            ni=c;
            jj=50;
            san=b;
            kk=100;
        }
    }
    if(b>=a&&b>=c){
        if(a>=c){
            iti=b;
            ii=100;
            ni=a;
            jj=500;
            san=c;
            kk=50;
        }
        if(c>=a){
            iti=b;
            ii=100;
            ni=c;
            jj=50;
            san=a;
            kk=500;
        }
    }
    if(c>=b&&c>=a){
        if(a>=b){
            iti=c;
            ii=50;
            ni=a;
            jj=500;
            san=b;
            kk=100;
        }
        if(b>=a){
            iti=c;
            ii=50;
            ni=b;
            jj=100;
            san=a;
            kk=500;
        }
    }
    for(int i=0;i<=iti;i++){
        for(int j=0;j<=ni;j++){
            for(int k=0;k<=san;k++){
                if(x==i*ii+j*jj+k*kk){
                    count++;
                }
            }
        }
    }
    cout<<count<<endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define pii pair<int,int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define IO ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define read(FILE)  freopen(FILE, "r", stdin);
#define out(FILE) freopen(FILE, "w", stdout);
#define all(x) x.begin(),x.end()
#define rep(i,m,n) for(int i=m ; i<n ; i++)
#define forr(i,m,n) for(int i=m ; i<=n ; i++)
#define clr(v,val) memset(v,val,sizeof(v))
#define endl '\n'
#define pb push_back
#define pff push_front
#define re return
const int N = 2e5 + 5;
const ll mod=int(1e9)+7;
using namespace std;
int main()
{
    IO;
    int n,cnt=1,mn=2e5+5,mx=-1,a[N];
    cin>>n;
    rep(i,0,n) cin>>a[i];

    mn=mx=a[0];
    rep(i,1,n){
    if(a[i]<mn)
        cnt++;
    mn=min(mn,a[i]);

    }



    cout<<cnt;


}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <atcoder/all>

using namespace std;
using namespace atcoder;

signed main() {
	int N, M; cin >> N >> M;
	scc_graph graph(N);
	for (int i = 0; i < M; i++) {
		int a, b;
      	cin >> a >> b;
		graph.add_edge(a, b);
	}
	auto scc = graph.scc();
	cout << scc.size() << endl;
	for (auto v : scc) {
		cout << v.size();
		for (auto x : v) {
			cout << " " << x;
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 40104
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1000000000000000LL
using pint = pair<int,int>;
using vec = vector<int>;
using ll=long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
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; }


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

    string s,t;
    cin>>s;
    cin>>t;
    int cnt=0;
    for(int i=0; i<s.length(); i++){
        if(s.at(i)!=t.at(i)) cnt++;
    }

    cout<<cnt<<endl;
}

Measured memory_bytes: 3792
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mset(m,v) memset(m,v,sizeof(m))
#define pr(a,s) printf("Case #%lld: %lld\n",a,s)
#define mod 1000000007
#define mp make_pair
#define all(a)                a.begin(),a.end()
#define pb push_back
#define scan(a) scanf("%d",&a)
#define scanl(a) scanf("%lld",&a)
#define se second
#define fi first
#define pi 3.14159265358979323
#define pii pair<ll,ll>
 
const ll inf = 1e15;
const int MAXM = 1e5+4;
const int MAXN = 1e4+10;

vector<int> v;
int arr[MAXM];
int n, k;
int dp[MAXM];

int solve(int idx) 
{
	if (idx == n)	return 0;
	if (dp[idx] != -1)	return dp[idx];
	int ret = INT_MAX;
	for (int i = 1 ; i <= k ; i++) {
		if (idx + i <= n) {
			ret = min(ret, abs(arr[idx+i] - arr[idx]) + solve(idx+i));
		}
	}
	return dp[idx] = ret;
}

int main() 
{
	cin>>n>>k;
	for (int i=1;i<=n;i++) {
		dp[i] = -1;
		cin>>arr[i];
	}
	cout << solve(1) << endl;
	return 0;
}

Measured memory_bytes: 5760
#include <iostream>
#include <numeric>
#include <queue>
#include <cstring>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
#include <limits.h>
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
int dp[10005];
string s1,s2;
int n,W;
int v[105],w[105],m[105];
int ans=0;
int main(int argc,char const* argv[])
{
  cin >> n >> W;
  for(int i=0;i<n;i++)
    {
      cin >> v[i] >> w[i] >> m[i];
    }
  memset(dp,0,sizeof(dp));
  for(int i=0;i<n;i++)
    {
      for(int k=0;m[i]>0;k++)
	{
	  int num=min(m[i],(int)(1<<k));
	  m[i]-=num;
	  for(int j=W;j>=num*w[i];j--)
	    {
	      dp[j]=max(dp[j],dp[j-num*w[i]]+v[i]*num);
	    }
	}
    }
  for(int i=0;i<=W;i++)
    {
      ans=max(ans,dp[i]);
    }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3204
#include <iostream>


#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <vector>
#include <list>
using namespace std;
#include <stdio.h>
#include <vector> 
#include <map> 
#include <algorithm>
#include <functional>
#include <algorithm>
#include <functional>
#include <array>
#include <iostream>

#include<iostream>
using namespace std;


int main()
{
	int N, M;
	std::string S;
	cin >> N;

	printf("%f\n", (float)((N+1)/2) / N);

	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int a, n, i;
	long long int min, max, sum;

	scanf("%d\n%d", &n, &a);
	sum = a;
	min = a;
	max = a;

	for(i=1; i<n; i++){
		scanf("%d", &a);
		sum += a;
		if(min>a)
			min = a;
		if(max<a)
			max = a;
	}

	printf("%lld %lld %lld\n", min, max, sum);

	return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std ;
#define rep( i, s, t ) for( register int i = s; i <= t; ++ i )
#define re register
#define int long long
int gi() {
	char cc = getchar() ; int cn = 0, flus = 1 ;
	while( cc < '0' || cc > '9' ) {  if( cc == '-' ) flus = - flus ; cc = getchar() ; }
	while( cc >= '0' && cc <= '9' )  cn = cn * 10 + cc - '0', cc = getchar() ;
	return cn * flus ;
}
const int N = 2e5 + 5 ; 
const int P = 1e9 + 7 ; 
int n, m, fac[N], inv[N], Ans ;  
int fpow( int x, int k ) {
	int ans = 1, base = x ; 
	while( k ) {
		if( k & 1 ) ans = ans * base % P ;
		base = base * base % P, k >>= 1 ;
	} return ans ; 
}
int C( int x, int y ) {
	if( y > x ) return 0 ;
	return fac[x] * inv[y] % P * inv[x - y] % P ; 
}
signed main()
{
	n = gi(), m = gi(), inv[0] = fac[0] = 1 ;
	rep( i, 1, n ) fac[i] = fac[i - 1] * i % P, inv[i] = fpow( fac[i], P - 2 ) ;
	Ans = 1 ;
	for( re int i = 1; i <= min( n - 1, m ); ++ i ) {
		int ans = C( n, i ) ;
		int t = n - i, uu = C( n - 1, n - t )  ; 
		Ans = ( Ans + ans * uu % P ) % P ;
	} cout << Ans << endl ;
	return 0 ;
}


Measured memory_bytes: 3456
#pragma GCC optimize("Ofast",3,"inline")
#include<bits/stdc++.h>
using namespace std;
#define fir first
#define sec second
#define m_p make_pair
#define y1 ygftgfgcdtfgxffgx
#define y2 yfdsesgvtyghftfvv
#define x1 xvyr6cf6fgcfgf676
#define x2 xcr6rfc5r66y6r6fr
#define up_bound upper_bound
#define low_bound lower_bound
#define next_per next_permutation
#define pb push_back
#define i_to_s to_string
typedef priority_queue<int> p_queue;
typedef priority_queue<int, vector<int>, greater<int> > min_p_queue;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int mon[20]={31,28,31,30,31,30,31,31,30,31,30,31};
ll gcd(ll x,ll y){return ((y==0)?x:gcd(y,x%y));}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	int a,b,c;
	cin>>a>>b>>c;
	cout<<c<<' '<<a<<' '<<b;
	return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val mod = (1e9 + 7).toInt()
    val s = readLine()!!.toInt()
    val dp = Array(2001) { 0 }
    dp[3] = 1
    for (i in 4..s) {
        dp[i] = (dp[i - 3] + dp[i - 1]) % mod
    }
    println(dp[s])
}

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

int main() {
  int n; cin >> n;
  set<int> mochi;
  for(int i = 0; i < n; ++i) {
    int a; cin >> a;
    mochi.insert(a);
  }
  cout << mochi.size() << "\n";
}

Measured memory_bytes: 3588
def solve(string):
    n, *h = map(int, string.split())
    s = "".join(["1" if h0 >= h1 else "0" for h0, h1 in zip(h, h[1:])]).split("0")
    return str(max(list(map(len, s))))


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))


Measured memory_bytes: 15180
#include <bits/stdc++.h>
 
using namespace std;
 
using i64 = long long;
#define forn(a, e) for (i64 a = 0; a < (i64)(e); a++)
#define forr(a, s, e) for (i64 a = s; a < (i64)(e); a++)
#define fore(e, a) for (auto& e : a)
 
#ifdef LOCAL
#define logv(a) {cerr << #a << " = "; fore(e, a) {cerr << e << " ";} cerr << "\n";}
#define logvp(a) {cerr << #a << " = "; fore(e, a) {cerr << "(" << e.first << ", " << e.second << ") ";} cerr << "\n";}
#define logvv(a) {cerr << #a << " = \n"; fore(r, a) { fore(e, r) {cerr << e << " ";} cerr << "\n";} }
#define logvf(a, field) {cerr << #a"."#field << " = \n"; fore(e, a) { cerr << e.field << " ";} cerr << "\n"; }
#define logvff(a, f1, f2) {cerr << #a".{"#f1 << ", "#f2 << "} = \n"; fore(e, a) { cerr << "(" << e.f1 <<", " << e.f2 << ") ";} cerr << "\n"; }
#define logs(a) cerr << #a << " = " << (a) << "\n";
#define logss(a, b) cerr << #a << " = " << (a) << ", " << #b << " = " << (b) << "\n";
#define logp(a) cerr << #a << " = " << "(" << a.first << ", " << a.second << ")" << "\n";
#define cond(pred, stmt) if (pred) { stmt }
#else
#define logv(a)
#define logvp(a)
#define logvv(a)
#define logvf(a, field)
#define logvff(a, f1, f2)
#define logs(a)
#define logss(a, b)
#define logp(a)
#define cond(pred, stmt)
#endif
 
using iip = pair<int, int>;
using llp = pair<i64, i64>;
using ivec = vector<int>;
using llvec = vector<i64>;
using svec = vector<string>;
template<typename T> using vec = vector<T>;
 
template<typename T, typename Dim>
auto make_vec(T value, Dim dim) { return vector<T>(dim, value); }
template<typename T, typename Dim1, typename... Dim>
auto make_vec(T value, Dim1 dim1, Dim... dims) { return make_vec(make_vec(value, dims...), dim1); }
 
template<typename T>
bool uax(T& v, const T& newv) { if (v < newv) { v = newv; return true; } else return false; }
template<typename T>
bool uin(T& v, const T& newv) { if (v > newv) { v = newv; return true; } else return false; }
 
template<typename T>
istream& operator>>(istream& is, vector<T>& c) { for (auto& e : c) is >> e; return is; }
template<typename T, size_t N>
istream& operator>>(istream& is, array<T, N>& c) { for (auto& e : c) is >> e; return is; }
 
template<typename ...T>
istream& read(T&... args) { return (cin >> ... >> args); }
 
static mt19937 rande(123123);
template<typename T>
T rand_int(T from, T to) { uniform_int_distribution<T> distr(from, to); return distr(rande); }
 
constexpr int INF = 1e9;
constexpr int MXB = 20;
using bin = bitset<MXB>;
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    rande.seed(chrono::steady_clock::now().time_since_epoch().count());
    
    i64 n;
    while (read(n)) {
        ivec a(n);
        read(a);

        int xr = 0;
        forn(i, n) {
            xr ^= a[i];
        }
        forn(i, n) {
            a[i] ^= xr;
        }
        forn(i, n) {
            cout << a[i] << " ";
        }
        cout << endl;
    }

}

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

int main(void){
    int n;
    cin >> n;
    vector<int> p(n);
    for(int i=0;i<n;i++) cin >> p[i];
    vector<int> q = p;
    sort(q.begin(),q.end());
    if(p==q){cout << "YES" << endl; return 0;}

    bool ok = false;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            swap(p[i],p[j]);
            if(p==q) ok = true;
            swap(p[i],p[j]); 
        }
    }

    if(ok) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
l,r=map(int,input().split())
if r-l>=2019:
    ans=0
else:
    ans=2018**2
    l,r=l%2019,r%2019
    for i in range (l,r+1):
        for j in range(i+1,r+1):
           ans=min(ans,(i*j)%2019)
print(ans)

Measured memory_bytes: 3064
#include <cstdio>
#include <cassert>
#include <algorithm>    
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <bitset>
#define pb push_back
#define mk make_pair
#define int long long
#define eb emplace_back
#define eps 1e-8
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()


using namespace std;
typedef long double ld;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef tuple<int, int, int> tiii;
typedef vector<int> vii;
typedef vector<long double> vd;
const int inf = 1e9;
const int INF = 1e18;
const int M = 1e9 + 7;

const int maxn = 2e5;
pii a[maxn];
set<int> s[maxn];
std::vector<int> v[maxn], vv[maxn];
int r[maxn], p[maxn];

void init(int n){
	for(int i = 1; i <= n; ++i){
		r[i] = 0;
		p[i] = i;
	}
}

int find(int x){ 
	return x == p[x] ? x : p[x] = find(p[x]);
}

inline int same(int x, int y){ 
	return find(x) == find(y); 
}

void unite(int x, int y){
	int px = find(x), py = find(y);	
	if(px == py) {
		return;
	}
	if(r[px] < r[py]) {
		p[px] = py;
	}
	else {
		p[py] = px;
		if(r[px] == r[py]) r[px]++;
	}
}


signed main()
{
#ifndef ONLINE_JUDGE
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
#endif
	int n;
	cin >> n;
	for(int i = 0; i < n; ++i){
		cin >> a[i].fi >> a[i].se;
	}
	sort(a, a + n);
	int cur = a[0].fi, i = 0, res = 0, dep = 0;
	while(i < n){
		++dep;
		while(i < n && a[i].fi == cur){
			v[a[i].se].pb(dep);
			s[dep].insert(a[i].se);
			++i;
		}
		cur = a[i].fi;
	}
	init(1e5 + 5);
	for(int i = 1; i <= 1e5; ++i){
		if((int)v[i].size() < 2) continue;
		for(int j = 1; j < (int)v[i].size(); ++j){
			unite(v[i][j], v[i][0]);
		}
	}
	for(int i = 1; i <= 1e5; ++i){
		vv[find(i)].pb(i);
	}
	for(int i = 1; i <= 1e5; ++i){
		if((int)vv[i].size() > 1){
			set<int> t;
			int tot = 0;
			for(int j : vv[i]){
				for(int k : s[j]){
					t.insert(k);
					++tot;
				}
			}
			res += (int)vv[i].size() * (int)t.size() - tot;
		}
	}
	cout << res << endl;



    
	return 0;
}

Measured memory_bytes: 34812
#include <bits/stdc++.h>
using namespace std;
#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
typedef long long ll;
typedef long double ld;
const ll inf = 1e18;
const int nax = 2e6 + 7;
const ll mod = 1e9 + 7;
//ll tree[4 * nax];
//9uS-22RSwk7gQqh
int count(ll x){
	int cnt = 0;
	while(x != 0){
		cnt++;
		x /= 10;
	}
	return cnt;
}

int main()
{
	int h , w;
	cin >> h >> w;
	for(int i = 0 ; i <= h + 1 ; i++){
		for(int j = 0 ; j <= w + 1 ; j++)
		{
			if(i == 0 || i == h + 1 || j == 0 || j == w + 1)
				cout << "#";
			else{
				char x;
				cin >> x;
				cout << x;
			}
		}
		cout << endl;
	}
	return 0;
} 




Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main(int argc, char** argv)
{
	int i, min, max, num;
	scanf("%d %d %d", &min, &max, &num);

	int cnt = 0;
	int chk_max = (int)sqrt((double)num);

	for (i = 1; i <= chk_max; i++) {
		if (num % i == 0) {

			if (i >= min && i <= max) {
				cnt++;
			}

			int val = num / i;
			if (chk_max < val && val >= min && val <= max) {
				cnt++;
			}
		}
	}

	printf("%d\n", cnt);
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define int long long
using namespace std;
int n;
main(){
cin>>n;
int ind=0;
for(int k=1;k<=n;k++){
    int a;
    cin>>a;
    if(a!=k)
        ind++;
}
if(ind>=3)
    cout<<"NO";
else cout<<"YES";
return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<limits.h>
#include<math.h>

int main(void){
    char O[51], E[51];
    scanf("%s", O);
    scanf("%s", E);

    int i;
    for(i=0; i<strlen(O)-1; i++) {
        printf("%c%c", O[i], E[i]);
    }
    printf("%c", O[strlen(O) - 1]);
    if(strlen(O) == strlen(E)) {
        printf("%c", E[strlen(E) - 1]);
    }
    printf("\n");

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
using namespace std;
int main() {
	int N,M,i,a,b;
	int L[50];
	cin >> N >> M;
	for (i = 0; i < N; i++) {
		L[i] = 0;
	}

	for (i = 0; i < M; i++) {
		cin >> a >> b;
		L[a-1]++;
		L[b-1]++;
	}
	for (i = 0; i < N; i++) {
		cout << L[i] << endl;
	}
	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 - 1)
using namespace std;
typedef long long ll;
template <class T> inline bool dpmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool dpmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

void solve(long long N) {
    ll ans, p;

    p = (int)(log2(N));

    ans = (int)(pow(2, p));

    cout << ans << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips:
// You use the default template now. You can remove this line by using your
// custom template)
int main() {
  long long N;
  cin >> N;
  solve(N);
  return 0;
}


Measured memory_bytes: 3992
import std.stdio, std.string, std.conv, std.range, std.array, std.algorithm;
import std.uni, std.math, std.container, std.typecons, std.typetuple;
import core.bitop, std.datetime;

immutable long mod = 10^^9 + 7;
immutable long inf = mod;

void main(){
    int n = readln.chomp.to!int;

    auto div = factorize(n);

    writef("%s: ", n);
    writefln("%(%s %)", div);
}

int[] factorize(int n){
    auto div = new int[](0);

    for(int p = 2; p*p <= n; ++p){
        while(n % p == 0){
            n /= p;
            div ~= p;
        }
    }

    if(n > 1) div ~= n;

    return div;
}

bool is_prime(int x){
    for(int i = 2; i*i <= x; ++i){
        if (x % i == 0) {
            return false;
        }
    }

    return true;
}

T modpow(T)(T x, T y, T mod){
    T res = 1;

    while(y > 0){
        (res *= x^^(y&1)) %= mod;
        y >>= 1;
        x = x^^2 % mod;
    }

    return res;
}

void readVars(T...)(auto ref T args){
    auto line = readln.split;
    foreach(ref arg ; args){
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    if(!line.empty){
        throw new Exception("args num < input num");
    }
}

Measured memory_bytes: 2728
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
typedef  int long long ll;
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
    
    ll n;
    cin>>n;
    string s;
    cin>>s;
    map<char,ll> m;
    rep(i,n){
        m[s[i]]++;
    }
    if(n==1){
        cout<<1<<endl;return 0;
    }
    ll ans=1;
    for(auto itr=m.begin();itr!=m.end();itr++){
        ll u=itr->second;
        ans*=(u+1);
        ans%=1000000007;
        
    }
    
    cout<<ans-1<<endl;
return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll        long long
#define  sci(x)   scanf("%d", &x)
#define  scl(x)   scanf("%lld", &x)
#define  scd(x)   scanf("%lf", &x)
#define l0(i,n)   for(ll i=0; i<n; i++)

int main ()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	//CODE TONOY
	int a,b,c;
	cin>>a>>b>>c;
	cout<<c<<" "<<a<<" "<<b<<endl;			
	return 0;
}

Measured memory_bytes: 256
[a, b, ab, x, y] = [int(i) for i in input().split()]
price = []
price.append(a * x + b * y)
if x > y:
    price.append(2 * ab * y + a * (x-y))
else:
    price.append(2 * ab * x + b * (y-x))
price.append(ab * 2 * max(x, y))
print(min(price))

Measured memory_bytes: 38384
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <cctype>
#include <tuple>
#include <array>
#include <cassert>

// BEGIN CUT HERE
#ifdef _MSC_VER
#include <agents.h>
#endif
// END CUT HERE 

#define FOR(i, a, b) for(int i = (int)(a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define REV(v) v.rbegin(), v.rend()
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define MP make_pair
#define MT make_tuple

using namespace std;	

typedef long long ll;
typedef pair<int, int> P;
typedef unsigned long long ull;

void check(vector<int> v, vector<int> &cand){
	// h, m, s
	if (v[0] % 5 != v[1] / 12) return;
	cand.push_back(v[0] / 5 * 60 * 60 + v[1] * 60 + v[2]);
}

int main(){
	int n;
	while (cin >> n, n){
		vector<vector<int>> cand(n);
		rep(i, n){
			vector<int> v(3);
			rep(j, 3) cin >> v[j];
			rep(k, 60){
				sort(ALL(v));
				do{
					check(v, cand[i]);
				} while (next_permutation(ALL(v)));
				rep(j, 3) v[j] = (v[j] + 1) % 60;
			}
		}
		tuple<int, int, int> ans;
		ans = MT(1e9, 1e9, 1e9);
		rep(i, n) rep(j, cand[i].size()){
			int start = cand[i][j];
			int end = start;
			rep(k, n){
				if (i == k) continue;
				int tmp = 12 * 60 * 60;
				for (auto t : cand[k]){
					if (start > t) continue;
					tmp = min(tmp, t);
				}
				end = max(end, tmp);
			}
			if (end == 12 * 60 * 60) continue;
			ans = min(ans, MT(end - start, start, end));
		}
		int s, e, t;
		tie(t, s, e) = ans;
		printf("%02d:%02d:%02d %02d:%02d:%02d\n", s / 3600, s % 3600 / 60, s % 60, e / 3600, e % 3600 / 60, e % 60);
	}

	return 0;
}

Measured memory_bytes: 1208
#include<stdio.h>
int main(){
    int a,b,c;
    scanf("%d",&a);
    if(a==1||a==2||a==3||a==4||a==5||a==6||a==7||a==8||a==9||a==10||a==12||a==14||a==15||a==16||a==18||a==20||a==21||a==24||a==25||a==27||a==28||a==30||a==32||a==35||a==36||a==40||a==42||a==45||a==48||a==49||a==54||a==56||a==63||a==64||a==72||a==81){
        printf("Yes");
    }
    else{
        printf("No");
    }
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        long k = getLong(sc.nextLine());

        for(int i = 0;i < k ;i++){
            if(s.charAt(i) != '1'){
                System.out.println(s.charAt(i));
                return;
            }
        }
        System.out.println(1);
        sc.close();
    }
    static long getLong(String val) {
        return Long.parseLong(val);
    }
}


Measured memory_bytes: 23632
import sys
import math
import time

start = time.time()
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n, a, b = na()

if (b-a) % 2 == 0:
    print((b-a)//2)
else:
    f = (a-1) + (b-a)//2+1
    b = (n-b) + (b-a)//2+1
    print(min(f, b))

Measured memory_bytes: 3188
#include <stdio.h>

void Grade(int m, int f, int r)
{
	if ( (m == -1) || (f == -1) )
	{
	    printf("F\n");
	}
	else 
	{
		if(m + f >= 80)
		{
		    printf("A\n");
		}
		else if(m + f >= 65)
		{
		    printf("B\n");
		}
		else if(m + f >= 50)
		{
		    printf("C\n");
		}
		else if(m + f < 30)
		{
		    printf("F\n");
		}
		else if(r >= 50)
		{
		    printf("C\n");
		}
		else
		{
		    printf("D\n");
		}
	}
}

int main()
{
	int m, f, r;

	while (1)
	{
	    scanf("%d%d%d", &m, &f, &r);
    	if (m == -1 && f == -1 && r == -1)
    	{
    	    break;
    	}
    	else
    	{
    	    Grade(m, f, r);
    	}
	}
	return 0;
}



Measured memory_bytes: 2032
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main(){
    int N,D;
    cin >> N >> D;
    int ans = 0;
    for(int i = 0; i < N; i++) {
        int X,Y;
        cin >> X >> Y;
        if(D*D >= X*X+Y*Y) {
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
    int n, f[110][15], p[110][15];

    cin >> n;
    for (int i = 0; i < n; i++) for (int j = 0; j < 10; j++) cin >> f[i][j];
    for (int i = 0; i < n; i++) for (int j = 0; j <= 10; j++) cin >> p[i][j];

    int res = -(1<<30);

    for (int i = 1; i < 1 << 10; i++) {
        int t = 0;
        for (int j = 0; j < n; j++) {
            int cnt = 0;
            for (int k = 0; k < 10; k++) {
                if ((i >> k & 1) and f[j][k]) cnt++;
            }
            t += p[j][cnt];
        }
        res = max(res, t);
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n, u, v, w, bos[100009], m;
vector<int> vec[100009];
bool col[100009];
set<int> st;

int get_bos(int x)
{
	if (bos[x] != x) {
		bos[x] = get_bos(bos[x]);
	}
	return bos[x];
}

void unite(int x, int y) {
	x = get_bos(x);
	y = get_bos(y);
	if (x > y) swap(x, y);
	bos[y] = x;
}



int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		bos[i] = i;
	}
	for (int i = 0; i < m; i++) {
		cin >> u >> v >> w;
		if (1) {
			unite(u, v);
		}
	}
	for (int i = 1; i <= n; i++) {
		st.insert(get_bos(i));
	}
	cout << st.size() << "\n";
	//system("pause");
	return 0;
}

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

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

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define test() int t;cin>>t;for(int test=1;test<=t;test++)
#define pb push_back
#define nl cout<<"\n"
#define F first
#define S second
#define all(x) x.begin(),x.end()

template<class C> void min_self( C &a, C b ){ a = min(a,b); }
template<class C> void max_self( C &a, C b ){ a = max(a,b); }

const ll MOD = 1000000007;
ll mod( ll n, ll m=MOD ){ n%=m,n+=m,n%=m;return n; }

const int MAXN = 1e5+5;
const int LOGN = 21;
const ll INF = 1e14;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};

template<class T1, class T2> void add( T1 &x, T2 y, ll m = MOD )
{
	x += y;
	if( x >= m )
		x -= m;
}

template<class T1, class T2> void sub( T1 &x, T2 y, ll m = MOD )
{
	x -= y;
	if( x < 0 )
		x += m;
}

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

	// a1 = x
	// a2 = x^2 mod m	
	// a3 = x^4 mod m
	// a4 = x^8 mod m
	// a5 = x^16 mod m
	// an = x^(2^(n-1)) mod m
	// sum of an = sum of ( x ^ 2^(i-1) ) mod m  for i = 1 to n

	ll n,x,m;
	cin>>n>>x>>m;

	
	vector<ll>v;
	set<ll>st;
	ll now = x;
	while( st.count(now) == 0 )
	{
		v.pb(now);
		st.insert(now);
		now = mod( now*now, m );
	}

	ll cycle_at = now;
	int sz = v.size(), index = -1;
	vector<ll>pref(sz+1,0);
	for(int i=0;i<sz;i++)
	{
		pref[i+1] = pref[i] + v[i];
		if( v[i] == now )
		{
			if( index == -1 )
				index = i;
		}
	}

	ll ans = pref[index];
	n -= index;

	int cycle_length = (sz-index);
	ll full = n/cycle_length;
	ll rem = n%cycle_length;

	ans += full * ( pref[sz] - pref[index] );
	ans += ( pref[index+rem] - pref[index] );

	cout<<ans,nl;


	cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
	return 0;
}


Measured memory_bytes: 6468
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
using ll = long long;
using namespace std;

int main(){
    string s;
    cin>>s;
    int a=0x61;
    char x;
    sort(s.begin(),s.end());
    rep(i,0,s.length()){
        if(s[i]==x)continue;
        else if(s[i]==a){a++;x=s[i];}
        else break;
    }
    if(a==0x7b)cout<<"None";
    else cout<<char(a);
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
int s[200005];
int vis[200005];
int main(){
	cin>>n;
	int k=0,ans=0;
	for(int i=1;i<=n;i++){
		scanf("%d",s+i);
		vis[s[i]]=vis[s[i]-1]+1;
		ans=max(vis[s[i]],ans);
	}
	cout<<n-ans;
	return 0;
}


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

int main() {
	// your code goes here
	string s1, s2;
	cin >> s1 >> s2;
	int l1 = s1.size(), l2 = s2.size();
	for(int i = 0, j = 0, k = 0; i < l1+l2; i++)
	{
	    if(i%2 == 0)printf("%c", s1[j++]);
	    else printf("%c", s2[k++]);
	}
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i < b; i++)


bool sort_by(pi c, pi d){
	return c.S < d.S;
}

int main() {
	int n, ans=0, m=101, s;
	cin >> n;
	REP(i, 0, n){
		cin >> s;
		ans += s;
		if(s%10!=0) m=min(m, s);
	}
	if(ans %10 == 0){
		if(m == 101) cout << 0;
		else cout << ans - m;
	}
	else cout << ans;
}


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

int main(){
  int W, H, N;
  cin >> W >> H >> N;
  int min_x = 0, min_y = 0, max_x = W, max_y = H;
  for (int i=0; i<N; i++){
    int x, y, a;
    cin >> x >> y >> a;
    if (a==1) min_x = max(min_x, x);
    if (a==2) max_x = min(max_x, x);
    if (a==3) min_y = max(min_y, y);
    if (a==4) max_y = min(max_y, y);
  }
  cout << (max(0, max_x - min_x) * max(0, max_y - min_y)) << endl;
  return 0;
}

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

int main() {
  int h, w, k;
  cin >> h >> w >> k;
  int x1, x2, y1, y2;
  cin >> y1 >> x1 >> y2 >> x2;
  x1--;
  y1--;
  x2--;
  y2--;

  vector<vector<bool>> c(h, vector<bool>(w, false));
  rep(i, h) {
    string s;
    cin >> s;
    rep(j, w) {
      if (s[j] == '@') c[i][j] = true;
    }
  }

  vector<vector<int>> d(h, vector<int>(w, -1));
  queue<pair<pair<int, int>, int>> que;

  que.push({{x1, y1}, 0});
  d[y1][x1] = 0;

  while (!que.empty()) {
    int cx = que.front().first.first;
    int cy = que.front().first.second;
    int cd = que.front().second;
    que.pop();

    if (cx == x2 && cy == y2) {
      cout << cd << endl;
      return 0;
    }

    int shift[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
    rep(i, 4) {
      rep2(j, 1, k + 1) {
        int nx = cx + j * shift[i][0];
        int ny = cy + j * shift[i][1];
        int nd = cd + 1;
        if (nx < 0 || nx >= w || ny < 0 || ny >= h) break;
        if (c[ny][nx]) break;
        if (d[ny][nx] >= 0 && d[ny][nx] <= cd) break;
        if (d[ny][nx] < 0 || d[ny][nx] > nd) {
          que.push({{nx, ny}, nd});
          d[ny][nx] = nd;
        }
      }
    }
  }

  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 11328
#include<iostream>
#include<string>// 加法 S.size() s.substr(l,r=s.size()-l) -> l文字目からr文字分
#include<cmath>//三角関数,rad
#include<algorithm>//__gcd()　lower_bound(a+l,a+r,x)-a でindex
// 配列  -> min/max({}) 
// vector-> *min_element(a+l,a+r)  *忘れず lとrで[l,r) 
//reverse(a+l,a+r)   配列aの[l,r)を逆順に strはreverse(all(s))
//sort(a+l,a+r,greater <int>()) 配列aの[l,r)昇順sort,大きい順はgreater<type>()
//vectorならall(v)
#include<ctime>//"clock()/CLOCKS_PER_SEC で秒数
#include<vector>//v.push_back(x),v.pop_back()
#include<queue>//q.push(x),front()で先頭を返す,pop()で削除, size(),empty()
#include<deque>//(push/pop)_(front/back)/fornt/back/insert/
#include<functional>//vector,queueと併用でpriority_queue
//宣言は priority_queue< Type, vector<Type>, greater<Type>> Q1; 
// pq.push(x),top()で参照 pop()で削除   greaterで最小 lessで最大がtopに
using namespace std;
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define print(i) std::cout << (i) << '\n'
inline long long ceildiv(long long a, long long  b) { return (a+b-1)/b; }
typedef pair<long long,long long> P;
const long long inf = 10e7;
//int |x|<=2*10**9     long |x|<= 9*10**18

#define ll long long
int main(){
int q,x,y;deque<int> v;
cin>>q;rep(i,q){cin>>x;
switch (x)
{
case 0:
    cin>>x>>y;
    if (x==0){v.push_front(y);}else{v.push_back(y);}
    goto d;

case 1:
    cin>>x;
print(v.at(x));
goto d;
case 2:cin>>y;if (y==0){v.pop_front();}else{v.pop_back();}goto d;
}
d:continue;
}
}



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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int a,b,q;
    cin>>a>>b>>q;
    vl s(a+1);
    vl t(b+1);

    REP(i,a) cin>>s[i];
    REP(i,b) cin>>t[i];
    s[a] = LONG_MAX;
    t[b] = LONG_MAX;
    sort(ALL(s));
    sort(ALL(t));

    vl stot(a);
    vl ttos(b);

    {
        int j=0;
        REP(i,a){
            while(true){
                if(s[i] > t[j]) j++;
                else break;
            }
            ll temp;
            if(j==0) temp = abs(s[i]-t[j]);
            else temp = min(abs(s[i]-t[j-1]), abs(s[i]-t[j]) );
            stot[i] = temp;
        }

        j=0;
        REP(i,b){
            while(true){
                if(t[i] > s[j]) j++;
                else break;
            }
            ll temp;
            if(j==0) temp = abs(t[i]-s[j]);
            else temp = min(abs(t[i]-s[j-1]), abs(t[i]-s[j]) );
            ttos[i] = temp;
        }
    }

    REP(i,q){
        ll ans = LONG_MAX;
        ll x;
        cin>>x;
        //DEBUG(x);
        ll temp = 0;
        //神社->寺
        auto iter = lower_bound(ALL(s),x);
        int idx = distance(s.begin(),iter);
        if(*iter == x){
            temp = stot[idx];
        }else{
            if(idx == 0){
                temp = abs(s[idx]-x) + stot[idx];
            }else{
                temp = min(abs(abs(s[idx-1]-x)+stot[idx-1]), abs(abs(s[idx]-x)+stot[idx]));
            }  
        }

        ans = min(ans,temp);

        //寺->神社
        iter = lower_bound(ALL(t),x);
        idx = distance(t.begin(),iter);
        if(*iter == x){
            temp = ttos[idx];
        }else{
            if(idx == 0){
                temp = abs(t[idx]-x) + ttos[idx];
            }else{
                temp = min(abs(abs(t[idx-1]-x)+ttos[idx-1]), abs(abs(t[idx]-x)+ttos[idx]));
            }  
        }

        ans = min(ans,temp);
        cout << ans << endl;        
    }

    return 0;
}

Measured memory_bytes: 4480
#include<iostream>
using namespace std;
int main(){
	int n,x;
	cin>>n>>x;
	int a[n+1]={};
	for(int i=1;i<=n;i++){
		cin>>a[i];
		a[i]+=a[i-1];
		if(a[i]>x) return cout<<i,0;
	}
	cout<<n+1;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const ll mod=1e9+7;
const int maxk=1e5+1;
const int maxn=101;
ll dp[maxn][maxk];
ll pre[maxk];
int a[maxn];
int n,k;
int main()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<=k;j++)
		{
			if(j==0)dp[i][j]=1;
			else if(i==0)dp[i][j]=0;
			else 
			{
				if(j-a[i]-1>=0)dp[i][j]=(pre[j]-pre[j-a[i]-1]+mod)%mod;
				else dp[i][j]=pre[j]%mod;
			}
		}
		for(int v=0;v<=k;v++)
		{
			if(v==0)pre[v]=dp[i][v];
			else pre[v]=(pre[v-1]+dp[i][v])%mod;
		}
	}
	cout<<dp[n][k]<<endl;
	return 0;
}

Measured memory_bytes: 79872
#include <iostream>
#include <bits/stdc++.h>
#define ll long long

using namespace std;
int n,m,k,a[300100];
string s;

int main()
{
//    cin >> s;
//    bool check = false , check2 = false;
//    if(((s[0] == '0' && s[1] != '0') || (s[0] == '1' && (s[1] == '0' || s[1] == '1' || s[1] == '2')))
//       && (s[2] != '0' || s[3] != '0'))
//        check = true;
//    if((s[0] != '0' || s[1] != '0') &&
//       ((s[2] == '0' && s[3] != '0') || (s[2] == '1' && (s[3] == '0' || s[3] == '1' || s[3] == '2'))))
//        check2 = true;
//    if(check2 && check)
//        cout << "AMBIGUOUS";
//    else if(check)
//        cout << "MMYY";
//    else if(check2)
//        cout << "YYMM";
//    else
//        cout << "NA";
    double n,k;  cin >> n >> k;
    double Ans = 0;
    for(int i = 1;i<=n;i++){

        int Have = i , cnt = 0;
        while(Have < k){
            cnt++;
            Have*=2;
        }
        double Res = 1;
        for(int j = 1;j<=cnt;j++)  Res*=1.0/2.0;
        Ans+=(1/n) * Res;
    }
    cout << setprecision(15) << fixed << Ans;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h, w, d;
    cin >> h >> w >> d;
    string s = "RGBY";
    rep(i, 0, h){
        rep(j, 0, w){
            int x = i + j + 1000;
            int y = i - j + 1000;
            x /= d; y /= d;
            cout << s[(x % 2) * 2 + (y % 2)];
        }
        cout << endl;
    }
}

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

using ll = long long;
#define REP(i,n) for(int i=0; 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 INF 1e9

int main(){
  string S;
  cin >> S;
  REP(i, S.size()){
    cout << 'x';
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        Map<Character, Integer> map = new HashMap<>();
        for (int i = 0; i < s.length; i++) {
            if(!map.containsKey(s[i])) {
                map.put(s[i], 1);
            }
            else {
                map.put(s[i], map.get(s[i]) + 1);
            }
        }
        if(map.size() == 2 && map.get(s[0]) == 2) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 35728
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

public class Class1
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        int A = int.Parse(input[0]);
        int B = int.Parse(input[1]);
        int T = int.Parse(input[2]);

        Console.WriteLine(Math.Floor((T + 0.5) / A) * B);
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
#include <iomanip>
#define rep(i,N) for(int i=0;i<(int)N;++i)
//cout << fixed << setprecision(20) << *** << endl;
typedef long long ll;
using namespace std;
int main()
{
	ll N,ANS=0;
	cin>>N;
	vector<ll>vec(100002,0);
	rep(i,N){
		ll t;
		cin>>t;
		vec[t]++;
		vec[t+1]++;
		vec[t+2]++;
	}
	sort(vec.begin(),vec.end());
	cout<<vec.back()<<endl;
}


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

template <typename T>
void print_vector(vector<T>& vec) {
    cout << "print_vector -> ";
    for(int i=0; i<vec.size(); i++) {
        if(i == vec.size()-1) {
            cout << vec[i] << endl;
        }
        else {
            cout << vec[i] << " ";
        }
    }
    return;
}

int main() {

    int n;
    cin >> n;
    vector<int> p(n);
    vector<int> q(n);
    for(int i=0; i<n; i++) cin >> p[i];
    for(int i=0; i<n; i++) cin >> q[i];

    vector<int> vec(n);
    for(int i=0; i<n; i++) vec[i] = i+1;    

    int p_index, q_index;

    int index = 0;
    do {
        if(vec == p) p_index = index;
        if(vec == q) q_index = index;
        index++;
    } while(next_permutation(vec.begin(), vec.end()));

    cout << abs(p_index-q_index) << endl;

    return 0;
}

Measured memory_bytes: 256
unittest
{
	assert( [ "7" ].parse.expand.solve == 2 );
	assert( [ "149696127901" ].parse.expand.solve == 27217477801 );

	assert( [ "11" ].parse.expand.solve == 2 );		// 追加ケース
}



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

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

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto x = input.front.to!( long );
	return tuple( x );
}

auto solve( long x )
{
	auto ans = x / ( 6 + 5 ) * 2;		// 6と5を交互に使ったときの回数（余りの分含まない）
	auto r = x % ( 6 + 5 );
	if(      6 < r ) ans += 2;		// 余りの分を加算（6と5の場合）
	else if( 0 < r ) ans += 1;		// 余りの分を加算（6だけで済む場合）
	
	return ans;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[200005],b[200005];
int main()
{
	int n;
	cin >> n;
	for(int i=0;i<n;i++)
		scanf("%d",&a[i]);
	int cnt=1;
	for(int i=0;i<n;i++){
		if(a[i]==cnt){
			b[cnt]=a[i];
			cnt++;	
		}
	}
	if(cnt==1){
		cout << -1 << endl;
	}
	else{
		cout << n-cnt+1 << endl;
	}
	return 0;
} 

Measured memory_bytes: 1792
import itertools
import math
n,d = map(int, input().split())
x = [list(map(int, input().split())) for i in range(n)]
m = 0
for h in itertools.combinations(x, 2):
    num = 0
    for j in range(d):
        num += (h[0][j]-h[1][j])**2
    if math.sqrt(num).is_integer() == True:
        m += 1
print(m)

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

#define ll long long

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll l, r;
    cin >> l >> r;

    vector<int> rem;
    vector<int> :: iterator itr;

    int mod = 0;

    for (ll i = l; i <=r; i++){
        mod = i % 2019;
        if (find(rem.begin(), rem.end(), mod) == rem.end()){
            rem.push_back(mod);
        }else {
            break;
        }
    }

    ll _min = 1e9;

    ll x;
    for (ll i = 0; i < rem.size(); i++){
        for (ll j = i + 1; j < rem.size(); j++){
            x = (rem[i] * rem[j]) % 2019;
            _min = min(_min, x);
        }
    }

    cout << _min << endl;


    return 0;
}



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

using namespace std;

const int N = 4e6 + 5;

typedef long long ll;

const ll mod = 1e9 + 7;

int x, n, s;
bitset <N> a;

main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    a.set(0);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> x;
        s += x;
        a |= (a << x);
    }
    for (int i = (s + 1) / 2; ; i++) {
        if (a[i]) {
            cout << i;
            return 0;
        }
    }
}


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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"
*/

int binarySearch(vector<int> A, int k, int n){
    int left = 0;
    int right = n;
    while(left < right){
        int mid = (left + right) / 2;
        if(A[mid] == k){
            return mid;
        }else if(A[mid] > k){
            right = mid;
        }else{
            left = mid+1;
        }
    }
    return n;
}

int main()
{
    int n; cin >> n;
    vector<int> A;
    rep(i,n){
        int Ai; cin >> Ai;
        A.push_back(Ai);
    }
    int q; cin >> q;
    rep(i,q){
        int k; cin >> k;
        auto k2 = lower_bound(A.begin(), A.end(), k);
        cout << distance(A.begin(), k2) << endl;
    }
}


Measured memory_bytes: 3508
h, w = map(int, input().split())
table = [[False] * w for _ in range(h)]
for i in range(h):
    s = input().rstrip()
    for j, c in enumerate(s):
        if c == '#':
            table[i][j] = True
res = [[] for _ in range(h)]
for i in range(h):
    for j in range(w):
        if table[i][j]:
            res[i].append('#')
            continue
        count = 0
        for k in range(-1, 2):
            for l in range(-1, 2):
                if i + k < 0 or i + k >= h or j + l < 0 or j + l >= w:
                    continue
                if k == 0 and l == 0:
                    continue
                if table[i + k][j + l]:
                    count += 1
        res[i].append(str(count))
for l in res:
    print(''.join(l))

Measured memory_bytes: 3188
s = gets.chomp

flag = s[0]
count_1=0
count_2=1
#pp s
#puts "now s = #{s}"

h = {"0"=>"1","1"=>"0"}
(s.length-1).times do|i|
  if flag==s[i+1] then
    count_1+=1
  end
  flag=h[flag]
end

s[0] = h[s[0]]
#puts "now s = #{s}"
flag=s[0]
#pp s
(s.length-1).times do|i|
  if flag==s[i+1] then
    count_2+=1
  end
  flag=h[flag]
end

#puts "[count_1,count_2] = #{[count_1,count_2]}"
puts [count_1,count_2].min

Measured memory_bytes: 1916