akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
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; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
    詰まった時に、別の分野の問題として考え直す（これdpでは？、グラフとしてみればいいのでは？）
    多くの問題はパターンマッチだが、パターンに落とし込むまでが難しく、そのための訓練としてわからない問題をあれこれ色々な角度から考察してみるのではないか
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

/* <--------------------------------------------> */



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

    int N, Ma, Mb; cin >> N >> Ma >> Mb;
    vector<int> a(N), b(N), c(N);
    rep(i, N) cin >> a[i] >> b[i] >> c[i];

    const int inf=1<<29;
    vector<vector<vector<int>>> dp(N+5, vector<vector<int>>(440, vector<int>(440, inf)));
    dp[0][0][0]=0;

    rep(i, N){
        rep(j, 401) rep(k, 401){
            chmin(dp[i+1][j][k], dp[i][j][k]);
            if(j-a[i]>=0 && k-b[i]>=0) chmin(dp[i+1][j][k], dp[i][j-a[i]][k-b[i]]+c[i]);
        }
    }

    int ans=inf;
    repr(j, 1, 401) repr(k, 1, 401) if(j*Mb==k*Ma) chmin(ans, dp[N][j][k]);
    if(ans==inf) cout << -1 << endl;
    else cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 35840
var
	M,L,R,ans,ll,rr:int64;
    k,i,x,y,xl,yl,limx,limy,xx,yy,id,ie:Longint;
    dp:array[1..60,1..2,1..2]of int64;
function power(a,b:int64):int64;
var r:int64;
begin
	if b=0 then power:=1
    else begin
    	r:=power(a*a mod M,b div 2);
        if b mod 2=1 then r:=r*a mod M;
        power:=r;
    end;
end;
begin
	read(L,R);
    M:=1000000007;
    ll:=1;
    rr:=2;
    for k:=1 to 60 do begin
    	if(rr<=L)or(R<ll)then begin
        	ll:=ll*2;
            rr:=rr*2;
        	continue;
        end;
        for i:=1 to k do begin
        	dp[i,1,1]:=0;
        	dp[i,1,2]:=0;
        	dp[i,2,1]:=0;
        	dp[i,2,2]:=0;
        end;
        if L<=ll then if rr-1<=R then begin
        	ans:=(ans+power(3,k-1))mod M;
            ll:=ll*2;
            rr:=rr*2;
            continue;
        end else dp[1,2,1]:=1 else if rr-1<=R then dp[1,1,2]:=1 else dp[1,1,1]:=1;
        for i:=1 to k-1 do begin
        	x:=(L>>(k-1-i))mod 2;
            y:=(R>>(k-1-i))mod 2;
            for xl:=1 to 2 do begin
            	if xl=1 then limx:=x else limx:=0;
                for yl:=1 to 2 do begin
                	if dp[i,xl,yl]=0 then continue;
                	if yl=1 then limy:=y else limy:=1;
                    if(limx=1)and(limy=1)then begin
                    	dp[i+1,xl,yl]:=(dp[i+1,xl,yl]+dp[i,xl,yl])mod M;
                    end else if(limx=0)and(limy=1)then begin
                    	dp[i+1,xl,2]:=(dp[i+1,xl,2]+dp[i,xl,yl])mod M;
                        dp[i+1,xl,yl]:=(dp[i+1,xl,yl]+dp[i,xl,yl])mod M;
                        dp[i+1,2,yl]:=(dp[i+1,2,yl]+dp[i,xl,yl])mod M;
                    end else if(limx=0)and(limy=0)then begin
                    	dp[i+1,xl,yl]:=(dp[i+1,xl,yl]+dp[i,xl,yl])mod M;
                    end;
                end;
            end;
        end;
        ll:=ll*2;
        rr:=rr*2;
        ans:=(ans+dp[k,1,1]+dp[k,1,2]+dp[k,2,1]+dp[k,2,2])mod M;
    end;
    writeln(ans);
end.

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

int main(){
    int n;
    while(cin>>n&&n){
        int d[LIMIT];
        int go[LIMIT];
        for(int i=1; i<=n; i++){
            cin>>d[i];
        }
        for(int i=1; i<=n; i++){
            if(i%2==1){
                go[i]=d[i];
            }else{
                if(d[i]==d[i-1]) go[i]=d[i];
                else if(d[i]==1){
                    for(int j=i-1; go[j]!=1; j--) go[j]=1;
                    go[i]=d[i];
                }else if(d[i]==0){
                    for(int j=i-1; go[j]!=0&&j>=1; j--) go[j]=0;
                    go[i]=d[i];
                }
            }
        }
        
        int sum=0;
        for(int i=1; i<=n; i++){
            if(go[i]==0) sum++;
        }
        cout << sum << endl;
    }
}

Measured memory_bytes: 7396
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
#define diup(v,a,k) distance((v).begin(),(k)+upper_bound((v).begin(),(v).end(),(a)))
#define dilo(v,a,k) distance((v).begin(),(k)+lower_bound((v).begin(),(v).end(),(a)))
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pil = pair<int,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,v.size())i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,v.size())s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(v.size())o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const double eps = 1e-6;
const ll LINF = 100200300400500600ll;
const int INF = 1001001001;
//--------------------------------------------------------
#define fastio cin.tie(nullptr); std::ios::sync_with_stdio(false);
#define myio ifstream iofi; if(argc>1){iofi.open(argv[1]); std::cin.rdbuf(iofi.rdbuf());}
#define myloopset int loop = 1; if(argc>2) loop =stoi(argv[2]); rep(i,loop)
//--------------------------------------------------------------
template <class T> T chmin(T &a,T b){if(a>b){a=b; return 1;}else return 0;}
template <class T> T chmax(T &a,T b){if(a<b){a=b; return 1;}else return 0;}
const int dx[4] = {0,1,0,-1};
const int dy[4] = {-1,0,1,0};

struct D21{
  int is,js;
  D21(int isize,int jsize){
    is = isize;
    js = jsize;
  }
  int operator()(int i,int j){
    return i*js+j;
  }
};


void Main(){
  int n;
  cin>>n;
  vi h(n);
  cin>>h;
  h.pb(0);
  h.pb(0);
  vi dp(n+2,INF);
  dp[0] = 0;
  rep(i,n){
    chmin(dp[i+1] , dp[i] + abs(h[i+1]-h[i]) );
    chmin(dp[i+2] , dp[i] + abs(h[i+2]-h[i]) );
  }
  cout<<dp[n-1]<<endl;

} int main(int argc,char** argv)
{fastio; myio; myloopset Main();}


Measured memory_bytes: 1024
#include<bits/stdc++.h> 
using   namespace std;
typedef long long int ll;
#define fo(i,s,e_ex) for(i=s;i<e_ex;i++)
#define Fo(i,s,e) for(i=s;i<=e;i++)
#define endl '\n'
#define MOD 1000000007//998244353
#define pbb push_back
#define mpp make_pair
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define mset(arr,val) memset(arr,val,sizeof(arr))
bool mat[1001][1001];
ll dp[1001][1001];
void solve(){
	ll i,j,n,m;
	cin>>n>>m;
	fo(i,0,n){
		fo(j,0,m){
			char ch;
			cin>>ch;
			if(ch=='.') mat[i][j]=true;
			else mat[i][j]=false;
		}
	}
	dp[n-1][m-1]=1;
	for(i=n-1;i>=0;i--){
		for(j=m-1;j>=0;j--){
			if(i==n-1 && j==m-1) continue;
			dp[i][j]=0;
			if(mat[i][j]){
				if(i+1<n) dp[i][j]=(dp[i+1][j]+dp[i][j])%MOD;
				if(j+1<m) dp[i][j]=(dp[i][j+1]+dp[i][j])%MOD;
			}
			//cout<<i<<" "<<j<<" "<<dp[i][j]<<endl;
		}
	}
	cout<<dp[0][0]<<endl;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	ll t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 9088
s = int(input())
dir = 1000000000000000000000
for i in range(1,int(s**0.5//1)+1):
	if s%i == 0:
		a = i
		b = s/i
		if a+b-2 < dir:
			dir = int(a + b - 2)
if s == 2:
  dir = 1
print(dir)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define ll long long
#define uint unsigned
#define ull unsigned ll
#define pii pair<int,int>
#define pll pair<ll,ll>
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a))
#define CPY(a,b) memcpy(a,b,sizeof(a))
using namespace std;
const int N=2005;
struct edge{
	int to,next;
}e[N*2];
int head[N],tot;
int n,mx[N],mn[N],sz[N];
char s[N];
void add(int x,int y){
	e[++tot]=(edge){y,head[x]};
	head[x]=tot;
}
void dfs(int x,int fa){
	mx[x]=0; sz[x]=(s[x]=='1');
	for (int i=head[x];i;i=e[i].next)
		if (e[i].to!=fa){
			dfs(e[i].to,x);
			mx[x]+=mx[e[i].to]+sz[e[i].to];
			sz[x]+=sz[e[i].to];
		}
	mn[x]=mx[x]&1;
	for (int i=head[x];i;i=e[i].next)
		if (e[i].to!=fa)
			if (mn[e[i].to]+sz[e[i].to]>mx[x]-mx[e[i].to]-sz[e[i].to])
				mn[x]=(mn[e[i].to]+sz[e[i].to])-(mx[x]-mx[e[i].to]-sz[e[i].to]);
	//printf("%d %d %d\n",x,mx[x],mn[x]);
}
int main(){
	scanf("%d%s",&n,s+1);
	For(i,1,n-1){
		int x,y;
		scanf("%d%d",&x,&y);
		add(x,y); add(y,x);
	}
	int ans=1<<30;
	For(i,1,n){
		dfs(i,0);
		if (!mn[i])
			ans=min(ans,mx[i]/2);
	}
	printf("%d\n",ans==1<<30?-1:ans);
}

Measured memory_bytes: 384
//verma_ankit484

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define pb push_back
const int mod = (int) 1e9+7;

using namespace std;
//using namespace __gnu_pbds;

//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>


int32_t main() {
  IOS
  #ifdef AV
  freopen("input.txt", "r", stdin);
  #endif
  int n, k;
  cin >> n >> k;
  int ans = -1;
  ans = (int)(floor(log(n) /  
                         log(k)) + 1); 
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	string s;
	cin>>s;
	int n=s.size();
	long long ans=0;
	for(int i=0;i+2<n;i++){
		if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C'){
			long long a=i,bc=i+1;
			while(a>=0&&s[a]=='A'){
				a--;
			}
			while(bc+1<n&&s[bc]=='B'&&s[bc+1]=='C'){
				bc+=2;
			}
			ans+=(i-a)*((bc-1)-i)/2;
			for(int j=a+1;j<a+1+((bc-1)-i);j+=2){
				s[j]='B';
				s[j+1]='C';
			}
			for(int j=a+1+((bc-1)-i);j<a+1+((bc-1)-i)+(i-a);j++){
				s[j]='A';
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

template<typename T, typename U> bool chmin(T &a, const U &b) {
	return (a > b ? a = b, true : false);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
	return (a < b ? a = b, true : false);
}

typedef long long ll;

#define writeln(n) cout<<n<<"\n";

typedef pair<int, int> P;
typedef pair<string, int> Psi;

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

	int n,k;
	cin>>n>>k;

	vector<ll> vc(n);

	for(int i=0; i<n; i++){
		cin>>vc[i];
	}

	sort(vc.begin(),vc.end(),greater<ll>());

	ll sum =0;
	for(int i =k; i<n; i++){
		sum += vc[i];
	}
	cout<<sum<<endl;
}


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

using namespace std;
using ll = long long;

const int N = 100005;

int st[4 * N];

int query(int p, int L, int R, int i, int j) {
	if(i > R or j < L) return 1e9;
	if(L >= i and R <= j) return st[p];
	int mid = (L + R) / 2;
	return min(query(2 * p, L, mid, i, j),
				query(2 * p + 1, mid + 1, R, i, j));
}

void upd(int p, int L, int R, int i, int val) {
	if(i > R or i < L) return;
	if(L == R) return void(st[p] = val);
	int mid = (L + R) / 2;
	upd(2 * p, L, mid, i, val);
	upd(2 * p + 1, mid + 1, R, i, val);
	st[p] = min(st[2 * p], st[2 * p + 1]);
}

int getL(int p, int L, int R, int lo, int mn) {
	if(R < lo or st[p] > mn) return -1;
	if(L == R) return L;
	int mid = (L + R) / 2;
	int ans = getL(2 * p, L, mid, lo, mn);
	if(ans != -1) return ans;
	return getL(2 * p + 1, mid + 1, R, lo, mn);
}

int n, m;
char s[N];
int dp[N];

int main() {

	scanf("%d %d %s", &n, &m, s);

	for(int i = n - 1; i >= 0; i--) {
		if(s[i] == '0') {
			dp[i] = query(1, 0, n + 1, i + 1, i + m) + 1;
		}
		else {
			dp[i] = 1e9;
		}
		upd(1, 0, n + 1, i, dp[i]);
	}

	if(dp[0] > n) return printf("-1\n"), 0;

	for(int i = 0; i < n; i++) {
		int j = getL(1, 0, n + 1, i + 1, dp[i] - 1);
		if(i) printf(" ");
		printf("%d", j - i);
		i = j - 1;
	}
	printf("\n");
}


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

int main(){
  string N;
  cin>>N;
  if(N.at(N.size()-1)=='3')
    cout<<"bon"<<endl;
  else if(N.at(N.size()-1)=='0'||N.at(N.size()-1)=='1')
    cout<<"pon"<<endl;
  else if(N.at(N.size()-1)=='6'||N.at(N.size()-1)=='8')
    cout<<"pon"<<endl;
  else
    cout<<"hon"<<endl;

}

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

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

    if (a >= b)
        cout << "delicious" << '\n';
    else if (x >= (b - a))
        cout << "safe" << '\n';
    else
        cout << "dangerous" << '\n';
}

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

int main(){
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  int L = A+B;
  int R = C+D;
  if (L == R){
    cout << "Balanced" << endl;
  }
  else if (L < R){
    cout << "Right" << endl;
  }
  else if (L > R){
    cout << "Left" << endl;
  }
}

Measured memory_bytes: 3636
/*
 * Author : Sadi
 * Thu 02/07/2020
 * 18:18:56.64
 */
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <cassert>

using namespace std;

#define    watch(x); cout << "\n" <<  #x << " is: " << x << "\n";
#define    all(a) (a).begin(), (a).end()
#define    fi first
#define    se second

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

template<class A>
ostream& operator << (ostream& output, const vector<A>& a) {
    output << "[";
    for(auto it = a.begin(); it != a.end(); ++it) {
        if(it != a.begin()) {
            output << ", ";
        }
        output << *it;
    }
    output << "]";
    return output;
}

using lld = long long;
using pii = pair<int, int>;
using pll = pair<lld, lld>;

//const int inf = 1e9;
//const int mod = 1e9 + 7;
//const double PI = acos(-1.0);
//const int mx = 1e5 + 5;



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

    vector<int> v {111, 222, 333, 444, 555, 666, 777, 888, 999, 1111};
    int n;
    cin >> n;
    cout << *lower_bound(all(v), n) << endl;

    return 0;
}


Measured memory_bytes: 3600
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String line = sc.nextLine();
    String[] ab = line.split(" ");
    int a = Integer.parseInt(ab[0]);
    int b = Integer.parseInt(ab[1]);
    int c = Integer.parseInt(ab[2]);

    int[] ans = new int[3];
    if(a <= b && a <= c) {
      ans[0] = a;
      if(b <= c) {
        ans[1] = b;
        ans[2] = c;
      }else {
        ans[1] = c;
        ans[2] = b;
      }
    }else if(b <= a && b <= c) {
      ans[0] = b;
      if(a <= c) {
        ans[1] = a;
        ans[2] = c;
      }else {
        ans[1] = c;
        ans[2] = a;
      }
    }else if(c <= a && c <= b) {
      ans[0] = c;
      if(a <= b) {
        ans[1] = a;
        ans[2] = b;
      }else {
        ans[1] = b;
        ans[2] = a;
      }
    }

    System.out.println(ans[0] + " "+ ans[1] + " " + ans[2]);
  }

}


Measured memory_bytes: 26164
#pragma GCC optimize("O2")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx,avx2,sse,sse2,fma,tune=native")
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
using namespace std;
using ll = long long;
using vi = vector<ll>;
using pi = pair<ll, ll>;
using vpi = vector<pi>;
using ld = long double;
const int maxn = 5e2 + 10, mlg = 17, mod = 1e9 + 7;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	map<string, int> m;
	string t;
	int o = 0;
	while(n--) {
		cin >> t;
		o = max(o, ++m[t]);
	}
	for(auto i : m)
		if(i.second==o)
		cout << i.first << '\n';
	return 0;
}


Measured memory_bytes: 23808
#include <iostream>

using namespace std;

int main()
{
    int n=0;
    while(cin >> n, n!=0){
        int a_score=0, b_score=0;
        for (int i = 0; i < n; i++){
            int a, b;
            cin >> a >> b;
            if (a>b){
                a_score += (a+b);
            } else if (b > a){
                b_score += (a+b);
            } else {
                a_score += a;
                b_score += b;
            }
        }
        cout << a_score << " " << b_score << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#include <iostream>
#include <utility> // pair
#include <string>
#include <vector>
#define MAX_N 200001
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define FOR(i, a, b) for(ll i=a; i<b; i++)
#define REP(i, n) for(ll i=0; i<n; i++)
#define REV(i, n) for(ll i=n-1; i>=0; i--)
#define ALL(v) v.begin(), v.end()
#define pb push_back
const ll INF = 9e18;
ll n, t[MAX_N];
string s[MAX_N], x;

signed main(){
    cin >> n;
    REP(i, n) cin >> s[i] >> t[i];
    cin >> x;

    ll ret = 0;
    bool flag = false;
    REP(i, n){
        if(flag){
            ret += t[i];
        }
        if(s[i] == x){
            flag = true;
        }
    }
    cout << ret << endl;
    return 0;
}

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

int N, T;
vector<pair<int, int> > ct;
int main(){
    scanf("%d%d", &N, &T);
    int tt;
    int cc;
    for(int i = 0; i< N; i++){
        scanf("%d%d", &cc, &tt);
        ct.push_back(make_pair(cc, tt));
    }
    sort(ct.begin(), ct.end());
    bool tle = 1;
    for(auto it = ct.begin(); it != ct.end(); it++){
        if((*it).second <= T){
            printf("%d", (*it).first);
            tle = 0;
            break;
        }
    }
    if(tle) printf("TLE");
    return 0;

}



Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#include <limits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <array>
#include <map>
#include <set>
#include <deque>
#include <list>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cstring>
#include <bitset>
#include <stack>
#include <queue>

#define MOD (1e9 + 7);
#define PI (3.14159265358979323846)

using ll = int64_t;
using ull = uint64_t;

using namespace std;

[[maybe_unused]] static auto __x = [](){ios_base::sync_with_stdio(0); cin.tie(0);};

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

    if (s == "Sunny") {
        cout << "Cloudy";
    }
    else if (s == "Cloudy") {
        cout << "Rainy";
    }
    else {
        cout << "Sunny";
    }

    return 0;
}


Measured memory_bytes: 256
import numpy as np
from numba import njit

N_ko, K_kai = map(int, input().split())
A_list = list(map(int, input().split()))
A = np.array(A_list, dtype=np.int64)

@njit
def cal_cumsum(A):
    Light_length = np.zeros(N_ko, dtype=np.int64)
    
    for i in range(N_ko):
        left = max(0, i - A[i])
        right = min(N_ko - 1, i + A[i])
        
        Light_length[left] += 1
        
        if (right + 1 < N_ko):
            Light_length[right + 1] -= 1
    
    Light_length = np.cumsum(Light_length)

    return(Light_length)

for k in range(min(42, K_kai)):
    A = cal_cumsum(A)


print(*A)


Measured memory_bytes: 130124
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;
using namespace std;

//---

template <typename T>
inline void print(const T& rhs){ std::cout<<" = "<<rhs<<std::endl; }
template <typename T>
inline void print(const std::vector<T>& rhs){
    std::cout<<" = [ ";
    for(uint i=0; i<rhs.size(); ++i){ std::cout<<rhs[i]<<' '; }
    std::cout<<"]"<<std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs){
    std::cout<<" = "<<std::endl;
    std::cout<<"[[ ";
    for(uint p=0; p<rhs.size(); ++p){
        if(p!=0){ std::cout<<" [ "; }
        for(uint q=0; q<rhs[p].size(); ++q){
            std::cout<<rhs[p][q]<<' ';
        }
        if(p!=rhs.size()-1){ std::cout<<"]"<<std::endl; }
    }
    std::cout<<"]]"<<std::endl;
}
template <typename TL, typename TR>
inline void print(const std::vector<std::pair<TR,TL>>& rhs){
    std::cout<<" = [";
    uint i=0;
    for(; i<rhs.size()-1; ++i){ std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"], "; }
    std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"]]" << endl;
}
#define printn(var) {printf("%s", #var);print(var);}
#define printn_all(var) {printf("%s(%d): ", __func__, __LINE__);printf("%s", #var);print(var);}

//---

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int N; cin >> N;
    vector<int> vA1(N+2, 0); for(int i=1; i<=N; ++i){ int tmp;cin>>tmp; vA1[i]=vA1[i-1]+tmp; } vA1[N+1]=vA1[N];
    vector<int> vA2(N+2, 0); for(int i=1; i<=N; ++i){ int tmp;cin>>tmp; vA2[i]=vA2[i-1]+tmp; } vA2[N+1]=vA2[N];
    
    int sum=0;
    for(int i=1; i<=N; ++i){
        int s1 = vA1[i]-vA1[0];   // (0, i] -> [1, i]
        int s2 = vA2[N]-vA2[i-1]; // (i-1, N] -> [i, N]
        sum = max(sum, s1+s2);
    }
    
    cout << sum << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << (x) << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
int main(){
    int n;
    ll k;
    cin >> n >> k;
    vector<ll>a(n);
    int cnt[60] = {};
    ll t = 0;
    rep(i,n){
        cin >> a[i];
        rep(j,60){
            if(a[i] & (1LL<<j))cnt[j]++;
        }
    }
    ll ans = 0;
    for(int i = 59; i >= 0; i--){
        if((ans + (1LL<<i))>k)continue;
        if(cnt[i] <= n/2){
            ans += (1LL<<i);
        }
    }
    ll K = 0;
    rep(i,n){
        K += a[i]^ans;
    }
    cout << K << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
const int max_n=100010;
int main()
{
    int n=0,c0[max_n],c1[max_n];
    char h[max_n];
    scanf("%s",h);
    n=strlen(h);
    for (int i=0;i<n ;i++ )
    {
        h[i] = h[i] - '0';
        c0[i] = i&1;
        c1[i] = !(i&1);
    }
    int diff0=0,diff1=0;
    for(int i=0;i<n;i++)
    {
        diff0 += !(c0[i]==h[i]);
        diff1 += !(c1[i]==h[i]);
    }
    if(diff0>diff1)cout<<diff1;
    else cout<<diff0;

}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
 
#define pb push_back 
#define x first 
#define y second 
#define MOD 1000081
 
using namespace std;
typedef long long ll;
typedef pair< int , int > PII;
const int dirx[] = {-2,-1,1,2, 1, -1};
const int diry[] = {0,1,1,0, -1, -1};
inline void debugMode() {
    #ifndef ONLINE_JUDGE
    freopen("eqs.in", "r", stdin);
    freopen("eqs.out", "w", stdout);
    #endif
}
 
int n, m;
PII a[100100];
vector < int > V, R;
 
int main(){ 
    //debugMode();
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    string s;
    cin >> s;
    s[3] = '8';
    cout << s;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define INT_MAX INT64_MAX
#define INT_MIN INT64_MIN
#define PI 3.14159265358979323846
#define CLK clock_t clk = clock();//Start of main
#define OCLK cerr << "Time (in ms): " << (double)(clock() - clk) * 1000.0 / CLOCKS_PER_SEC << '\n';//End of main
#define MOD 1000000007
/* DEFINE cout */
#define pln cout << "===============================\n"
#define on cout<<"\n"
#define os cout<<" "
#define o2(a,b) cout<<a<<" "<<b
#define o(a) cout << a
#define bitcount __builtin_popcount
/* DEFINE cout */
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);//fastio
using namespace std;
struct hash_pair { // use pair as key in unordered_map<pair<int,int>,int,hash_pair>;
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);
        return hash1 ^ hash2;
    }
};
bool prime[10000001];
int P=MOD-2;
int factorial[10000001]={0};
int powerFunction(int x,int y){
    int res = 1;
    int p = MOD;
    x = x % p;
    while (y > 0){
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
void sieveFunction(int maxLimit){
    memset(prime, true, sizeof(prime));
    prime[0] = prime[1]=false;
    for(int i=2; maxLimit >= i ; i++){
        if(prime[i]){
            for(int j=2*i ; maxLimit >= j ; j+=i)
                prime[j]=false;
        }
    }
}
void factorialFunction(int maxLimit){
    factorial[0]=1;
    for(int i=1 ; i <= maxLimit ; i++)
        factorial[i]=(factorial[i-1]*i)%MOD;
    return;
}
int gcd(int a, int b){
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
signed main(){
    int n, k;
    cin >> n >> k;
    int arr[n];
    for(int i=0; n>i; i++){
        cin >> arr[i];
    }
    sort(arr, arr+n);
    int ans =0;
    for(int i=0; k>i; i++){
        ans += arr[i];
    }
    cout << ans << endl;
}






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

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define LB lower_bound
#define UB upper_bound

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a);i>(b);--i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = 1000000000;
const LL MOD = 1000000007;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

int main() {
  int K, X;
  cin >> K >> X;
  for(int i = X-K+1; i < X+K-1; i++) {
    cout << i << " ";
  }
  cout << X+K-1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

ll n, m, a, b, use[100008], ans[100008], nurimax;
vector<vector<P>> edge;

int dfs(ll at, ll color){
	use[at] = 1;
	ll m = edge[at].size();
	ll nuri = 1;
	rep(i, 0, m-1){
		if(nuri == color){
			nuri++;
		}
		if(use[edge[at][i].first] == 0){
			ans[edge[at][i].second] = nuri;
			dfs(edge[at][i].first, nuri);
			nurimax = max(nuri, nurimax);
			nuri++;
		}
	}
	return 0;
}

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	cin >> n;
	edge.resize(n+1);
	rep(i, 1, n-1){
		cin >> a >> b;
		edge[a].push_back(P(b, i));
		edge[b].push_back(P(a, i));
	}
	ll maxe = 0;
	ll maxi = 0;
	rep(i, 1, n){
		if(edge[i].size() > maxe){
			maxe = edge[i].size();
			maxi = i;
		}
	}
	memset(use, 0, sizeof(use));
	nurimax = 0;
	dfs(maxi, -1);
	print(nurimax)
	rep(i, 1, n-1){
		print(ans[i])
	}
	
	return 0;
}

Measured memory_bytes: 9728
S = input()
X, Y = map(int, input().split())

if S.find("F") < 0:
    if X != 0 or Y != 0:
        print("No")
    else:
        print("Yes")
    exit()

n = len(S)
d = list(map(len, S.split("T")))
xs = d[::2]
ys = d[1::2]

dpx = [set() for _ in range(len(xs))]
for i in range(len(xs)):
    if i == 0:
        d = (-1) ** S.find("F")
        dpx[i].add(d * xs[i] + n)
        continue
    
    for j in dpx[i - 1]:
        dpx[i].add(j + xs[i])
        dpx[i].add(j - xs[i])

dpy = [set() for _ in range(len(ys) + 1)]
dpy[0].add(n)
for i in range(len(ys)):
    for j in dpy[i]:
        dpy[i + 1].add(j + ys[i])
        dpy[i + 1].add(j - ys[i])

ans = (X + n in dpx[-1]) & (Y + n in dpy[-1])
print("Yes" if ans else "No")


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

int main()
{
	string S;
	int A, B;
	cin >> A >> B;
	cin >> S;
	int t = 1;
	if (S.size() != (A + B + 1))
		t = 0;
	for (int i = 0;t&& i < S.size(); i++)
	{
		if (i != A && (S[i] < '0' || S[i] > '9'))
			t = 0;
		if (i == A && S[i] != '-')
			t = 0;
	}
	if (t)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
	
}

Measured memory_bytes: 256
from fractions import gcd
n=int(input())
l=list(map(int,input().split()))
x=l.pop(0)
for i in l:
  x=gcd(x,i)
c=0
for j in range(int(x*(1/2))+1):
  if x%2==0:
    x=x/2
    c+=1
  else:
    break
print(c)

Measured memory_bytes: 5048
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  int w,h,x,y,r;
  cin>>w>>h>>x>>y>>r;
  if(x<=0 || y<=0) cout<<"No"<<'\n';
  else if(x+r>w || y+r>h) cout<<"No"<<'\n';
  else cout<<"Yes"<<'\n';
  return(0);
}



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


#ifdef LOCAL 
string to_string(char a) { return string(1,a); }
string to_string(bool a) { return a ? "1" : "0"; }
string to_string(const char* a) { return (string)a; }
string to_string(string a) { return a; }
string to_string(vector<bool> v) {
	string s = "["; for(unsigned i=0;i<v.size();i++){ s += ((i>0)?" ":"");
    s += char('0'+v[i]); } 	s += "]"; return s; }
template<class A, class B> string to_string(pair<A,B> p);
template<class T> string to_string(T v) {
	bool b = 1; string s = "["; for (const auto& x: v) {
		if (!b) {s += ", ";} b = 0; s += to_string(x); } s += "]"; return s; }
template<class A, class B> string to_string(pair<A,B> p) {
	return "("+to_string(p.first)+", "+to_string(p.second)+")"; }
void dbgf() { cerr << endl; }
template<class H, class... T> void dbgf(H h, T... t) {
	cerr << to_string(h); if (sizeof...(t)) cerr << ", ";
	dbgf(t...); }
#define dbg(...) cerr << #__VA_ARGS__ << " = ", dbgf(__VA_ARGS__)
#else
#define dbg(...) 0
#endif
#define boolout(x) cout<<(x?"YES":"NO")<<endl;
typedef long long ll;

const int nmax=1e7+5;
int sieve[nmax];
int divs[nmax];

ll calc_sieve(int n){
    sieve[1]=1;
    int i=2;
    ll res = 1;
        //dbg(i, res);
    for (; i <= n; ++i) {
        divs[i]++; 
        for (int j = i; j < nmax; j=j+i) {
            divs[j]++;
        }
        //dbg(i, divs[i]);
        res += (ll) i * divs[i];
        //dbg(i, res);
    }
    for (; i <= n; i++) {
       divs[i]++; 
       divs[i]++; 
       //dbg(i, divs[i]);
       res +=  (ll) i * divs[i];
       //dbg(i, res);
    }

    return res;
}
void solve()
{
    int n;
    cin >> n;
    
    cout << calc_sieve(n) << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin >> t; // read t. cin knows that t is an int, so it reads it as such.
    for (int i = 1; i <= t; ++i) {
        solve();
    }
    return 0;
}



Measured memory_bytes: 42708
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t N,P;
  cin >> N >> P;
  int64_t ans = 0;
  if(N == 1){
    cout << P << endl;
  }
  else{
   for(int64_t i=1; i<=1000000; i++){
    int64_t x = pow(i,N);
    if(P %x == 0){
      ans = max(ans,i);
    }
   }
   cout << ans << endl;
  }
} 

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

int main() {
  string s;
  cin>>s;
  
  for (int i=1;i<4;i++){
    if(s[0]==s[1] && s[1]==s[2]){
      cout << "Yes" << endl;
      return 0;
    }
    else if(s[1]==s[2] && s[2]==s[3]){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;

  return 0;
}


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

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

    if(s == "Sunny") cout << "Cloudy"<< endl;
    if(s == "Cloudy") cout << "Rainy"<< endl;
    if(s == "Rainy") cout << "Sunny"<< endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll n;
	cin>>n;
	ll a[5];
	cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4];
	sort(a,a+5);
	ll k = (n+a[0]-1)/a[0];
	cout<<5+k-1<<endl;
}

Measured memory_bytes: 256
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!
 
#include <bits/stdc++.h>
using namespace std;
 
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define cout_precision cout.setf(ios::fixed); cout.precision(32);
 
using ll = int64_t; using vll = vector<ll>; using vvll = vector<vll>;
using pll = pair<ll, ll>; using vpll = vector<pll>; using vvpll = vector<vpll>;
 
// ------------------------------------------------------------------------------------------------

ll ans;
string s, prev_s, curr_s;

void func() {
    cin >> s;
    ans = 1;
    prev_s = string(1, s[0]);
    curr_s= "";
    for (ll i = 1; i < (ll) s.length(); i++) {
        curr_s += string(1, s[i]);
        if (prev_s != curr_s) {
            ans++;
            prev_s = curr_s;
            curr_s = "";
        }
    }
    cout << ans << endl;
}

int main() {
    fast_io; cout_precision;
    ll t = 1; // cin >> t;
    for (ll i = 0; i < t; i++) {
        func();
    }
}

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

typedef long long ll;

int main(){
   ll n,m; cin>>n>>m;
   vector<pair<ll,ll>>a;
   for(int i=0;i<n;i++){
       ll s,t; cin>>s>>t;
       a.push_back(make_pair(s,t));
   }
   sort(a.begin(),a.end());
   ll ans=0;
   for(int i=0;i<n;i++){
       if(m-a[i].second>=0){
           m-=a[i].second;
           ans+=a[i].first*a[i].second;
       }else{
           while(m>0){
               ans+=a[i].first;
               m--;
           }
       }
   }
   cout<<ans<<endl;
   return 0;
}

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

int64_t sum(int64_t n){
  int64_t ans = n * (n+1) / 2;
  return ans;
}

int main() {
  int64_t N;
  cin >> N;
  
  int64_t ans = 0;
  ans = sum(N) - sum(N/3)*3 - sum(N/5)*5 + sum(N/15)*15;
  cout << ans << endl;
}


Measured memory_bytes: 3632
#include <fstream>
#include <cstring>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <climits>

using namespace std;

//ifstream cin("tema.in");
//ofstream cout("tema.out");

const int BUFFSIZE = 1 << 17;

char buffer[BUFFSIZE];
int pointer = BUFFSIZE;

char Advance() {
    if (pointer == BUFFSIZE) {
        fread(buffer, 1, BUFFSIZE, stdin);
        pointer = 0;
    }
    return buffer[pointer++];
}

int Read() {
    int answer = 0;
    char ch = Advance();
    while (!isdigit(ch))
        ch = Advance();
    while (isdigit(ch)) {
        answer = answer * 10 + ch - '0';
        ch = Advance();
    }
    return answer;
}

const int MAXN = 10;

char s[1 + MAXN];

int main() {
    //freopen("tema.in", "r", stdin);
    //freopen("tema.out", "w", stdout);
    scanf("%s", s + 1);
    int n = strlen(s + 1);
    if (n <= 3 || s[1] != 'Y' || s[2] != 'A' || s[3] != 'K' || s[4] != 'I')
        printf("No\n");
    else
        printf("Yes\n");
    return 0;
}


Measured memory_bytes: 128
# https://atcoder.jp/contests/abc152/submissions/9619555

import sys
readline = sys.stdin.readline

import numpy as np

N = int(readline())
AB = list(list(map(int, readline().split())) for _ in range(N - 1))
M = int(readline())
UV = list(list(map(int, readline().split())) for _ in range(M))

graph = [[] for _ in range(N + 1)]
for i, (a, b) in enumerate(AB):
    graph[a].append((b, i))
    graph[b].append((a, i))


def get_path(U, V):
    INF = 100
    visited = [False] * (N + 1)
    pred = [None] * (N + 1)
    stack = [U]
    visited[U] = True
    while stack:
        v = stack.pop()
        for w, i in graph[v]:
            if visited[w]:
                continue
            visited[w] = True
            pred[w] = (v, i)
            stack.append(w)
    path = 0
    w = V
    while w != U:
        v, i = pred[w]
        w = v
        path += 1 << i
    return path


condition_path = [get_path(u, v) for u, v in UV]


def popcnt(n):
    c = (n & 0x5555555555555555) + ((n >> 1) & 0x5555555555555555)
    c = (c & 0x3333333333333333) + ((c >> 2) & 0x3333333333333333)
    c = (c & 0x0f0f0f0f0f0f0f0f) + ((c >> 4) & 0x0f0f0f0f0f0f0f0f)
    c = (c & 0x00ff00ff00ff00ff) + ((c >> 8) & 0x00ff00ff00ff00ff)
    c = (c & 0x0000ffff0000ffff) + ((c >> 16) & 0x0000ffff0000ffff)
    c = (c & 0x00000000ffffffff) + ((c >> 32) & 0x00000000ffffffff)
    return c


sgn = np.where(popcnt(np.arange(1 << M)) % 2, -1, 1)
S = np.zeros(1 << M, np.int64)
for i in range(M):
    S[1 << i:1 << (i + 1)] = S[:1 << i] | condition_path[i]

n_edges = popcnt(S)

x = 1 << (N - 1 - n_edges)
answer = (x * sgn).sum()
print(answer)


Measured memory_bytes: 62448
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int N; long long D; 
	cin >> N >> D; 
	long long X[200010] = {}; 
	long long Y[200010] = {}; 
	for(int i = 0; i < N; i++) cin >> X[i] >> Y[i]; 
	int ans = 0; 
	for(int i = 0; i < N; i++){
		if(X[i] * X[i] + Y[i] * Y[i] <= D * D) ans ++; 
	}
	cout << ans << "\n"; 
}

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

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define int long long
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define inf 1000000000000000007
#define f first
#define s second
#define mini(c,a,b) *min_element(c+a,c+b)
#define maxi(c,a,b) *max_element(c+a,c+b)
//printf("%.12Lf\n",);
int keta(int x){
	rep(0,i,30){
		if(x<10){
			return i+1;
		}
		x=x/10;
	}
}
int gcd(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return bb;
		}	
		bb=bb%aa;
		if(bb==0){
			return aa;
		}
	}
}	
int lcm(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return x/bb*y;
		}	
		bb=bb%aa;
		if(bb==0){
			return x/aa*y;
		}
	}
}
bool p(int x){
	if(x==1)return false;
	rep(2,i,sqrt(x)+1){
		if(x%i==0&&x!=i){
			return false;
		}
	}	
	return true;
}
int max(int a,int b){
	if(a>=b)return a;
	else return b;
}
int min(int a,int b){
	if(a>=b)return b;
	else return a;
}	
int n2[41];		
int nis[41]; 
int nia[41];
int mody[41];
int nn;
int com(int n,int y){
	int ni=1;
	for(int i=0;i<41;i++){
		n2[i]=ni;
		ni*=2;
	}
	int bunsi=1,bunbo=1;
	rep(0,i,y)bunsi=(bunsi*(n-i))%mod;
	rep(0,i,y)bunbo=(bunbo*(i+1))%mod;
	mody[0]=bunbo;
	rep(1,i,41){
		bunbo=(bunbo*bunbo)%mod;
		mody[i]=bunbo;
	}
	rep(0,i,41)nis[i]=0;
	nn=mod-2;
	for(int i=40;i>=0;i-=1){
		if(nn>n2[i]){
			nis[i]++;
			nn-=n2[i];
		}
	}
	nis[0]++;
	rep(0,i,41){
		if(nis[i]==1){
			bunsi=(bunsi*mody[i])%mod;
		}
	}
	return bunsi;
}
int yakuwa(int n){
	int sum=0;
	rep(1,i,sqrt(n+1)){
		if(n%i==0)sum+=i+n/i;
		if(i*i==n)sum-=i;
	}
	return sum;
}	
bool hei(int n){
	rep(0,i,100){
		if(i*i==n){
			return true;
		}
	}
	return false;
}
int pow(int b,int a){	
	int aa=1;
	rep(0,i,a)aa*=b;	
	return aa;
}
int a[5];
signed main(){
	sc(s)
	int n=s.size();
	rep(0,i,n){
		if(s[i]=='K'){
			if(a[0]!=0){
				c("NO")
				return 0;
			}	
			a[0]=i;
		}	
		if(s[i]=='I'){
			if(a[1]!=0){
				c("NO")
				return 0;
			}	
			a[1]=i;
		}
		if(s[i]=='H'){
			if(a[2]!=0){
				c("NO")
				return 0;
			}	
			a[2]=i;
		}
		if(s[i]=='B'){
			if(a[3]!=0){
				c("NO")
				return 0;
			}	
			a[3]=i;
		}
		if(s[i]=='R'){
			if(a[4]!=0){
				c("NO")
				return 0;
			}	
			a[4]=i;
		}
	}
	if(a[0]>a[1]||a[1]>a[2]||a[2]>a[3]||a[3]>a[4]){
		c("NO")
		return 0;
	}	
	if(a[0]>1){
		c("NO")
		return 0;
	}	
	else{
		if(a[0]==1){
			if(s[0]!='A'){
				c("NO")
				return 0;
			}
		}
	}
	if(a[4]<n-2){
		c("NO")
		return 0;
	}	
	else{
		if(a[4]==n-2){
			if(s[n-1]!='A'){
				c("NO")
				return 0;
			}
		}
	}	
	rep(0,i,4){
		if(i==0||i==1){
			if(a[i+1]-a[i]!=1){
				c("NO")
				return 0;
			}	
		}	
		if(a[i+1]-a[i]>2){
			c("NO")
			return 0;
		}
		else{
			if(a[i+1]-a[i]==2){
				if(s[a[i]+1]!='A'){
					c("NO")
					return 0;
				}
			}
		}
	}	
	c("YES")
}	


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int64_t X, N, D;
  cin>>X>>N>>D;
  int64_t a;
  X=abs(X);
  if(abs(X-D*(X/D))<abs(X-D*(X+D-1)/D)){
    a=X/D;
  }
  else{
    a=(X+D-1)/D;
  }
  if(N<=a){
    cout<<abs(abs(X)-abs(D*N))<<endl;
  }
  else{
    if((N-a)%2==0){
      cout<<abs(X-D*a)<<endl;
    }
    else{
      cout<<D-abs(X-D*a)<<endl;
    }
  }
}
  

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var p = new Program();
            p.Solve();
        }

        void Solve()
        {
            var line = Console.ReadLine().ToCharArray();
            var numbers = line.Select(x => int.Parse(x.ToString())).ToArray();

            for (int i = 0; i < 8; i++)
            {
                var sum = numbers[0];
                for (int j = 1; j <= 3; j++)
                {
                    sum += plus[j - 1] ? numbers[j] : -numbers[j];
                }
                if (sum == 7)
                    break;
                IncreaseBit();
            }

            string ans = numbers[0].ToString();
            for (int i = 0; i < 3; i++)
            {
                ans += (plus[i] ? "+" : "-") + numbers[i + 1];
            }
            ans += "=7";
            Console.WriteLine(ans);
        }

        private bool[] plus = new bool[3];
        void IncreaseBit()
        {
            for (int i = plus.Length - 1; i >= 0; i--)
            {
                plus[i] = !plus[i];
                if (plus[i])
                    break;
            }
        }

    }

    class BitArray
    {
        bool[] bits = new bool[3];
        public BitArray(int num)
        {

        }
    }
}


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

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;

using ll    = long long;
using vll   = vector<ll>;
using pll   = pair<ll,ll>;
using ld    = long double;

const ll mod = (ll)1e9 + 7;
const ll mxN = (ll)2e6 + 3;

void solve() {
	ll n;cin>>n;
	string ans="";
	while(n) {
		n--;
		ans+='a'+n%26;
		n/=26;
	}
	reverse(all(ans));
	cout<<ans<<'\n';
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(20);
	cout << fixed;
//	pre();
//	ll t;cin>>t;while (t--)
		solve();
}


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

#define int long long

#define MOD 1000000007

int n, a, b, c, d;

int kai[1010];
int memo[1010][1010];

void init(){
    kai[0] = 1;
    for(int i = 1;i < 1010;i++){
        kai[i] = (kai[i-1] * i) % MOD;
    }
}

int pow_mod(int n, int m){
    int ans = 1;

    while(m > 0){
        if(m & 1) ans = (ans * n) % MOD;
        n = (n * n) % MOD;
        m >>= 1;
    }

    return ans;
}


int cmemo[1010][1010];

int combi(int n, int r){
    if(cmemo[n][r] != -1) return cmemo[n][r];
    return cmemo[n][r] = ((kai[n] * pow_mod(kai[r], MOD-2) % MOD) * pow_mod(kai[n-r], MOD-2)) % MOD;}

int memo2[1010][1010] = {};

int dp(int i, int j){
    if(j == 0) return 1;
    if(i > b)  return 0;
    if(memo[i][j] != -1) return memo[i][j];

    int ans = dp(i+1, j);

    int tmp = 1;
    int tt = j;
    int tt2 = 1;
    int cnt = 1;

    for(int num = 1;num < c;num++){
        tt -= i;
        if(tt < 0) return memo[i][j] = ans;
        tt2 = (tt2 * cnt) % MOD;
        cnt++;
        tmp = (tmp * combi(tt+i, i)) % MOD;
    }

    for(int num = c;num <= d;num++){
        tt -= i;
        tt2 = (tt2 * cnt) % MOD;
        cnt++;
        if(tt < 0) return memo[i][j] = ans;
        tmp = (tmp * combi(tt+i, i)) % MOD;
        ans = (ans + (dp(i+1, j-num*i) * (tmp*pow_mod(tt2, MOD-2) % MOD)) % MOD) % MOD;
    }

    return memo[i][j] = ans;
}

signed main(){

    init();

    cin >> n >> a >> b >> c >> d;

    memset(memo, -1, sizeof(memo));
    memset(cmemo, -1, sizeof(cmemo));

    cout << dp(a, n) << endl;

    return 0;
}


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

int main() {
  string A;
  cin >>A;
  if(A.at(0)=='9'){
    cout <<"Yes" <<endl;
    return 0;
  }
  if(A.at(1)=='9'){
    cout <<"Yes" <<endl;
    return 0;
  }
  cout <<"No" <<endl;
  return 0;
}


Measured memory_bytes: 256