akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e9) + 1;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, n) for(int i = 1; i <= (int)(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main()
{
  int s, w;
  cin >> s >> w;

  if (s <= w) {
    cout << "unsafe" << endl;
  } else {
    cout << "safe" << endl;
  }

  return 0;
}


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

using namespace std;
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define repd(i, a, b) for(int i = (a); i > (b); i--)
#define forRev(it, a) for(__typeof((a).rbegin()) it = (a).rbegin(); it != (a).rend(); it++)
#define ll long long
#define ld long double
#define mk make_pair
#define pb push_back
#define sz(a) (int)(a).size()
#define bc(n) __builtin_popcountll(n)

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<iii> viii;

const int N = 26 + 7;
const int M = 350;
const int inf = 1e9 + 7;
const long long linf = 1e18 + 7;
const double pi = acos(-1);
const double eps = 1e-7;
const bool multipleTest = 0;

int cnt[N];

void solve() {
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int u; scanf("%d", &u);
        int sl = 0;
        while (u % 2 == 0) {
            ++sl;
            u /= 2;
        }
        if (sl >= 2) cnt[2]++;
        else cnt[sl]++;
    }
    
    if (cnt[2] < cnt[0] - 1) {
        puts("No");
    } else {
        if (cnt[2] == cnt[0] - 1) {
            if (cnt[1]) {
                puts("No");
            } else puts("Yes");
        } else puts("Yes");
    }
    
    
}

void test() {
}

int main() {
#ifdef _LOCAL_
    freopen("in.txt", "r", stdin);
    //    freopen("out.txt", "w", stdout);
#endif
    int Test = 1;
    if (multipleTest) {
        cin >> Test;
    }
    for(int i = 0; i < Test; ++i) {
//        test();
        solve();
    }
    
#ifdef _LOCAL_
    cout<<"\n" << 1.0 * clock() / CLOCKS_PER_SEC <<endl;
#endif
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,m,p;
  int flag[100005]={};
  int ac=0,wa=0;
  int mwa[100005]={};
  string str;

  cin>>n>>m;
  for(int i=0;i<m;i++){
    cin>>p>>str;
      if(str=="WA" && flag[p]!=1) wa++;
      if(str=="WA") mwa[p]++;
      else if(str=="AC"){
	if(flag[p]!=1) ac++;
	flag[p]=1;
      }
  }

  for(int i=1;i<=n;i++){
    if(flag[i]!=1) wa-=mwa[i];
  }

  cout<<ac<<" "<<wa<<endl;

  return 0;
}


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

int main(){
    int N, Q;
    std::string S;
    std::cin >> N >> S >> Q;
    
    std::vector< std::set< int > > word_set(26, std::set< int >{1000000000});
    for(int i=0; i<N; i++){
        word_set[S[i] - 'a'].insert(i);
    }
    
    std::vector< int > ans;
    for(int i=0; i<Q; i++){
        int Q1;
        std::cin >> Q1;
        if(Q1 == 1){
            int Q2;
            char Q3;
            std::cin >> Q2 >> Q3;
            if(S[Q2 - 1] == Q3){
                continue;
            }
            word_set[S[Q2 - 1] - 'a'].erase(Q2 - 1);
            word_set[Q3 - 'a'].insert(Q2 - 1);
            S[Q2 - 1] = Q3;
        }else{
            int Q2, Q3;
            std::cin >> Q2 >> Q3;
            int cnt = 0;
            for(int j=0; j<26; j++){
                auto itr1 = word_set[j].lower_bound(Q2 - 1);
                if(*itr1 <= Q3 - 1){
                    cnt++;
                }
            }
            ans.push_back(cnt);
        }
    }
    
    for(int i=0; i<ans.size(); i++){
        std::cout << ans[i] << std::endl;
    }
    
    return 0;
}



Measured memory_bytes: 24452
/* in the name of Anton */

/*
  Compete against Yourself.
  Author - Aryan Choudhary (@aryanc403)
*/

#ifdef ARYANC403
    #include "/home/aryan/codes/PastCodes/template/header.h"
#else
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
    #pragma GCC optimize ("-ffloat-store")
    #include<iostream>
    #include<bits/stdc++.h>
    #define dbg(args...)
#endif

using namespace std;
#define fo(i,n)   for(i=0;i<(n);++i)
#define repA(i,j,n)   for(i=(j);i<=(n);++i)
#define repD(i,j,n)   for(i=(j);i>=(n);--i)
#define all(x) begin(x), end(x)
#define sz(x) ((lli)(x).size())
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define endl "\n"

typedef long long int lli;
typedef long double mytype;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;


const auto start_time = std::chrono::high_resolution_clock::now();
void aryanc403()
{
#ifdef ARYANC403
auto end_time = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> diff = end_time-start_time;
    cerr<<"Time Taken : "<<diff.count()<<"\n";
#endif
}

const lli INF = 0xFFFFFFFFFFFFFFFL;

lli seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline lli rnd(lli l=0,lli r=INF)
{return uniform_int_distribution<lli>(l,r)(rng);}

class CMP
{public:
bool operator()(ii a , ii b) //For min priority_queue .
{    return ! ( a.X < b.X || ( a.X==b.X && a.Y <= b.Y ));   }};

void add( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt==m.end())         m.insert({x,cnt});
    else                    jt->Y+=cnt;
}

void del( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt->Y<=cnt)            m.erase(jt);
    else                      jt->Y-=cnt;
}

bool cmp(const ii &a,const ii &b)
{
    return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}

const lli mod = 1000000007L;
// const lli maxN = 1000000007L;

    lli T,n,i,j,k,in,cnt,l,r,u,v,x,y;
    lli m;
    string s;
    vector<vi> ee;
    vi a;
    lli idx=-1;
    vi stk;
    //priority_queue < ii , vector < ii > , CMP > pq;// min priority_queue .

lli dfs(lli u,lli p,lli h)
{
    stk.pb(u);
    lli &ans=a[u];
    ans=1;
    if(u+1==n)
    {
        idx=stk[(h+1)/2+1];
        dbg(u,stk,h);
    }
    for(auto x:ee[u])
    {
        if(x==p)
            continue;
        ans+=dfs(x,u,h+1);
    }
    stk.pop_back();
    return ans;
}

int main(void) {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    // freopen("txt.in", "r", stdin);
    // freopen("txt.out", "w", stdout);
// cout<<std::fixed<<std::setprecision(35);
// cin>>T;while(T--)
{

    cin>>n;
    ee.resize(n);
    a.resize(n);
    fo(i,n-1)
    {
        cin>>u>>v;
        u--;v--;
        ee[u].pb(v);
        ee[v].pb(u);
    }

    stk.pb(-1);
    dfs(0,-1,1);
    cout<<(n-a[idx]>a[idx]?"Fennec":"Snuke")<<endl;
    dbg(idx,n-a[idx],a[idx]);
}   aryanc403();
    return 0;
}


Measured memory_bytes: 16740
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Main {

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

      char ca = "a".charAt(0);
      char cz = "z".charAt(0);
      int[] count = new int[26];

      br.lines()
        .filter(s -> s != null && !s.isEmpty())
        .map(String::toLowerCase)
        .map(s -> IntStream.range(0,s.length())
          .mapToObj(i -> s.charAt(i))
          .filter(c -> !(ca > c  || c > cz))
          .mapToInt(c -> count[c -ca] += 1) 
          .toArray() )
        .toArray();
      
      IntStream.range(0, count.length)
        .forEach(i -> System.out.println(Character.valueOf((char)(ca + (char)i)).toString() + " : " + count[i]));
    }
  }
}


Measured memory_bytes: 31460
using System;

class Plogram
{
    static void Main()
    {
        string[] ARRAY = Console.ReadLine().Split(' ');
        string[] array = Console.ReadLine().Split(' ');

        int H = int.Parse(ARRAY[0]);
        int W = int.Parse(ARRAY[1]);
        int h = int.Parse(array[0]);
        int w = int.Parse(array[1]);

        Console.WriteLine((H - h) * (W - w));
    }
}


Measured memory_bytes: 13140
var lines = [];
var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
});

rl.on('close', function () {
    var A = Number(lines[0].split(" ")[0])
    var B = Number(lines[0].split(" ")[1])
    var X = Number(lines[0].split(" ")[2])

    if (A + B < X) { console.log("NO") ;return(0)}
    if (X < A) { console.log("NO");return(0) }
    console.log("YES")
});

Measured memory_bytes: 21448
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

#define int long long

const int MOD = 1e9 + 7;

int add(int a, int b) {
	return (a + b) % MOD;
}

int sub(int a, int b) {
	return (a - b + MOD) % MOD;
}

int mul(int a, int b) {
	return (a * b) % MOD;
}

int binpow(int a, int b) {
	int res = 1;
	while (b) {
		if (b & 1) res = mul(res, a);
		a = mul(a, a);
		b >>= 1;
	}
	return res;
}

int divv(int a, int b) {
	return mul(a, binpow(b, MOD - 2));
}

const int N = 1e6 + 7;

int f[N];

void init() {
	f[0] = 1;
	for (int i = 1; i < N; i++) {
		f[i] = mul(i, f[i - 1]);
	}
}

int C(int n, int k) {
	return divv(f[n], mul(f[k], f[n - k]));
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	init();

	int n, a, b, c;
	cin >> n >> a >> b >> c;
	{
		int wa = a;
		int wb = b;
		a = divv(wa, wa + wb);
		b = divv(wb, wa + wb);
	}
	c = divv(c, 100);
	int e = divv(1, sub(1, c));
	e = mul(e, c);
	cerr << e << endl;
	int ans = 0;
	for (int tot = n; tot < 2 * n; tot++) {
		int prob = C(tot - 1, n - 1);
		// prob = mul(prob, f[n - 1]);
		prob = mul(prob, binpow(a, n));
		prob = mul(prob, binpow(b, tot - n));
		int total = add(tot, mul(e, tot));
		ans = add(ans, mul(prob, total));
	}
	swap(a, b);
	for (int tot = n; tot < 2 * n; tot++) {
		int prob = C(tot - 1, n - 1);
		// prob = mul(prob, f[n - 1]);
		prob = mul(prob, binpow(a, n));
		prob = mul(prob, binpow(b, tot - n));
		int total = add(tot, mul(e, tot));
		ans = add(ans, mul(prob, total));
	}
	cout << ans << endl;
}


Measured memory_bytes: 8064
#include<iostream>
#include<string>
using namespace std;
int main(){
    string s,t;
    cin>>s>>t;
    for(int i=0;i<s.length();i++){
        int j;
        for(j=0;j<s.length();j++){
            if(s[j]!=t[(i+j)%s.length()])break;
        }
        if(j==s.length()){
            cout<<"Yes\n";
            return 0;
        }
    }
    cout<<"No\n";
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
	int N, M;
	cin >> N >> M;
	vector<int>R(M);
	vector<int>L(M);
	for (int i = 0; i < M; i++) {
		cin >> L[i] >> R[i];
	}
	int max = 100010;
	int min = 0;
	for (int i = 0; i < M; i++) {
		if (L[i] > min) {
			min = L[i];
		}
		if (R[i] < max) {
			max = R[i];
		}
	}
	if (min <= max) {
		cout << max - min + 1 << endl;
	}
	else {
		cout << 0 << endl;
	}
	return 0;
}

Measured memory_bytes: 1024
// Problem : A - Prefix and Suffix
// Contest : AtCoder Grand Contest 006
// URL : https://atcoder.jp/contests/agc006/tasks/agc006_a
// Memory Limit : 256.000000 MB 
// Time Limit : 2000.000000 milisec 
// Powered by CP Editor (https://github.com/coder3101/cp-editor2)

//Dragon_warrior7(IITK)
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define nl cout << '\n'
#define sor(x) sort(x.begin(), x.end())
#define rev(v) reverse(v.begin(), v.end())
#define lb(v, temp) lower_bound(v.begin(), v.end(), temp)
#define ub(v, temp) upper_bound(v.begin(), v.end(), temp)
#define fi first
#define se second
#define llmax 1000000000000000000
#define deb(x) cout << #x << " " << x << "\n"
#define pll pair<ll, ll> 
#define vll vector<ll> 
#define rub cout << "\n------------------------------------\n"
void read(vector<ll> &v)
{
	for (int i = 0; i < v.size(); i++)
		cin >> v[i];
}

void print(vector<ll> v)
{
	for (int i = 0; i < v.size(); i++)
		cout << v[i] << " ";
}
ll n,m,a,b,temp,x,y;
string str;
set<ll> s;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
   string t;
   cin>>n;
   cin>>str;
   cin>>t;
   a=2;
   b=1;
   ll mx=0;
   while(a && b<=n)
   {
   string temp1;
   string temp2;
      for(int i=n-b;i<n;i++)
      {
         temp1.pb(str[i]);
      }
      for(int i=0;i<b;i++)
      {
         temp2.pb(t[i]);
      }
      if(temp1==temp2)
      {
      mx=max(mx,b);
         b++;
         temp1.clear();
         temp2.clear();
         continue;
      }
      else
     { b++;
      temp1.clear();
      temp2.clear();
      }
   }
  // if(str==t)
   //{cout<<str.size();
   //return 0;}
   for(int i=mx;i<n;i++)
   {
      str.pb(t[i]);
   }
   cout<<str.size();
}

Measured memory_bytes: 256
#include<stdio.h>
int main() {
	int a,b;
	scanf("%d %d", &a, &b);

	if (a + b == 15) {
		printf("+");
	}
	else if(a*b == 15) {
		printf("*");
	}
	else if(a + b != 15 && a*b != 15) {
		printf("x");
	}
	return 0;

}

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

int main() 
{
	int a, b, n[1000] = { 0 };
	cin >> a >> b;

	for (int i = 1; i <= 999; i++) {
		n[i] = i+n[i-1];
	}

	for (int i = 1;; i++) {
		for (int j = 0; j < 999;j++) {
			if (n[j] - i == a && n[j + 1]-i == b) {
				cout << i << endl;
				return 0;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
using namespace std;

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

  if (n == 0) {
    printf("2\n");
  } else if (n == 1) {
    printf("1\n");
  } else {
    long long a = 2, b = 1, temp;
    for (int i=1; i<n; i++) {
      temp = a;
      a = b;
      b = b + temp;
    }
    printf("%lld\n", b);
  }
}

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

int main() {
  ll n,k,q;
  cin >> n >> k >> q;
  vector<int> b(n,0);
  rep(i,q){
    int t;
    cin >> t;
    b[t-1]++;
  }
  vector<string> c(n,"Yes");
  rep(i,n){
    if ((k-(q-b[i])) <= 0) c[i] = "No";
  }
  rep(i,n){
    cout << c[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 6400
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N=105;
const int M=1e5+5;
const int MOD=1e9+7;

int n, k;
int a[N];
int cache[N][M];

int dp(int idx, int k)
{
	if(k<0)
		return 0;
	if(k==0)
		return 1;
	if(idx==n+1)
		return 1;
	int &ans=cache[idx][k];
	if(ans!=-1)
		return ans;
	int mini=min(k, a[idx]);
	ans=dp(idx+1, k) - dp(idx+1, k-(mini)-1) + MOD;
	ans%=MOD;
	ans+=dp(idx, k-1);
	ans%=MOD;
	return ans;
}

int32_t main()
{
	IOS;
	memset(cache, -1, sizeof(cache));
	cin>>n>>k;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	int ans=dp(1, k) - dp(1, k-1) + MOD;
	ans%=MOD;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 88576
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>

using namespace std;

int main()
{
    string a,b,c;
    cin>>a>>b>>c;
    int aa=a.size(),bb=b.size();
    if(a[aa-1]==b[0]&&b[bb-1]==c[0])cout<<"YES";
    else cout<<"NO";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define pi pair<ll,ll>
#define pii pair<ll,pi>
#define pb push_back
#define mk make_pair
#define db double long
const int siz = 2 * 1e5 + 7;
int parent1[siz];
int nodesize1[siz];
int parent2[siz];
int nodesize2[siz];
int get2(int x) {
	if (parent2[x] == x)return x;
	return parent2[x] = get2(parent2[x]);
}
void dsu2(int u, int v) {
	u = get2(u);
	v = get2(v);
	if (v != u) {
		//if (rand() & 1)swap(u, v);
		parent2[v] = u;
		nodesize2[u] += nodesize2[v];
		nodesize2[v] = 0;
	}
}
int get1(int x) {
	if (parent1[x] == x)return x;
	return parent1[x] = get1(parent1[x]);
}
void dsu1(int u, int v) {
	u = get1(u);
	v = get1(v);
	if (v != u) {
		//if (rand() & 1)swap(u, v);
		parent1[v] = u;
		nodesize1[u] += nodesize1[v];
		nodesize1[v] = 0;
	}
}
void clear() {
	for (int i = 0; i < siz; i++) {
		parent1[i] = i;
		nodesize1[i] = 1;
		parent2[i] = i;
		nodesize2[i] = 1;
	}
}
int main() {
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, k, l;
	cin >> n >> k >> l;
	clear();
	for (int i = 0; i < k; i++) {
		int a, b;
		cin >> a >> b;
		if (get1(a) != get1(b)) {
			dsu1(a, b);
		}
	}
	for (int i = 0; i < l; i++) {
		int a, b;
		cin >> a >> b;
		if (get2(a) != get2(b)) {
			dsu2(a, b);
		}
	}
	map<pi, int>m;
	for (int i = 1; i <= n; i++) {
		m[mk(get1(i), get2(i))]++;
	}
	for (int i = 1; i <= n; i++) {
		cout << m[mk(get1(i), get2(i))] << " ";
	}
	cout << endl;
}


Measured memory_bytes: 18176
#include <bits/stdc++.h>
#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 all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
int main(){
	int x,y;
	cin>>x>>y;
	if(x%y==0) puts("-1");
	else cout<<x<<endl;
}


Measured memory_bytes: 256
/* Author: Dhruv Rastogi */
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(sdk) sdk.begin(),sdk.end()
#define mll map<int, int>
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;++i)
#define repd(i,a,b) for(int i=a;i>=b;--i)
#define mp make_pair
#define hell 1000000007
#define endl '\n'
#define vvll vector<vector<int> >
#define vll vector<int>
#define mint map<int,int> 
#define sz(x) (int)x.size()
#define sll set<int>
#define pll pair<int,int>
#define F first
#define S second
const long double PI = acos(-1.0);

queue<pll> q;
int dist[1005][1005];
int vis[1005][1005];
int f1[]={0,0,1,-1};
int f2[]={1,-1,0,0};
int h,w;

bool isvalid(int x,int y){
    return (x>=0 and x<h and y>=0 and y<w);
}
void solve(){  
    cin>>h>>w;
    rep(i,0,h){
        rep(j,0,w){
            char x;
            cin>>x;
            if(x=='#'){
                q.push(mp(i,j));
                vis[i][j]=1;
            }
        }
    } 
    while(!q.empty()){
        pll k=q.front();
        q.pop();
        rep(i,0,4){
            if(isvalid(k.F+f1[i],k.S+f2[i]) and !vis[k.F+f1[i]][k.S+f2[i]]){
                vis[k.F+f1[i]][k.S+f2[i]]=1;
                q.push(mp(k.F+f1[i],k.S+f2[i]));
                dist[k.F+f1[i]][k.S+f2[i]]=dist[k.F][k.S]+1;
            }
        }
    } 
    int ans=0;
    rep(i,0,h){
        rep(j,0,w){
            ans=max(ans,dist[i][j]);
        }
    }
    cout<<ans<<endl;
}

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 13056
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.*;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		String[] tokens = in.readLine().split(" ");
		int N = Integer.parseInt(tokens[0]);
		int K = Integer.parseInt(tokens[1]);
		in.close();
		double result = 0.0;
		for (int i = 1; i <= N; ++i) {
			double initRatio = 1.0 / (double) N;
			int j = i;
			while (j < K) {
				j *= 2;
				initRatio *= 0.5;
			}
			result += initRatio;
		}
		System.out.println(result);
	}
}

Measured memory_bytes: 19668
#include<iostream>
#include<vector>
using namespace std;
int n,a,b,q,k,x,y,j,visit[100010]={},cnt[100010]={};
long c,dis[100010];
vector<vector<int>> v(100010);
vector<vector<int>> d(100010);

int dfs(int p){
  visit[p]=1;
  int i;
  for(i=0;i<cnt[p];i++){
    //cout<<p<<" "<<cnt[p]<<endl;
    if(visit[v[p][i]]==0){
      dis[v[p][i]]=dis[p]+d[p][i];
      dfs(v[p][i]);
    }
  }   
}

int main(){
  int i;
  cin >> n;
  for(i=0;i<n-1;i++){
    cin >> a >> b >> c;
    v[a].push_back(b);
    v[b].push_back(a);
    cnt[a]++;
    cnt[b]++;
    d[a].push_back(c);
    d[b].push_back(c);
  }
  cin >> q >> k;
  dis[k]=0;
  dfs(k);
  for(i=0;i<q;i++){
    cin >> x >> y;
    cout <<dis[x]+dis[y]<<endl;
  }
}


Measured memory_bytes: 18944
open Printf
open Scanf

let () =
        let (a, b, c, d) = scanf "%d %d %d %d" (fun a b c d -> (a, b, c, d)) in
        printf "%d\n"
        (let x = (min b d) - (max a c) in
        (if x < 0 then 0 else x))


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

int main(void){
    int m,f,r,s;
    while(true){
        cin>>m>>f>>r;
        if(m==-1&&f==-1&&r==-1){
            return 0;
        }
        else if(m==-1||f==-1){
            cout<<"F"<<endl;
        }
        else{
            s=m+f;
            if(s<30){
            cout<<"F"<<endl;
            }
            else if(s<50){
                if(r>=50){
                    cout<<"C"<<endl;
                }
                else{
                    cout<<"D"<<endl;
                }
            }
            else if(s<65){
                cout<<"C"<<endl;
            }
            else if(s<80){
                cout<<"B"<<endl;
            }
            else{
                cout<<"A"<<endl;
            }
        }
    }
    
    return 0;
}



Measured memory_bytes: 3076
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
const int INF = 1000000009;
const ll LINF = 1e18;

int main() {
  int n;
  cin >> n;
  vector<int> x(n), y(n);
  for (int i = 0; i < n; ++i) cin >> x[i] >> y[i];

  auto dist = [&](int i, int j) {
    double dx = x[i] - x[j];
    double dy = y[i] - y[j];
    return sqrt(dx * dx + dy * dy);
  };

  vector<int> p(n);
  for (int i = 0; i < n; ++i) p[i] = i;
  double len = 0;
  int cnt = 0;
  do {
    for (int i = 0; i < n - 1; ++i) {
      len += dist(p[i], p[i + 1]);
    }
    cnt++;
  } while (next_permutation(p.begin(), p.end()));
  double ans = len / cnt;
  printf("%.10f\n", ans);
}


Measured memory_bytes: 3248
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>
#include <unordered_map>

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;
const int MOD = 1000000007;

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

    ll l,r; cin >> l >> r;

    ll ans = 1000000;
    
    for(ll i=l; i<=min(r,2019*2+l); i++){
        for(ll j=i+1;j<=min(r,2019*2+l); j++){
            ans = min(ans, i%2019*j%2019);
        }
    }
    

    cout << ans << endl;

    return 0;
}

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

int main() {
  char X,Y;
  cin>>X>>Y;
  int x,y;
  if(X=='A') x=10;
  else if (X=='B') x=11;
  else if (X=='C') x=12;
  else if (X=='D') x=13;
  else if (X=='E') x=14;
  else if (X=='F') x=15;
  if(Y=='A') y=10;
  else if (Y=='B') y=11;
  else if (Y=='C') y=12;
  else if (Y=='D') y=13;
  else if (Y=='E') y=14;
  else if (Y=='F') y=15;
  if(x<y) cout<<"<"<<endl;
  else if (x==y) cout<<"="<<endl;
  else if (x>y) cout<<">"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
#define MOD 1000000007
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL) 

int32_t main() {
    fast_io;
 
    // AC WA TLE RE
    int t;
    cin >> t;
    int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
    for (int i=0 ; i<t ; i++) {
        string s;
        cin >> s;
        if (s == "AC") {
            c1++;
        }
        else if (s == "WA") {
            c2++;
        }
        else if (s == "TLE") {
            c3++;
        }
        else {
            c4++;
        }
    }
    cout << "AC x " << c1 << endl;
    cout << "WA x " << c2 << endl;
    cout << "TLE x " << c3 << endl;
    cout << "RE x " << c4 << endl;

    return 0;
}

Measured memory_bytes: 3644
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

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

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define rep(i,x) for(int i=0;i<(x);++i)
#define rep1(i,x) for(int i=1;i<=(x);++i)
#define rrep(i,x) for(int i=(x)-1;i>=0;--i)
#define rrep1(i,x) for(int i=(x);i>=1;--i)
#define FOR(i,a,x) for(int i=(a);i<(x);++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define _ ios::sync_with_stdio(false);cin.tie(0)

template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T get(){T a;cin>>a;return a;}
template<typename T>T rev(T a){reverse(all(a));return a;}
template<typename T>istream&operator>>(istream&is,vector<T>&vec){rep(i,vec.size())is>>vec[i];return is;}
template<typename T>vector<T>&sort(vector<T>&a){sort(all(a));return a;}

const int inf = 1e9;
const ll linf = 3e18;
const double eps = 1e-9;

#define MAX_N 200000

int x[MAX_N], y[MAX_N], z[MAX_N];

signed main()
{
    _;

    int N; cin >> N;
    int a, b; cin >> a >> b;
    int M; cin >> M;
    rep(i, M) cin >> x[i] >> y[i] >> z[i];
    int K; cin >> K;

    vi ops;

    rrep(i, M) {
        if (y[i] <= K && K <= z[i]) {
            if (x[i] == 0) {
                K = z[i] - (K - y[i]);
            } else if (x[i] == 1) {
                ops.PB(1);
            } else if (x[i] == 2) {
                ops.PB(2);
            }
        }
    }

    int v = a + (K - 1) * b;

    rrep(i, ops.size()) {
        if (ops[i] == 1) {
            v++;
        } else {
            v /= 2;
        }
    }

    cout << v << endl;
}

Measured memory_bytes: 3524
#include <bits/stdc++.h>
using namespace std;
int N, M, Q, table[509][509];

int main(){

	cin>>N>>M>>Q;

	for (int i=0;i<M;i++){
		int L, R;cin>>L>>R;
		table[L][R]++;
	}

	for (int l=1;l<=N;++l){
		for (int r=1;r<=N;++r){
			table[l][r+1]+=table[l][r];
		}
	}

	for (int l=1;l<=N;++l){
		for (int r=1;r<=N;++r){
			table[l+1][r]+=table[l][r];
		}
	}


	for (int i=0;i<Q;++i){
		int p,q;cin>>p>>q;
		int ans=table[q][q]+table[p-1][p-1]-table[q][p-1]-table[p-1][q];
		cout << ans << endl;
	}

	return 0; 
}

Measured memory_bytes: 1920
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = ReadLine().Split(' ');
            WriteLine(s[0][0].ToString().ToUpper() + s[1][0].ToString().ToUpper() + s[2][0].ToString().ToUpper());
        }

        static int InputNum()
        {
            return int.Parse(ReadLine());
        }
        static List<int> InputNumList()
        {
            return ReadLine().Split(' ').Select(int.Parse).ToList();
        }
    }
}



Measured memory_bytes: 11092
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>
#include <numeric>

using namespace std;

int main(){

    int N;
    cin >> N;
    vector<int> a(N + 1);
    for(int i = 1; i <= N; i++){
        cin >> a[i];
    }

    vector<int> ans;
    vector<int> bit(N + 1, 0);
    for(int i = N; i>= 1; i--){
        if(bit[i] == a[i]){
            continue;
        }
        else{
            ans.push_back(i);
            int upper = min(1000, i);
            for(int j = 1; j <= upper; j++){
                if(j * j > i){
                    break;
                }
                if(j * j == i){
                    bit[j] ^= 1;
                    break;
                }
                if(i % j == 0){
                    bit[j] ^= 1;
                    int temp = i / j;
                    bit[temp] ^= 1;
                }
            }
        }
    }

    cout << (int)ans.size() << endl;
    for(int i = 0; i < (int)ans.size(); i++){
        cout << ans[i];
        if(i == (int)ans.size()){
            cout << endl;
        }
        else{
            cout << " ";
        }
    }

    return 0;
}

Measured memory_bytes: 3064
char s[9];m[21][21];
main(n,x,y,c){for(;scanf("%d",&n),n;){
for(memset(m,0,sizeof(m));n--;m[x][y]=1)scanf("%d%d",&x,&y);
for(scanf("%d",&n),x=y=10;n--;)for(scanf("%s%d",s,&c),m[x][y]=0;c--;m[x][y]=0)*s=='W'?x--:*s=='E'?x++:*s=='S'?y--:y++;
for(x=0;x<21;x++)for(y=0;y<21;y++)if(m[x][y])goto z;
z:puts(x==21?"Yes":"No");
}exit(0);}

Measured memory_bytes: 584
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

template <class T>
vector<T> sumup(const vector<T>& a) {
  int N = a.size();
  vector<T> res(N + 1);
  for (int i = 0; i < N; i++) res[i + 1] = res[i] + a[i];
  return res;
}

const ll INF = 1ll << 60;

int main() {
#ifdef DEBUG
  ifstream ifs("in.txt");
  cin.rdbuf(ifs.rdbuf());
#endif
  int N, K;
  while (cin >> N >> K) {
    vector<ll> A(N);
    for (ll& x : A) cin >> x;
    A.insert(A.begin(), 0);
    A.push_back(0);
    N += 2;
    vec<ll, 2> dp = make_v(N, K + 1, INF);
    dp[0][0] = 0;
    for (int i = 0; i < N; i++) {
      for (int k = 0; k <= K; k++) {
        for (int j = i + 1; j < N; j++) {
          int t = j - i - 1;
          if (k + t > K) continue;
          chmin(dp[j][k + t], dp[i][k] + max(0ll, A[j] - A[i]));
        }
      }
    }
    ll res = INF;
    for (int k = 0; k <= K; k++) chmin(res, dp[N - 1][k]);
    cout << res << endl;
  }
  return 0;
}


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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int n = ri();
	std::string s;
	std::cin >> s;
	for (auto &i : s) i -= 'a';
	
	int q = ri();
	std::set<int> pos[26];
	for (int i = 0; i < n; i++) pos[s[i]].insert(i);
	for (int i = 0; i < q; i++) {
		if (ri() == 1) {
			int index = ri() - 1;
			std::string tmp;
			std::cin >> tmp;
			int c = tmp[0] - 'a';
			pos[s[index]].erase(index);
			pos[s[index] = c].insert(index);
		} else {
			int l = ri() - 1;
			int r = ri();
			int cnt = 0;
			for (int j = 0; j < 26; j++)
				if (pos[j].lower_bound(l) != pos[j].lower_bound(r)) cnt++;
			printf("%d\n", cnt);
		}
	}
	return 0;
}


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

int main(void)
{
    int A,B,C,K;
    int ans;

    scanf("%d",&A);
    scanf("%d",&B);
    scanf("%d",&C);
    scanf("%d",&K);
    ans=pow(2,K)*A+B+C;
    if(A+pow(2,K)*B+C>ans) ans= A+pow(2,K)*B+C;
    if(A+B+pow(2,K)*C>ans) ans= A+B+pow(2,K)*C;
    printf("%d",ans);

    return 0;
}

Measured memory_bytes: 128
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var (N, M) = Slice2<long>();
            var t = 1900 * M + 100 * (N - M);
            WriteLine(Pow(2, M) * t);
        }

        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 27952
#include<cstdio>
int abs(int n){
if(n<0)return -n;
else return n;
}
int main(){
int n;
scanf("%d",&n);
int t[n];
int x[n];
int y[n];
for(int i=0;i<n;i++){
scanf("%d%d%d",&t[i],&x[i],&y[i]);
}
int p=0;
int q=0;
int r=0;
for(int i=0;i<n;i++){
int k=abs(p-x[i])+abs(q-y[i])-(t[i]-r);
if(k<=0&&k%2==0){
p=x[i];
q=y[i];
r=t[i];
}else{
printf("No");
break;
}
if(i==n-1)printf("Yes");
}
return 0;
}

Measured memory_bytes: 1280
#include<stdio.h>
#include<wctype.h>
#include<ctype.h>

int main()
{
	char sent[1200];
	int x;
	gets(sent);
	for (x = 0; sent[x] != '\0'; x++)
	{
		if (isupper(sent[x]))
		{
			sent[x] = tolower(sent[x]);
		}
		else
		{
			sent[x] = toupper(sent[x]);
		}
	}
	puts(sent);
	return 0;
}

Measured memory_bytes: 928
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;

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

fn main() {
    let mut n: isize = read();

    loop {
        let s = n.to_string();
        if s.replace(s.chars().nth(0).unwrap(), "").len() == 0 {
            println!("{}", s);
            break;
        }
        n += 1;
    }
}

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

int main(){
    Int A, B, C, K;
    cin >> A >> B >> C >> K;

    if(K <= A){
        cout << K << endl;
    } else if(K <= A+B){
        cout << A << endl;
    } else {
        cout << A - (K-(A+B)) << endl;
    }
}


Measured memory_bytes: 3640
//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define shandom_ruffle random_shuffle

using ll=long long;
const int nax=10007;
using pii=pair<int,int>;

int n, m;

vector <int> nor[nax];

int z;
vector <pii> graf[nax];
pii wyn[nax];

vector <int> stos, okok;

map < pii,int> mapa;

void dfs(int v, int oj, int cel)
{
	stos.push_back(v);
	if (cel==v)
		okok=stos;
	for (int i : nor[v])
		if (i!=oj)
			dfs(i, v, cel);
	stos.pop_back();
}

vector <int> daj(int v, int u)
{
	dfs(v, 0, u);
	return okok;
}

int bylo[nax];

void dfs2(int v)
{
	while(!graf[v].empty())
	{
		pii x=graf[v].back();
		graf[v].pop_back();
		if (bylo[x.second])
			continue;
		bylo[x.second]=1;
		dfs2(x.first);
		wyn[x.second]={x.first, v};
	}
}

int main()
{
	scanf("%d%d", &n, &m);
	for (int i=1; i<n; i++)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		nor[a].push_back(b);
		nor[b].push_back(a);
	}
	for (int i=1; i<=m; i++)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		graf[a].push_back({b, i});
		graf[b].push_back({a, i});
		auto wez=daj(a, b);
		int k=wez.size();
		for (int i=0; i+1<k; i++)
		{
			a=wez[i];
			b=wez[i+1];
			if (a>b)
				swap(a, b);
			mapa[{a, b}]++;
		}
	}
	z=m;
	int sco=2*(n-1);
	for (int i=1; i<=n; i++)
		for (int j : nor[i])
		{
			if (j<i && (mapa[{j, i}]&1))
			{
				if (mapa[{j, i}]==1)
					sco--;
				z++;
				graf[i].push_back({j, z});
				graf[j].push_back({i, z});
			}
			if (j<i && !mapa[{j, i}])
				sco-=2;
		}
	//~ for (int i=1; i<=n; i++)
		//~ debug() << i << " " << graf[i];
	for (int i=1; i<=n; i++)
		dfs2(i);
	printf("%d\n", sco);
	for (int i=1; i<=m; i++)
		printf("%d %d\n", wyn[i].first, wyn[i].second);
	return 0;
}


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

signed main() {
  int h, w; cin >> h >> w;
  string s[h];
  for(int i = 0; i < h; i++) cin >> s[i];
  for(int i = 0; i < h; i++) {
      cout << s[i] << endl;
      cout << s[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int main(void){
	int n, i;
	bool f;
	while(scanf("%d",&n) != EOF){
		f = false;
		for(i = 0;n >> i;i++){
			if(1 << i & n){
				if(f){
					printf(" ");
				}
				f = true;
				printf("%d",1 << i);
			}
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 1032
from collections import Counter

n = int(input())
prime = []

def P(x):
	i = 2
	while x != 1:
		if x%i == 0:
			prime.append(i)
			x //= i
		else:
			i += 1

for j in range(1,n+1):
	P(j)


D = Counter(prime)
ans = 1 
for v in D.values():
	ans = ans*(v+1)%(10**9+7)
print(ans)

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

int main() {
  string s;
  cin >> s;
  bool have;
  have = true;
  rep(i,s.size()){
    if(i % 2 == 0 && s[i] == 'L'){
      have = false;
    }
    if(i % 2 == 1 && s[i] == 'R'){
      have = false;
    }
  }
  if(have){
    cout << "Yes";
  }
  else{
    cout << "No";
  }
  
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;

class Program
{
    static void Main()
    {
        SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().Solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";


    void Solve()
    {
        int N = cin.Nextint;
        int M = cin.Nextint;
        var A = new char[N][];
        var B = new char[M][];

        for (int i = 0; i < N; i++)
        {
            A[i] = cin.Next.ToCharArray();
        }
        for (int i = 0; i < M; i++)
        {
            B[i] = cin.Next.ToCharArray();
        }
        bool flag = false;
        for (int i = 0; i < N; i++)
        {
            for (int j = 0; j < N; j++)
            {
                flag = true;
                for (int k = 0; k < M; k++)
                {
                    for (int l = 0; l < M; l++)
                    {
                        int x = i + k;
                        int y = j + l;
                        if (x >= N || y >= N)
                        {
                            flag = false;
                            break;
                        }
                        if (A[x][y] != B[k][l])
                        {
                            flag = false;
                            break;
                        }

                    }
                    if (!flag) break;
                }
                if (flag) break;
            }
            if (flag) break;
        }
        WriteLine((flag) ? "Yes" : "No");
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] Scan { get { return ReadLine().Split(); } }
    public int[] Scanint { get { return Array.ConvertAll(Scan, int.Parse); } }
    public long[] Scanlong { get { return Array.ConvertAll(Scan, long.Parse); } }
    public double[] Scandouble { get { return Array.ConvertAll(Scan, double.Parse); } }
    public string Next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return Next;
        }
    }
    public int Nextint { get { return int.Parse(Next); } }
    public long Nextlong { get { return long.Parse(Next); } }
    public double Nextdouble { get { return double.Parse(Next); } }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                   \
  ifstream in("abc158/abc158_a.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
const int INF = 100100100;
const ll LINF = 1e18+100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  string S;
  cin >> S;

  cout << ((S[0] == S[1] && S[1] == S[2]) ? "No" : "Yes") << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>

int main() {
  int N, M, K;
  scanf("%d %d %d", &N, &M, &K);

  for (int i=0; i<=N; ++i)
    for (int j=0; j<=M; ++j)
      if (i*M + j*(N-2*i) == K)
        return !printf("Yes\n");

  printf("No\n");
  return 0;
}


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

int main() {
  string s;
  cin >> s;
  rep(i,5) cout << s[i];
  cout << " ";
  rep(i,7) cout << s[i+6];
  cout << " ";
  rep(i,5) cout << s[i+14];
}

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

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

using namespace std;
typedef long long int ll;
const int INF = 1000000000;
const double PI = 3.1415926535897932;
const ll MOD = 1000000007;

int main()
{
    int n;
    int a[20], b[20], c[20];
    cin >> n;
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    rep(i, n - 1) cin >> c[i];

    int ans = 0;
    int before = -1;
    rep(i, n) {
        ans += b[a[i]-1];
        if (before == a[i] - 1) ans += c[before - 1];
        before = a[i];
    }
    cout << ans << endl;
    return 0;
}

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

int calculate_dp(int *DP, int k, int *a, int N) {
    if (DP[k] != 0)
        return DP[k];
    for (int i = N; i >= 1; i--) {
        if (k >= a[i]) {
            if (calculate_dp(DP, k - a[i], a, N) == 1) {
                //printf("相手が負ける選び方(k:%d, a[%d]): %d:", k, i, a[i]);
                return DP[k] = 2;
            }
        }
    }
    return DP[k] = 1;
}

int main () {
    int N;
    int K;
    scanf("%d", &N);
    scanf("%d", &K);

    int *a = malloc((N + 1) * sizeof(int));
    int *DP = calloc(K + 1, sizeof(int));
    for (int i = 1; i <= N; i++) {
        scanf("%d", &a[i]);
    }

    calculate_dp(DP, K, a, N);

    if (DP[K] == 2)
        printf("%s\n", "First");
    else
        printf("%s\n", "Second");

    return 0;
}


Measured memory_bytes: 8320
def main():
    import sys
    input = sys.stdin.readline
    N, M = [int(x) for x in input().strip().split()]
    f = [False] * N
    c = [1] * N
    f[0] = True
    
    for m in range(M):
        x, y = [int(x) for x in input().strip().split()]
        f[y-1] = f[y-1] or f[x-1]
        c[y-1] += 1
        c[x-1] -= 1
        if c[x-1] == 0:
            f[x-1] = False
        
    print(len([1 for b in f if b]))

if __name__ == '__main__':
    main()

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

int main() {
  string s, t; cin >> s >> t;
  sort(s.begin(), s.end());
  sort(t.rbegin(), t.rend());
  bool ans = s < t;
  cout << (ans ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256