akhauriyash/Code-Regression huggingface dataset:
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<cstdio>
#include<vector>
#include<stack>
#include<cmath>
#include<queue>
#include<set>
#include<map>
#define N 100100

using namespace std;

int s[N];

int main()
{
	int n;
	scanf ("%d",&n);
	for (int i=1;i<=n;i++)
		scanf ("%d",&s[i]);
	
	long long mi = 2,ma = 2;
	
	for (int i=n;i>0;i--)
	{
		ma = (ma/s[i]+1)*s[i]-1;
		
		if (mi%s[i] != 0)
			mi = mi/s[i]*s[i]+s[i];
	}
	if (ma >= mi)
		printf ("%lld %lld\n",mi,ma);
	else
		printf ("-1\n");
	return 0;
}


Measured memory_bytes: 640
n = gets.to_i
rooms = Array.new(4) {Array.new(3) {Array.new(10, 0)}}
n.times do
  b, f, r, v = gets.split.map(&:to_i)
  rooms[b - 1][f - 1][r - 1] += v
end
st = Array.new(4, "")
4.times do |b|
  3.times do |f|
    10.times do |r|
      st[b] += " " + rooms[b][f][r].to_s
    end
    st[b] += "\n"
  end
end
print st.join("#" * 20 + "\n")


Measured memory_bytes: 8904
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;

int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}

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

ll lcm(ll a,ll b){
    a / gcd(a,b) * b;
}
const ll mod = 1e9 + 7;
const ll INF = 1e9 + 7;

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


/////////////////////////////////////////////////////////////////////////////////////////

int main(){
    ll h,w;
    cin >> h >> w;

    if (h == 1 or w == 1){
        cout << 1 << endl;
    }
    else if (h % 2 != 0 and w % 2 != 0){
        cout << (h * w) / 2 + 1 << endl;
    }
    else{
        cout << h * w / 2 << endl;
    }

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
ll ans=0;
int n;
int i;
int main()
{
 int n,a,b;
 cin>>a>>b;
double suihou1=1.0*a/0.08;
int suihou2=b*10;
int ans;
if(suihou1-(int)suihou1>=0.5)
    ans=suihou1+1;
else
    ans=suihou1;

 double ans1=1300,ans2=1300,ans3=1300,ans4=1300;
 if(floor((ans)*0.1)==b)
    ans1=floor(ans);
    if(floor((suihou2)*0.08)==a)
        ans2=suihou2;
    ((int)min(ans1,min(ans2,min(ans3,ans4)))==1300)?cout<<"-1"<<endl:cout<<(int)min(ans1,min(ans2,min(ans3,ans4)))<<endl;

}



Measured memory_bytes: 256
import sys

for line in sys.stdin:
    a, b, c, d, e, f = map(float, line.split())
    det = a*e-b*d    
    print '%.3f %.3f' % (round((c*e-b*f)/det, 3)+0.000001, round((a*f-c*d)/det, 3))

Measured memory_bytes: 6316
#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0;i--)
#define _GLIBCXX_DEBUG
using namespace std;

int main(){
  int64_t n,m;
  cin >> n >> m;
  vector<int> a(n,-1);
  bool flag = false;
  rep(i,m){
    int s,c;
    cin >> s >> c;
    if( ((n != 1) && (s==1 && c == 0)) || (a[s-1] != -1 && a[s-1] != c)){
      flag = true;
    }else{
      a[s-1] = c;
    }
    /*rep(j,n){
      cout << a[i];
    }
    cout << endl;*/
  }
  if(n == 1 && a[0] == -1){
    a[0] = 0;
  }
  
  rep(i,n){
    if(a[i] == -1){
      if(i == 0){
        a[i] = 1;
      }else{
        a[i] = 0;
      }
    }
  }
  if(flag){
    cout << -1 << endl;
  }else{
    rep(i,n){
      cout << a[i];
    }
    cout << endl;
  }
    
    
  
}

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

using namespace std;

int w[10];

int main(void)
{
	string s;

	int mx = 0;
	
	cin >> s;

	if (s[0] == 'R') {
		w[0] = 1;
		mx = 1;
	}
	for (int i = 1; i < 3; i++)
	{
		if (s[i] == 'R')
		{
			w[i] = w[i - 1] + 1;
			mx = max(mx, w[i]);
		}
		else w[i] = 0;
	}

	printf("%d", mx);
	return 0;
}

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

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

typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//定数
#define INF 1000000000 //10^9:極めて大きい値,∞
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second　//pairの二つ目の要素


int main(){
    string s,t, ans;
    cin>>s>>t;
    bool b;
//    rep(i,s.size()-t.size()+1){
    for(int i=s.size()-t.size();i>=0;i--){
        ans=s;
        b=true;
        rep(j,t.size()){
            if(s[j+i]=='?'){
                ans[j+i]=t[j];
                continue;
            }
            b=b&&(s[j+i]==t[j]);
//            cout<<i<<" "<<s[j+i]<<" "<<t[j]<<endl;
            if(!b) break;
        }
        if(b)break;
    }
    if(b){
        rep(i,s.size()) if(ans[i]=='?') ans[i]='a';
        cout<<ans<<endl;
    }
    else cout<<"UNRESTORABLE"<<endl;
    return 0;
}

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

int main() {
  int a, b; cin >> a >> b;

  string A, B;
  rep( i, 0, b ) A += char( '0'+a );
  rep( i, 0, a ) B += char( '0'+b );

  cout << ( A < B ? A : B ) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define typeof(x) __typeof__(x)
#define int long long int
#define double long double
#define mod(x) ((x % MOD) + MOD) % MOD
#define REP(i,a,b) for(int i=(a);i<(b);++i)
#define RREP(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define ALL(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
#define SZ(c) (int)((c).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define LB(c,x) (int)(lower_bound(ALL(c),x)-(c).begin())
#define UB(c,x) (int)(upper_bound(ALL(c),x)-(c).begin())
#define COUNT(c,x) (UB(c,x)-LB(c,x))
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)),(c).end());
#define COPY(c1,c2) copy(ALL(c1),(c2).begin())
#define EXIST(s,e) (s).find(e)!=(s).end()
#define PB push_back
#define MP make_pair
#define vec vector
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define NL cerr << endl;

using namespace std;

typedef pair<int,int> P;
struct edge { int from, to; int cost; };
ostream& operator << (ostream& s, const edge& e) {
   s << "(" << e.from << "->" << e.to << ": " << e.cost << ")";
   return s;
}
bool operator< (const edge &edge1, const edge &edge2){
   return edge1.cost < edge2.cost;
};

const int INF = 1e18;
const int MOD = 1e9+7;

template<typename T> ostream& operator << (ostream& s, const vector<T>& v) {
   s << "[";
   for (int i = 0; i < v.size(); i++) { s << v[i]; if (i < v.size() - 1) s << " "; }
   s << "]";
   return s;
}
template<typename T1, typename T2> ostream& operator << (ostream& s, const pair<T1,T2>& p) {
   s << "(" << p.first << "," << p.second << ")";
   return s;
}
template<typename T1, typename T2> ostream& operator << (ostream& s, const map<T1,T2>& m) {
   s << "{";
   for (auto i = m.begin(); i != m.end(); ++i) {
      s << i->first << ":" << i->second;
      if (next(i) != m.end()) s << ", ";
   }
   s << "}";
   return s;
}

signed main()
{
   int N, T; cin >> N >> T;
   vec<int> A(N);
   REP(i, 0, N) {
      cin >> A[i];
   }

   int amin = A[0], dmax = 0, count;
   REP(i, 1, N) {
      if (A[i] - amin > dmax) {
         dmax = A[i] - amin;
         count = 1;
      } else if (A[i] - amin == dmax) {
         count++;
      }
      amin = min(amin, A[i]);
   }

   cout << count << endl;

   return 0;
}


Measured memory_bytes: 1024
function main(input) {
  const args = input.split('\n').map(n => parseInt(n, 10));
  const N = args[0];
  const d = N % 10;
  if (d === 3)
    console.log('bon');
  else if (d === 0 || d === 1 || d === 6 || d === 8)
    console.log('pon');
  else
    console.log('hon');
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 29628
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;

int main(){

  int x, a, b;
  cin >> x >> a >> b;

  int x_a = abs(x-a);
  int x_b = abs(x-b);
  if(x_a>x_b){
    cout << "B" << endl;
  } else {
    cout << "A" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>a
#define pb push_back

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

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

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

class UnionFind{
public:
  vi Parent;
  UnionFind(int n){
    Parent = vi(n,-1);
  }

  int root(int a){
    if(Parent[a] < 0) return a;
    return Parent[a] = root(Parent[a]);
  }

  int size(int a){
    a = root(a);
    return -Parent[a];
  }

  bool merge(int a, int b){
    a = root(a);
    b = root(b);
    if(a == b) return false;

    if(a < b) swap(a,b);
    Parent[a] += Parent[b];
    Parent[b] = a;

    return true;
  }

  bool issame(int a, int b){
    return root(a) == root(b);
  }
};

int main(){
  ll a,b,c,k; cin >> a>>b>>c>>k;
  if(k%2) cout << b-a << endl;
  else cout << a-b << endl;
}

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

using namespace std;
#define ll long long int

int main()
{
   ll t;
   t = 1;	
  // cin t;
   while(t--){
        ll n , m;
        cin >> n >> m;
        ll ans = n;
        ll h[n + 1];
        for(int i =1; i <=n ; i ++)
        cin >> h[i];
        bool visited[n + 1] = {0};
        for(int i =0 ; i < m ; i ++)
        {
            ll x, y;
            cin >> x >> y;
            if(h[x] <= h[y] && !visited[x])
            {
                visited[x] = true;
                ans --;
            }

            if(h[x] >= h[y] && !visited[y])
            {
                visited[y] = true;
                ans --;
            }


        } 
        cout << ans << endl;
   }
}


Measured memory_bytes: 4404
#include <iostream>
using namespace std;
int main()
{
 int h,m,s;
 cin >> s;
 m = s%3600;
 h = (s-m)/3600;
 s = m%60;
 m = (m-s)/60;
 cout << h << ':' << m << ':' << s << '\n';
 return 0;
}

Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
const int mod=1000000007;
int f[42][1<<18];
int n,x,y,z,p;
int qp(int x,int k)
{
	int res=1;
	while(k)
	{
		if(k&1)res=1ll*res*x%mod;
		x=1ll*x*x%mod;
		k>>=1;
	}
	return res;
}
int ans,sum;
int main()
{
	scanf("%d%d%d%d",&n,&x,&y,&z);
	p=(1<<z-1)+(1<<y+z-1)+(1<<x+y+z-1);
	f[0][0]=1;
	sum=(1<<x+y+z)-1;
	for(int i=0;i<n;i++)
		for(int j=0;j<=sum;j++)
			if(f[i][j])
				for(int k=1;k<=10;k++)
				{
					int now=(j<<k)|(1<<k-1);
					now&=sum;
					if((now&p)!=p)
						(f[i+1][now]+=f[i][j])%=mod;
				}
	for(int i=0;i<=sum;i++)
		(ans+=f[n][i])%=mod;
	printf("%d\n",(qp(10,n)-ans+mod)%mod);
	return 0;
}


Measured memory_bytes: 41216
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

ll Pow(ll n,ll p){
	ll r=1;
	for(;p>0;p>>=1){
		if(p&1) r=(r*n)%mod;
		n=(n*n)%mod;
	}
	return r;
}

const int M=2000005;
ll F[M];

void Init(){
	F[0]=1;
	for(int i=1;i<M;i++) F[i]=F[i-1]*i%mod;
}

ll Div(ll n,ll m){
	return n*Pow(m,mod-2)%mod;
}

ll nCk(ll n,ll k){
	return Div(F[n],F[n-k]*F[k]%mod);
}

ll nPk(ll n,ll k){
	return nCk(n,k)*F[k]%mod;
}

int l,r,d;

int main(){
	cin>>l>>r>>d;
	cout<<r/d-(l-1)/d<<endl;
}

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

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

int main() {
  ll n;
  cin >> n;
  ll mod = 1000000007;
  vector<ll> c(n);
  rep(i,0,n) cin >> c[i];
  ll k = modpow(4,n-1,mod);
  ll p = 0;
  sort(c.begin(), c.end());
  rep(i,0,n) {
    p += c[i] * (n + 1 - i);
    p %= mod;
  }
  ll ans = k * p % mod;
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 4764
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    int x, y;
    cin >> x >> y;

    for (int i = 0; i <= 100; i++) {
        int j = x - i;
        if (j < 0) break;
        int tot = i * 2 + j * 4;
        if (tot == y) {
            cout << "Yes" << endl;
            exit(0);
        }
    }
    cout << "No" << endl;
    return 0;
}

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

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

/* Macros reg. ends here */

const ll INF = 1LL << 50;

static const long long mod = 1000000007;

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  vector<string> ss(3);
  cin >> ss[0] >> ss[1] >> ss[2];

  vll sp(3, 0);
  ll turn = 0;
  ll ans = -1;
  while (true) {
    if (sp[turn] == (ll)ss[turn].size()) {
      ans = turn;
      break;
    }
    ll nt = ss[turn][sp[turn]] - 'a';
    sp[turn]++;
    turn = nt;
  }

  printf("%c\n", 'A' + (char)ans);

  return 0;
}


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

int main(){
    long int A,B,H,M;

    cin>>A>>B>>H>>M;
    long double hour,minute;
    minute = M*M_PI/30.0;

    hour = H*2*M_PI/12.0 + 0.5*2*M_PI/360.0*(M);

    vector<long double> m(2),h(2);
    h.at(0) = A*cos(hour);
    h.at(1) = A*sin(hour);
    m.at(0) = B*cos(minute);
    m.at(1) = B*sin(minute); 
    
    double a=h.at(0)-m.at(0) ,b=h.at(1)-m.at(1);
    printf("%10.10lf\n",sqrt(pow(a,2)+pow(b,2)));  
}

Measured memory_bytes: 4124
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>
#include <bitset>

using namespace std;
typedef long long ll;

int main() {
  int N, T;
  cin >> N >> T;
  vector<int> A(N);
  vector<int> B(N);
  for (int i = 0; i < N; ++i) {
    cin >> A[i] >> B[i];
  }

  vector<int> cur0(T + 1);
  vector<int> next0(T + 1);
  vector<int> cur1(T + 1);
  vector<int> next1(T + 1);

  // Init
  {
    int a = A[0];
    int b = B[0];
    fill(cur0.begin(), cur0.end(), -1);
    fill(cur1.begin(), cur1.end(), -1);
    cur0[0] = 0;
    if (a <= T) cur0[a] = b;
    cur1[1] = b;
  }

  // Iterate
  for (int i = 1; i < N; ++i) {
    int a = A[i];
    int b = B[i];
    fill(next0.begin(), next0.end(), -1);
    fill(next1.begin(), next1.end(), -1);
    
    // process cur0
    for (int t = 0; t <= T; ++t) {
      if (cur0[t] >= 0) {
	next0[t] = max(next0[t], cur0[t]);
	if (t + a <= T) next0[t + a] = max(next0[t + a], cur0[t] + b);
	if (t + 1 <= T) next1[t + 1] = max(next1[t + 1], cur0[t] + b);
      }
    }

    // process cur1
    for (int t = 0; t <= T; ++t) {
      if (cur1[t] >= 0) {
	next1[t] = max(next1[t], cur1[t]);
	if (t + a <= T) next1[t + a] = max(next1[t + a], cur1[t] + b);
      }
    }
    
    swap(cur0, next0);
    swap(cur1, next1);
  }

  // Terminate
  int mx = 0;
  for (int t = 0; t <= T; ++t) {
    mx = max(mx, cur1[t]);
  }
  cout << mx << endl;
  
  return 0;
}


Measured memory_bytes: 256
import math

n = int(input())
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
D = 0
z = []

#p = 1
for i in range(n):
    D += abs(x[i] - y[i])
print(D)

D = 0
#p = 2
for i in range(n):
    D += (abs(x[i] - y[i])) ** 2
D = math.sqrt(D)
print(D)

D = 0
#p = 3
for i in range(n):
    D += (abs(x[i] - y[i])) ** 3
D = D ** (1/3)
print(D)

#p = ∞
for i in range(n):
    z.append(abs(x[i] - y[i]))
print(max(z))



Measured memory_bytes: 5696
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

int main() {
	string s0;
	string s;

	cin >> s0;

	s = s0;

	REP(i, s0.size() - 1) {
		s = s.substr(0, s.size() - 1);

		if (s.size() % 2 == 0) {
			string s1 = s.substr(0, s.size() / 2);
			string s2 = s.substr(s.size() / 2, s.size() / 2);

			if (s1 == s2) {
				cout << s.size() << endl;
				break;
			}
		}
	}
}

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

using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }

struct Edge {
  int a, b, c;
};

struct Query {
  int j, v, w;
};

struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) { }
  bool unionSet(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findSet(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};


void solve() {
  int K;
  cin >> K;
  int even = K / 2;
  int odd = (K + 1) / 2;
  cout << even * odd << endl;
}

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(16);
  solve();
  return 0;
}

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


int main() {
    int n;
    cin >> n;
    pair<pair<string,int>,int> p[110];//
    rep(i,n){
        int m;
        string s;
        cin >> s >> m;
        p[i] = make_pair(make_pair(s,-m),i);
    }
    sort(p,p+n);
    rep(i,n){
        cout << p[i].second+1 << endl;
    }
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
from decimal import Decimal
import sys

def classify(w):
    if w <= Decimal("48.00"):
        return "light fly"
    elif Decimal("48.00") < w <= Decimal("51.00"):
        return "fly"
    elif Decimal("51.00") < w <= Decimal("54.00"):
        return "bantam"
    elif Decimal("54.00") < w <= Decimal("57.00"):
        return "feather"
    elif Decimal("57.00") < w <= Decimal("60.00"):
        return "light"
    elif Decimal("60.00") < w <= Decimal("64.00"):
        return "light welter"
    elif Decimal("64.00") < w <= Decimal("69.00"):
        return "welter"
    elif Decimal("69.00") < w <= Decimal("75.00"):
        return "light middle"
    elif Decimal("75.00") < w <= Decimal("81.00"):
        return "middle"
    elif Decimal("81.00") < w <= Decimal("91.00"):
        return "light heavy"
    else:
        return "heavy"
    
[print(classify(Decimal(j))) for j in [i for i in sys.stdin]]



Measured memory_bytes: 6324
#include <bits/stdc++.h>
using namespace std;
long long n,m,x,ans;
int main()
{
	scanf("%lld%lld",&n,&m);
	for (int i=m;i<=n+1;i++)
	{
		ans=(ans+((long long)i*(n+1-i))+1)%1000000007;
	}
	printf("%lld",ans);
} 

Measured memory_bytes: 3824
#include<iostream>
#include<string.h>
using namespace std;
string s;
void judge(string& s)
{
	for(int i=0;i<s.length()-1&&s.length()>2;i++)
	{
		if(s[i]=='S'&&s[i+1]=='T')
		{
			s.erase(i,2);	
			i=i-2;
			if(i<-1)
			i=-1;
		}
	}
}
int main()
{
	cin>>s;
	int c;
	c=s.size();
	if(c==1)
	{
		cout<<1<<endl;
		return 0;
	}
	else if(c==2)
	{
		if(s[0]=='S'&&s[1]=='T')
		{
			cout<<0<<endl;
			return 0;
		}
		else
		cout<<2<<endl;
		return 0;
	}
	judge(s);
	c=s.size();
	if(c==1)
	{
		cout<<1<<endl;
		return 0;
	}
	else if(c==2)
	{
		if(s[0]=='S'&&s[1]=='T')
		{
			cout<<0<<endl;
			return 0;
		}
		else
		cout<<2<<endl;
		return 0;
	}
	cout<<s.length();
} 

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i,l,r) for (int i=l;i<=r;i++)
using namespace std;
typedef long long ll;
int a,b,c,ans,N,M,tt;
int main(){
	scanf("%d%d",&a,&b);
	if (a<b) printf("0\n");
	else printf("10\n");
	return 0;
}


Measured memory_bytes: 256
L = [int(i) for i in input().split()]
count = 0
L.sort()
while L[2]-L[0] >= 2:
    L[0] += 2
    count += 1
while L[2]-L[1] >= 2:
    L[1] += 2
    count += 1
L.sort()
if L[0] != L[1]:
    count += 2
else:
    if L[0] != L[2]:
        count += 1

print(count)


Measured memory_bytes: 3064
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <tuple>
#include <time.h>
#include <random>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;

long long int INF = 3e18;
double Pi = 3.1415926535897932384626;

vector<ll> G[500005];
vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←


#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define re(i,n) for(i=0;i<n;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl


ll mod = 1000000007;
ll rui(ll number1,ll number2){

    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){

    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){

    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){

    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}

/*
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=800000; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
	rfact[800000] = rui(fact[800000],mod - 2);
	for(ll i=800000; i>=1; i--){
	   rfact[i-1] = rfact[i] * i;
	   rfact[i-1] %= mod;
	}
	return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod) * rfact[n-r]) % mod;}
*/

ll n,m,num,sum,ans,a,b,c,d,e,g,h,w,i,j,k,q,l,r;
ll x[500005],y[500005],z[500005];
bool used[500005];
char s[500005],t[500005];
bool flag,dame;

int main(){
	cin >> n >> m;
	l = -1;
	r = INF;
	for(i=0;i<m;i++){
		cin >> a >> b;
		l = max(l,a);
		r = min(r,b);
	}
	p(max(0ll,r-l+1));
	return 0;
}

Measured memory_bytes: 25084
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
    int N; cin>>N;
    vector<unsigned long long > T(N,0);
    for(int i=0;i<N;i++){
        cin>>T[i];
    }

    unsigned long long  ans=T[0],MOD=1000000007;
    if(N==1){
        cout<<T[0];
        return 0;
    }
    for(int i=1;i<N;i++){
        ans=(ans)/__gcd(ans,T[i])*T[i];
    }
    cout<<ans;
    return 0;
}

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

int par[2][MAX_N];
int myrank[2][MAX_N];

void init(int n){
	rep(i,n){
		par[0][i] = par[1][i] = i;
		myrank[0][i] = myrank[1][i] =0;
	}
}

int find(int x, int z){
	return par[z][x]==x?x:par[z][x] = find(par[z][x], z);
}

void unite(int x, int y, int z){
	x = find(x,z);
	y = find(y,z);
	if(x == y) return;
	
	if(myrank[z][x] < myrank[z][y]){
		par[z][x] = y;
	} else {
		par[z][y] = x;
		if(myrank[z][x] == myrank[z][y]) myrank[z][x]++;
	}
}

signed main(){	
	int N, K, L, a, b;
	map<int,int> mp;
	cin>>N>>K>>L;
	
	init(N+10);
	
	rep(i, K){cin>>a>>b;unite(a,b,0);}
	rep(i, L){cin>>a>>b;unite(a,b,1);}
	
	// rep(i,N) mp[find(i,0)*(N+1) + find(i,1)]++;
	
	rep(i,N) mp[find(i,0)*(N+29) + find(i,1)]++;
	
	rep(i,N) cout<<(i-1?" ":"")<<mp[find(i,0)*(N+29)+find(i,1)];
	
	cout<<endl;
	
	
	return 0;
}

Measured memory_bytes: 18176
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cassert>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for (int i = a; i < (int)(b); ++i)
#define FORD(i,a,b) for (int i = a; i >= (int)(b); --i)
#define FOREACH(it,c) for(typeof(c.begin()) it = c.begin(); it != c.end(); ++it)

int x = 0, y = 0;
vector<string> buf;

int main() {
  vector<string> lines;
  string str;
  while (getline(cin,str)) {
    if (str == "END_OF_TEXT") break; 
    lines.push_back(str);
  }
  char c;
  while (cin>>c, c != '-') {
    switch (c) {
    case 'a': {
      x = 0;
    } break;
    case 'e': {
      x = lines[y].size();
    } break;
    case 'p': {
      if (y != 0) y--;
      x = 0;
    } break;
    case 'n': {
      if (y != lines.size()-1) y++;
      x = 0;
    } break;
    case 'f': {
      if (x != lines[y].size()) x++;
      else if (y != lines.size()-1) {
	y++; x = 0;
      }
    } break;
    case 'b': {
      if (x != 0) x--;
      else if (y != 0) {
	y--; x = lines[y].size();
      }
    } break;
    case 'd': {
      if (x != lines[y].size()) {
	FOR(i,x,lines[y].size()-1) {
	  lines[y][i] = lines[y][i+1];
	}
	lines[y].resize(lines[y].size()-1);
      } else if (y != lines.size()-1) {
	lines[y]+=lines[y+1];
	FOR(i,y+1,lines.size()-1) {
	  lines[i] = lines[i+1];
	}
	lines.resize(lines.size()-1);
      }
    } break;
    case 'k': {
      if (x != lines[y].size()) {
	string tmp;
	FOR(i,x,lines[y].size()) {
	  tmp += lines[y][i];
	}
	lines[y].resize(x);
	buf = vector<string>(1,tmp);
      } else if (y != lines.size()-1) {
	lines[y]+=lines[y+1];
	FOR(i,y+1,lines.size()-1) {
	  lines[i] = lines[i+1];
	}
	lines.resize(lines.size()-1);
	buf = vector<string>(1, "");
      }
    } break;
    case 'y': {
      if (buf.size()) {
	if (buf[0] == "") {
	  string tmp = lines[y].substr(0,x);
	  lines.resize(lines.size()+1);
	  FORD(i,lines.size()-1,y+2) {
	    lines[i] = lines[i-1];
	  }
	  lines[y+1] = lines[y].substr(x);
	  lines[y] = tmp;
	  y++; x = 0;
	} else {
	  string tmp = lines[y].substr(x);
	  lines[y] = lines[y].substr(0,x);
	  lines[y] += buf[0];
	  lines[y] += tmp;
	  x += buf[0].size();
	}
      } 
    } break;
    default: assert(false);
    }
  }
  REP(i,lines.size())
    cout<<lines[i]<<endl;
  return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
typedef long long ll;

int main(void) {
  ll a, b, c, max;
  scanf("%lld%lld%lld", &a, &b, &c);
  if((a * b * c) & 1) printf("%lld", a > b ? (a > c ? b * c : a * b) : (b > c ? a * c : a * b));
  else printf("0");
  return 0;
}

Measured memory_bytes: 128
def f(a, b, c)
  r = 0
  N.times{
    r += a
   
    # p [a, b, c, r]
    return true if r % b == c
  }
  false
end

N = 100
A, B, C = gets.split.take(3).map(&:to_i)
puts f(A, B, C) ? :YES : :NO


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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define srt(i) sort(i.begin(), i.end())
#define rvt(i) sort(i.begin(), i.end(), greater<int>())

int main() {
  int r;
  cin >> r;

  cout << M_PI*2*r << endl;

}


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

string subsequence(string s1,string s2)
{   
    int x = s1.length();
    int y = s2.length();
    ll dp[x+1][y+1];
    for(int i=0;i<=x;i++)
    {
        for(int j=0;j<=y;j++)
        {
            dp[i][j] = 0;
        }
    }
    for(int i=1;i<=x;i++)
    {
        for(int j=1;j<=y;j++)
        {
            if(s1[i-1] == s2[j-1])
            {
                dp[i][j] = 1 +dp[i-1][j-1];
            }
            else
            {
                dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    string res;
    int i=x,j=y;
    while(i>0 && j>0)
    {
        if(s1[i-1] == s2[j-1])
        {
            res+=s1[i-1];
            i--;
            j--;
        }
        else if (dp[i-1][j]>dp[i][j-1])
        {
            i--;
        }
        else
        {
            j--;
        }
    }
    reverse(res.begin(),res.end());
    return res;
}

int main()
{   ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s1,s2;
    cin>>s1>>s2;
    cout<<subsequence(s1,s2)<<endl;
}

Measured memory_bytes: 74000
#include<cstdio>
#include<cstring>
char a[100005];
int len;
int main() {
	scanf("%s", a);
	len = strlen(a);
	int i;
	if (a[0] == '0' || a[len - 1] == '1') {
		printf("-1");
		return 0;
	}
	for (i = 0; i < len/2; i++) {
		if (a[i] != a[len - 2 - i]) {
			printf("-1");
			return 0;
		}
	}
	int prev=1,x = 1;
	for (i = 1; i < len; i++) {
		x++;
		printf("%d %d\n", prev, x);
		if (i>1 && a[i - 1] == '1') prev = x;
	}
	return 0;
}

Measured memory_bytes: 1408
#include "bits/stdc++.h"
using namespace std;
#define forn(i, x, n) for (int i = x; i < n; i++)
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
typedef long double ld;
typedef long long ll;
template <typename... Args>
void dbg(Args&&... args) {
  using expander = int[];
  (void)expander {0,(static_cast<void>(void(cout << std::forward<Args>(args) << " ")), 0)...};
  cout << endl;
}
void gen() {exit(0);}

int n;

void input() {
  scanf("%d", &n);
}

void solve() {
  int x = n;
  while (x > 0) {
    if (x % 4 == 0 || x % 7 == 0) {
      printf("Yes\n");
      return;
    }
    x -= 4;
  }
  x = n;
  while (x > 0) {
    if (x % 4 == 0 || x % 7 == 0) {
      printf("Yes\n");
      return;
    }
    x -= 7;
  }
  printf("No\n");
}

int main() {
#ifdef DEBUG
  freopen("input", "r", stdin);
  //  freopen("output", "w", stdout);
  //  gen();
#endif
  input();
  solve();
  return 0;
}


Measured memory_bytes: 256
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
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;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
//ll mod = 1e9 + 7;
//ll MOD = 1e9 + 7;
ll INF = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k;
    cin >> n >> k;
    V vec(n + 1);
    rep3(i, 1, n+1) cin >> vec[i];
    rep3(i, 1, n + 1)
    {
        vec[i] += vec[i - 1];
        vec[i] %= k;
    }
    rep(i, n + 1)
    {
        vec[i] = (ll)(vec[i] + (k * 1e6) - i) % k;
    }
   // rep(i, n+1) cout << vec[i] << " ";
  //  cout << endl;
    map<ll, ll> mp;
    queue<ll> q;
    ll res = 0;
    rep(i, n + 1)
    {

        res += mp[vec[i]];
        mp[vec[i]]++;
        q.push(vec[i]);
        if (q.size() >= k)
        {
            mp[q.front()]--;
            q.pop();
        }
    }
    cout << res << endl;
}


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



namespace CSharpSample01
{



    class Program
    {
        static long[] paty;
        static long[] layer;

        static long Solve(int n, long X)
        {
            
            if(X == 1)
            {
                if (n != 0) return 0;
                else return 1;
            }
            if (X < layer[n] / 2 + 1) return Solve(n - 1, X - 1);
            else if (X == layer[n] / 2 + 1) return paty[n - 1] + 1;
            else if (X < layer[n] - 1) return paty[n - 1] + 1 + Solve(n - 1, X - (layer[n] / 2 + 1));
            else return 2 * paty[n - 1] + 1;
        }

        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int N = int.Parse(input[0]);
            long X = long.Parse(input[1]);

            paty = new long[N + 1];
            paty[0] = 1;
            layer = new long[N + 1];
            layer[0] = 1;

            for(int i = 1; i <= N; i++)
            {
                layer[i] = 3 + 2 * layer[i - 1];
                paty[i] = 1 + 2 * paty[i - 1];
            }

            Console.WriteLine(Solve(N, X));
        }
    }
}

Measured memory_bytes: 11092
# https://at274.hatenablog.com/entry/2020/01/15/060000
from functools import reduce
import math


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm, numbers, 1)


N, M = map(int, input().split())
A = list(map(int, input().split()))

# 最初、Aの要素は全て偶数
# 2で割ったものに置き換え
A = [a // 2 for a in A]

# 各要素について、2で割り切れる回数が等しいかチェック
# 全ての要素について、２で割れる回数が同じでないと題意は満たせない
count_div_2 = None
for a in A:
    cnt = 0
    while a % 2 == 0:
        a //= 2
        cnt += 1
    # 1個目は無条件で保存
    if count_div_2 is None:
        count_div_2 = cnt
    # 2個目からチェック
    elif cnt != count_div_2:
        print(0)
        exit()

# Aの全要素の最小公倍数
# my_lcmの既数倍が題意を満たす
# my_lcmがMを超えていたら一つも作れない
my_lcm = lcm_list(A)
if my_lcm > M:
    print(0)
    exit()

tmp = M // my_lcm
# tmp=1or2なら1個, 3or4なら2個, 5or6なら3個,...(偶数は使えない)
ans = (tmp + 1) // 2
print(ans)


Measured memory_bytes: 86116
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <math.h>
using namespace std;

int main(int argc, char const *argv[]){
    int n;
    cin >> n;


    vector<pair<int,int>> a(n);
    
    for (int i = 0; i < n; i++)
    {
        int j;
        cin >> j;
        a[i] = make_pair(j,i+1);
    }
    
    sort(a.begin(),a.end());

    for (int i = 0; i < n; i++)
    {
        cout << a[i].second << " " ;
    }

    
    

    cout << endl;
    return 0;
}


Measured memory_bytes: 1664
#include <stdio.h>
int main()
{
	int a,N,cnt=0;
	double result;
    scanf("%d",&N);
    for(a=1;a<=N;a++){
    	if(a%2!=0){
    		cnt++;
		}
	}
	result=cnt*1.0/N*1.0;
    printf("%.10lf",result);
}


Measured memory_bytes: 128
// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}T[] lreads(T=long)(long n){return iota(n).map!((_)=>lread!T).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}void arywrite(T)(T a){a.map!text.join(' ').writeln;}
void scan(L...)(ref L A){auto l=readln.split;foreach(i,T;L){A[i]=l[i].to!T;}}alias sread=()=>readln.chomp();
void dprint(L...)(lazy L A){debug{auto l=new string[](L.length);static foreach(i,a;A)l[i]=a.text;arywrite(l);}}
static immutable MOD=10^^9+7;alias PQueue(T,alias l="b<a")=BinaryHeap!(Array!T,l);import std, core.bitop;
// dfmt on

void main()
{
    long H, W;
    scan(H, W);
    string[] A = generate(sread).take(H).array;
    auto h = new bool[](H);
    auto w = new bool[](W);
    foreach (y; 0 .. H)
    {
        if (A[y].all!"a == '.'")
            h[y] = true;
    }
    foreach (x; 0 .. W)
    {
        if (iota(H).all!(a => A[a][x] == '.'))
            w[x] = true;
    }
    foreach (y; 0 .. H)
    {
        if (h[y])
            continue;
        foreach (x; 0 .. W)
        {
            if (w[x])
                continue;
            write(A[y][x]);
        }
        writeln();
    }
}


Measured memory_bytes: 3616
#include<stdio.h>

int main() {
	int n, x, t, tmp;
	tmp = scanf("%d", &n);
	tmp = scanf("%d", &x);
	tmp = scanf("%d", &t);

	printf("%d\n", (n % x == 0) ? t * (n / x) : t * ((n / x) + 1));
	return 0;
}



Measured memory_bytes: 3228
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;

fn main() {
    input!{
      mut s: chars,
    }

    let n = s.len();
    if n < 3 {
        println!("{}", 0);
        return;
    }


    let mut acnt = 0u64;
    let mut i = 0;
    let mut ans = 0u64;
    while i < n-2 {
        if s[i] == 'A' {
            acnt += 1;
        } else {
            acnt = 0;
        }

        if s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C' {
            s[i+2] = 'A';
            ans += acnt;
            i = i+2;
            acnt -= 1;
        } else {
            i += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4476
using ll=long long;using ull=unsigned long long;
#include<limits>
namespace pcl{template<typename T>constexpr T TNF=std::numeric_limits<T>::max()/2;constexpr int INF=TNF<int>;constexpr ll LNF=TNF<ll>;constexpr double DNF=TNF<double>;constexpr double EPS=1e-8;constexpr int P7=1'000'000'007;constexpr int DX[]={1,0,-1,0,1,1,-1,-1};constexpr int DY[]={0,1,0,-1,-1,1,1,-1};}
#include<algorithm>
#include<cmath>
#include<iostream>
namespace pcl{template<typename T>void updmax(T&a,T const&b){a=std::max(a,b);}template<typename T>void updmin(T&a,T const&b){a=std::min(a,b);}template<typename T,typename U,typename V>bool in_range(T const&begin,U const&mid,V const&end){return begin<=mid&&mid<end;}template<typename T,typename U,typename V>bool in_range(T const&begin,std::initializer_list<U>list,V const&end){auto p=std::minmax_element(list.begin(),list.end());return begin<=*p.first&&*p.second<end;}template<typename T,typename U,typename V>bool in_range_strict(T const&begin,std::initializer_list<U>list,V const&end){if(!std::is_sorted(list.begin(),list.end()))return false;return in_range(begin,list,end);}template<typename T>inline T cget(){T x;std::cin>>x;return x;}}
#include<iostream>
#include<vector>
namespace pcl{template<typename T>std::ostream&operator<<(std::ostream&os,std::vector<T>const&v){os<<'[';for(size_t i=0;i<v.size();i++){if(i!=0)os<<",";os<<v[i];}os<<']';return os;}template<typename T>std::istream&operator>>(std::istream&is,std::vector<T>&v){for(size_t i=0;i<v.size();i++)is>>v[i];return is;}}
#include<bits/stdc++.h>
using namespace std;using namespace pcl;int main(){int N,K;cin>>N>>K;long double res=0;for(int n=1;n<=N;n++){if(n<K){res+=1.0/pow(2,ceil(log2((double)K/n)));}else{res+=1.0;}}cout<<fixed<<setprecision(15)<<res/N<<endl;}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll memo[3005][3005];
int main()
{
    string a,b;
    cin>>a>>b;
    
    for(int i=1;i<=a.size();i++)
    {
        for(int j=1;j<=b.size();j++)
        {
            if(a[i-1]==b[j-1])
            {
                memo[i][j]=memo[i-1][j-1]+1;
            }
            
            else
            {
                memo[i][j]=max(memo[i-1][j],memo[i][j-1]);
            }
        }
    }
    
    int r=a.size();
    int c=b.size();
    string key="";
    while(r>0 && c>0)
    {
        if(memo[r][c]==memo[r-1][c])
        {
            r--;
        }
        
        else if(memo[r][c]==memo[r][c-1])
        {
            c--;
        }
        
        else
        {
            key+=a[r-1];
            r--;
            c--;
        }
    }
    for(int i=key.size()-1;i>=0;i--)
    {
        cout<<key[i];
    }
    
    cout<<"\n";
}


Measured memory_bytes: 70656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll one = 1;
const ll INF = 9223372036854775807; //10^18
const int inINF = 2147483647; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
    ll N; cin >> N;
    ll ans = 0;
    for (ll i = 1; i*i <= N; i++) {
        if(N % i == 0){
            if(i < N/i - 1){
                ans += N/i - 1;
            }
        }
    }
    printf("%lld\n", ans);

}

Measured memory_bytes: 3748
#include<bits/stdc++.h>
using namespace std ;
#define int long long 
signed main()
{
	int n;
	cin>>n;
	if(n==1||n==2){
		cout<<0<<endl;
	}
	else if(n%2==0){
		cout<<n/2-1;
	}
	else{
		cout<<n/2;
	}
	return 0;
 } 

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

int main()
{
    int n;
    string s;
    cin >> n >> s;
    int a = 0;
    int b = 0;
    int c = 0;
    int abc = 0;
    for(int i = 0;i < n;i++){
        if(s[i] == 'A'){
            a++;
        }
        if (s[i + 1] == 'B' && a > 0){
            b++;
        }
        if (s[i + 2] == 'C' && b > 0 && a > 0){
            c++;
            abc++;
        }
            a = 0;
            b = 0;
            c = 0;
    }
    cout<<abc;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define all(v) v.begin(),v.end()
#define repf(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define MOD 998244353 

using namespace std;
using namespace __gnu_pbds;

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

ordered_set<ll> ors;

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

ll power(ll a, ll n, ll m)
{
    ll ans=1;
    while(n)
    {
        if(n&1) ans=(ans*a)%m;
        n>>=1;
        a=(a*a)%m;
    }
    return ans;
}

ll invmod(ll a, ll m)
{
    return power(a,m-2,m);
}

ll lp[10000001];

void prime()
{
    repf(i,1,10000001) lp[i]=i;
    repf(i,2,10000001)
    {
        if(lp[i]==i)
        {
            for(ll j=2*i;j<10000001;j+=i)
            {
                if(lp[j]==j) lp[j]=i;
            }
        }
    }
}

void solve(ll tt) {
    prime();
    ll n;
    cin>>n;
    ll ans=1;
    repf(i,2,n+1) {
        ll c=1;
        ll x=i;
        while(x>1) {
            ll f=lp[x];
            ll c1=0;
            while(x%f==0) {
                x/=f;
                c1++;
            }
            c*=(1+c1);
        }
        ans=ans+i*c;
    }
    cout<<ans<<endl;
}

int main()
{
    IOS;
    ll t;
    // cin>>t;
    t=1;
    repf(tt,1,t+1) {
        solve(tt);
    }
}     

Measured memory_bytes: 81772
#include <iostream>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#define INF 100000000000
#define MOD 1000000007
#define ll long long int
//#define int long long int
using namespace std;


int main(){

  string S; cin>>S;

  string s = "hi";

  for(int i=0;i<=50;i++){
    if(s == S) {
      cout<<"Yes"<<endl;
      return 0;
    }

    s += "hi";
  }

  cout<<"No"<<endl;

 


  return 0;
}

Measured memory_bytes: 256
read = lambda: map(int, input().split())
n, k = read()
N = 10 ** 5 + 10
c = [0] * N
for i in range(n):
    a, b = read()
    c[a] += b
for i in range(N):
    k -= c[i]
    if k <= 0:
        ans = i
        break
print(ans)

Measured memory_bytes: 5748