akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] s = new int[n+1];
    for(int i = 0; i < n; i++){s[i] = sc.nextInt();}
    int q = sc.nextInt();
    int[] t = new int[q];
    for(int i = 0; i < q; i++){t[i] = sc.nextInt();}
    int max = n;
    int cnt = 0;

    for(int i = 0 ; i < q; i++){
      if(banpei(s, t[i], max)){cnt++;}
    }

    System.out.println(cnt);
  }

  public static boolean banpei(int[] s, int key, int max){
    int i = 0;
    s[max] = key;

    while(true){
      if(s[i] == key){
        break;
      }
      i++;
    }

    if(i == max){return false;}
    return true;
  }
}



Measured memory_bytes: 40376
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
 
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m
////////////////////////////////////////////////////////////

struct P{
	long y;
	long x;
};

int main(){
	int n,m;
	cin >> n >> m;
	vector<struct P> s(n);
	rep(i,0,n){
		cin >> s[i].x >> s[i].y;
	}
	
	vector<struct P> c(m);
	rep(i,0,m){
		cin >> c[i].x >> c[i].y;
	}

	rep(i,0,n){
		long sx = s[i].x;
		long sy = s[i].y;
		long minD = abs(sx - c[0].x ) + abs( sy - c[0].y );
		int idx=0;
		rep(j,1,m){
			long cx = c[j].x;
			long cy = c[j].y;
			long d = abs(sx - cx) + abs(sy - cy ) ;
			if(d < minD){
				idx = j;
				minD = d;
			}
		}
		P(idx+1);
	}

	ret 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <stack>
#include <string>
using namespace std;

main() {
string str;
while(getline(cin, str), str!="."){
    string tmp = "";
    for(int i = 0; i < str.size(); i++) {
        if(str[i] == '(' || str[i] == ')' || str[i] == '[' || str[i] == ']')
            tmp += str[i];
    }
    bool f = 1;
    stack<char> stk;
    for(int i = 0; i < tmp.size(); i++) {
        if (tmp[i] == '(' || tmp[i] == '[')
            stk.push(tmp[i]);
        else if (!stk.empty()){
            char top = stk.top();
            stk.pop();
            if (tmp[i] == ')' && top == '(') {

            } else if (tmp[i] == ']' && top == '['){
            } else {
                f = 0;
            }
        } else {
        f = 0;
        }
    }
    if (!stk.empty()) f = 0;
    cout << (f ? "yes" : "no") << endl;
}
}

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

using namespace std;

namespace {

#define VEVE(i, a, b) for (ll i = a, __##i = b; i < __##i; ++i)
#define DYDY(i, a, b) for (ll i = a, __##i = b; i > __##i; --i)
#define RARA(x, seq) for (auto &x : seq)
#define SIZE(x) ((ll)(x.size()))
#define ALL(x) x.begin(), x.end()

typedef int64_t ll;
typedef double dd;

void Solve(ll) {
  ll n, k, q;
  if (not(cin >> n >> k >> q))
    return;
  vector<ll> arr(n);
  RARA(a, arr) cin >> a;
  auto vals = arr;
  sort(ALL(vals));
  vals.erase(unique(ALL(vals)), vals.end());
  auto is_poss = [&](ll low_val, ll hig_val) {
    ll cnt = 0;
    for (ll i = 0; i < n;) {
      if (arr[i] < low_val) {
        ++i;
        continue;
      }
      ll j = i, in_range = 0;
      while (j < n and arr[j] >= low_val) {
        in_range += (arr[j] <= hig_val);
        ++j;
      }
      cnt += max(ll(0), min(j - i - k + 1, in_range));
      i = j;
    }
    return cnt >= q;
  };
  ll low = 0, hig = 1e9;
  while (low <= hig) {
    const ll mid = (low + hig) / 2;
    bool can = false;
    VEVE(i, 0, n) {
      ll j = i;
      while (j < n and vals[j] - vals[i] <= mid)
        ++j;
      if (i < j and is_poss(vals[i], vals[j - 1])) {
        can = true;
        break;
      }
    }
    if (can) {
      hig = mid - 1;
    } else {
      low = mid + 1;
    }
  }
  cout << (hig + 1) << endl;
}

void Init() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
}
}

int32_t main() {
#ifdef AZN
  freopen("input.txt", "r", stdin);
#endif
  Init();
  ll tests = 11;
  VEVE(test, 1, tests + 1) Solve(test);
  return 0;
}


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n;
    cin >> n;
    string s;
    cin >> s;
    if(n % 2 == 1){
        cout << "No\n";
        return 0;
    }
    REP(i,n/2){
        if(s[i] != s[i + n / 2]){
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";
    return 0;
}

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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	cout << (n - 2) * 180 << endl;
}

Measured memory_bytes: 892
//    >File Name: 061B.cpp
//    > Author: Webwei

#include<bits/stdc++.h>
using namespace std;

int s[1010];
int main()
{
	int n,m;
	cin>>n>>m;
	int a,b;
	for(int i=0;i<m;i++){
		cin>>a>>b;
		s[a]++;
		s[b]++;
	}
	for(int i=1;i<=n;i++){
		cout<<s[i]<<endl;
	}
	return 0;
}

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

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

    int N;
    cin>>N;
    int A[200100] = {}, temp = 0;
    for(int i = 1; i < N; i++){
        cin>>temp;
        A[temp]++;
    }
    for(int i = 1; i <= N; i++){
        cout<<A[i]<<endl;
    }
}


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

char s[14];

int main(){
	scanf("%s", s);
	for(int i = 11; i >= 4; i--){
		s[i + 1] = s[i];
	}
	s[4] = ' ';
	s[13] = '\0';
	printf("%s\n", s);
	return 0;
}


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

int main(void) {
  int A, B;
  cin >> A >> B;
  int sum = A + B;
  int sub = A - B;
  int mux = A * B;
  int tmp = max(sum, sub);
  int tmp2 = max(tmp, mux);
  cout << tmp2 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}

// a b c d  
// j     e
// i h g f

// ha^hc = b
// hc^he = d
// ha^he = b^d

bool solve(){
  ll N; cin>>N;
  ll a[N]; CINA(a,N);
  ll r = 0;
  if(N%2==1){
    REP(i,N){ r ^= a[i]; }
  }else{
    for(int i=0;i<N;i+=2){ r ^= a[i]; }
    if(r>0){ return false;}
    for(int i=1;i<N;i+=2){ r ^= a[i]; }
  }
  return (r==0);
}

int main(){
  cout << (solve()?Liny:Linn);
}

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

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

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

// 階乗を求める
ll facctorialMethod(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

void printVector(const vector<char>& vec) {
    for (auto value : vec) {
        cout << value << " ";
    }
    cout << endl;
}


int main() {
    int N;
    cin >> N;
    vector<char> v;
    FOR(i,1,N+1) {
        v.push_back('0'+i);
    }
    vector<string> ss;
    do {
        string s(ALL(v));
        ss.push_back(s);
    } while (next_permutation(ALL(v)));

    string p_str;
    REP(i,N) {
        string tmp;
        cin >> tmp;
        p_str+=tmp;
    }
    string q_str;
    REP(i,N) {
        string tmp;
        cin >> tmp;
        q_str+=tmp;
    }

    int p=stoi(p_str);
    int q=stoi(q_str);
    int p_pos=-1,q_pos=-1;
    REP(i,ss.size()) {
        if (ss[i]==p_str) {
            p_pos = i+1;
        }
        if (ss[i]==q_str) {
            q_pos = i+1;
        }
    }

    if (p_pos == -1 || q_pos == -1) return 1;

    cout << abs(q_pos-p_pos) << endl;
    return 0;
}


Measured memory_bytes: 2424
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <algorithm>
#include <math.h>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#define ll long long
#define vi vector<ll>
#define vs vector<string>
#define fr(i, k, n) for (ll i = k; i < n; i++)
#define rep(i, n) fr(i, 0, n)
#define alll(v) v.begin(), v.end()
#define mp(a, b) make_pair(a, b)
#define rdd(a) ll a; cin >> a
#define rrd rdd(a); rep(i, a)
//min({a,b,c,d})などの記法
using namespace std;
template <class X> void pr(X x) { cout << x << endl; }
template <class X> void prr(X x) { for (auto it : x) { cout << it<< endl; } }

int main() {
    string s;
    cin>>s;
    if (s.size()>=4 && s[0]=='Y' &&s[1]=='A' &&s[2]=='K' &&s[3]=='I') {
        pr("Yes");
        return 0;
    }
    pr("No");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define OUT(a) cout << (a) << "\n"
#define ll long long

int main() {
    ll n;
    vector<ll> a(5);
    cin >> n;
    REP(i,5) cin >> a[i];
    ll Min = *min_element(a.begin(), a.end());
    ll ans = (n+Min-1)/Min + 4;
    OUT(ans);
    return 0;
}

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

using namespace std;

typedef long long i64;
typedef i64 int_t;
typedef vector<int_t> vi;
typedef vector<vi> vvi;

typedef pair<int_t, int_t> pi;

#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define sz(a) i64((a).size())
#define all(c) (c).begin(), (c).end()
#define REP(s, e, i) for(i=(s); i < (e); ++i)

const i64 NUM = 1000000007;
i64 modpow(i64 a, i64 b) {
  i64 ans = 1;
  while(b != 0) {
    if(b % 2 == 1) {
      ans *= a;
      ans %= NUM;
    }
    b /= 2;
    a = a * a;
    a %= NUM;
  }
  return ans;
}


template<typename T> T gcd(T a, T b) {
  if(a < b) swap(a, b);
  if(b == 0) return a;
  return gcd(b, a % b);
}


int main(int argc, char *argv[]) {
  i64 N, i;
  cin >> N;
  //vector<pi> A(N);

  map<pi, i64> Ac;
  set<pi> As;
  REP(0, N, i) {
    i64 A, B;
    cin >> A >> B;
    if(A == 0) {
      if(B != 0) {
	B = 1;
      }
    }
    else if(B == 0) {
      A = 1;
    }
    else {
      if(A < 0) {
	A *= -1;
	B *= -1;
      }
      i64 g = gcd(A, abs(B));
      A /= g;
      B /= g;
    }

    pi k(A, B);
    if(Ac.find(k) == Ac.end()) {
      Ac[k] = 0;
    }
    Ac[k]++;

    if(A == 0 && B == 0) {
      As.insert({0, 0});
    }
    if(A == 0 || B == 0) {
      As.insert({0, 1});
    }
    else {
      if(B < 0) {
	B *= -1;
	swap(A, B);
      }
      As.insert({A, B});
    }
  }

  i64 ans = 0;
  bool have_zero = false;
  for(auto k: As) {
    i64 A = k.first, B = k.second;
    i64 N1, N2;
    if(A == 0 && B == 0) {
      have_zero = true;
      continue;
    }
    else if(A == 0) {
      N1 = Ac[{0, 1}];
      N2 = Ac[{1, 0}];
    }
    else {
      N1 = Ac[{A, B}];
      N2 = Ac[{B, -A}];
    }
    //cout << A << " " << B << " " << N1 << " " << N2 << endl;
    i64 d1 = 0, d2 = 0;
    if(N1 != 0) {
      i64 p = modpow(2, N1);
      //d1 += p;
      d2 += p - 1;
    }
    if(N2 != 0) {
      i64 p = modpow(2, N2);
      //d1 += p;
      //d1 %= NUM;
      d2 += p - 1;
      d2 %= NUM;
    }
    //cout << "d1 = " << d1 << " d2 = " << d2 << endl;
    ans *= (d2 + 1);
    ans %= NUM;
    ans += d2;
    ans %= NUM;
  }

  if(have_zero) {
    ans += Ac[{0, 0}];
  }
  
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 41016
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;



#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

ll debugFlag = false;
template<typename T> void debug(T&);
template<typename T> void debug(T&, bool);
template<typename T> void debug(vector<T>&);
template<typename T> void debug(vector<T>&, bool);
template<typename T, typename U> void debug(pair<T, U>&);
template<typename T, typename U> void debug(pair<T, U>&, bool);

template<typename T>
void debug(T& obj) {
	debug(obj, true);
}

template<typename T>
void debug(T& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << obj;
	if (lnFlag) cout << endl;
}

template<typename T>
void debug(vector<T>& obj) {
	debug(obj, true);
}

template<typename T>
void debug(vector<T>& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << "[";
	rep(i, obj.size()) {
		if (i != 0) cout << ",";
		debug(obj[i], false);
	}
	cout << "]";
	if (lnFlag) cout << endl;
}

template<typename T, typename U>
void debug(pair<T, U>& obj) {
	debug(obj, true);
}

template<typename T, typename U>
void debug(pair<T, U>& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << "(";
	debug(obj.first, false);
	cout << ",";
	debug(obj.second, false);
	cout << ")";
	if (lnFlag) cout << endl;
}

void solve() {

	ll N;
	cin >> N;

	ll Y = N;
	ll X = 0;

	while (N != 0) {
		X += N % 10;
		N /= 10;
	}

	if (Y%X == 0) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}

}


int main(int argc, char* argv[]) {
	if (argc == 2 && string(argv[1]) == "debug") debugFlag = true;
	solve();
	cout << endl;
	return 0;
}


Measured memory_bytes: 384
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn main() {
    let n: i32 = read();
    for i in 1..n+1 {
        let mut x = i;
        if x % 3 == 0 {
            print!(" {}", i);
            continue;
        }
        while x != 0 {
            if x % 10 == 3 {
                print!(" {}", i);
                break;
            }
            x /= 10;
        }
    }
    println!();
}



Measured memory_bytes: 5024
#include<bits/stdc++.h>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define INF 0x7FFFFFFF
#define mod 1000000007
typedef long long ll;
////////////////////////////////////////////////////////////

int main(){
	int n,k;
	cin >> n >> k;
	if( n % k ) cout << 1 << endl;
	else cout << 0 << endl;
	ret 0;
}

Measured memory_bytes: 256
def main():
    n = int(input())
    w_list = [input() for _ in range(n)]

    if len(set(w_list)) != n:
        print("No")
        exit()

    for i in range(n - 1):
        if w_list[i][-1] != w_list[i + 1][0]:
            print("No")
            break
    else:
        print("Yes")


if __name__ == "__main__":
    main()


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

using namespace std;

#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define watch(x) cout << (#x) << " is " << (x) << endl
#define f(t) for(ll i =0;i<t;i++)
#define bs(a,x) binary_search(a.begin(),a.end(),x)
#define ll long long int
#define ul unsigned long int
#define ld long double
#define umpi unordered_map<int,int> 
#define umpl unordered_map<ll,ll> 
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define mod 1000000007 
#define N 10000000
#define all(a) a.begin(),a.end()
#define point pair<ll,ll>

const int inf = 100000007;
const ll linf = 1ll * inf * inf;
const ll MAXIMUM =100005;

inline ll mul(ll a, ll b){ return (a * 1ll * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c >= mod) c -= mod; return c; }
inline ll max(ll a, ll b){return a>b?a:b;}
inline ll min(ll a, ll b){return a<b?a:b;}

struct 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 is_pali(string s,ll low,ll high){
    ll i=low,j=high;
    while(i<j){
        if(s[i-1]!=s[j-1])return false;
        i++;j--;
    }
    return true;
}

int main()
{
    fio;
    string s;cin>>s;
    int n=s.length();
    bool ans=is_pali(s,1,s.length());
    ans=ans&is_pali(s,1,(n-1)/2);
    ans=ans&is_pali(s,(n+3)/2,n);
    cout<<((ans)?"Yes\n":"No\n");
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <limits>
using namespace std;
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define lli long long int
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define um unordered_map
#define F first
#define S second
#define clr(x) memset(x, 0, sizeof(x))
#define mem(data_structure, val) memset(data_structure, val, sizeof(data_structure))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define endl "\n"
const ll mod = 1e9+7;
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pll;
typedef vector<int>		vi;
typedef vector<ll>		vll;
typedef vector<pii>		vpii;
typedef vector<pll>		vpll;
typedef vector<vi>		vvi;
typedef vector<vll>		vvll;

struct 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; 
    } 
}; 
um<pii, int, hash_pair> map_with_pair{};
priority_queue <int, vector<int>, greater<int> > pq_desc; // decreasing order

const int N = 1e3+1;
lli dp[N][N];

bool isValid(int i, int j, int h, int w, vector<vector<char>>& grid) {
	if(i<0 || j<0 || i>=h || j>=w || grid[i][j]=='#') return false;
	return true;
}

lli numbersOfPath(int i, int j, int h, int w, vector<vector<char>>& grid) {
	if(dp[i][j] != -1) return dp[i][j];
	lli ans = 0;
	if(isValid(i-1, j, h, w, grid)) ans += numbersOfPath(i-1, j, h, w, grid);
	ans %= mod;
	if(isValid(i, j-1, h, w, grid)) ans += numbersOfPath(i, j-1, h, w, grid);
	ans %= mod;
	return dp[i][j] = ans;
}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int h, w;
	cin >> h >> w;

	vector<vector<char>> grid(h, vector<char>(w));
	fo(i, h) fo(j, w) cin >> grid[i][j];

	mem(dp, -1);
	dp[0][0] = 1;

	lli ans = numbersOfPath(h-1, w-1, h, w, grid);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 9216
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.C
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var c = new long[3, 3];
            var sum = 0L;
            for (int i = 0; i < 3; i++)
            {
                var read = ReadLongs();
                for (int j = 0; j < 3; j++)
                {
                    c[i, j] = read[j];
                    sum += read[j];
                }
            }

            if (sum % 3 != 0) return "No";

            var a0_a1 = c[0, 0] - c[0, 1];
            if (a0_a1 != c[1, 0] - c[1, 1]) return "No";
            if (a0_a1 != c[2, 0] - c[2, 1]) return "No";
            
            var a1_a2 = c[0, 1] - c[0, 2];
            if (a1_a2 != c[1, 1] - c[1, 2]) return "No";
            if (a1_a2 != c[2, 1] - c[2, 2]) return "No";

            var a2_a0 = c[0, 2] - c[0, 0];
            if (a2_a0 != c[1, 2] - c[1, 0]) return "No";
            if (a2_a0 != c[2, 2] - c[2, 0]) return "No";

            var b0_b1 = c[0, 0] - c[1, 0];
            if (b0_b1 != c[0, 1] - c[1, 1]) return "No";
            if (b0_b1 != c[0, 2] - c[1, 2]) return "No";

            var b1_b2 =  c[1, 0] - c[2, 0];
            if (b1_b2 != c[1, 1] - c[2, 1]) return "No";
            if (b1_b2 != c[1, 2] - c[2, 2]) return "No";

            var b2_b0  = c[2, 0] - c[0, 0];
            if (b2_b0 != c[2, 1] - c[0, 1]) return "No";
            if (b2_b0 != c[2, 2] - c[0, 2]) return "No";

            return "Yes";
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 28232
#include <iostream>
#include <vector>
using namespace std;
using Graph = vector<vector<int>>;

// 木上の探索

void dfs(const Graph &G, vector<int> &td,int v, int p, int d) {
  td[v]=d;
  for (auto nv : G[v]) {
    if (nv == p) continue;
    dfs(G,td,nv,v,d+1);
  }
}

int main(){
  int n,u,v;
  cin >>n>>u>>v;
  --u;
  --v;
  Graph g(n);

  vector<int> td(n,0),ad(n,0);

  for(int i=0;i<n-1;++i) {
    int a,b;
    cin>>a>>b;
    g[a-1].push_back(b-1);
    g[b-1].push_back(a-1);
  }
  dfs(g,td,u,-1,0);
  dfs(g,ad,v,-1,0);
  int k=0;
  for(int i=0;i<n;++i){
    //      cout<<i<<" "<<ad[i]<<"\n";
    if(td[i]<ad[i]){
      //	cout<<td[i]<<" "<<ad[i]<<" "<<i<<"\n";
      k=max(k,ad[i]);
    }
  }
  cout<<k-1;
}


Measured memory_bytes: 12928
def main():
    h, w, d = map(int, input().split())

    a = [None] * (h * w + 1)
    for i in range(1, h + 1):
        l = map(int, input().split())
        for j, k in enumerate(l, 1):
            a[k] = (i, j)

    c = [0] * (h * w + 1)
    for i in range(d + 1, h * w + 1):
        xb, yb = a[i-d]
        xn, yn = a[i]
        c[i] = c[i - d] + abs(xn - xb) + abs(yn - yb)

    q = int(input())
    res = []
    for _ in range(q):
        l, r = map(int, input().split())
        res.append(c[r] - c[l])

    ans = '\n'.join(map(str, res))
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 31268
N = int(input())

ans = 0
res = 1
for i in range(2,N+1):
  j = i
  if j % 2 == 1:
    continue
  cnt = 0
  while j % 2 == 0:
    j //= 2
    cnt += 1
  if ans < cnt:
    res = i
    ans = cnt
  
print(res)

Measured memory_bytes: 9120
#include<bits/stdc++.h>
 
#define INF 1000000007
#define LINF 1000000000000000007
 
using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> P;


int a,b;

int main(){
	cin >> a>>b;
	
	cout << max(max(a+b,a-b), a*b) << endl;
	
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<LL> a(n);
  for (int i = 0; i < n; i ++) {
    cin >> a.at(i);
  }

  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  int tmp_cnt = 1;
  LL x = 0;
  LL ans = 0;
  for (int i = 1; i < n; i ++) {
    if (a.at(i) == a.at(i - 1) && i == n - 1) {
      tmp_cnt ++;
      if (tmp_cnt >= 2 && x > 0) {
        ans = x * a.at(i);
      } else if (tmp_cnt >= 4) {
        ans = a.at(i) * a.at(i);
      }
    } else if (a.at(i) == a.at(i - 1)) {
      tmp_cnt ++;
    } else {
      if (tmp_cnt >= 2 && x > 0) {
        ans = x * a.at(i - 1);
        break;
      } else if (tmp_cnt >= 4) {
        ans = a.at(i - 1) * a.at(i - 1);
        break;
      } else if (tmp_cnt >= 2) {
        x = a.at(i - 1);
      }
      tmp_cnt = 1;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String ABCD = sc.next();
		int A = Integer.parseInt(ABCD.substring(0, 1));
		int B = Integer.parseInt(ABCD.substring(1, 2));
		int C = Integer.parseInt(ABCD.substring(2, 3));
		int D = Integer.parseInt(ABCD.substring(3, 4));
		String res = solve(A,B,C,D);
		System.out.println(res);
	}

	private static String solve(int A,int B,int C,int D) {
		if(A+B+C+D==7) {
			return A+"+"+B+"+"+C+"+"+D+"=7";
		}else if(A-B+C+D==7) {
			return A+"-"+B+"+"+C+"+"+D+"=7";
		}else if(A-B-C+D==7) {
			return A+"-"+B+"-"+C+"+"+D+"=7";
		}else if(A-B-C-D==7) {
			return A+"-"+B+"-"+C+"-"+D+"=7";
		}else if(A-B+C-D==7) {
			return A+"-"+B+"+"+C+"-"+D+"=7";
		}else if(A+B-C+D==7) {
			return A+"+"+B+"-"+C+"+"+D+"=7";
		}else if(A+B-C-D==7) {
			return A+"+"+B+"-"+C+"-"+D+"=7";
		}else if(A+B+C-D==7) {
			return A+"+"+B+"+"+C+"-"+D+"=7";
		}else {
			return A+"+"+B+"+"+C+"+"+D+"=7";
		}
	}

}


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

using vi = vector<int>;

int dfs(vi& V, vi& C, int& N, int i, int X, int Y){
    if(i == N) return X - Y;

    int ans = -1;

    ans = max(ans,dfs(V,C,N,i+1,X + V[i], Y + C[i]));
    ans = max(ans,dfs(V,C,N,i+1,X, Y));

    return ans;
}

int main(){
    int N;
    cin >> N;
    vector<int> V(N),C(N);
    for(int i=0;i<N;i++) cin >> V[i];
    for(int i=0;i<N;i++) cin >> C[i];

    cout << dfs(V,C,N,0,0,0) << endl;
}

Measured memory_bytes: 256
n, k = gets.chomp!.split(" ").map(&:to_i)
#hls = []
hls = gets.chomp!.split(" ").map(&:to_i)
#hls = gets.chomp!.split(" ").map(&:to_i)


#n.times do
  #hls << gets.chomp!.to_i
#end
#p hls
count = 0
hls.each do |c|
  if c >= k
    count += 1
  end
end

p count


Measured memory_bytes: 7940
import itertools
N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

j_list = list(itertools.permutations(range(1, N + 1)))
a = j_list.index(P) + 1
b = j_list.index(Q) + 1
print(abs(a - b))

Measured memory_bytes: 8052
#pragma region Macros
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
#pragma endregion

void solve(){
    int n;
    cin >> n;
    Graph G(n);
    for (int i=0; i<n-1; i++) {
        int a, b;
        cin >> a >> b;
        G.at(a-1).push_back(b-1);
        G.at(b-1).push_back(a-1);
    }
    vector<ll> fennec(n, LINF), snuke(n, LINF);
    queue<int> que;
    fennec.at(0) = 0;
    que.push(0);
    while (!que.empty()) {
        int cur = que.front(); que.pop();
        for (int next : G.at(cur)) {
            if (fennec.at(next) == LINF) {
                fennec.at(next) = fennec.at(cur) + 1;
                que.push(next);
            }
        }
    }
    snuke.at(n-1) = 0;
    que.push(n-1);
    while (!que.empty()) {
        int cur = que.front(); que.pop();
        for (int next : G.at(cur)) {
            if (snuke.at(next) == LINF) {
                snuke.at(next) = snuke.at(cur) + 1;
                que.push(next);
            }
        }
    }
    int cnt = 0;
    for (int i=0; i<n; i++) {
        if (fennec.at(i) <= snuke.at(i)) cnt++;
        else cnt--;
    }
    if (cnt > 0) cout << "Fennec" << "\n";
    else cout << "Snuke" << "\n";
}

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

    solve();

    return 0;
}


Measured memory_bytes: 7296
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define inf 1145141919364364
#define double long double
using namespace std;
typedef pair<ll, ll>P;
ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
signed main() {
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	ll s = a - 1;
	ll bb = b - (b / c + b / d - b / (lcm(c, d)));
	ll aa = s - (s / c + s / d - s / (lcm(c, d)));
	cout << bb - aa << endl;
	ggr
}



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

int a, b, c, x, y;

int main(){
    cin >> a >> b >> c >> x >> y;
    if(a + b < c * 2){
        cout << a * x + b * y << endl;
    }else{
        if(a < c){
            if(x < y){
                cout << c * x * 2 + b * (y - x) << endl;
            }else{
                cout << a * (x - y) + c * y * 2 << endl;
            }
        }else if(b < c){
            if(y < x){
                cout << c * y * 2 + a * (x - y) << endl;
            }else{
                cout << b * (y - x) + c * x * 2 << endl;
            }
        }else{
            if(x < y){
                if(a > b){
                    cout << min(c * 2 * y, b * (y - x) + c * x * 2) << endl;
                }else{
                    cout << min(c * 2 * y, c * x * 2 + b * (y - x)) << endl;
                }
            }else{
                if(a < b){
                    cout << min(c * 2 * x, a * (x - y) + c * y * 2) << endl;
                }else{
                    cout << min(c * 2 * x, c * y * 2 + a * (x - y)) << endl;
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
// セグフォ一生取れなかったので解答AC
// ヘビのライブラリは作った方がいい
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int h,w,n,a[10005];
vector<P>vec;
void go(int p,int q,int r,int s){
	for(int i=q;i<=s;i++) vec.pb(mp(p,i));
	for(int i=p+1;i<=r;i++) vec.pb(mp(i,s));
	for(int i=s-1;i>=q;i--) vec.pb(mp(r,i));
	for(int i=r-1;i>p;i--) vec.pb(mp(i,q));
	if(p+1<=r-1&&q+1<=s-1) go(p+1,q+1,r-1,s-1);
}
int ans[105][105];
int main(){
	cin >> h >> w >> n;
	for(int i=1;i<=n;i++) cin >> a[i];
	go(1,1,h,w);
	int s = 0;
	for(int i=1;i<=n;i++){
		for(int j=0;j<a[i];j++){
			ans[vec[s].fi][vec[s].sc] = i;
			s++;
		}
	}
	for(int i=1;i<=h;i++) for(int j=1;j<=w;j++) printf("%d%c",ans[i][j],j==w?'\n':' ');
}


Measured memory_bytes: 560
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(double x){
  printf("%.15f",x);
}
int N;
int A[100];
int main(){
  double res;
  int i;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=0;Lj4PdHRW<(N);Lj4PdHRW++){
      rd(A[Lj4PdHRW]);
    }
  }
  res = 0;
  for(i=0;i<(N);i++){
    res += 1.0 / A[i];
  }
  res = 1.0 / res;
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190818-1

// --- original code ---
// int N, A[100];
// {
//   int i;
//   double res;
//   rd(N,A(N));
// 
//   res = 0;
//   rep(i,N) res += 1.0 / A[i];
//   res = 1.0 / res;
//   wt(res);
// }


Measured memory_bytes: 256
#include<iostream>
using namespace std;
 
int main(){
    int n, ans=0;
    cin >> n;
    int a[n],b[n],c[n];
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++) cin >> b[i];
    for(int i = 0; i < n -1; i++) cin >> c[i];

    for(int i = 0; i < n; i++){
        ans += b[a[i]-1];
        if(i > 0){
            if(a[i-1] == a[i] -1){
                ans += c[a[i-1] -1];
            } 
        }
            
    }

    cout << ans << endl;    
    
}

Measured memory_bytes: 256
#!/usr/bin/env python3
N = int(input())
a = list(map(int, input().split(" ")))
s = 1
count = 0
for i in range(len(a)):
    if a[i] == s:
        s += 1
    else:
        count += 1
if count == len(a):
    print(-1)
else:
    print(count)

Measured memory_bytes: 26268
let a, b, c, k = Scanf.scanf " %d %d %d %d" @@ fun a b c d -> a, b, c, d
let d = ref @@ max a @@ max b c
let r = a + b + c - !d
let _ = for _ = 1 to k do d := 2 * !d done; Printf.printf "%d\n" @@ r + !d

Measured memory_bytes: 384
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
# include <cstdlib>
# include <tuple>
# include <array>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using D = double;
constexpr int INF = 2147483647;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr double HDINF = 50000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define RALL(qpqpq)           (qpqpq).rbegin(),(qpqpq).rend()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define RFOR(i,tptpt,ypypy)  for(LL i=(tptpt);i>=(ypypy);i--)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

string s;
string ans;

int main() {
	cin >> s;
	REP(i, s.size()) {
		if (s[i] == 'B'&&ans.size())ans.pop_back();
		else if(s[i]!='B') ans.push_back(s[i]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int w,h;
	while(cin >> w >> h){
		if(w == 0 || h == 0)break;
		int dp[100][100][4] = {0};

		for(int i = 0; i < w; i++)dp[0][i][2] = 1;
		for(int i = 0; i < h; i++)dp[i][0][0] = 1;

		for(int i = 1; i < h; i++){
			for(int j = 1; j < w; j++){
				dp[i][j][0] = (dp[i-1][j][0] + dp[i-1][j][1]) % 100000;
				dp[i][j][1] = dp[i-1][j][2] % 100000;
				dp[i][j][2] = (dp[i][j-1][2] + dp[i][j-1][3]) % 100000;
				dp[i][j][3] = dp[i][j-1][0] % 100000;
			}
		}
		int ans = 0;
		for(int i = 0; i < 4; i++){
			ans += dp[h-1][w-1][i];
			ans %= 100000;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1320
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {
	int n;
	cin>>n;
	set<char> s;
	REP(i,1,n) {
		char c;
		cin>>c;
		s.insert(c);
	}
	if(s.size()<=3)cout<<"Three";
	else cout<<"Four";
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3640
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Gosu_Hiroo
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define tr(container, it) \
        for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mll map<ll,ll>
#define intv(x, a, b)((x)>=a && (x)<=b)
#define  rep(i, _begin, _end) for (__typeof(_end) end = _end, begin = _begin,  i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define  _for(i, end) for (__typeof(end) i = 0, _len = (end); i < (_len); i += 1)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define F first
#define S second
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define mod(x, m) ((((x) % (m)) + (m)) % (m))
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define readint ({int t;cin >> t;t;})
const double PI = 2 * acos(.0);
const int INF = 0x3f3f3f3f;
const ll LLINF = 1000000000000000005LL;;
const ll MOD = (ll) (1e9) + 7;
void _mod(ll &x){x = mod(x, MOD);}
//const ll MOD = (ll) 998244353 ;
const double EPS = 1e-10;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *) array, (T *) (array + N), val);
}

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

template <typename T>
ostream& operator << (ostream& os, const set<T> V) {
    for(auto v : V)os << v << " ";
    return os;
}

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

//#define int ll

class BGoldenApple {
public:

void solve(std::istream& cin, std::ostream& cout) {
    int N, D;
    cin >> N >> D;
    cout << (N + 2 * D)/(2 *  D + 1 ) << endl;
}


};


#undef int
int main() {


	BGoldenApple solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	in.tie(0); ios::sync_with_stdio(0); out<<fixed<<setprecision(20);
	solver.solve(in, out);
	return 0;
}


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

int main(void){
    int a,b,c,x;
    cin>>a>>b>>c>>x;
    int ans=0;
    for (int i=0;i<=a;i++){
        for(int j=0;j<=b;j++){
            for(int k=0;k<=c;k++){
                if(500*i+100*j+50*k==x){
                    ans++;
                }
            }
        }
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 256
import math
N = int(input())
X = list(map(int,input().split()))
A = math.ceil(sum(X)/N)
B = math.floor(sum(X)/N)
ans_1 = 0
ans_2 = 0
for i in range(N):
    ans_1 += (X[i]-A)**2
for j in range(N):
    ans_2 += (X[j]-B)**2
print(min(ans_1,ans_2))

Measured memory_bytes: 3064
// fork from https://teratail.com/questions/248237
#include<iostream>
#include<algorithm>
#include<vector>
#define rep(i, n) for (int i=0; i<(n); i++)
using namespace std;

int main(){
    int K, N; cin >> N >> K;
    double p[N], tot=0, ans;
    rep(i, N) cin >> p[i];
    rep(i, K){
        tot += (p[i]+1)/2;
    }
    ans = tot;;
    for(int i=1; i<N-K+1; i++){
        tot += (p[i+K-1]+1)/2 - (p[i-1]+1)/2;
        if(ans < tot) ans = tot;
    }
    //rep(i, N-K+1) cout << sum[i] << " ";
    //cout << endl;
    // cout << ans << endl;
    printf("%.10f\n", ans);
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

int main()
{
	int a, b, c, d;
	scanf("%d %d %d %d",&a, &b, &c, &d);
	
	if ( abs(a - c) <= d  )
	{
		printf("Yes\n");
	}
	
	else if ( abs(a - b) <= d && abs(b - c) <= d)
	{
		printf("Yes\n");
	}
	
	else
	{
		printf("No\n");
	}

	return 0;
	
}


Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
const int maxn = 1e5 + 5;
long long seq[maxn];
long long ret[maxn];
int main(){
  int n;
  std::cin >> n;
  long long sum = 0;
  for(int i = 1; i <= n; ++ i){
      std::cin >> seq[i];
      sum += seq[i];
  }
  sum /= 2;
  for(int i = 2; i <= n ; i += 2){
      sum -= seq[i];
  }
  long long cur = sum;
  for(int i = 1; i <= n; ++ i){
          ret[i] = 2 * (seq[i] - cur);
       //   std::cout << 2 * (seq[i] - cur) << " ";
          cur = seq[i] - cur;
  }
  std::cout << ret[n] << " ";
  for(int i = 1; i < n; ++ i) std::cout << ret[i] << " ";
 }

Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main()
{
  ll N;
  cin >> N;
  vector<ll> A(N);
  rep(i, N) cin >> A.at(i);
  sort(all(A));
  reverse(all(A));
  ll ans = 0;
  rep(i, N-1){
    if(i == 0){
      ans += A.at(0);
    }
    else{
      ans += A.at((i+1)/2);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 4836
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

int main(){
    ll a, b;
    cin >> a >> b;
    ll conj = pow(10, to_string(b).size()) * a + b;
    cerr << conj << endl;
    rep(i, sqrt(conj)-2, sqrt(conj)+3){
        if(i * i == conj){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
N = input()
aryA = input().split(" ")

N = int(N)
aryA = [int(s) for s in aryA]
ans = []
for x in range(len(aryA) - 1):
    for y in range(len(aryA)):
        ans.append(abs(aryA[x] - aryA[y]))

print(max(ans))

Measured memory_bytes: 3316
b,c=[],[]
for i in range(10):
  a=int(input())
  b.append(a)
else: b.sort()
for i in range(10):
  a=int(input())
  c.append(a)
else: c.sort()
ans,ans2=0,0
for i in range(9,6,-1):
  ans+=b[i]
  ans2+=c[i]
else: print ans,ans2

Measured memory_bytes: 18000
#include <stdio.h>
int main(void) {
    int cnt = 0;
    char c, prev;
    while ((c = getchar()) != '\n');
    while (c = getchar()) {
        if (c < '0' || '9' < c) cnt += prev & 1;
        prev = c;
        if (c == EOF) break;
    }
    printf("%s\n", cnt & 1 ? "NO" : "YES");
    return 0;
}

Measured memory_bytes: 128