akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
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; }

template<class T> vector<int> z_algorithm(const T& s) {
  vector<int> prefix(s.size());
  prefix[0] = s.size();
  int i = 1, len = 0;
  while (i < s.size()) {
    while (i + len < s.size() && s[i + len] == s[len]) ++len;
    prefix[i] = len;
    if (!len) { ++i; continue; }
    int j = 1;
    while (i + j < s.size() && prefix[j] < len - j) {
      prefix[i + j] = prefix[j];
      ++j;
    }
    i += j;
    len -= j;
  }
  return prefix;
}

class UnionFind {
  vector<int> par, sz;
public:
  UnionFind(int n) {
    par.resize(n);
    for (int i = 0; i < n; i++)
      par[i] = i;
    sz.resize(n, 1);
  }
  int root(int x) {
    if (par[x] == x)
      return x;
    return par[x] = root(par[x]);
  }
  bool same(int x, int y) {
    return root(x) == root(y);
  }
  int size(int x) {
    return sz[root(x)];
  }
  bool unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y)
      return false;
    if (sz[x] >= sz[y]) {
      sz[x] += sz[y];
      par[y] = x;
    } else {
      sz[y] += sz[x];
      par[x] = y;
    }
    return true;
  }
};

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s, t;
  cin >> s >> t;
  while (s.size() < t.size())
    s += s;
  auto len = z_algorithm(t+s+s);
  UnionFind uf(s.size());
  bool exist = false;
  rep(i, s.size()) {
    if (len[t.size()+i] >= t.size()) {
      exist = true;
      if (len[t.size()+(i+t.size())%s.size()] >= t.size() && !uf.unite(i, (i+t.size())%s.size())) {
        cout << -1 << endl;
        return 0;
      }
    }
  }
  if (!exist) {
    cout << 0 << endl;
    return 0;
  }
  int ans = 0;
  rep(i, s.size())
    chmax(ans, uf.size(i));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 19864
#include <stdio.h>
#define N 100001
int main(){
  int i,n,ct=0;
  char s[N]={};
  scanf("%s",s);
  for(i=0;;i++){
    if(s[i]==0){
      n=i;
      break;
    }
  }
  for(i=0;i<n-1;i++){
    if(s[i]==s[i+1]){
      if(s[i]=='0'){
        s[i+1]='1';
      }else{
        s[i+1]='0';
      }
      ct++;
    }
  }
  printf("%d\n",ct);
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Iterator;
import java.util.Collections;
import java.util.Comparator;
import java.util.Random;

class Main{
        public static void main(String args[]){
                Scanner sc = new Scanner(System.in);
                int N = sc.nextInt();
                int[][] A = new int[3][N+2];
                A[1][0] = 0;
                A[2][N+1] = 0;
                for(int j=1; j<=N; j++){
                        A[1][j] = A[1][j-1] + sc.nextInt();
                }

                for(int j=1; j<=N; j++){
                        A[2][j] = sc.nextInt();
                }

                for(int j=N; j>=1; j--){
                        A[2][j] = A[2][j+1] + A[2][j];
                }

                int Max = 0;
                for(int i=1; i<=N; i++){
                        Max = Math.max(A[1][i]+A[2][i],Max);
                }
                System.out.print(Max);
        }
}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
#include <unordered_map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main(void) {
    string s,t;
    cin >> s>>t;
    unordered_map<char,int> ms,mt;
    int num=0;
    int n_s[s.size()],n_t[s.size()];
    rep(i,s.size()){
        if(ms.find(s[i])!=ms.end())n_s[i]=ms[s[i]];
        else{
            ms[s[i]]=num;
            n_s[i]=num;
            num++;
        }
    }
    num=0;
    rep(i,s.size()){
        if(mt.find(t[i])!=mt.end())n_t[i]=mt[t[i]];
        else{
            mt[t[i]]=num;
            n_t[i]=num;
            num++;
        }
    }
    rep(i,s.size()){
        if(n_s[i]!=n_t[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 2312
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) 
#define rep2(i, n, m) for (ll i = n; i <= (ll)(m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (ll)(m); --i)

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

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007;

vll ans;
int k;

void dfs(int cnt, ll v)
{
  if (cnt >= 10) return;
  ans.eb(v);

  ll d = v % 10;
  rep2(i, -1, 1) {
    ll nd = d + i;

    if (nd >= 0 && nd <= 9) dfs(cnt+1, v*10+nd);
  }
}

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

  cin >> k;
  rep2(i, 1, 9) dfs(0, i);

  sort(all(ans));
  ans.erase(unique(all(ans)),ans.end());

  cout << ans[k-1] << endl;

  return (0);
}


Measured memory_bytes: 5304
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll p=pow(10,9)+7;
ll phi(ll n) {
    ll result = n;
    for (ll i = 2; i * i <= n; i++) {
        if(n % i == 0) {
            while(n % i == 0)
                n /= i;
            result -= result / i;
        }
    }
    if(n > 1)
        result -= result / n;
    return result;
}
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      
    x = x % p;  
   while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p; 
    } 
    return res; 
} 

ll modInverse(ll n, ll p) 
{ 
    return power(n, p-2, p); 
}


 
int main() {
 
    int n,x,i,j;
    cin>>n>>x;
    int dp[n][x];
    memset(dp,-1,sizeof(dp));
    dp[0][0]=1;
    char temp;
   for(i=0;i<n;i++)
   {
       for(j=0;j<x;j++)
       {
        cin>>temp;
        if(temp=='#')
        dp[i][j]=0;
       }
   }
   for(i=0;i<n;i++)
   {
       for(j=0;j<x;j++)
       {
           if(dp[i][j]==-1)
           {
               if(i==0)
               dp[i][j]=dp[i][j-1]%p;
               else if(j==0)
               dp[i][j]=dp[i-1][j]%p;
               else
               dp[i][j]=(dp[i-1][j]+dp[i][j-1])%p;
           }
       }
   }
    cout<<dp[n-1][x-1];
 
    return 0;
    
}  



Measured memory_bytes: 4096
#include<iostream>
using namespace std;
int main(){
  int a,b,c;
  while(cin >> a >> b >> c && a!=-1||b!=-1||c!=-1){
    if(a==-1||b==-1)cout<<"F"<<endl;
    else if(a+b>=80)cout<<"A"<<endl;
    else if(a+b>=65)cout<<"B"<<endl;
    else if((a+b>=50)||(a+b>=30&&c>=50))cout<<"C"<<endl;
    else if(a+b>=30)cout<<"D"<<endl;
    else cout << "F" << endl;
  }
}


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

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

    int c = abs(A + B);
    if (c % 2 == 0){
        cout << c / 2 << endl;
    }
    else {
        cout << "IMPOSSIBLE" << endl;
    }
}

Measured memory_bytes: 256
N = raw_input()
array = map(int, raw_input().split())

#print N, array

dic = {}

while len(array):
    key = array.pop(0)
    if key not in dic:
        dic[key] = 1
    else:
        dic[key] = dic[key] + 1

#print dic
#print len(dic)

reduce_num = 0

#while len(dic) > 0:
for key in dic:
    if dic[key] == key:
        pass
    elif dic[key] > key:
        reduce_num = reduce_num + dic[key] - key
    else:
        reduce_num = reduce_num + dic[key]
        
print reduce_num


Measured memory_bytes: 15920
#include <bits/stdc++.h>
#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long

using namespace std;

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

  if (a >= 1 && a <= 9 && b >= 1 && b <= 9) {
    cout << a * b << endl;
  } else {
    cout << -1 << endl;
  }
}


Measured memory_bytes: 256
using System;
using System.Linq;

class B{
  public static void Main(){
    string K = Console.ReadLine();
    string fs = string.Join("", K.Reverse());
    string ss = K.Substring(0, (K.Length - 1) / 2);
    string ssr = string.Join("", ss.Reverse());
    string ts = fs.Substring(0, (K.Length - 1) / 2);
    string tsr = string.Join("", ts.Reverse());
    if (K != fs) Console.WriteLine("No");
    else if (ss != ssr) Console.WriteLine("No");
    else if (ts != tsr) Console.WriteLine("No");
    else Console.WriteLine("Yes");
  }
}
      


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main()
{
    int D;
    cin >> D;
    int count = 25 - D;
    string s = "Christmas";
    rep(i,count)
    {
        s += " Eve";
    }
    cout << s;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
using ull = unsigned long long;
using ll = long long;
using ld = long double;
using D = double;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
 
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define makeunique(x) sort(all(x)), (x).resize(unique(all(x)) - (x).begin())
#define rep(i, x)  for(int i = 0; i < (x); i++)
#define rrep(i, x) for(int i = (x - 1); i >= 0; i--)
#define sqrt(x) sqrt(abs(x))
#define y1 y1_1234413
#define j1 j1_235
#define y0 y0_235
#define j0 j0_256
#define fi first
#define se second
#define re return
#define prev PREV
#define next NEXT
#define sz(x) ((int)x.size())
 
template<typename T> T sqr(T a) { re a * a; }
template<typename T> T gcd(T a, T b) { re b ? gcd(b, a % b) : a; }
template<typename T> T sgn(T a) { re a > 0 ? 1 : (a < 0 ? -1 : 0); }
template<typename T> T abs(T a) { re a > 0 ? a : -a; }
 
const int inf = 2e9;
const ld st = 0.000001;
const ld pi = acos((ld)-1);
const int N = 1e4 + 10;
 
#define FILENAME ""
 
int n;
int m;

int a[N][N]; 

vi res;

int dp[N][N];

int f (int x, int y) {
	if (x > n - 1 || y > m - 1) re 0;
	if (dp[x][y] != -1) re dp[x][y];
	dp[x][y] = max (f (x + 1, y), f (x, y + 1));
	int tmp = f (x + 1, y + 1);
	if (tmp + a[x][y] > dp[x][y] && a[x][y]) {
		dp[x][y] = tmp + a[x][y];
		res.pb (y);
	}
	re dp[x][y];
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
//  freopen(FILENAME ".in", "r", stdin);
//  freopen(FILENAME ".out", "w", stdout);
	string s, t;
	cin >> s >> t;
	n = sz (s);
	m = sz (t);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (t[j] == s[i]) a[i][j] = 1;
			dp[i][j] = -1;
		}
	}
	int ans = f (0, 0);
    /*for (int i = 0; i < n; i++) {
    	for (int j = 0; j < m; j++) {
    		cout << dp[i][j] << ' ';
    	}
    	cout << endl;
    }*/
    int i = 0, j = 0, gg = ans;      
    while (i < n && j < m && gg > 0) {
    	while (i < n && dp[i][j] == gg) i++;
    	i--;
    	while (j < m && dp[i][j] == gg) j++;
    	j--;
    	cout << t[j];
    	gg--;
    	i++;
    	j++;
    }
	re 0;
}

Measured memory_bytes: 238200
#include <bits/stdc++.h>
using namespace std;
long long n, k, c, m, x, xx, y, yy, i, j, b[100005], f[100005], g[100005];
int main(){
	scanf("%lld%lld%lld%lld%lld", &x, &xx, &y, &yy, &m);
	n=(y-x)*60+yy-xx-m;
	printf("%lld\n", n);
	return 0;
}

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

using namespace std;
using ll = long long;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, k;
  cin >> n >> k;
  string s; cin >> s;
  for(int i = 0; i < n; ++i) {
    if(i == k - 1) cout << (char)tolower(s[i]);
    else cout << s[i];
  }
  cout << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll>PLL;
#define rep(i,n) for (int i = 0; i < (n); ++i)
ll MOD = 1e4+7;
int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    if ( a == b && b == c && !(a&1) && !(b&1) && !(c&1)) {
        cout << -1 << endl;
        return 0;
    }
    ll ans = 0;
    while ( 1 ) {
        if ( (a&1) || (b&1) || (c&1) ) break;
        ll tmp_a = a;
        ll tmp_b = b;
        ll tmp_c = c;
        a = tmp_b / 2 + tmp_c / 2;
        b = tmp_a / 2 + tmp_c / 2;
        c = tmp_a / 2 + tmp_b / 2;
        ++ans;
    }
    cout << ans << endl;
    return 0;
}


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)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "

int main(){
    int a,b;cin>>a>>b;
    int cand1=floor((double)a/0.08);
    int cand2=ceil((double)a/0.08);
    int cand3=floor((double)b/0.1);
    int cand4=ceil((double)b/0.1);
    int mn=min(cand1,min(cand2,min(cand3,cand4)));
    int mx=max(cand1,max(cand2,max(cand3,cand4)));
    for(int i=mn;i<=mx;i++){
        if((a==8*i/100)&&(b==i/10)){co(i);return 0;}
    }
    co(-1);
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    
    int counter = 0;
    int test_case;
    
    while(1){
        scanf("%d", &test_case);
        if(test_case == 0) break;
        else printf("Case %d: %d\n", counter+1, test_case);
        counter++;
    }
}


Measured memory_bytes: 2620
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,nn) for(int i=0;i<nn;i++)
#define MOD 1000000007
typedef long long ll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}else{return 0;}}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}else{return 0;}}
template <class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <class T> inline T LCM(T a,T b){return a*b/GCD(a,b);}



int main(){
  ll n;
  cin >> n;
  ll x[110],y[110],h[110],kijun;
  bool zero[110][110]={0};
  FOR(i,n){
    cin >> x[i] >> y[i] >> h[i];
    if(h[i]!=0)kijun=i;
    
  }
  
  ll hi;
  bool a;

  for(int i=0;i<=100;i++){
    for(int j=0;j<=100;j++){
      hi=h[kijun]+abs(i-x[kijun])+abs(j-y[kijun]);
      a=1;
      for(int k=0;k<n;k++){
        if(h[k]==0){
          if(abs(i-x[k])+abs(j-y[k])<hi){
            a=0;
          }
          continue;
        }
        if(h[k]+abs(i-x[k])+abs(j-y[k])!=hi){
          a=0;
        }
      }
      if(a){
        cout << i << " " << j << " " << hi << endl;
        return 0;
      }
    }
  }

}


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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;

const int INF = 1e9;
const ld EPS = 1e-8;

// https://github.com/primenumber/ProconLib/blob/master/Others/Compressor.cpp
template<typename T>
vector<int> compress(const vector<T> &x) {
  const int n = x.size();
  vector<T> v = x;
  sort(v.begin(), v.end());
  auto itr = unique(v.begin(), v.end());

  vector<int> zip(n);
  for(int i = 0; i < n; ++i) {
    zip[i] = lower_bound(v.begin(), itr, x[i]) - v.begin();
  }
  return zip;
}

// http://www.prefield.com/algorithm/container/fenwick_tree.html
template<class T>
struct BIT {
  vector<T> x;
  BIT(int n) : x(n, 0) {}
  T sum(int i, int j) { // inclusive
    if (i == 0) {
      T S = 0;
      for (; j >= 0; j = (j & (j + 1)) - 1) S += x[j];
      return S;
    } else {
      return sum(0, j) - sum(0, i - 1);
    }
  }
  void add(int k, T a) {
    for (; k < x.size(); k |= k + 1) x[k] += a;
  }
};

const int64_t MOD = 998244353;
struct Fp {
  int64_t x;
  Fp() : x(0) {}
  Fp(int y) : x(y >= 0 ? y % MOD : (MOD - (-y) % MOD) % MOD) {}

  Fp &operator+=(const Fp &p) {
    x = (x + p.x) % MOD;
    return *this;
  }
  Fp &operator-=(const Fp &p) {
    x = (x + MOD - p.x) % MOD;
    return *this;
  }
  Fp &operator*=(const Fp &p) {
    x = x * p.x % MOD;
    return *this;
  }
  Fp operator-() const { return Fp(-x); }
  Fp operator+(const Fp &rhs) const { return Fp(*this) += rhs; }
  Fp operator-(const Fp &rhs) const { return Fp(*this) -= rhs; }
  Fp operator*(const Fp &rhs) const { return Fp(*this) *= rhs; }
  Fp operator+(const int y) const { return Fp(*this) += Fp(y); }
  Fp operator-(const int y) const { return Fp(*this) -= Fp(y); }
  Fp operator*(const int y) const { return Fp(*this) *= Fp(y); }
};

Fp modpow(int a, int k) {
  // a ** k 
  if (k == 0) return Fp(1);
  if (k % 2 == 1) {
    Fp half = modpow(a, k / 2);
    return half * half * a;
  }else {
    Fp half = modpow(a, k / 2);
    return half * half;
  }
}

int main(){
  int N;
  cin >> N;
  vector<int> x(N), y(N);
  REP(i, N) cin >> x[i] >> y[i];

  vector<int> zipx = compress(x);
  vector<int> zipy = compress(y);
  vector<int> h(N);
  REP(i, N) h[zipx[i]] = zipy[i];

  BIT<int> bl(N), br(N);
  REP(i, N) br.add(i, 1);

  Fp ret = 0;
  REP(i, N) {
    br.add(h[i], -1);
    int ul = bl.sum(h[i] + 1, N - 1);
    int dl = bl.sum(0, h[i] - 1);
    int ur = br.sum(h[i] + 1, N - 1);
    int dr = br.sum(0, h[i] - 1);
    REP(use_ul, 2)REP(use_dl, 2)REP(use_ur, 2)REP(use_dr, 2) {
      int cond = 1;
      if ((use_ul && use_dr) || (use_ur && use_dl)) cond++;
      ret += (use_ul ? modpow(2, ul) - 1 : Fp(1)) * (use_dl ? modpow(2, dl) - 1 : Fp(1))
            * (use_ur ? modpow(2, ur) - 1 : Fp(1)) * (use_dr ? modpow(2, dr) - 1 : Fp(1)) * cond;
    }
    bl.add(h[i], 1);
  }

  cout << ret.x << endl;
  return 0;
}



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

const int N = 200010;
const int mod = 1000000007;

ll a[N], b[N], r[N];
map<pair<ll, ll>, int> mp;

int main() {
	int n, k = 0, x = 0, y = 0;
	scanf("%d", &n);
	r[0] = 1;
	for(int i=1; i<=n; i++)
		r[i] = r[i-1]*2%mod;
	int tmp = 0;
	for(int i=1; i<=n; i++) {
		++k;
		scanf("%lld%lld", &a[k], &b[k]);
		if(a[k]==0 || b[k]==0) {
			if(a[k]==0 && b[k]!=0)
				x++;
			else if(a[k]!=0 && b[k]==0)
				y++;
			else
				tmp++;
			k--;
			continue;
		}
		int flag = 1;
		if(a[k]<0) {
			a[k] = -a[k];
			flag = -flag;
		}
		if(b[k]<0) {
			b[k] = -b[k];
			flag = -flag;
		}
		ll d = __gcd(a[k], b[k]);
		a[k] /= d; b[k] /= d;
		a[k] *= flag;
		mp[{a[k], b[k]}]++;
	}
	ll ans = (r[x]+r[y]-1)%mod;
	// printf("k=%d\n", k);
	for(int i=1; i<=k; i++) {
		// printf("%d\n", i);
		if(mp[{a[i], b[i]}]==0)
			continue;
		if(a[i]<0) {
			int p = mp[{a[i], b[i]}], q = mp[{b[i], -a[i]}];
			ans = ans*(r[p]+r[q]-1)%mod;
			mp[{a[i], b[i]}] = mp[{b[i], -a[i]}] = 0;
		}
		else {
			int p = mp[{a[i], b[i]}], q = mp[{-b[i], a[i]}];
			ans = ans*(r[p]+r[q]-1)%mod;
			mp[{a[i], b[i]}] = mp[{-b[i], a[i]}] = 0;
		}
	}
	printf("%lld\n", (ans+tmp-1+mod)%mod);
	return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef pair<ll, int> PILL;
typedef pair<ll, ll> PLL;

const int MAX_N = 1e5+5;
const int M = 1e6;
const ll INF = (ll)(1e18);
const int inf = 1e9;
const ll MOD = 1000000007LL;

void solve() {

}



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

    int cur = 1;
    int a, b;
    cin >> a >> b;

    int ans = 0;
    while (cur < b) {
        cur += a;
        cur--;
        ans++;
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <iomanip>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
typedef long long ll;
using namespace std;
const int N = 2e5 + 5;
const int MOD = 1000000007;

int main()
{
    int n;
    cin >> n;
    int ct = 0;
    int res = 0;
    for (int i = 0; i < n; ++i)
    {
        int x, y;
        cin >> x >> y;
        if (x == y)
        {
            ++ct;
        }
        else
        {
            res = max(ct, res);
            ct = 0;
        }
    }
    res = max(res, ct);
    if (res >= 3)
    {
        cout << "Yes" << endl;
    }
    else
    {

        cout << "No" << endl;
    }
}


Measured memory_bytes: 3628
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int n = sc.nextInt();
      	int m = sc.nextInt();
      	int[] a = new int[n];
      	int sum = 0;
      	for(int i = 0; i < n; i++){
        	a[i] = sc.nextInt();
          	sum += a[i];
        }
      	Arrays.sort(a);
      	double border = (double)sum/4.0/(double)m;      
      	int count = 0;
      	for(int i = n-1; i >= 0; i--){
        	if(a[i] >= border) count++;
          	else break;
        }
      	if(count>=m) System.out.println("Yes");
      	else System.out.println("No");
    }
}

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

typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007
#define PI 3.1415926535897932384626433

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    int maxx = max(a+b, max(a-b, a*b));
    cout << maxx << endl;


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn=2e5+13; 
int a[maxn];
int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	for(int i=k+1;i<=n;i++)
	{
		if(a[i]>a[i-k]) printf("Yes\n");
		else printf("No\n"); 
	}
 } 

Measured memory_bytes: 4540
L = gets.to_i

nums = []
i = 18
a = L
while a > 0
  if 2 ** i <= a
    nums << i + 1
    a -= 2 ** i 
  else
    i -= 1
  end
end

N = nums.first + 1

G = []
(1...nums.first).each do |n|
    G << [n, n + 1, 0]
    G << [n, n + 1, 2 ** (n - 1)]
end 

base = 0
nums.reverse.each do |i| 
      G << [i, N, base]
      base += 2 ** (i - 1)
end

puts [N, G.size].join(' ')
G.each do |x|
    puts x.join(' ')
end   


Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
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; }
using ll = long long;
using P = pair<int, int>;
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }

ll n, k;

int main() {
    cin >> n >> k;
    vector<ll> A(n, 0);
    for(int i = 0; i < n; ++i) {
        cin >> A.at(i);
    }

    for(int i = 0; i < min(k, 45LL); ++i) {
        vector<ll> B(400400, 0);
        for(int i = 0; i < n; ++i) {
            ll left = i - A.at(i);
            ll right = i + A.at(i);
            B.at(max(0LL, left))++;
            B.at(right+1)--;
        }
        for(int i = 0; i < n; ++i) {
            B.at(i+1) += B.at(i);
        }
        A = B;
    }

    for(int i = 0; i < n; ++i) {
        if(i == n-1) cout << A.at(i) << endl;
        else cout << A.at(i) << " ";
    }
}


Measured memory_bytes: 11180
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  int n;
  cin >> n;
  ll ans = 1e18;
  vector<ll> a(n);
  ll sum = 0;
  for(int i = 0; i < n; i++) cin >> a[i], sum += a[i];
  ll now = 0;
  for(int i = 0; i < n - 1; i++) {
    now += a[i];
    ans = min(ans, abs(now - (sum - now)));
  }
  cout<< ans << endl;
  return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<string>
#include<queue>

using namespace std;

bool flag = true;

void IsSplitable(queue<int> num, queue<int> left, queue<int> right) {
	if (num.size() > 0) {
		if (left.size() > 0) {
			if (num.front() > left.back()) {
				left.push(num.front());
				num.pop();
				IsSplitable(num, left, right);
			}
			else {
				if (right.size() > 0) {
					if (num.front() > right.back()) {
						right.push(num.front());
						num.pop();
						IsSplitable(num, left, right);
					}
					else {
						flag = false;
					}
				}
				else {
					right.push(num.front());
					num.pop();
					IsSplitable(num, left, right);
				}
			}
		}
		else {
			left.push(num.front());
			num.pop();
			IsSplitable(num, left, right);
		}
	}
}

int main() {
	int Indexnum;
	
	cin >> Indexnum;
	//getchar();
	for (size_t in = 0; in != Indexnum; ++in) {
		
		queue<int> number;
		queue<int> left;
		queue<int> right;
		for (size_t i = 0; i < 10; ++i) {
			int temp;
			cin >> temp;
			number.push(temp);
		}

		IsSplitable(number, left, right);

		if (flag == true) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
		flag = true;
	}

	return 0;
}

Measured memory_bytes: 1224
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <bitset>
#include <vector>
#include <queue>
#include <map>
#include <set>

#define i64 int64_t
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define st(vvv) sort(vvv.begin(),vvv.end())
#define rvs(vvv) reverse(vvv.begin(),vvv.end())
int inf = 1000000007;
i64 giant = 4000000000000000000;

using namespace std;

int main() {
	int n, d;
	cin >> n >> d;
	int data[10][10];
	int ans = 0;
	ff(i, 0, n) {
		ff(j, 0, d) {
			cin >> data[i][j];
		}
	}
	ff(i, 0, n-1) {
		ff(j, i + 1, n) {
			double s = 0;
			int s2 = 0;
			ff(k, 0, d) {
				int t = (data[i][k] - data[j][k]);
				t *= t;
				s += t;
				s2 += t;
			}
			s = sqrt(s);
			s2 = sqrt(s2);
			if (s == s2)ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
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;
} 

template <class T>
class SegTree {
    int n;// 葉の数
    vector<T> data;// データを格納するvector
    T def; // 初期値かつ単位元
    function<T(T, T)> operation; // 区間クエリで使う処理
    function<T(T, T)> update;// 点更新で使う処理

    // 区間[a,b)の総和。ノードk=[l,r)に着目している。
    T _query(int a, int b, int k, int l, int r) {
        if (r <= a || b <= l) return def; // 交差しない
        if (a <= l && r <= b)
            return data[k]; // a,l,r,bの順で完全に含まれる
        else {
            T c1 = _query(a, b, 2 * k + 1, l, (l + r) / 2); // 左の子
            T c2 = _query(a, b, 2 * k + 2, (l + r) / 2, r); // 右の子
            return operation(c1, c2);
        }
    }

    public:
    // _n:必要サイズ, _def:初期値かつ単位元, _operation:クエリ関数,
    // _update:更新関数
    SegTree(size_t _n, T _def, function<T(T, T)> _operation,
        function<T(T, T)> _update)
        : def(_def), operation(_operation), update(_update) {
        n = 1;
        while (n < _n) {
            n *= 2;
        }
        data = vector<T>(2 * n - 1, def);
    }

    // 場所i(0-indexed)の値をxで更新
    void change(int i, T x) {
        i += n - 1;
        data[i] = update(data[i], x);
        while (i > 0) {
            i = (i - 1) / 2;
            data[i] = operation(data[i * 2 + 1], data[i * 2 + 2]);
        }
    }

    // [a, b)の区間クエリを実行
    T query(int a, int b) {
        return _query(a, b, 0, 0, n);
    }

    // 添字でアクセス
    T operator[](int i) {
        return data[i + n - 1];
    }
};

int main(){
    ll n,t;cin >> n >>t;
    SegTree<ll> st(2*n,INF,[](ll a,ll b){return min(a,b);},[](ll a,ll b){return b;});
    rep(i,n){
        ll a;cin >> a;
        st.change(i,a);
        st.change(i+n,a);
    }
    ll ans=INF;
    rep(i,n){
        ll ret=0;
        rep(j,n){
            //cout << st.query(j+n-i,j+n+1) <<endl;
            ret+=st.query(j+n-i,j+n+1);
        }
        //cout << ret+t*i <<endl;
        chmin(ans,ret+t*i);
    }
    cout << ans <<endl;
}

Measured memory_bytes: 3604
#include<iostream>
#include<stack>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    string s;
    stack<int>s1;
    vector<int>ans;
    cin>>s;
    stack<pair<int,int> >s2;
    int sum=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='@')break;
        if(s[i]=='\\')s1.push(i);
        else if(s[i]=='/'&&s1.size()>0) //判断里面是否有 '\\'
        {
            int j=s1.top();s1.pop();
            sum+=i-j;
            int a=i-j;
            while(s2.size()&&s2.top().first>j)
            {
                a+=s2.top().second;s2.pop();
            }
            s2.push(make_pair(j,a));
        }
    }

    while(!s2.empty())
    {
        ans.push_back(s2.top().second);
        s2.pop();
    }
    reverse(ans.begin(),ans.end());
    cout<<sum<<endl;
    cout<<ans.size();
    for(int i=0;i<ans.size();i++)
    {
        cout<<' '<<ans[i];
    }
    cout<<endl;
    return 0;
}



Measured memory_bytes: 3252
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] e = new int[n+1];
    for(int i=1;i<=n;i++){
      int t=i;
      for(int j=2;j<=t;j++){
        while(t%j==0){
          e[j]++;
          t/=j;
        }
      }
    }
    int cnt2 = 0;
    int cnt4 = 0;
    int cnt14 = 0;
    int cnt24 = 0;
    int cnt74 = 0;
    int ans = 0;
    for(int i=2;i<=n;i++){
      if(e[i]>=2)cnt2++;
      if(e[i]>=4)cnt4++;
      if(e[i]>=14)cnt14++;
      if(e[i]>=24)cnt24++;
      if(e[i]>=74)cnt74++;
    }
    ans=cnt74+cnt24*(cnt2-1)+cnt14*(cnt4-1)+cnt4*(cnt4-1)*(cnt2-2)/2;
    System.out.println(ans);
  }
}

Measured memory_bytes: 21844
#include<iostream>
#include<vector>
#include<cstddef>
#include<algorithm>

using ui = std::uint32_t;

int main(){

	ui n, w;
	std::cin >> n >> w;
	std::vector<ui> tab(w+1,0);

	using item_t = std::pair<ui, ui>;//v,w
	std::vector<item_t> items(n);
	for( auto& e : items )
		std::cin >> e.first >> e.second;


	for( ui wi{ 1 }; wi <= w; ++wi )
		for( ui k{}; k < n; ++k )
			if( wi >= items[k].second )
				tab[wi]
				= std::max( {
							tab[wi-1]
							,tab[wi]
							,tab[wi - items[k].second] + items[k].first
							} );

	std::cout << tab[w] << "\n";
	return 0;
}


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

typedef long long ll;

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

    int n, q, l, r;
    string s;
    cin >> n >> q >> s;

    vector<int> ac(n + 1, 0);

    for (int i = 1; i < n; i++) {
        if (s[i-1] == 'A' && s[i] == 'C') ac[i] = ac[i-1] + 1;
        else ac[i] = ac[i-1];
    }


    vector<int> ans(q, 0);
    for (int i = 0; i < q; i++) {
        cin >> l >> r;
        ans[i] = ac[r-1] - ac[l-1];
    }

    for (int i = 0; i < q; i++) cout << ans[i] << endl;
    
}

Measured memory_bytes: 4260
s = input()
N = len(s)
a = 0
dp = {}
dp[0] = 0
bits = [2 ** i for i in range(26)]

for c in s:
    a = a ^ bits[ord(c)-ord('a')]
    dp[a] = min(dp.get(a, N), min([dp.get(a ^ bit, N) for bit in bits]) + 1)

print(dp[a] if dp[a] != 0 else 1)


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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
//Write From this Line
int N, M, Q;

vector<vector<int>> sum;
void buildSumTable(vector<int> L, vector<int> R){
	sum = vector<vector<int>>(N + 1, vector<int>(N + 1, 0));
	for(int i = 0; i < M; i++){
		sum[L[i]][R[i]]++; // 其のマスにいくつ入っているか
	}

	for (int i = 1; i <= N; i++) { //1-indexed
		for(int j = 1; j <= N; j++){
			sum[i][j] += sum[i-1][j];
			sum[i][j] += sum[i][j-1];
			sum[i][j] -= sum[i-1][j-1];
		}
	}
}

int getSumRange(int L, int R) {
	int ans = sum[R][R] - sum[R][L-1] - sum[L-1][R] + sum [L-1][L-1];
	return ans;
}
int main()
{
	
	cin >> N >> M >> Q;
	vector<int> L(M), R(M);
	for(int i = 0; i < M; i++){
		cin >> L[i] >> R[i];
	}
	vector<int> p(Q), q(Q);
	for(int i = 0; i < Q; i++){
		cin >> p[i] >> q[i];
	}
	buildSumTable(L, R);

	for(int i = 0; i < Q; i++){
		int ans = getSumRange(p[i], q[i]);
		cout << ans << endl;
	}
}



Measured memory_bytes: 5120
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		int t = 0;
		while(t == 0){
			string[] str = Console.ReadLine().Split(' ');
			if(str[1] == "?"){
				t = 1;
			} else {
				int a = int.Parse(str[0]);
				int b = int.Parse(str[2]);
				int c = 0;
				if(str[1] == "+"){
					c = a + b;
				} else if(str[1] == "-"){
					c = a - b;
				} else if(str[1] == "*"){
					c = a * b;
				} else if(str[1] == "/"){
					c = a / b;
				}
				Console.WriteLine(c);
			}
		}
	}
}


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

using namespace std;

void solve() {
  int N;
  cin >> N;
  vector<pair<int, int>> v;
  for (int i = 1; i <= N; i++) {
    int a;
    cin >> a;
    v.emplace_back(a, i);
  }
  sort(v.begin(), v.end());
  for (auto &p : v) {
    cout << p.second << " ";
  }
  cout << endl;
}

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


Measured memory_bytes: 1780
// {{{ by shik
#include <bits/stdc++.h>
#include <unistd.h>
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x),end(x)
#define REP(i,n) for ( int i=0; i<int(n); i++ )
#define REP1(i,a,b) for ( int i=(a); i<=int(b); i++ )
#define FOR(it,c) for ( auto it=(c).begin(); it!=(c).end(); it++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;

#ifdef SHIK
template<typename T>
void _dump( const char* s, T&& head ) { cerr<<s<<"="<<head<<endl; }

template<typename T, typename... Args>
void _dump( const char* s, T&& head, Args&&... tail ) {
    int c=0;
    while ( *s!=',' || c!=0 ) {
        if ( *s=='(' || *s=='[' || *s=='{' ) c++;
        if ( *s==')' || *s==']' || *s=='}' ) c--;
        cerr<<*s++;
    }
    cerr<<"="<<head<<", ";
    _dump(s+1,tail...);
}

#define dump(...) do { \
    fprintf(stderr, "%s:%d - ", __PRETTY_FUNCTION__, __LINE__); \
    _dump(#__VA_ARGS__, __VA_ARGS__); \
} while (0)

template<typename Iter>
ostream& _out( ostream &s, Iter b, Iter e ) {
    s<<"[";
    for ( auto it=b; it!=e; it++ ) s<<(it==b?"":" ")<<*it;
    s<<"]";
    return s;
}

template<typename A, typename B>
ostream& operator <<( ostream &s, const pair<A,B> &p ) { return s<<"("<<p.first<<","<<p.second<<")"; }
template<typename T>
ostream& operator <<( ostream &s, const vector<T> &c ) { return _out(s,ALL(c)); }
template<typename T, size_t N>
ostream& operator <<( ostream &s, const array<T,N> &c ) { return _out(s,ALL(c)); }
template<typename T>
ostream& operator <<( ostream &s, const set<T> &c ) { return _out(s,ALL(c)); }
template<typename A, typename B>
ostream& operator <<( ostream &s, const map<A,B> &c ) { return _out(s,ALL(c)); }
#else
#define dump(...)
#endif

template<typename T>
void _R( T &x ) { cin>>x; }
void _R( int &x ) { scanf("%d",&x); }
void _R( long long &x ) { scanf("%" PRId64,&x); }
void _R( double &x ) { scanf("%lf",&x); }
void _R( char &x ) { scanf(" %c",&x); }
void _R( char *x ) { scanf("%s",x); }

void R() {}
template<typename T, typename... U>
void R( T& head, U&... tail ) {
    _R(head);
    R(tail...);
}

template<typename T>
void _W( const T &x ) { cout<<x; }
void _W( const int &x ) { printf("%d",x); }
template<typename T>
void _W( const vector<T> &x ) {
    for ( auto i=x.cbegin(); i!=x.cend(); i++ ) {
        if ( i!=x.cbegin() ) putchar(' ');
        _W(*i);
    }
}

void W() {}
template<typename T, typename... U>
void W( const T& head, const U&... tail ) {
    _W(head);
    putchar(sizeof...(tail)?' ':'\n');
    W(tail...);
}

#ifdef SHIK
#define FILEIO(...)
#else
#define FILEIO(name) do {\
    freopen(name ".in","r",stdin); \
    freopen(name ".out","w",stdout); \
} while (0)
#endif

// }}}

const int N=55;
int n,a[N],r;
int main() {
    R(n,r);
    REP(i,n) R(a[i]);
    LL c0=1,c1=0;
    REP(i,n) {
        LL nc0=c0;
        LL nc1=c1;
        if ( a[i]%2==0 ) {
            nc0+=c0;
            nc1+=c1;
        } else {
            nc0+=c1;
            nc1+=c0;
        }
        tie(c0,c1)=tie(nc0,nc1);
    }
    W(r==0 ? c0 : c1);
    return 0;
}


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

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

  int64_t N, T;
  cin >> N >> T;
  pair<int64_t, int64_t> P[N];
  rep(i,N){
    cin >> P[i].first >> P[i].second;
  }
  int64_t ans = 0;
  int64_t dp1[N+2][T] = {}, dp2[N+2][T] = {};
  for(int i=1;i<=N;i++){
    for(int j=1;j<T;j++){
      if(P[i-1].first > j){
        dp1[i][j] = dp1[i-1][j];
      }
      else{
        dp1[i][j] = max(dp1[i-1][j], dp1[i-1][j-P[i-1].first] + P[i-1].second);
      }
    }
  }

  for(int i=N;i>=1;i--){
    for(int j=1;j<T;j++){
      if(P[i-1].first > j){
        dp2[i][j] = dp2[i+1][j];
      }
      else{
        dp2[i][j] = max(dp2[i+1][j], dp2[i+1][j-P[i-1].first] + P[i-1].second);
      }
    }
  }

  for(int i=1;i<=N;i++){
    for(int j=0;j<=T-1;j++){
      ans = max(ans, dp1[i-1][j] + dp2[i+1][T-j-1] + P[i-1].second);
    }
  }


  cout << ans << endl;

}

Measured memory_bytes: 141056
# https://atcoder.jp/contests/abc067/submissions/2975640

from collections import deque

INF = 10 ** 5 + 10

N = int(input())
f = [INF for _ in range(N)]
# f[v]:=頂点0からの最短距離
s = [INF for _ in range(N)]
# s[v]:=頂点N-1からの最短距離

e = [[] for _ in range(N)]
# 道, 隣接リスト, 0-indexed

for _ in range(N - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    # 0-indexed
    e[a].append(b)
    e[b].append(a)

q = deque()
q.append((0, 0))

while q:
    v, d = q.popleft()
    f[v] = d
    for nv in e[v]:
        if f[nv] <= d + 1: continue
        q.append((nv, d + 1))

q = deque()
q.append((N - 1, 0))

while q:
    v, d = q.popleft()
    s[v] = d
    for nv in e[v]:
        if s[nv] <= d + 1: continue
        q.append((nv, d + 1))

Fennec_count = 0
for v in range(N):
    if f[v] <= s[v]:
        # 頂点0から近い場合
        # 等距離なら先に塗れる黒になる
        Fennec_count += 1
        # 黒

print('Fennec' if Fennec_count > N - Fennec_count else 'Snuke')


Measured memory_bytes: 29384
#include<bits/stdc++.h>
    #include <ext/pb_ds/assoc_container.hpp> 
  #include <ext/pb_ds/tree_policy.hpp>
  #pragma comment(linker, "/stack:200000000")
  #pragma GCC optimize("O3")
  #pragma GCC optimize("Ofast")
  #pragma GCC optimize("unroll-loops")
    using namespace std;
  using namespace __gnu_pbds;
    #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
    #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #define endl "\n"
    #define int long long
    #define all(v) v.begin(),v.end()
    #define rep(i,a,b) for(int i = a; i <=b; i++)
    #define rep2(i,a,b) for(int i = a; i>=b; i--)
    #define PB push_back
    #define MP make_pair
    #define db long double
    #define trace1(x)                cerr<<#x<<": "<<x<<endl
    #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
    #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
    #define trace3race4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
    #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
    #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
    #define cases int testcases;cin>>testcases; while(testcases--)
    #define INF 2000000000
    const double PI = acos(-1);
    const int N = 100005;


  int32_t main() 
  {
    IOS



       int n;
       cin >> n;
       cout << n*n*n;
    
    return 0;
      }

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

int main(){
  int n, m;
  cin >> n >> m;
  priority_queue<double>a;
  double ai;
  for(int i=0; i<n; i++){
    cin >> ai;
    a.push(ai);
  }
  for(int i=0; i<m; i++){
    double p=a.top();
    a.pop();
    a.push(p/2);
  }
  long sum=0;
  while(!a.empty()){
    sum += long(a.top());
    a.pop();
  }
  cout << sum;
  return 0;
}

Measured memory_bytes: 1400
//ID:computerbox --> Hajiyev Huseyn
#include <bits/stdc++.h>
#define FAST_READ ios_base::sync_with_stdio(0);/*cin.tie(0); cout.tie(0);*/
#define in freopen("input.txt", "r", stdin);
#define out freopen("output.txt", "w", stdout);
#define ll long long
#define debt(x,y)cout<<"#x = "<<(x)<<" and "<<"#y = "<<(y)<<endl;
#define deb(x)cout<<"#x = "<<(x)<<endl;
#define COUT(n, a) cout<< fixed << setprecision(a) << n<<endl
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define arr(a,n) for(ll i=1;i<=n;i++) cout<<a[i]<<" "; cout << "\n";
#define vecc(a,n) for(ll i=0;i<n;i++) cout<<a[i]<<" "; cout << "\n";
#define CURTIME() cerr << clock() * 1.0 / CLOCKS_PER_SEC << endl
#define DTIME(ccc) __begin = clock(); ccc; cerr<<"Time of work = "<<(clock()-__begin)/CLOCKS_PER_SEC<<endl;
#define MAXN 200010

using namespace std;

ll n,k;
ll cislo=1;
ll mina=MAXN;
int main(){
FAST_READ;
cin>>n>>k;
while(n--)
{
  mina=min(cislo*2,cislo+k);
  cislo=mina;
  //debt(mina,cislo);

}

cout<<cislo<<endl;



return 0;
} 

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from operator import itemgetter

def main():
    N = int(input())
    AList = list(map(int, input().split()))
    ABList = [[] for _ in range(N)]
    for i in range(N):
        a = AList[i]
        ABList[i] = [a, i+1]
    ABList = sorted(ABList, key=itemgetter(0))
    for i in ABList:
        print(i[1], end=' ')
    print()

if __name__ == '__main__': main()

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


int main() {
	string s;
	cin >> s;
	
	if (s == "a" || s == "i" || s == "u" || s == "e" || s == "o") {
		cout << "vowel";
	}
	else {
		cout << "consonant";
	}
	
	return 0;
}










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

int main(){
  int n;
  cin>>n;
  string s;
  cin>>s;
  int q;
  cin>>q;
  
  vector<vector<int>> d(26,vector<int>(n));
  rep(i,n){
    d[s[i]-'a'][i]=1;
  }
  rep(i,26)rep(j,n-1){
    d[i][j+1]+=d[i][j];
  }

  vector<vector<int>> minus(26); 
  vector<vector<int>> plus(26);
  
  rep(num,q){
    int type;
    cin>>type;
    if(type==1){
      int i;
      char c;
      cin>>i>>c;
      i--;
      if(s[i]!=c){
        minus[s[i]-'a'].pb(i);
        plus[c-'a'].pb(i);
        s[i]=c;
      }
    }else{
      int l,r;
      cin>>l>>r;
      l--;
      r--;
      int res=0;
      rep(i,26){
        int judge=d[i][r];
        if(l!=0) judge-=d[i][l-1];
        rep(j,minus[i].size()){
          if(l<=minus[i][j]&&minus[i][j]<=r) judge--;
        }
        rep(j,plus[i].size()){
          if(l<=plus[i][j]&&plus[i][j]<=r) judge++;
        }
        if(judge) res++;
      }
      cout<<res<<endl;
    }
  }
}


Measured memory_bytes: 56800
#include <bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define rfor(i,a,b) for(ll (i) = (a); (i) > (b); --(i))
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;
#define all(x) (x).begin(),(x).end()

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

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

ll factorial(ll n){
    ll t = 1;
    rep1(i, n)t *= i;
    return t;
}

ll combinations(ll n, ll k) {
    ll r = 1;
    for (ll d = 1; d <= k; ++d) {
        r *= n--;
        r /= d;
    }
    return r;
}

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


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

#define _CRT_SECURE_NO_WARNINGS

#define FOR(i, x, n) for(decltype(x) i = (x); i < (n); i++)
#define REP(i, n) for(decltype(n) i = 0; i < (n); i++)
#define RREP(i, n) for (decltype(n) i = (n) - 1; i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

using namespace std;

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

using LL = long long int;
using LD = long double;

const int INF = (1 << 30) - 1;
const LL INF64 = ((LL)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

using pii = pair<int, int>;
using pll = pair<LL, LL>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<LL>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;

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

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

	if (a <= 0 && 0 <= b) {
		cout << "Zero" << endl;
	} else if (0 < a) {
		cout << "Positive" << endl;
	} else {
		cout << ((b - a + 1 ) % 2 != 0 ? "Negative" : "Positive") << endl;
	}
	return 0;
}

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


int main(){
    long long A, B; cin >> A >> B;

    long long ans = A;

    long long i = A / 4;
    for (long long f = A + 1; f < (i + 1) * 4; f++) {
        ans = ans ^ f;
    }

    long long j = B / 4;
    for (long long f = j*4; f <= B; f++) {
        ans = ans ^ f;
    }

    cout << ans << endl;
    return 0;
}

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

int main(void){
    vector<int> road;
    int n = 0;
    int m = 0;
    int cnt = 0;
    cin >> n >> m;
    int ans[n] = {0};
    for (size_t i = 0; i < m; i++)
    {
        int bufo = 0;
        int buft = 0;
        cin >> bufo >> buft;
        road.push_back(bufo);
        road.push_back(buft);
    }
    sort(road.begin(),road.end());

    for (int x = 0; x < 2 * m; x++)
    {
        //cout << road[x] << endl;
        ans[road[x]-1]++;
    }
    
    for (size_t i = 0; i < n; i++)
    {
        cout << ans[i] << endl;
    }
    
    
}

Measured memory_bytes: 256