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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0)
#define mapmax(v) v.rbegin()->first
#define mapmin(v) v.begin()->first
#define pb push_back
#define pf push_front
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const int mod=1000000007;
const int mod2=998244353;

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

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

void YES(bool b) {cout << (b?"YES\n":"NO\n");}
void Yes(bool b) {cout << (b?"Yes\n":"No\n");}
void yes(bool b) {cout << (b?"yes\n":"no\n");}
void Yay(bool b) {cout << (b?"Yay!\n":":(\n");}

ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

long long powmod(long long a,long long b){
    long long c=1;
    while(b){
        if(b&1) c=a*c%mod;
        a=a*a%mod;
        b>>=1;
    }
    return c;
}

ll nCr(ll n,ll r){
	ll x=1,y=1;
	rep(i,r){
		x=x*(n-i)%mod;
		y=y*(i+1)%mod;
	}
	return x*powmod(y,mod-2)%mod;
}

int main()
{
	ll n,a,b,ans=0;
	cin >> n >> a >> b;
	ans=powmod(2,n)-1-nCr(n,a)-nCr(n,b);
	cout << (ans%mod+mod)%mod << endl;
	return 0;
}


Measured memory_bytes: 256
#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>;

vector<ll> enum_divisor(ll N) {
    vector<ll> ans;
    for(ll i = 1; i*i <= N; i++) {
        if(N%i==0) {
            ans.push_back(i);
            if(i != N/i) {
                ans.push_back(N/i);
            }
        }
    }
    return ans;
}

int main() {
    ll N; cin >> N;
    set<ll> res;
    vector<ll> A1 = enum_divisor(N);
    vector<ll> A2 = enum_divisor(N-1);
    for(auto x:A1) res.insert(x);
    for(auto x:A2) res.insert(x);
    res.erase(1);
    ll ans = 0;
    for(auto K:res) {
        ll n = N;
        while(n%K == 0) n /= K;
        if(n%K == 1) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <stdio.h>

long Combination(long n, long r) {
  long answer = 1;
  if (n-r < r) {
    r = n-r;
  }
  for (long i = 1; i <= r; i++) {
    answer *= n+1-i;
    answer /= i;
  }
  return answer;
}

int main(void) {

  long n,m;
  scanf("%ld %ld", &n, &m);
  long a[m],b[m];
  for (long i = 0; i < m; i++) {
    scanf("%ld %ld", &a[i], &b[i]);
  }
  long pair[m];
  pair[m-1] = Combination(n,2);
  long parent[n+1];
  long size[n+1];
  for (long i = 0; i <= n; i++) {
    parent[i] = i;
    size[i] = 1;
  }
  long root_a,root_b;
  long list[n+1];
  long list_size;
  for (long i = m-1; i > 0; i--) {
    pair[i-1] = pair[i];
    root_a = parent[a[i]];
    root_b = parent[b[i]];
    list_size = 0;
    while (parent[root_a] != root_a) {
      list[list_size] = root_a;
      list_size++;
      root_a = parent[root_a];
    }
    for (long i = 0; i < list_size; i++) {
      parent[list[i]] = root_a;
    }
    list_size = 0;
    while (parent[root_b] != root_b) {
      list[list_size] = root_b;
      list_size++;
      root_b = parent[root_b];
    }
    for (long i = 0; i < list_size; i++) {
      parent[list[i]] = root_b;
    }
    if (root_a != root_b) {
      pair[i-1] -= size[root_a]*size[root_b];
      size[root_a] += size[root_b];
      parent[root_b] = root_a;
    }
  }
  for (long i = 0; i < m; i++) {
    printf("%ld\n", pair[i]);
  }

  return 0;
}

Measured memory_bytes: 5120
#pragma GCC optimize ("-O3")
#include<bits/stdc++.h>
#include <stdint.h>
using namespace std;
 
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 998244353;
ll NUM = 1e9+7;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(ll i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define INF 1e18
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define zer ll(0)
 

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

    if(s=="SUN")
    {
        cout<<7;
    }
    else if(s=="SAT")
    {
        cout<<1;
    }
    else if(s=="FRI")
    {
        cout<<2;
    }
    else if(s=="THU")
    {
        cout<<3;
    }
    else if(s=="WED")
    {
        cout<<4;
    }
    else if(s=="TUE")
    {
        cout<<5;
    }
    else if(s=="MON")
    {
        cout<<6;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long ans,l,n,x[222222],pre[222222],suf[222222];
long long calcsuf(long long i)
{
	if ((n-i)&1)
	{
		long long xp=(i+n)/2;
		return (2*(pre[xp]-pre[i-1])-x[i]+2*suf[xp+1]-(l-x[xp+1]));
	}
	else
	{
		long long xp=(i+n)/2;
		return (2*(pre[xp]-pre[i-1])-x[i]-x[xp]+2*suf[xp+1]);
	}
}
long long calcpre(long long i)
{
	if (i&1)
	{
		long long xp=(i+1)/2;
		return (2*(suf[xp]-suf[i+1])-(l-x[xp])-(l-x[i])+2*pre[xp-1]);
	}
	else
	{
		long long xp=(i+1)/2;
		return (2*pre[xp]-x[xp]+2*(suf[xp+1]-suf[i+1])-(l-x[i]));
	}
}
int main()
{
	scanf("%lld%lld",&l,&n);
	for (long long i=1;i<=n;i++)
	{
		scanf("%lld",&x[i]);
	}
	for (long long i=1;i<=n;i++) pre[i]=pre[i-1]+x[i];
	for (long long i=n;i>=1;i--) suf[i]=suf[i+1]+(l-x[i]);
	for (long long i=1;i<=n;i++)
	{
		ans=max(ans,x[i]+calcsuf(i));
	}
	for (long long i=1;i<=n;i++)
	{
		ans=max(ans,l-x[i]+calcpre(i));
	}
	printf("%lld\n",ans);
	return 0;
} 

Measured memory_bytes: 5120
#include<bits/stdc++.h>
#define me(a,x) memset(a,x,sizeof(a))
#define sc scanf
#define itn int
#define IN freopen("in.txt","r",stdin);
#define OUT freopen("out.txt","w",stdout);
#define STR clock_t startTime = clock();
#define END clock_t endTime = clock();cout << double(endTime - startTime) / CLOCKS_PER_SEC *1000<< "ms" << endl;
using namespace std;
const int N=1e6;
const long long mod=1e9+7;
const long long mod2=998244353;
const int oo=0x7fffffff;
const int sup=0x80000000;
typedef long long ll;
typedef unsigned long long ull;
template <typename it>void db(it *begin,it *end){while(begin!=end)cout<<(*begin++)<<" ";puts("");}
template <typename it>
string to_str(it n){string s="";while(n)s+=n%10+'0',n/=10;reverse(s.begin(),s.end());return s;}
template <typename it>int o(it a){cout<<a<<endl;return 0;}
inline ll mul_64(ll x,ll y,ll c){return (x*y-(ll)((long double)x/c*y)*c+c)%c;}
ll ksm(ll a,ll b,ll c){ll ans=1;for(;b;b>>=1,a=a*a%c)if(b&1)ans=ans*a%c;return ans;}
void exgcd(ll a,ll b,ll &x,ll &y){if(!b)x=1,y=0;else exgcd(b,a%b,y,x),y-=(a/b)*x;}
ll a[N];
int main(){
    
    int n;sc("%d",&n);
    for(int i=0;i<n;i++)sc("%lld",&a[i]);
    ll ans=0;
    for(int i=0;i<=60;i++){
        int k=0;
        for(int j=0;j<n;j++)k+=a[j]>>i&1;
        ans+=(1LL<<i)%mod*k%mod*(n-k)%mod;
        ans%=mod;
    }
    o(ans);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using  namespace std;
typedef long long ll;
#define RAP(i, n) for(ll i=0;i<(n);i++)
#define FOR(i, a, b) for(ll i=(a);i<(b);i++)

int main(){
    ll n, count=0, ans=0, point;
    cin >> n;
    vector<ll> A(n);
    RAP(i,n){
        cin >> A[i];
        if(A[i]<0){
            count++;
        }
    }
    sort(A.begin(), A.end());
    if(count%2==1){
        auto itr = lower_bound(A.begin(),A.end(), 0);
        ll idx = distance(A.begin(),itr);
        if(itr != A.end()){
            if(abs(A[idx-1])>A[idx]){
                point = idx;
            }else{
                point = idx-1;
            }
        }else{
            point = idx - 1;
        }
        RAP(i,n){
            ans += abs(A[i]);
        }
        ans -= abs(A[point])*2;
    }else{
        RAP(i,n){
            ans += abs(A[i]);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
struct edge{int from, to;};

int main(){
    int n;
    cin >> n;
    ll ans=0;
    rep(i,n){
        int l,r;
        cin >> l >> r;
        ans+=r-l+1;
    }
    cout << ans << endl;
    return 0;
}

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

typedef long long ll;
const ll MOD=998244353;

int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	
	static ll dp[3002][3002];
	dp[a][b]=1;
	for(int i=a+1;i<=c;i++){
		ll sum=0;
		dp[i][b]=dp[i-1][b]*b;
		dp[i][b]%=MOD;
		sum+=dp[i-1][b];
		for(int j=b+1;j<=d;j++){
			sum*=i-1; sum%=MOD;
			dp[i][j]=sum+dp[i-1][j]*j;
			dp[i][j]%=MOD;
			sum+=dp[i-1][j];
		}
	}
	ll ret=dp[c][b];
	for(int j=b+1;j<=d;j++){
		ret*=c;
		ret+=dp[c][j];
		ret%=MOD;
	}
	cout<<ret<<endl;
}



Measured memory_bytes: 73904
def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end
def inpf() a=gets.chomp.split(" ").map(&:to_f)end
def inps() a=gets.chomp.split(" ")end  
def copy(a) Marshal.load(Marshal.dump(a)) end
def kaizyo(n)(n < 2)? 1 : (2..n).inject(:*) end
def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end
def na(n=0,d=0) Array.new(n,d)end
def na2(n=0,m=0,d=0) Array.new(n){Array.new(m,d)}end
def na3(n=0,m=0,l=0,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end
def bit(n) n.to_s(2).split("").map(&:to_i) end
def inp() a=gets.chomp.split(" ").map(&:to_i)end
n,m = inp
ans = na(n)
m.times do
  a,b = inp
  ans[a-1] += 1
  ans[b-1] += 1
end
puts ans
=begin
=end

Measured memory_bytes: 1788
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        while(a!=0 && b!=0){
            for(int i=0;i<b;i++){
                System.out.printf("#");
            }
            System.out.printf("\n");
            for(int j=0;j<a-2;j++){
                System.out.printf("#");                    
                for(int k=0;k<b-2;k++){
                System.out.printf(".");
                }
                System.out.printf("#\n");
            }
            for(int i=0;i<b;i++){
                System.out.printf("#");
            }
            System.out.printf("\n\n");
            a=sc.nextInt();
            b=sc.nextInt();
        }
    }
}


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

using ll = long long;
const int INF = 1e9 + 1;

int main() {

	ll N;
	cin >> N;

	if (N % 2 != 0)
		cout << 0 << endl;

	else {
		ll ans = 0;
		while (N >= 1) {
			N /= 5;
			ans += N / 2;
		}

		cout << ans << endl;
	}



	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

struct UnionFind {
	vector<int> v;
	UnionFind(int n) : v(n)  { for (int i = 0; i < n; i++) v[i] = i; }
	int  find(int x)         { return v[x] == x ? x : v[x] = find(v[x]); }
	void unite(int x, int y) { v[find(x)] = find(y); }
};

int main() {
	int n;
	string s1, s2;
	cin >> n;
	cin >> s1 >> s2;
	int ans = s1.length() + s2.length();
	REP(i, s1.length()) {
		REP(j, s2.length())
			if (s1.substr(i, s1.length() - i) == s2.substr(0, j + 1))
				ans = min(ans, (int)(s2.length() + i));
	}
	cout << ans << endl;
}

Measured memory_bytes: 384
n=int(input())
ans=1
max=0
for i in range(1,n+1):
    cnt=0
    bin_str=bin(i)[2:]
    rev_bin=bin_str[::-1]
    
    for j in range(len(rev_bin)):
        if rev_bin[j]=="0":
            cnt+=1

    if cnt>max:
       max=cnt
       ans=i
print(ans)

Measured memory_bytes: 3064
program main
	implicit none
	integer N, i, j, counter
	integer, allocatable :: a(:)
	read(*, *) N
	allocate(a(1: N))
	do i = 1, N
		read(*, *) a(i)
	end do
	i = 1
	counter = 0
	do j = 1, N
		i = a(i)
		counter = counter + 1
		if(i == 2) then
			write(*, *) counter
			exit
		else if(j == N) then
			write(*, *) -1
			exit
		end if
	end do	
end program main

Measured memory_bytes: 1024
N = int(input())
K = int(input())
S = str(N)
'''
ans = 0
li = []
for i in range(1,N+1):
    if str(i).count('0') == len(str(i)) - K:
        ans += 1
        li.append(i)
print(ans)
print(li)
'''
L = len(S)

dp = [[[1, 0], [0, 0], [0, 0], [0, 0]] for i in range(L)]
dp[0] = [[1, 0], [int(S[0])-1, 1], [0, 0], [0, 0]]
#print(dp)
for l in range(1,L):
    s = int(S[l])
    if s == 0:
        dp[l][1][1] += dp[l-1][1][1]
        dp[l][2][1] += dp[l-1][2][1]
    else:
        dp[l][1][1] += dp[l-1][0][1]
        dp[l][2][1] += dp[l-1][1][1]
        dp[l][3][1] += dp[l-1][2][1]
        dp[l][1][0] += dp[l-1][1][1]
        dp[l][2][0] += dp[l-1][2][1]
        dp[l][3][0] += dp[l-1][3][1]

    dp[l][1][0] += dp[l-1][0][0]*9 + dp[l-1][1][0]
    dp[l][2][0] += dp[l-1][1][0]*9 + dp[l-1][2][0]
    dp[l][3][0] += dp[l-1][2][0]*9 + dp[l-1][3][0]
    dp[l][1][0] += dp[l-1][0][1]*max(0,s-1)
    dp[l][2][0] += dp[l-1][1][1]*max(0,s-1)
    dp[l][3][0] += dp[l-1][2][1]*max(0,s-1)

#print(dp)
print(sum(dp[L-1][K]))

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define N 15
#define M 1005
#define L 5000
ll n,m;
ll a[M];
ll b[M];
ll c[M];
ll dp[L];

ll DP(ll mask)
{
	if (mask==((1<<n)-1))
		return 0;
	if (dp[mask]!=-1)
		return dp[mask];
	ll ans=1e18;
	for(ll j=1;j<=m;j++)
	{
		if ((mask&c[j])!=c[j])
		ans=min(ans,DP(mask|c[j])+a[j]);
	}
	dp[mask]=ans;
	return ans;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>m;
	for(ll i=1;i<=m;i++)
	{
		cin>>a[i]>>b[i];
		ll mask=0;
		for(ll j=0;j<b[i];j++)
		{
			ll u;
			cin>>u;
			u--;
			mask|=(1<<u);
		}
		c[i]=mask;
	}
	for(ll i=0;i<L;i++)
		dp[i]=-1;

	ll ans = DP(0);
	if (ans==1e18)
		ans=-1;
	cout<<ans;
}

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

using namespace std;

using ll = long long;

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

    const ll MOD = 1e9 + 7;

    ll N, K;
    cin >> N >> K;

    vector<vector<vector<ll>>> dp(
        N + 1, vector<vector<ll>>(N + 2, vector<ll>(K + 1)));
    dp[0][0][0] = 1;

    for (int i = 1; i <= N; ++i) {
        for (int j = 0; j <= i; ++j) {
            for (int k = 2 * j; k <= K; ++k) {
                ll &v = dp[i][j][k];
                (v += (2 * j + 1) * dp[i - 1][j][k - 2 * j]) %= MOD;
                (v += (j + 1) * (j + 1) * dp[i - 1][j + 1][k - 2 * j]) %= MOD;
                if (0 <= j - 1) (v += dp[i - 1][j - 1][k - 2 * j]) %= MOD;
            }
        }
    }

    cout << dp[N][0][K] << endl;

    return 0;
}


Measured memory_bytes: 53248
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        if (a % b == 0) {
            System.out.println(0);
        } else {
            System.out.println(1);
        }
    }
}


Measured memory_bytes: 21844
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
sb=sum(b)

for i in range(len(a)-1):
  
  if a[i]+1==a[i+1]:
    sb+=c[a[i]-1]
    
print(sb)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int n;
  string s;

  cin >> n >> s;

  if(n % 2 == 1){
    cout << "No" << endl;
    return 0;
  }
  else{
    if(s.substr(0,n / 2) == s.substr(n / 2,n / 2)){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <functional>
#include <complex>

using namespace std;

const int INF = (1<<30) - 1;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N;
    while(cin>>N, N){
        int W, H;
        cin >> W >> H;
        vector<vector<int>> d(H+1, vector<int>(W+1));
        int x, y;
        while(N--){
            cin >> x >> y;
            d[y][x] = 1;
        }
        
        for(int i=0; i<H; i++)
            for(int j=0; j<W; j++)
                d[i+1][j+1] += d[i+1][j] + d[i][j+1] - d[i][j];
        
        int S, T;
        cin >> S >> T;
        int ans = 0;
        for(int i=T; i<=H; i++){
            for(int j=S; j<=W; j++){
                ans = max(ans, d[i][j] - d[i-T][j] - d[i][j-S] + d[i-T][j-S]);
            }
        }
        cout << ans << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1260
#include<stdio.h>
#include<string.h>
#define N 55
#define LL long long
LL s[N][N];
char a[N],b[N],c[N];

int main(){
	int n;
	LL ans;
	scanf("%d%s",&n,a);
	ans=0;
	for(int t=0;t<(1<<n);++t){
		int k1=0,k2=0;
		for(int j=0;j<n;++j){
			if(t&1<<j)b[k1++]=a[j];
			else c[k2++]=a[j];
        }
		b[k1]=c[k2]='\0';
		memset(s,0,sizeof(s));
        s[0][0]=1;
		for(int i=0;i<=k1;++i){
			for(int j=0;j<=k2;++j){
				if(a[n*2-1-i-j]==b[i])
				s[i+1][j]+=s[i][j];
				if(a[n*2-1-i-j]==c[j])
				s[i][j+1]+=s[i][j];
			}
		}
		ans+=s[k1][k2];
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 128
def divide_by_two(a):
    cnt = 0
    while True:
        if a % 2 == 0:
            a //= 2
            cnt += 1
        else:
            break

    return cnt


def main():
    n = int(input())
    a_list = list(map(int, input().split()))
    ans = 10 ** 9

    for a in a_list:
        ans = min(ans, divide_by_two(a))

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 62872
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prl = lambda x: print(*x ,sep='\n')

s,w = nm()
print('unsafe' if s <= w else 'safe')

Measured memory_bytes: 61972
import sys

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    nums = string_to_int(inputs[0])
    nums.sort()
    abc_last_i = len(nums) // 2 - 1
    arc_first_i = len(nums) // 2

    return nums[arc_first_i] - nums[abc_last_i]


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    input()
    ret = solve(inputs(1))
    print(ret)


Measured memory_bytes: 14656
#include<bits/stdc++.h>
using namespace std;
long long a[100005];
vector<pair<int,int> > num;
bool cmp(pair<int,int> x,pair<int,int> y){
	return x>y;
}
int main(){
	int n,m;
	scanf("%d %d",&n,&m);
	
	for(int i=0;i<n;i++){
		int xx;
		scanf("%d",&xx);
		num.push_back(make_pair(xx,1));
	}
	for(int i=0;i<m;i++){
		int b,c;
		cin>>b>>c;
		num.push_back(make_pair(c,b));
	}
	sort(num.begin(),num.end(),cmp);
	int cnt=0;
	vector<int> res;
	for(int i=0;i<num.size();i++){
		for(int j=0;j<num[i].second;j++){
			res.push_back(num[i].first);
		}
		if(res.size()>=n) break;
	}
	long long sum=0;
	for(int i=0;i<n;i++){
		sum+=1ll*res[i];
	}
	cout<<sum;
}

Measured memory_bytes: 3440
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int ls,lt;
char s[100004],t[100004];
vector<int>cs[34],ct[34];
vector<int>::iterator it;
int main(){
    scanf("%s%s",s+1,t+1);
    ls=strlen(s+1);
    lt=strlen(t+1);
    for(int i=1;i<=ls;i++){
        cs[s[i]-'a'].push_back(i);
    }
    for(int i=1;i<=lt;i++){
        ct[t[i]-'a'].push_back(i);
    }
    for(int i=0;i<26;i++)if((cs[i].size()==0)&&ct[i].size()!=0)return puts("-1"),0;
    ll count_s=0;
    int pos=0;
    for(int i=1;i<=lt;i++){
        int x=t[i]-'a';
        it=lower_bound(cs[x].begin(),cs[x].end(),pos+1);
        if(it==cs[x].end()){
            count_s++;
            pos=0;
            it=lower_bound(cs[x].begin(),cs[x].end(),pos+1);
        }
        pos=(*it);
    }
    printf("%lld\n",count_s*ls+pos);
    return 0;
}


Measured memory_bytes: 1656
#include <iostream>


using std::cout;
using std::cin;
using std::endl;

int main(){

    int A,B,N;

    cin >> N;
    
    if(N == 1){

        cout << "Hello World" << endl;
    }

    else if(N == 2){
        
        cin >> A >> B; 
        if((A <= 1 || A <=9) && (B <= 1 || B <=9))
        cout << A + B << endl;
    }

    return 0;
}


Measured memory_bytes: 256
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const ll mod=1e9+7;

int main(){
  string s;
  cin >> s;
  map<string,int> map;
  rep(i,4){
    map[s.substr(i,1)]++;
  }

  bool flag = true;

  for(auto a: map){
    if(a.second != 2) flag = false;
  }

  if(flag) printf("Yes\n");
  else printf("No\n");


  return 0;
}


Measured memory_bytes: 256
n = str(input())
m = len(n)
n = int(n)
x = 9
ans = 0
if m%2 == 0:
    for _ in range((m+1)//2):
        ans += x
        x *= 100

else:
    for _ in range((m+1)//2-1):
        ans += x
        x *= 100
    ans += n - 10**(m-1) +1

print(ans)


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

int main(){
  int N;
  cin >> N;
  int p[N];
  for(int i = 0 ; i < N ; i++){
    cin >> p[i];
  }
  sort(p,p + N);
  reverse(p,p + N);

  int sum = 0;
  sum = p[0]/2;
  for(int i = 1 ; i < N ; i++){
    sum += p[i];
  }
  cout << sum << endl;
  return 0;
}


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

typedef long long LL;

#define FOR(i, a, b) for (int i = (a), i##_END_ = (b); i <= i##_END_; ++i)
#define DNF(i, a, b) for (int i = (a), i##_END_ = (b); i >= i##_END_; --i)

template <typename Tp> void in(Tp &x) {
	char ch = getchar(), f = 1; x = 0;
	while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
	if (ch == '-') f = -1, ch = getchar();
	while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
	x *= f;
}

template <typename Tp> bool chkmax(Tp &x, Tp y) {return x >= y ? 0 : (x=y, 1);}
template <typename Tp> bool chkmin(Tp &x, Tp y) {return x <= y ? 0 : (x=y, 1);}
template <typename Tp> Tp Max(const Tp &x, const Tp &y) {return x > y ? x : y;}
template <typename Tp> Tp Min(const Tp &x, const Tp &y) {return x < y ? x : y;}

int n, k;

int main()
{
	in(n); in(k);

	LL ans = 0;
	
	FOR(b, k + 1, n) {
		int one = b - k;
		int time = n / b;
		ans += time * 1ll * one;
		ans += Max(0, (n - ((n / b) * b + k) + 1));
		if (k == 0) ans--;
	}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
typedef pair<int,int> P;
typedef vector<int> Vi;
int const MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { return a = b; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { return a = b; } return false; }

int main(){
  cin.tie(0); ios::sync_with_stdio(false);
    
  int n; Int ans=-MOD; cin>>n; bool shop[n][10]; int p[n][11];
  for (int i = 0; i < n; i++){
    for (int j = 0; j < 10; j++)cin>>shop[i][j];
  }
  for (int i = 0; i < n; i++){
    for (int j = 0; j < 11; j++)cin>>p[i][j];
  }
  for (int i = 1; i < (1<<10); i++){
    int op[n]={}; Int a=0;
    for (int j = 0; j < 10; j++){
      if((i>>j)&1){
        for (int k = 0; k < n; k++){
          if(shop[k][9-j])op[k]++;
        }
      }
    }
    for (int j = 0; j < n; j++)a+=p[j][op[j]];
    chmax(ans,a);
  }
  cout<<ans<<'\n';
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
const ll INF=100000000000000001;
const double PI=3.141592653589;

int gcd(int a,int b){
  if(a<b)swap(a,b);
  int c=a%b;
  while(c!=0){
    a=b;
    b=c;
    c=a%b;
  }
  return b;
}

int main(){
  int n,X; cin>>n>>X;
  vector<int> x(n);
  rep(i,n){
    int a; cin>>a;
    x[i]=abs(a-X);
  }
  int ans=x[0];
  rep(i,n){
    ans=gcd(x[i],ans);
  }
  cout<<ans<<endl;


  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
template <typename T> bool chmax(T &u, const T z) { if (u < z) {u = z; return true;} else return false; }
template <typename T> bool chmin(T &u, const T z) { if (u > z) {u = z; return true;} else return false; }
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long 
//typedef pair<ll, ll> P;
const ll INF=1LL<<60;
ll gcd(ll x,ll y){return y? gcd(y,x%y) :x;}
//写し
vector<pair<ll,int>>factorize(ll n){
    vector<pair<ll,int>>res;
    for(ll i=2;i*i<=n;++i){
        if(n%i)continue;
        res.emplace_back(i,0);
        while(n%i==0){
            n/=i;
            res.back().second++;
        }
    }
    if(n!=1)res.emplace_back(n,1);
    return res;
}
int main(){
    ll a,b;
    cin>>a>>b;
    ll g=gcd(a,b);
    auto f=factorize(g);
    int ans=f.size()+1;
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 3636
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{

private static final int BIG_NUM=2000000000;
	public static void main(String[]args){
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		int H,W;
		String work[]=new String[2];
		
		while(true){
			try{
				work=br.readLine().split("[\\s]+");
				
				if(work[0].equals("0") && work[1].equals("0")){break;}	//両方とも0だったらループを抜ける.
				
				H=Integer.parseInt(work[0]);
				W=Integer.parseInt(work[1]);
				
				//長方形を描画する
				for(int i=0; i<H; i++) {
					for(int j=0; j<W; j++) {
						System.out.printf("#");
					}
					System.out.printf("%n");
				}
				System.out.printf("%n");
				
			}catch(IOException e){
				e.printStackTrace();
			}
		}
	}
}


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

using namespace std;

template <class T> T abs(T x) { return x < 0 ? -x : x; }

const int N = 100010;

int a[N];
int f[2][N];

int main() {
  int n;
  scanf("%d", &n);
  a[0] = 0;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", a + i);
  }
  a[n + 1] = 0;
  f[0][0] = 0;
  for (int i = 1; i <= n; ++i) {
    f[0][i] = f[0][i - 1] + abs(a[i] - a[i - 1]);
  }
  f[1][n + 1] = 0;
  for (int i = n; i >= 1; --i) {
    f[1][i] = f[1][i + 1] + abs(a[i] - a[i + 1]);
  }
  for (int i = 1; i <= n; ++i) {
    printf("%d\n", f[0][i - 1] + abs(a[i - 1] - a[i + 1]) + f[1][i + 1]);
  }
}


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

using namespace std;

const int N=3e6+5;
long long sx[N],gx[N],sxy[N],gxy[N],gxyz[N],f[1010];
int n;

void solve(int u,int v,int w,int p)
{
    if(!u||!v||!w) return ;
    memset(gx,0,sizeof(gx));
    memset(sx,0,sizeof(sx));
    memset(gxy,0,sizeof(gxy));
    memset(sxy,0,sizeof(sxy));
    memset(gxyz,0,sizeof(gxyz));
    for(int i=0;i<u;i++)
        gx[i]=1LL;
    sx[0]=gx[0];
    for(int i=1;i<N;i++)
        sx[i]=sx[i-1]+gx[i];
    for(int i=0;i<N;i++)
        gxy[i]=sx[i]-sx[i-min(v-1,i)]+gx[i-min(v-1,i)];
    sxy[0]=gxy[0];
    for(int i=1;i<N;i++)
        sxy[i]=sxy[i-1]+gxy[i];
    for(int i=0;i<N;i++)
        gxyz[i]=sxy[i]-sxy[i-min(w-1,i)]+gxy[i-min(w-1,i)];
    for(int d=0;d<n;d++)
        for(int t=0;t*n+d<N;t++)
            f[(p+d)%n]+=gxyz[t*n+d];
    return;
}

int main()
{
    int x,y,z,a,b,c;
    scanf("%d%d%d",&x,&y,&z);
    scanf("%d%d%d",&a,&b,&c);
    scanf("%d",&n);
    solve(a,b,c,3);
    solve(a,b,z-c,2);
    solve(a,y-b,c,2);
    solve(x-a,b,c,2);
    solve(a,y-b,z-c,1);
    solve(x-a,b,z-c,1);
    solve(x-a,y-b,c,1);
    solve(x-a,y-b,z-c,0);
    for(int i=0;i<n-1;i++)
        printf("%lld ",f[i]);
    printf("%lld\n",f[n-1]);
    return 0;
}

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

using namespace std;

#define ll long long

void solve() {
    int n;
    cin >> n;
    for(int i=1; i<10; ++i){
        for(int j=0; j<10; ++j){
            if(i*j==n){
                cout << "Yes";
                return;
            }
        }
    }
    cout << "No";
}

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

    int t = 1;
//    cin >> t;
    while (t--) {
        solve();
    }
}


Measured memory_bytes: 3612
S = input()
S = S[::-1]

dp = [[0]*13 for _ in range(len(S)+1)]

dp[0][0]=1

q=1
for i in range(1,len(S)+1): #i文字目，1-index
  s = S[i-1]
  if s=='?':
    for j in range(13):
      for n in range(10):
      	dp[i][(j+n*q)%13] += dp[i-1][j]
    for j in range(12):
      dp[i][j] %= 10**9+7
  else:
    n = int(s)
    for j in range(13):
      dp[i][(j+n*q)%13] = dp[i-1][j]
  q = (10*q)%13
  
print(dp[len(S)][5])

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ld> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define TS to_string
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


ll INF = 1e9;
ll MOD = 1000000007;
ll LINF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b;}     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}

//-----------------------------------------
class warshall_floyd{
  private:
    ll N; // 頂点数
    vvll dis; // iからjまでの最短距離
    ll inf = 1e18;

  public:
    warshall_floyd(ll n){
      N = n;
      dis.resize(N,vll(N));

      for(ll i=0;i<N;i++){
        for(ll j=0;j<N;j++){
          dis[i][j] = ( i == j ? 0 : inf );
        }
      }
    }

    // 辺の入力
    void in_edge(ll to, ll from, ll cost){
      dis[to][from] = cost;
    }

    // d[i][j]を埋める
    vvll main(){
      for(ll k=0;k<N;k++){
        for(ll i=0;i<N;i++){
          for(ll j=0;j<N;j++){
            if(dis[i][k] == inf || dis[k][j] == inf) continue;
            dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
          }
        }
      }
      return dis;
    }

    // 負の経路の検出
    bool negative_loop(){
      for(ll i=0;i<N;i++){
        if(dis[i][i] < 0) return true;
      }
      return false;
    }
};
//-----------------------------------------

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  ll n, m;
  cin >> n >> m;
  warshall_floyd W(n);
  REP(i,m){
    ll a, b, c;
    cin >> a >> b >> c;
    W.in_edge(a,b,c);
  }
  vvll tmp = W.main();
  bool f = W.negative_loop();
  if(f){
    cout << "NEGATIVE CYCLE" <<endl;
    return 0;
  }
  REP(i,n){
    REP(j,n){
      if(j) cout << " ";
      if(tmp[i][j] == LINF) cout << "INF";
      else cout << tmp[i][j];
    }
    cout << endl;
  }

  return 0;
}




Measured memory_bytes: 3324
//#pragma comment(linker,"/STACK:102400000,102400000")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
#define _for(i, a, b) for (int i = (a); i < (b); ++i)
#define _rep(i, a, b) for (int i = (a); i <= b; ++i)
const int max_number = 1000000;
const double pi=3.14159265358979323846264338328;


int main()
{
    
    double area, circum;
    double r;
    scanf("%lf", &r);
    area = M_PI * r * r;
    circum = 2 * r * M_PI;
    printf("%f %f\n", area, circum);

    return 0;

}


Measured memory_bytes: 3208
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func min(a []int) int {
	minCurrent := a[0]
	for i := 1; i < len(a); i++ {
		if a[i] < minCurrent {
			minCurrent = a[i]
		}
	}
	return minCurrent
}

func max(a []int) int {
	maxCurrent := a[0]
	for i := 1; i < len(a); i++ {
		if a[i] > maxCurrent {
			maxCurrent = a[i]
		}
	}
	return maxCurrent
}

func main() {
	scanner.Split(bufio.ScanWords)
	nNumbers := nextInt()
	a := make([]int, nNumbers)
	for i := 0; i < nNumbers; i++ {
		a[i] = nextInt()
	}

	nQueries := nextInt()
	for i := 0; i < nQueries; i++ {
		queryType := nextInt()
		b := nextInt()
		e := nextInt()
		if queryType == 0 {
			fmt.Println(min(a[b:e]))
		} else if queryType == 1 {
			fmt.Println(max(a[b:e]))
		}
	}
}



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

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  string ans;
  if(a+b > c+d) ans = "Left";
  else if(a+b < c+d) ans = "Right";
  else ans = "Balanced";
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
INF = float("inf")


def yes():
    print("Yes")  # type: str


def no():
    print("No")  # type: str


def solve(N: int, S: str):
    if N % 2 == 1:
        no()
        return

    if S[:(N//2)] == S[(N//2):]:
        yes()
    else:
        no()
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, S)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
h, w, k = map(int, input().split())
S = [[] for _ in range(h)]
for i in range(h):
    s = str(input())
    for x in s:
        S[i].append(int(x))

ans = 10**5
dame = False

for bit in range(1<<h-1):
    h_cut_count = 0
    Cut_line = []
    for i in range(9):
        if (bit>>i)&1 == 1:
            h_cut_count += 1
            Cut_line.append(i)
    # print(Cut_line)

    before_line = -1
    Blocks = []

    for j in range(len(Cut_line)):
        if before_line == -1:
            Blocks.append(S[:Cut_line[j]+1])
            before_line = Cut_line[j]
        else:
            Blocks.append(S[before_line+1:Cut_line[j]+1])
            before_line = Cut_line[j]
    if before_line == -1:
        Blocks.append(S[:])
    else:
        Blocks.append(S[before_line+1:])
    
    Block_count = [0 for _ in range(len(Blocks))]

    v_cut_count = 0

    for i in range(w):
        for j in range(len(Blocks)):
            for column in Blocks[j]:
                if column[i] == 1:
                    Block_count[j] += 1
        if max(Block_count) > k:
            Block_count = [0 for _ in range(len(Blocks))]
            v_cut_count += 1
            for j in range(len(Blocks)):
                for column in Blocks[j]:
                    if column[i] == 1:
                        Block_count[j] += 1
            if max(Block_count) > k:
                dame = True

    if dame == False:
        cand = h_cut_count + v_cut_count
    elif dame == True:
        cand = 10**5
    ans = min(cand, ans)
    dame = False

    # print(Blocks)
    # print(cand)
    # print('-'*30)
    
    

print(ans)

Measured memory_bytes: 50012
n = gets.to_i

left = -1
right = n


def sum(x)
  (x*(x+1))/2
end

while left + 1 < right do
  mid = (left + right)/2
  if sum(mid) <= n
    left = mid
  else
    right = mid
  end
end

x = n - sum(left)

if x <= 1
  (left-1).times do |i|
    puts i + 1
  end

  puts left + n - sum(left)
  exit
end

1.upto(left+1) do |i|
  puts  i if i != left + sum(left) - n + 1
end


Measured memory_bytes: 1788
#include<iostream>
#include<cmath>
#include<iomanip>
#include<string>
#include<vector>

using namespace std;
int main() {
	int n; cin >> n;
	vector<int>p(n);
	for (auto& e : p)cin >> e;

	int ans=0;
	for (int i = 1; i < n - 1; ++i)
		if ((p[i-1] < p[i] && p[i] < p[i+1])||
			(p[i-1] > p[i] && p[i] > p[i+1]))
			++ans;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

char dn[2400000], * di = dn;
inline void putint(ll X) {
	if (X == 0) {
		*di++ = '0';
		*di++ = '\n';
		return;
	}
	int keta = 0;
	char C[20];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}

int A[200000];
int B[200010];

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

	int N = getint();
	ll kotae = 0;
	rep(i, N) kotae += B[(A[i] = getint())]++;
	rep(i, N) putint(kotae - B[A[i]] + 1);
	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 6016
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MAX_N (1 << 17)


void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{
    ll aa;
    ll bb;
}frequent;

int main(void){
    // char ;
    ll n,ans=1;
    scanf("%lld",&n);
    ll a[1001]={};
    rrep(i,n,2){
        ll c=i;
        while(c%2==0){
            c/=2;
            a[2]++;
        }

        ll b=c;
        rep(j,3,c+1){
            while(b%j==0){
                b/=j;
                a[j]++;
            }
        }
    }
    
    rep(i,0,n+1){
        // printf("%lld ",a[i]);
        ans*=(a[i]+1);
        ans%=MOD1;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(void){
  int A,B;
  cin>>A>>B;
  if(A%2==0 & B%2==0){
      cout<<abs(A+B)/2<<endl;
  }
  else if(A%2==1 & B%2==1){
      cout<<abs(A+B)/2<<endl;
  }
  else{
      cout<<"IMPOSSIBLE";
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <numeric>
#include <chrono>
#include <bitset>
#include <tuple>
#include <queue>
#include <cstring>
#include <cassert>
using namespace std;

const int N = 2e5 + 10, mod = 1e9 + 7;

int main() {
    // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    // vector<int> vec = {1};
    // vec.erase(vec.begin(), vec.begin() + 0);
    // cout << vec[0] << '\n';
    int tc = 1; 
    // scanf("%d", &tc);
    for(int cn = 1; cn <= tc; cn++) {
        int n; scanf("%d", &n);
        long long k; scanf("%lld", &k);
        vector<int> arr(n);
        for(int &x : arr) {
            scanf("%d", &x);
            x--;
            assert(x < n);
        }
        vector<int> v;
        vector<bool> vis(n, 0);
        int u = 0;
        while(!vis[u]) {
            vis[u] = 1;
            v.push_back(u);
            u = arr[u];
        }
        for(int i = 0; i < v.size(); i++) {
            if(v[i] == u) {
                if(k <= i) return printf("%d\n", v[k] +1 ), 0;
                v.erase(v.begin(), v.begin() + i);
                k -= i;
                break;
            }
        }
        int sz = v.size();
        assert(sz);
        printf("%d\n", v[k % sz] + 1);
    }  
    return 0;
}

Measured memory_bytes: 5148
#include <iostream>
#include <vector>
#include <algorithm>

int main(int argc, char *argv[]){
    long int N;
    long int flow[5];
    std::cin >> N;
    for(auto &f : flow){
        std::cin >> f;
    }

    long int maxFlow = *std::min_element(std::begin(flow),std::end(flow));
    long int hasMod = N%maxFlow == 0 ? 0 : 1;
    std::cout << (N/maxFlow)+ hasMod + 4 << std::endl;
    return 0;
}


Measured memory_bytes: 256
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}
macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn solve(inputs: &Vec<(u64, u64, u64)>, t: u64, i: usize) -> u64 {
    let n = inputs.len();
    if i >= n { return t }
    let (c, s, f) = inputs[i];
    let mut t = max!(s, t);
    if t % f > 0 { t -= t % f; t += f; }
    solve(&inputs, t + c, i + 1)
}

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let inputs: Vec<_> = (1..n).map(|_| {
        let c: u64 = sc.cin();
        let s: u64 = sc.cin();
        let f: u64 = sc.cin();
        (c, s, f)
    }).collect();
    for i in 0..n {
        put!(solve(&inputs, 0, i));
    }
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> { self.cin::<String>().chars().collect() }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> { (0..n).map(|_| self.cin()).collect() }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
int n;
vector<string> vec;
bool check(string s){
  set<int> ss;
  rep(i,s.size()){
    if(ss.count(s[i])) return false;
    ss.insert(s[i]);
  }
  return true;
}
void dfs(string s, int cnt){
  if(!check(s)) return;
  if(cnt==n){
    vec.push_back(s);
    return;
  }
  dfs(s+"1",cnt+1);
  if(n>=2) dfs(s+"2",cnt+1);
  if(n>=3) dfs(s+"3",cnt+1);
  if(n>=4) dfs(s+"4",cnt+1);
  if(n>=5) dfs(s+"5",cnt+1);
  if(n>=6) dfs(s+"6",cnt+1);
  if(n>=7) dfs(s+"7",cnt+1);
  if(n>=8) dfs(s+"8",cnt+1);
}
int main() {
  cin >> n;
  string p = "";
  string q = "";
  rep(i,n){
    string a;
    cin >> a;
    p = p + a;
  }
  rep(i,n){
    string a;
    cin >> a;
    q = q + a;
  }
  dfs("",0);
  
  int anum;
  int bnum;
  sort(vec.begin(), vec.end());
  rep(i,vec.size()){
    if(vec[i]==p) anum = i;
    if(vec[i]==q) bnum = i;
  }
  cout << abs(anum-bnum) << endl;
}

Measured memory_bytes: 2424