akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
 
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("-ffloat-store")
 
#define int  long long
#define rep(i,begin,end) for(__typeof(end)i=(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define F first
#define S second
#define sz(x) ((int)x.size())
#define pb push_back
#define pf push_front
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define mod 1000000007
#define what_is(x) cerr << #x << " is " << x <<"\n";
#define sortA(v) sort(v.begin(), v.end())
#define sortD(v) sort(v.rbegin(), v.rend())
#define PI 3.14159265358979323846
#define vout(a) for(auto x:a) cout<<x<<" ";
#define INF 10000000000000000 //1e16
 
// #define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
 
 
// using namespace __gnu_pbds;
using namespace std;
 
using ll  = long long;
using vi  = vector<int>;
using pii = pair<int,int>;
using vii = vector<pii>;
using mi  = multiset<int>;
using mii = multiset<pii>;
 
int lcm(int a,int b) {return (a*(b/__gcd(a,b)));}



void solve()
{
    int t,n,m,i,k,r,l,u,v,w,j,s,sum=0,pos,flag=0,count=0;
    string S,T,U; 
    int h;
    cin>>h>>w>>k;
    char a[h][w];
    rep(i,0,h)
    {
        rep(j,0,w) 
        {
            cin>>a[i][j];
            if(a[i][j]=='#') count++;
        }
    }
    vi row(h+1);
    vi col(w+1);
    rep(i,0,h)
    {
        flag=0;
        rep(j,0,w)
        {
            if(a[i][j]=='#') flag++;
        }
        row[i+1]=flag;
    }
    rep(j,0,w)
    {
        flag=0;
        rep(i,0,h)
        {
            if(a[i][j]=='#') flag++;
        }
        col[j+1]=flag;
    }
    int ans=0;
    rep(mask,0,1<<h+w)
    {
        sum=0;
        // rep(i,0,n)
        // {
        //     if(mask&(1<<i))
        //     {
        //         sum+=a[i]; //sum of subsets
        //     }
        // }
        // if(h>w)
        map<int,int> curr;
        rep(i,0,h)
        {
            if(mask&(1<<i))
            {
                sum+=row[i+1];
                curr[i]++;
            }
        }
        rep(i,h,h+w)
        {
            if(mask&(1<<i))
            {
                sum+=col[i-h+1];
                rep(I,0,h)
                {
                    rep(J,0,w)
                    {
                        if(curr[I]&&J==(i-h))
                        {
                            if(a[I][J]=='#') sum--;
                        }
                    }
                }
            }
        }
        if(count-sum==k) ans++;
        // count=0;
        sum=0;
    }
    cout<<ans;
}
 
 
signed main()
{
    #ifndef ONLINE_JUDGE 
       freopen("input.txt","r",stdin);
       freopen("output.txt","w",stdout);
    #endif
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve();
        if(t)cout<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF (1 << 30 - 1)
#define LLINF (1LL << 60)
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
ll V, T;
string S;
ll ans = 0;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

signed main() {
    cin >> A >> V >> B >> W >> T;
    ll D = abs(B - A);
    ll X = V - W;
    if (X > 0) {
        if (D <= X * T) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    } else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int n,m,K;
char a[1010][1010];
int main() {
	scanf("%d%d%d",&n,&m,&K);
	for(int i=1;i<=n;++i) {
		for(int j=1;j<=m;++j) {
			int x=(i+j)-1, y=(i-j)-(1-m)+1;
			int s=((x-1)/K+1)&1, t=((y-1)/K+1)&1;
			if(!s && !t) putchar('R');
			if(!s && t) putchar('G');
			if(s && !t) putchar('B');
			if(s && t) putchar('Y');
		}
		puts("");
	}
	return 0;
}

Measured memory_bytes: 3764
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);const tn=():number=>{const a=input[0];input.shift();return Number(a)};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{const a=input[0];input.shift();return String(a)};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const tc=():string=>{let a=input[0].split('');const b=a[0];a.shift();if(a.length>0){input[0]=a.join('')}else{input.shift()}return String(b)};const tcc=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(tc())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length;i+=2){if(eval(a+op+arr[i]))return arr[i+1];}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const gojo=(a:number,b:number):number=>{if(a%b===0)return b;return gojo(b,a%b)};
const main=()=>{
  let [a,b,c]=tnn(3)
  to(floor((a-c)/(b+c)))
}
main()

Measured memory_bytes: 7372
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

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

    if(s.size() <= k){
        cout << s << endl;
    }
    else{
        rep(i,k){
            cout << s[i];
        }
        rep(i,3){
            cout << ".";
        }
        cout << endl;
    }
    
}

Measured memory_bytes: 3624
#include <iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<math.h>
#include<cmath>
#define ll long long
using namespace std;
long double pi = 3.14159265358979323846;
#define fast ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);



int main()
{
	int n, m;  cin >> n >> m;
	string a = "", b = "";
	for (int i = 0; i < n; i++)
		a +=(m+'0');
	for (int i = 0; i < m; i++)
		b += (n+'0');
	cout << min(a, b);

	return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,a[30];long long ans;char s[222222];
int main(){
	cin>>s+1,n=strlen(s+1);
	for(int i=1;i<=n;i++)a[s[i]-'a'+1]++;
	for(int i=1;i<26;i++)for(int j=i+1;j<=26;j++)ans+=1ll*a[i]*a[j];
	printf("%lld",ans+1);
}

Measured memory_bytes: 384
#include <vector>
#include <string>
#include <algorithm>
#include <iostream>

using namespace std;

int main()
{
	int a,b;
	cin >> a >> b;
	vector<int> d;
	d.push_back(a + b);
	d.push_back(a - b);
	int e = a * b;
	d.push_back(e);
	cout << max({ d[0],d[1],d[2] });

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
    int n,x,m;
    cin>>n>>x>>m;
    map<int,int>mp,rev;
    int pend=0,tmp=x;
    for(;;pend++,(tmp*=tmp)%=m){
        if(mp.find(tmp)!=mp.end())
            break;
        mp[tmp]=pend;
        rev[pend]=tmp;
    }
    int pbeg=mp[tmp];
    int per=pend-pbeg;
    int psum=0;
    for(int i=0;i<per;i++)
        psum+=rev[i+pbeg];
    int sum=0;
    for(int i=0;i<min(n,pbeg);i++)
        sum+=rev[i];
    if(n>=pbeg){
        n-=pbeg;
        sum+=n/per*psum;
        for(int i=0;i<n%per;i++)
            sum+=rev[i+pbeg];
    }
    cout<<sum<<endl;
}


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

int a[1005],b[1005],c[1005];
int krus[105][105];
const int INF = 1e9;
set<pair<int,int> > edge;

int main() {
  int n,m;
  cin >> n >> m;
  for(int i = 0; i < m; i++) {
    cin >> a[i] >> b[i] >> c[i];
    a[i]--;
    b[i]--;
  }
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < n; j++) {
      if(i != j) krus[i][j] = INF;
    }
  }

  for(int i = 0; i < m; i++) {
    krus[a[i]][b[i]] = krus[b[i]][a[i]] = c[i];
  }

  for(int k = 0; k < n; k++) {
    for(int i = 0; i < n; i++) {
      for(int j = 0; j < n; j++) {
	krus[i][j] = min(krus[i][j],krus[i][k] + krus[k][j]);
      }
    }
  }

  /* for(int i = 0; i < n; i++) {
    for(int j = 0; j < n; j++) {
      cout << krus[i][j] << endl;
    }

    }*/

  int ans = 0;
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < m; j++) {
      if(i == b[j]) continue;
      if(krus[i][a[j]] + c[j] == krus[i][b[j]]) {
	ans++;
	pair<int,int> p(a[j],b[j]);
	if(edge.find(p) == edge.end()) edge.insert(p);
      }
    }
  }

  cout << m - edge.size() << endl;
}

      


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
#include <random>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS_VEC(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
#define CONTAINS_SET(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }


signed main()
{
	int x, a, b;
	cin >> x >> a >> b;
	x -= a;
	int n = x / b;
	x -= b * n;
	cout << x << endl;
}



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

int ceilDivide(int a, int b) {
    return (a+b-1)/b;
}

int main() {
    int n, k;
    cin >> n >> k;

    int pos;
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        if (x==1) pos = i;
    }

    int ans = n;
    for (int i = 1; i+k-1 <= n; i++) {
        int tmp = 1+ceilDivide(i-1, k-1);
        tmp += ceilDivide(n+1-i-k, k-1);
        ans = min(ans, tmp);
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 3628
#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>;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define sz(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int ch(string s){
    int a=sz(s);
    
    if(a%2){
        return 0;
    }else{
        string b,c;
        b="";c="";
        rep(i,a/2){
            b+=s[i];
        }
        FOR(i,a/2,a-1){
            c+=s[i];
        }
        if(b==c){
            return a;
        }else{
            return 0;
        }
    }
}
int main() {
    ll n;cin>>n;
    cout<<((n-1)*n)/2<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<functional>
#include<map>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define PII pair<int,int>
#define PLI pair<long long, int>
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define ctoi(x) (x - 'a') 
#define CTOI(x) (x - 'A')
#define BIT(x) (1 << (x))
using namespace std;
int main(){
    int sx, tx, sy, ty;
    cin >> sx >> sy >> tx >> ty;
    REP(i, tx-sx){
        cout << "R";
    }
    REP(i, ty-sy){
        cout << "U";
    }
    REP(i, tx-sx){
        cout << "L";
    }
    REP(i, ty-sy){
        cout << "D";
    }
    cout << "DR";
    REP(i, tx-sx){
        cout << "R";
    }
    REP(i, ty-sy){
        cout << "U";
    }
    cout << "UL";
    cout << "UL";
    REP(i, tx-sx){
        cout << "L";
    }
    REP(i, ty-sy){
        cout << "D";
    }
    cout << "DR" << endl;
    return 0;
}


Measured memory_bytes: 256
program answer
        implicit none
        integer :: i,N
        integer,allocatable,dimension(:) :: A,B
        integer :: ans
        intrinsic min
        read(*,*) N
        allocate(A(N),B(N-1))
        read(*,*) (B(i),i=1,N-1)
        A(1)=B(1)
        A(N)=B(N-1)
        ans=A(1)+A(N)
        do i=2,N-1
          A(i) = min(B(i-1),B(i))
          ans=ans+A(i)
        end do
        write(*,'(I0)') ans
        stop
      end program answer


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
ll gcd(ll a, ll b){
    if(b==0) return a;
    return gcd(b,a%b);
}

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

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


int main(){
	
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif

	long long int a,b,g;
	cin >> a >> b;
	g=__gcd(a,b);
	vector<long long int>v;
	for(long long int i=2;i*i<=g;i++){
		if(g%i==0){
			while(g%i==0) g/=i;
			v.push_back(i);
		}
	}
	if(g>1) v.push_back(g);
	cout << (1+v.size());


	


 
 
	
 
}

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>;

int main() {
  int N;
  cin >> N;
  vector<int> L(N);
  for (int i = 0; i < N; i++)
  {
    cin >> L[i];
  }
  sort(L.rbegin(), L.rend());

  int sum = 0;
  for (int i = 1; i < N; i++)
  {
    sum += L[i];
  }
  if (L[0] < sum) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3544
import numpy as np
n,w = map(int,input().split())
dp = np.full(100001,w+1,dtype=int)
dp[0] = 0
for i in range(n):
    we,va = map(int, input().split())
    dp[va:] = np.minimum(dp[va:],dp[:-va]+we)
print(np.max(np.where(dp <= w)))

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

int main(){
  int n, k, number = 1, i;
  cin >> n >> k;

  for(i = 0; i < n; i++){
    if(number + k <= number * 2){
      number += k;
    } else{
      number *= 2;
    }
  }
  cout << number << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1e9
#define INFLL 1ull<<60u
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

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

void solve() {
    const int MAX = 1e6;
    // init
    int N; cin >> N;
    vector<ll> rui(N,0);
    REP(i,N) {
        int A; cin >> A;
        if ( i == 0 ) rui[i] = A;
        else rui[i] = A + rui[i-1];
    }
    map<ll,ll> mp;
    REP(i,N) {
        if (!mp.count(rui[i])) mp[rui[i]] = 0;
        mp[rui[i]] ++;
    }

    ll ans = 0;
    for(const auto &p : mp) {
        auto [v,cnt] = p;
        if (v == 0 ) ans += cnt*(cnt+1)/2;
        else if (cnt > 1) ans += cnt*(cnt-1)/2;
    }

    cout << ans << endl;

}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 17100
N_mai, Y_en = map(int, input().split())
N_man, N_5sen, N_sen = -1, -1, -1

for man in range(N_mai + 1):
    
    for sen_5 in range(0, N_mai - man + 1):
        
        mai = N_mai - man - sen_5
        summ = 10000 * man + 5000 * sen_5 + 1000 * mai
        
        if (summ == Y_en):
            N_man, N_5sen, N_sen = man, sen_5, mai
            break

print(N_man,N_5sen,N_sen)

Measured memory_bytes: 3060
import numpy as np
n = int(input())
s = input()

left = 0
right = 0

black = [0] * n
white = [0] * n
for i in range(n):
    if s[i] == ".":
        black[i] += 1
    else:
        white[i] += 1

black.insert(0, 0)
white.insert(0, 0)
black = np.cumsum(black)
white = np.cumsum(white)

results = [black[n]]
for i in range(n):
    results.append(white[i + 1] + black[n] - black[i + 1])
print(min(results))



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

using namespace std;

int main(void) {
	int num, i = 0, p = 0;
	long long ans[2] = { 0 };
	cin >> num;
	vector<int> d(num);
	for (; i < num; i++)
		scanf("%d", &d[i]);
	sort(d.begin(), d.end(), greater<int>());
	for (i = 0; i < num-1; i++) {
		if (d[i] == d[i + 1]) {
			ans[p++] = d[i++];
			if (p == 2)
				break;
		}
	}
	cout << ans[0] * ans[1] << "\n";
	return 0;
}

Measured memory_bytes: 640
n = int(input())
data = list(map(int, input().split()))   # 1行にある複数の値を整数にして、リストにしまう
#
vmin = min(data)  # 最小値
vmax = max(data)  # 最大値
vsum = sum(data)  # 合計
#
print(vmin, vmax, vsum)  # 結果表示


Measured memory_bytes: 6588
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<string>
#include<sstream>
#include<cmath>
#include<climits>
#include<algorithm>
#include<bitset>
#include<set>
#include<stack>
#include<queue>
#include<iomanip>
#include<memory.h>
#include<complex>
#include<unordered_map>
using namespace std;  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef tuple<int,int> tii;
#define rep(i,n) for(int i=0;i<(n);i++)  
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
const double PI = M_PI;  
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cerr<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
#define DIV int(1e9+7)
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}
/* Coding Space*/
vector<int> ans;
vector<int> G[200000]; // G[from][i] = to
bool used[200000];

void dfs(int index){
  used[index] = 1;
  ans.pb(index);
  rep(i,(int)G[index].size()){
    int to = G[index][i];
    if(used[to] == 0){dfs(to); return;}
    if(i == (int)G[index].size() - 1) return;
  }
  return;
}

void bdfs(int index){
  used[index] = 1;
  if(index!=1)ans.insert(ans.begin(),index);
  rep(i,(int)G[index].size()){
    int to = G[index][i];
    if(used[to] == 0){bdfs(to); return;}
    if(i == (int)G[index].size() - 1) return;
  }
  return;
}


int main(){
  int n,m; cin >> n >> m;
  rep(i,m){
    int a,b; cin >> a >> b;
    G[a].pb(b);
    G[b].pb(a);
  }
  dfs(1);
  bdfs(1);
  cout << ans.size() << endl;
  rep(i,(int)ans.size()){
    cout << ans[i] << (i==(int)ans.size()-1?"\n":" ");
  }
}

Measured memory_bytes: 12152
#include <iostream>
#include <array>
#include <vector>
#include <iomanip>
#include <string>
#include <cmath>
#include <array>
#include <algorithm>
#include <queue>
#include <map>
using namespace std;
const int  INF=10e9;

typedef  pair<int,int> P;


int main(){
     int n;
     cin>>n;
     int mi=1000000000;
     int ma=-14156789;
     vector<int> a(n);
     for(int i=0;i<n;++i){
          cin>>a[i];
          if(mi>a[i])mi=a[i];
          if(ma<a[i])ma=a[i];
     }
     int ans=INF;
     for(int i=mi;i<=ma;++i){
          int ansk=0;
          for(int j=0;j<n;++j){
               ansk+=(i-a[j])*(i-a[j]);
          }
          if(ans>ansk)ans=ansk;
     }

     cout<<ans<<endl;
}

Measured memory_bytes: 256
k, a, b = map(int, input().split())

if a >= b-1:
    print(k+1)
else:
    if k <= a-1:
        print(k+1)
    else:
        k -= a
        k += 1
        if k % 2 == 1:
            print(k//2*(b-a)+a+1)
        else:
            print(k//2*(b-a)+a)


Measured memory_bytes: 2940
#include <stdio.h>

int main(void)
{
	int i, j;
	int n;
	int n1[256], n2[256], n3[256];
	int p[256];
	int f1, f2, f3;
	
	scanf("%d", &n);
	
	for (i = 0; i < n; i++){
		p[i] = 0;
		scanf("%d %d %d", &n1[i], &n2[i], &n3[i]);
	}
	for (i = 0; i < n; i++){
		f1 = 0; f2 = 0; f3 = 0;
		for (j = 0; j < n; j++){
			if (i == j){
				continue;
			}
			if (n1[j] == n1[i]){
				f1 = 1;
			}
			if (n2[j] == n2[i]){
				f2 = 1;
			}
			if (n3[j] == n3[i]){
				f3 = 1;
			}
		}
		if (f1 == 0){
			p[i] += n1[i];
		}
		if (f2 == 0){
			p[i] += n2[i];
		}
		if (f3 == 0){
			p[i] += n3[i];
		}
	}
	for (i = 0; i < n; i++){
		printf("%d\n", p[i]);
	}
	return (0);
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
  	cin>>n;
  	n = n % 10;
  	if (n == 3) cout<<"bon"<<endl;
  	else if (n == 0 || n == 1 || n == 6 || n == 8) cout<<"pon"<<endl;
  	else cout<<"hon"<<endl;
  	return 0;
}

Measured memory_bytes: 3552
#include<iostream>
#include<algorithm>
using namespace std;
int dp[500][500];
int top[500];
int main(){
	int h,w;
	char z;
	while(true){
	cin>>h>>w;
	if(h==0&&w==0)break;
	for(int i=0;i<500;i++)top[i]=0;
	for(int j=0;j<w;j++){
		cin>>z;
		dp[0][j]=1;
		if(z=='*')dp[0][j]=0;
		top[j]=max(top[j],dp[0][j]);
	}
	for(int i=1;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>z;
			dp[i][j]=dp[i-1][j]+1;
			if(z=='*')dp[i][j]=0;
			top[i]=max(top[i],dp[i][j]);
		}
	}
	bool t[500];
	int ans=0;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++)t[j]=true;
		for(int j=1;j<=top[i];j++){
			for(int k=0;k<w;k++)if(dp[i][k]==j-1)t[k]=false;
			int best=0,cnt=0;
			for(int k=0;k<w;k++){
				if(t[k])cnt++;
				else{
					best=max(best,cnt);
					cnt=0;
				}
			}
			best=max(best,cnt);
			ans=max(ans,best*j);
		}
	}
	cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 2136
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long

signed main(){
    int N;
    cin >>N;
    cout <<N*N<<endl;
}

Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
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 ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main() {
    int n; // 参加人数
    int d; // 日数
    int x; // 残りチョコ数
    int s[101]; // s[i]: i日目に食べられたチョコ総数
    FOR(i, 1, 100) {
        s[i] = 0;
    }
    cin >> n >> d >> x;

    int tmp;
    REP(i, n) {
        cin >> tmp;
        for (int j = 1; j <= 100; j += tmp) {
            s[j] += 1;
        }
    }
    int tot = 0;
    FOR(i, 1, d) {
        tot += s[i];
    }
    cout << tot + x << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
 
int main() {

    int n;
    cin >> n;
    
    int ac = 0;
    int wa = 0;
    int tle = 0;
    int re = 0;
    rep(i,n) {
        string s;
        cin >> s;
        if(s == "AC")   ac++;
        if(s == "WA")   wa++;
        if(s == "TLE")  tle++;
        if(s == "RE")   re++;
    }
    cout<<"AC x "<<ac<<endl;
    cout<<"WA x "<<wa<<endl;
    cout<<"TLE x "<<tle<<endl;
    cout<<"RE x "<<re<<endl;


 return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
double EPS=1e-8;
int INF = 1e9;
ll dp[21][100];
int main(){
	int n,a[100];
	cin>>n;
	REP(i,n)cin>>a[i];
	memset(dp,0,sizeof(dp));
	dp[a[0]][0]=1;
	for(int i=1;i<n-1;i++){
		for(int j=0;j<=20;j++){
			if(j+a[i]<=20)dp[j+a[i]][i]+=dp[j][i-1];
			if(j-a[i]>=0)dp[j-a[i]][i]+=dp[j][i-1];
		}
	}
	cout<<dp[a[n-1]][n-2]<<endl;
}

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

using namespace std;

#define rep(i,a,n) for (int i=(a);i<(n);i++)
#define per(i,a,n) for (int i=(n)-1;i>=(a);i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) (int)x.size()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll>pll;
typedef vector<pii> vpii;

template<typename T>
T getint() {
    T x=0,p=1;
    char ch;
    do{ch=getchar();}while(ch <= ' ');
    if(ch=='-')p=-1,ch=getchar();
    while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
    return x*p;
}

mt19937 gen(chrono::system_clock::now().time_since_epoch().count());

template<typename T1,typename T2>bool umin(T1 &x,const T2&y){if(x>y)return x=y,true;return false;}
template<typename T1,typename T2>bool umax(T1 &x,const T2&y){if(x<y)return x=y,true;return false;}

const int maxn=(int)(1 << 20)+10;
const int inf=(int)1e9+5;
const int mod=1e9 + 7;
const ll llinf=(ll)1e18+5;
const ld pi=acos(-1.0);

typedef vector < pair <int, int> > edges;

edges answer;

int c;
int can[maxn];

int newnode() {
    return ++c;
}

int build(int n) {
    if (n == 1) {
        return newnode();
    }
    int v = newnode();
    int nxt = n - 1;
    while(!can[nxt]) nxt--;

    for(int i = 0; i < n - nxt - 1; ++i) {
        answer.push_back(make_pair(v, newnode()));
    }

    int rec = build(nxt);
    answer.emplace_back(v, rec);
    return v;
}

int main() {
  //  freopen("input.txt","r",stdin);
   // freopen("output.txt","w",stdout);

    ios_base::sync_with_stdio(0);

    string s;
    cin >> s;
    int n = s.length();

    for(int i = 0; i < n; ++i) {
        can[i + 1] = s[i] - '0';
    }

    auto bad = []() {
        cout << -1 << endl;
        exit(0);
    };

    if (can[n]) bad();
    if (!can[1]) bad();
    for(int i = 1; i < n; ++i) {
        if (can[i] != can[n - i]) bad();
    }

    for(int i = n / 2 + 1; i < n; ++i) {
        can[i] = 0;
    }
    can[n] = true;
    auto ans = build(n);

    for(auto x: answer) cout << x.first << ' ' << x.second << endl;
    return 0;
}


Measured memory_bytes: 5700
N, M = map(int, input().split())
mod = 10 ** 9 + 7

def calc(n):
    f = 1
    factorials = [1]
    for m in range(1, n + 1):
        f *= m
        f %= mod
        factorials.append(f)
    inv = pow(f, mod - 2, mod)
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= mod
        invs[m - 1] = inv
    return factorials, invs

factorials, invs = calc(M)
mPn = (factorials[M] * invs[M - N]) % mod
ans = (mPn * mPn) % mod
for k in range(1, N + 1):
    v = pow(-1, k - 1) * factorials[N] * factorials[M - k] * invs[N - k] * invs[k] * invs[M - N] % mod
    ans -= v * mPn
print(ans % mod)

Measured memory_bytes: 48452
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << '\n';
	#define SAY(X) cout << (X) << '\n';
#else
	#define DBG(X)
	#define SAY(X)
#endif
 
using namespace std;

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

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for(auto& elem: ret) cin >> elem; return ret; }

void solve() {
	int n = fetch<int>();
	auto S = fetch<string>();

	for(auto& chr: S) {
		int code = chr - 'A';
		code += n;
		code %= 26;

		chr = 'A' + code;
	}

	cout << S << '\n';
}

int main() {
	fast_io();
	solve();

	return 0;
}


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

using namespace std;

#define long long long
#define INF (long) 1e18
#define MOD 1'000'000'007
#define mll map<long, long>
#define pll pair<long, long>
#define umap unordered_map
#define umll umap<long, long>
#define uset unordered_set
#define pb push_back
#define FOR(i, a, b) \
  for (long i = (a); i < (long) (b); i++)

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

  long n;
  cin >> n;

  string s = to_string(n);
  if (s.size() == 1) {
    printf("%d\n", s[0] - '0');
    return 0;
  } else {
    long resp = s[0] - '0' - 1 + (s.size() - 1) * 9;
    long x = 0;
    FOR (i, 0, s.size()) {
      x += s[i] - '0';
    }
    if (x > resp) resp = x;
    printf("%lld\n", resp);
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using namespace std;

int main() {
    fastIO;
    uint64_t x;
    cin >> x;

    int year = 0;
    uint64_t account = 100;
    while (true) {
        if (account >= x) {
            cout << year << endl;
            return 0;
        }
        account += account / 100;
        year++;
    }
}

Measured memory_bytes: 3620
N = int(input())
MM = input().split()
T = int(MM[0])
A = int(MM[1])
LL = input().split()
jisyo ={}
for i in range(N):
  H = float(T) - float(LL[i])*0.006
  PPP =  A - H
  jisyo[abs(PPP)] = i+1
dic2 = sorted(jisyo.items())
print(dic2[0][1])

Measured memory_bytes: 9336
import java.util.Scanner;
import java.util.*;

class Main{

	public static void main(String args[]){

		Scanner scan = new Scanner(System.in);

		int N =  scan.nextInt();
		int A = scan.nextInt();
		int B = scan.nextInt();

		int x = 0;
		int one = N * A;
		if(one >= B){
		x = B;
		}else{
			x = one;
		}

	System.out.println(x);

	}
}

Measured memory_bytes: 22996
n, m = map(int, input().split())
l = [list(map(int, input().split())) + [i] for i in range(m)]

l.sort()

memo = []
mae = 0
cnt = 0
for i in range(m):
    if i == 0:
        mae = l[0][0]
        cnt = 1
    else:
        if mae == l[i][0]:
            cnt += 1
        else:
            mae = l[i][0]
            cnt = 1
    memo.append([l[i][2], str(l[i][0]).zfill(6) + str(cnt).zfill(6)])

memo.sort()

for a in memo:
    print(a[1])

Measured memory_bytes: 41496
#include <unordered_map>
#include <functional>
#include <algorithm>
#include <iostream>
#include <climits>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
using namespace std;
#define ll long long int
int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s; cin >> s; 
    ll cnt = 0;
    ll ans = -1;
    for(int i=0;i<s.size();i++){
        if(s[i] == 'R') cnt++;
        else cnt = 0;
        ans = max(ans, cnt);
    }
    cout << ans << endl;
}

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



ll slimes(ll i,ll j,ll slime[],ll dp[][400])
{
    if(i>j || i==j)
    {
        return 0;
    }
    if(dp[i][j]!=-1)
    {
        return dp[i][j];
    }
    ll sum = LONG_MAX;
    for(ll k=i;k<j;k++)
    {
        ll sum1=0;
        ll sum2=0;
        for(ll q=i;q<=k;q++)
        {
            sum1 = sum1 +slime[q];
        }
        for(ll q=k+1;q<=j;q++)
        {
            sum2 = sum2 +slime[q];
        }
        sum = min(sum,slimes(i,k,slime,dp)+slimes(k+1,j,slime,dp)+sum1+sum2);
    }
    return dp[i][j] = sum;
}

int main()
{
    ll n;
    cin>>n;
    ll slime[n];
    for(ll i=0;i<n;i++)
    {
        cin>>slime[i];
    }
    ll dp[400][400];
    for(ll i=0;i<400;i++)
    {
        for(ll j=0;j<400;j++)
        {
            dp[i][j] = -1;
        }
    }
    cout<<slimes(0,n-1,slime,dp);
}


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

void solve(long long N){
    ll w = 0;
    vector<ll> ans(3, 0);
    for(ll h = 1; h <= (ll)3500; ++h){
        for(ll n = 1; n <= (ll)3500; ++n){
            if((4 * h * n - N * n - N * h) > 0 && (N * h * n) % (4 * h * n - N * n - N * h) == 0){
                w = (N * h * n) / (4 * h * n - N * n - N * h);
                ans[0] = h;
                ans[1] = n;
                ans[2] = w;
            }
        }
    }
    cout << ans[0] << " " << ans[1] << " " << ans[2] << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


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

typedef long long LL;

LL n,k;

LL cnt(LL x){
	LL ret = 0;
	while(x<k) x*=2LL,ret++;
	return ret;
}

double seper[100005];

int main(){
	seper[0] = 1.00;
	for(int i=1;i<=100;i++){
		seper[i] = seper[i-1]/2.0;
	}
	scanf("%lld%lld",&n,&k);
	double ans = 0.00;
	for(int i=1;i<=n;i++){
		LL tmp = cnt(i);
		ans+=seper[tmp];
//		cout << tmp  << endl;
//		cout << s
	}
	ans/=n;
	printf("%.10lf\n",ans);
	return 0;
}

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

ll wa(ll N){
  return N * (N+1) / 2;
}
int main() {
  ll N;
  cin >> N;
  
  ll ans = 0;
  ans = wa(N-1) ; //1~N-1までの和
  cout << ans << endl;
}


Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i < (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.16f\n", a)//少数出力
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>

using ll = long long;

const int INF = 1073741823;
const int MINF = -1073741823;
const ll LINF = ll(4661686018427387903);
const ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;


using namespace std;

void scans(string& str) {
	char c;
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void warshall_floyd(int n, vector<vector<int>>& d) {//d[i][]]にiからjのコストを入れる。i=jのところは0、存在しない辺はINFを入れる。
	for (int i = 0; i < n; i++)      // 経由する頂点
		for (int j = 0; j < n; j++)    // 開始頂点
			for (int k = 0; k < n; k++)  // 終端
				d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
}

/*-----------------------------------------ここからコード-----------------------------------------*/


int main() {

	int n, m, l;
	scanf("%d%d%d", &n, &m, &l);
	int a, b, c;
	vector<vector<int>> d(n, vector<int>(n));
	rep(i, m) {
		scanf("%d%d%d", &a, &b, &c);
		d[a - 1][b - 1] = d[b - 1][a - 1] = c;
	}
	rep(i, n) {
		rep(j, n) {
			if (i == j)d[i][j] = 0;
			else if (d[i][j] == 0)d[i][j] = INF;
		}
	}
	warshall_floyd(n, d);
	vector<vector<int>> d2(n, vector<int>(n));
	rep(i, n) {
		rep(j, n) {
			if (i == j)continue;
			else d2[i][j] = (d[i][j] <= l ? 1 : INF);
		}
	}
	warshall_floyd(n, d2);
	int q;
	scanf("%d", &q);
	int s, t;
	rep(i, q) {
		scanf("%d%d", &s, &t);
		printf("%d\n", (d2[s - 1][t - 1] < INF ? d2[s - 1][t - 1] - 1 : -1));
	}

	return 0;
}


Measured memory_bytes: 1280
#include     <bits/stdc++.h>
#define len(v) ((int)((v).size()))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define chmax(x, v) x = max((x), (v))
#define chmin(x, v) x = min((x), (v))
#define FOR(s,n) for(int i=s;i<n;i++)
using namespace std;
#define ll long long

int main() {
	int t;
	cin>>t;
	if(t==0)
        cout<<"1";
    else
        cout<<"0";
    return 0;
}




Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define N 2200000
using namespace std;
char s[N];
int a[N],b[N];
int A,B,C,D,n;
int pre(){
	a[A]=1;
	for(int i=A+1;i<=n;i++){
		if(s[i]=='#')continue;
		a[i]=max(a[i-1],a[i-2]);
	}
	b[B]=1;
	for(int i=B+1;i<=n;i++){
		if(s[i]=='#')continue;
		b[i]=max(b[i-1],b[i-2]);
	}
}
int main(){
	scanf("%d%d%d%d%d",&n,&A,&B,&C,&D);
	scanf("%s",s+1);
	pre();
	int flag=(A<B)^(C<D);
	if(a[C]==0||b[D]==0){
		printf("No\n");
		return 0;
	}
	if(flag==0){
		printf("Yes\n");
		return 0;
	}
	for(int i=3;i<=D+1;i++){
		if(s[i]=='.'&&s[i-1]=='.'&&s[i-2]=='.'&&b[i-1]&&a[i-2]){
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 4864
// Math = ♥️

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define ld long double
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;
#define pq priority_queue
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(), (c).end()
#define ordered_set                            \
    tree<ll, null_type, less<ll>, rb_tree_tag, \
         tree_order_statistics_node_update>

int main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ld n;
    cin >> n;

    n /= 3;

    cout << fixed << setprecision(7) << n * n * n << "\n";
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define mod 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define INT_MAX INF
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=200050;
int main() {
	int N,A,B,C,D;
	cin>>N>>A>>B>>C>>D;
	A-=1;
	B-=1;
	C-=1;
	D-=1;
	string S;
	cin>>S;
	bool flag=1;
	for(int i=A;i<C;i++)
		if(S[i]=='#' && S[i+1]=='#')
			flag=0;
	for(int i=B;i<D;i++)
		if(S[i]=='#' && S[i+1]=='#')
			flag=0;

	if(!flag){
		cout<<"No"<<endl;
		return 0;
	}

	//以降、初期位置から目的地までの間に"##"はない
	if(C<D){
		cout<<"Yes"<<endl;
		return 0;
	}

	//DP[i]=Bが目的地まで移動する間に通ることができる点
	int DP[SIZE]={};
	DP[B]++;
	for(int i=B;i<=D;i++){
		if(DP[i] && (S[i-1]!='#' && S[i+1]!='#')){
			cout<<"Yes"<<endl;
			return 0;
		}
		if(DP[i] && S[i+1]!='#')
			DP[i+1]++;
		if(DP[i] && S[i+2]!='#')
			DP[i+2]++;
	}
	cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 1284
n = int(input())
ans = 0
for i in range(n):
    if (i + 1) % 2 != 0:
        d_count = 1
        for j in range(1, (i + 1) // 2 + 1):
            if (i + 1) % j == 0:
                d_count += 1
        if d_count == 8:
            ans += 1
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define Repr(i, n, a) for (int i = (n); i >= (a); i--)
#define rep(i, n) Rep(i, 0, n)
#define repr(i, n) Repr(i, n, 0)
#define all(a) a.begin(), a.end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

int n, a, b;
vector<int> h;

bool solve(int x)
{
    vector<int> v = h;
    rep(i, n) v[i] -= b * x;
    int cnt = 0;
    rep(i, n) if (v[i] > 0) cnt += (v[i] + a - b - 1LL) / (a - b);
    return cnt <= x;
}

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

    cin >> n >> a >> b;
    h.resize(n);
    rep(i, n) cin >> h[i];
    int l = 0, r = 1e9;
    while (r - l > 1)
    {
        int mid = (r + l) / 2;
        if (solve(mid))
            r = mid;
        else
            l = mid;
    }
    cout << r << endl;
}

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


int main(void) {
	int A, B, M; 

	cin >> A >> B >> M;

	vector<int> a(A),b(B);
	for (int i = 0; i < A; i++)cin >> a[i];
	for (size_t i = 0; i < B; i++)cin >> b[i];

	int sum = *min_element(a.begin(),a.end()) + *min_element(a.begin(),a.end());

	int x, y ,c;
	for (size_t i = 0; i < M; i++)
	{
		cin >> x >> y >> c;
		sum = min(sum, a[x - 1] + b[y - 1] - c);
	}


	

	cout << sum << endl;


	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>

using namespace std;
using pii = pair<int, int>;
using piii = pair<pii, int>;
using ll = long long;
using vint = vector<int>;
using vvint = vector<vector<int>>;

#define rep(i,n) for(int i=0; i<n; i++)
#define rep2(i,a,b) for(int i=a; i<b; i++)
#define fi first
#define se second

// Mod int
const int MOD = 1000000007;
struct mint{
  ll x;
  mint():x(0){}
  mint(ll x):x((x%MOD+MOD)%MOD){}
  mint operator+=(const mint& a){ if((x+=a.x)>=MOD) x-=MOD; return *this;}
  mint operator-=(const mint& a){ if((x+=MOD-a.x)>=MOD) x-=MOD; return *this;}
  mint operator*=(const mint& a){ (x*=a.x)%=MOD; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator==(const mint& a)const{ return x == a.x;}
};

vector<vint> valid_candidate(int w) {
    vector<vint> ret;
    rep(i, 1<<w) {
        bool ok = true;
        vint bits(w);
        rep(j, w) {
            bits[j] = ((i&(1<<j)) ? 1 : 0);
        }
        rep(j, w-1) {
            if (bits[j] && bits[j+1]) {
                ok = false;
            }
        }
        if (ok) {
            ret.push_back(bits);
        }
    }
    return ret;
}

int main() {
    int h, w, k;
    cin >> h >> w >> k;
    k--;

    vector<vint> can = valid_candidate(w-1);
    vector<mint> dp(w);
    dp[0].x = 1;

    rep(_, h) {
        vector<mint> next(w);

        for(vint bits: can) {
            rep(i, w) {
                int idx = i;
                if (i<w-1 && bits[i]) idx++;
                else if (i && bits[i-1]) idx--;
                next[idx] += dp[i];
            }
        }
        dp = next;
    }

    cout << dp[k].x << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FastIO ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define inf 0x3f3f3f3f
#define rep(i,a,b) for(LL i=a;i<b;i++)
#define repp(i,a,b) for(LL i=a;i<=b;i++)
#define per(i,a,b) for(LL i=a;i>=b;i--)
#define mem(gv) memset(gv,0,sizeof(gv))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pb push_back
typedef unsigned int uni;
typedef unsigned short uns; 
typedef long long LL;
typedef double db;
using namespace std;
int main(){
	FastIO;
	string s;
	int n,k;
	cin>>n>>k>>s;
	s[k-1]=s[k-1]+'a'-'A';
	cout<<s;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
using ll=long long;
int main(){

  ll X,Y;
  cin>>X>>Y;
  ll ans=1;
  while(1){
  
    X*=2;
    if(X>Y){
    
      break;
    }
    ans++;
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 3592