akhauriyash/Code-Regression huggingface dataset:
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = null;
		PrintStream out = null;
		try {
			sc = new Scanner(System.in);
			out = System.out;
			exec(sc, out);
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		} finally {
			if(out != null) {
				out.close();
			}
			if(sc != null) {
				sc.close();
			}
		}
		System.exit(0);
	}
	public static void exec(final Scanner sc, final PrintStream out) throws Exception{
		final int A = sc.nextInt();
		final int B = sc.nextInt();
		final int C = A+B;
		if(C%2 == 1) {
			out.println("IMPOSSIBLE");
		}else {
			out.println(C/2);
		}
	}
}


Measured memory_bytes: 21844
#include<cstdio>
#include<cctype>
#include<queue>
#include<algorithm>
#include<cstring>
using namespace std;

#define REP(i, N) for(int i=0;i<(int)(N);++i)

int unit[20];
int need[20];

int nextInt() {int r = 0, ch; while( isspace(ch = getchar())); do {r = r * 10 + ch - '0';}while( isdigit( ch = getchar() ) ); return r;}

bool visited[1 << 20];

struct State {
  int one, mask, have;
//   bool operator<(const State& t) const {
//     if( one != t.one ) return one > t.one;
//     return have < t.have;
//   }
};

int solve(int N, int U) {
  memset(visited, 0, sizeof(visited));
  //  priority_queue<State> up;
  queue<State> up;
  State s;
  s.one = 0;
  s.mask = 0;
  s.have = 0;
  visited[s.mask] = 1;
  up.push(s);
  while( !up.empty() ) {
    s = up.front(); up.pop();

    if( s.have >= U ) return s.one;

    for(int i = 0; i < N; i++)
      if ( visited[s.mask | (1 << i)] == 0 && (s.mask | need[i]) == s.mask )
        {
          State next;
          next.mask = s.mask | (1 << i);
          next.one = s.one + 1;
          next.have = s.have + unit[i];
          visited[next.mask] = 1;
          up.push(next);
        }
  }
  return -1;
}

int main() {
  for(;;) {
    int N, U;
    N = nextInt();
    U = nextInt();
    if( N == 0 && U == 0 ) break;
    REP(i, N) need[i] = 0;

    int all = 0;
    REP(i, N) {
      unit[i] = nextInt();
      all += unit[i];
      int K = nextInt();
      REP(k, K) {
        int x = nextInt();
        need[i] |= (1 << x);
      }
    }
    if( all == U ) {
      printf("%d\n", N);
      continue;
    }
    int best = solve(N, U);
    printf("%d\n", best);
  }
}

Measured memory_bytes: 4124
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main {

    public static void main(String[] args) {
        // TODO 自動生成されたメソッド・スタブ
        Scanner sc = new Scanner(System.in);
        // 果物の種類
        int fruit_type = sc.nextInt();
        // 購入数
        int count = sc.nextInt();
        //果物毎の価格リスト
        ArrayList<Integer> fruit_list = new ArrayList<>();
        for(int i = 0; i < fruit_type;i++) {
            fruit_list.add(sc.nextInt());
        }
        // 価格リストを昇順ソート
        Collections.sort(fruit_list);
        //価格リストの先頭から購入数の数だけ加算
        int sum = 0;
        for(int i = 0; i<count;i++) {
            sum += fruit_list.get(i);
        }
        System.out.println(sum);

    }

}


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

using namespace std;

int main() {
	vector<int> v;
	for(int i = 0; i < 10; i++) {
		int h;
		cin >> h;
		v.push_back(h);
	}

	sort(v.begin(), v.end());

	for (int i = 1; i <= 3; i++) {
		cout << v.at(v.size() - i) << endl;
	}

	return 0;
}

Measured memory_bytes: 3124
#include<stdio.h>

int main(void)
{
 int n,d,x,a[100],s;
 int i,j;
 scanf("%d%d%d",&n,&d,&x);
 for(i=0;i<n;i++) scanf("%d",&a[i]);
 s=0;
 for(i=0;i<n;i++){
    for(j=1;j<=d;j+=a[i]) s++;
  }
 s+=x;
 printf("%d\n", s);
 return 0;
}


Measured memory_bytes: 128
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Util{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		int N = ri();
        
        for (int i = 1; i <= N; i++)
        {
            int ans = 0;
            int x = 1;
            int y = 1;
            int z = 1;
            while (func(x, y, z) <= i)
            {
                y = 1;
                while (func(x, y, z) <= i)
                {
                    z = 1;
                    while (func(x, y, z) <= i)
                    {
                        if(func(x, y, z) == i) ans++;
                        z++;
                    }
                    y++;
                    z = 1;
                }
                x++;
                y = 1;
                z = 1;
            }

            // for (int x = 1; x * x + 5 <= i; x++)
            // {
            //     for (int y = 1;  x * x + y * y + x * y + 3<= i; y++)
            //     {
            //         for (int z = 1; func(x, y, z) <= i; z++)
            //         {
            //             if(func(x, y, z) == i) ans++;
            //         }
            //     }
            // }
            
		    Console.WriteLine(ans);
        }

		Console.ReadLine();
	}

    int func(int x, int y, int z) {
        return x * x + y * y + z * z + x * y + y * z + z * x;
    }

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
    static int[] generateNums(int num, int N){return Enumerable.Repeat(num, N).ToArray();}
    static int[] generateSuretsu(int N){return Enumerable.Range(0, N).ToArray();}
}

public static class Combination {
	//使い方:int[][] Is = Combination.Enumerate(nums, k, withRepetition:false).ToArray();
    public static IEnumerable<T[]> Enumerate<T>(IEnumerable<T> items, int k, bool withRepetition) {
        if (k == 1) {
            foreach (var item in items)
                yield return new T[] { item };
            yield break;
        }
        foreach (var item in items) {
            var leftside = new T[] { item };

            // item よりも前のものを除く （順列と組み合わせの違い)
            // 重複を許さないので、unusedから item そのものも取り除く
            var unused = withRepetition ? items : items.SkipWhile(e => !e.Equals(item)).Skip(1).ToList();

            foreach (var rightside in Enumerate(unused, k - 1, withRepetition)) {
                yield return leftside.Concat(rightside).ToArray();
            }
        }
    }
}


Measured memory_bytes: 27856
#include <bits/stdc++.h>
#define rep(i,n) for ( int i = 0; i < (n); ++i )
using namespace std;
using ll = long long int;
const long long int INF = 1001001001001001LL;
const int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;


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

    int n;
    cin >> n;
    vector<vector<int>> v(n, vector<int>(3));
    rep(i, n) rep(j, 3) cin >> v[i][j];

    vector<vector<int>> dp(n+1, vector<int>(3, 0));
    
    rep(i, n) {
        rep(j, 3) {
            rep(k, 3) {
                if( j != k ) dp[i+1][j] = max( dp[i+1][j], dp[i][k] + v[i][j] );
            }
        }
    }

    cout << *max_element( dp[n].begin(), dp[n].end() ) << endl;
    
    return 0;
}

Measured memory_bytes: 11264
#include<iostream>
#include<iomanip>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;



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

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

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n,i,m=0;
	char s[51];

	scanf("%d%s",&n,s);
	for(i=0;i<=n-3;i++)
		if((s[i]=='A')&&(s[i+1]=='B')&&(s[i+2]=='C'))
			m++;
	printf("%d",m);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    lint S, C;
    cin >> S >> C;
    lint ret = min(S, C / 2);
    lint diff = C / 2 - S;
    if (diff >= 0) {
        ret = max(ret, min(S + diff / 2, C / 2 - diff / 2));
    }
    cout << ret << endl;
    return 0;
};

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <numeric>
#include <limits>
#include <cmath>
#include <iomanip>
#include <sstream>
 
#define ALL(a)  (a).begin(),(a).end()
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;



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

    ll n, m; cin >> n >> m;
    vector<ll> a;
    ll sum = 0;

    for (int i = 0; i < n; i++) {
        int temp;
        cin >> temp;
        a.push_back (temp);
        sum += temp;
    }

    double res = (double)sum / (4 * m);

    ll ct = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] >= res) ct++;
    }


    (ct >= m) ? (cout << "Yes" << endl) : (cout << "No" << endl);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <numeric>
using namespace std;
#define MOD 1000000007
typedef long long ll;
typedef pair <int,int> P;

int main(){
    int N,Q;
    cin >> N >> Q;
    string S;
    cin >> S;
   
    int A[N];
    A[0] = 0;
    for(int i = 1;i<N;i++){
        if(S.at(i) == 'C' && S.at(i-1) == 'A'){
            A[i] = A[i - 1] + 1;
        }else{
            A[i] = A[i - 1];
        }
    }

    int l;
    int r;
    int ans = 0;
    for(int i = 0;i<Q;i++){
        cin >> l >> r;
        ans = A[r-1] - A[l-1];
        cout << ans << endl;
    }
}

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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

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

  cout << fixed << setprecision(10);

  int r;
  cin >> r;
  cout << r * 2.0 * M_PI;
}

Measured memory_bytes: 3804
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
const int maxn=1e5+1000;
int h[maxn],n,lim[maxn];
bool cmp(int x,int y){return x>y;}
int main() {
    scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%d",&h[i]);
    sort(h+1,h+1+n,cmp);
    lim[0]=h[1];lim[n]=h[n];
    for(int i=1;i<n;i++)lim[i]=h[i+1];
    int tar=0;
    while(tar+1<lim[tar+1]&&tar+1<n)tar++;
    int id=0;
    for(int i=1;i<n;i++)if(lim[i]>tar){id=i;}
    int l1=lim[tar]-1-tar,l2=id-tar;
    if(l1&1||l2&1)printf("First");
    else printf("Second");
    return 0;
}

Measured memory_bytes: 1024
//----------------------------おまじない
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")
//----------------------------
#define FOR(i,j,n) for (ll i=(j);i<(n);i++)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define REPN(i,n) for (ll i=(n);i>0;i--)
#define I(n) scanf("%d", &(n))
#define LL(n) scanf("%lld", &(n))
#define pb(n) push_back((n))
#define mp(i,j) make_pair((i),(j))
#define eb(i,j) emplace_back((i),(j))
#include <bits/stdc++.h>
using namespace std;
//------------------------------typedef集
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef vector<vi> vvi;
typedef vector<vpi> vvpi;
typedef vector<vvi> vvvi;
typedef long long ll;
const ll mod = 998244353;

ll n,a,b,k;
ll invs[300050];

ll pow(ll base, ll power){
    ll ans = 1;
    while (power){
        if (power&1) ans = (ans*base)%mod;
        base = (base*base)%mod;
        power >>= 1;
    }
    return ans;
}

int main(){
    cin >> n >> a >> b >> k;
    
    ll f = 1;
    FOR(i,1,n+1){
        f *= i;
        f %= mod;
    }
    ll inv = pow(f,mod-2);
    invs[n] = inv;
    //cerr << f << " " << inv << endl;
    REPN(i,n){
        inv *= i;
        inv %= mod;
        invs[i-1] = inv;
        //cerr << inv << endl;
    }

    ll ret = 0;
    REP(i,n+1){
        ll residue = k - i*a;
        if (residue < 0) break;
        if (residue%b) continue;
        ll j = (k-i*a)/b;
        if (j > n) continue;
        
        //cerr << i << " " << j << endl;
        
        ll tmpa = f * invs[i] % mod;
        tmpa = tmpa * invs[n-i] % mod;

        ll tmpb = f * invs[j] % mod;
        tmpb = tmpb * invs[n-j] % mod;

        ret += (tmpa*tmpb) % mod;
        ret %= mod;

    }
    cout << ret << endl;

}

Measured memory_bytes: 2560
(function (input) {
  'use strict';
  const lines = input.split('\n')
  const tle = Number(lines[0].split(' ')[1])
  const Length = Number(lines[0].split(' ')[0])
  let costMix = 2000
  for(let i=1; i<Length+1; i++){
    let cost = Number(lines[i].split(' ')[0])
    let time = Number(lines[i].split(' ')[1])
    if (time > tle) continue
    if (cost < costMix) costMix = cost
  }
  if (costMix === 2000) console.log('TLE')
  else console.log(costMix)
})(require("fs").readFileSync("/dev/stdin", 'utf8'));


Measured memory_bytes: 21064
#include <bits/stdc++.h>
using namespace std;
#define N_PRIME 1000000007
#define ll int64_t

int main(void){
    vector<int> a;
    
    while(true){
        char c;
        c = getchar();
        if( c == 'S' ){
            a.push_back(0);
        }else if ( c== 'T' ){
            a.push_back(1);
        }else{
            break;
        }
    }
        stack<int> counter;
        stack<bool> is_S;
        
        for(int i = 0 ; i < a.size() ; i++ ){
            if( counter.size() == 0 ){
                counter.push(1);
                is_S.push( a[i] == 0 );
            }else{
                if( is_S.top() == (a[i] == 0) ){
                    counter.top()++;
                }else{
                    if( a[i] == 0 ){
                        counter.push(1);
                        is_S.push( a[i] == 0 );
                    }else{
                        counter.top()--;
                    }
                }
            }
            
            if( counter.top() == 0 ){
                counter.pop();
                is_S.pop();
            }
        }
        
        int sum = 0;
        while( counter.empty() == false ){
            sum += counter.top();
            counter.pop();
        }
        
        cout << sum << endl;
    
    return 0;
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
           string a,b;
           cin>>a>>b;
           int cnt=0;
           int ans=10000000;
           for(int i=0;i<=a.size()-b.size();i++)
           {
               for(int j=0;j<b.size();j++)
               {
                   if(a[i+j]!=b[j]){cnt++;}
               }
               ans=min(ans,cnt);
               cnt=0;
           }
           cout<<ans;
}


Measured memory_bytes: 3584
/*
 ABC148 B
 auther: takeheroaf
 created at 2020-1-10 10:10:18
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vc vector
#define a first
#define b second
#define pb push_back
#define INF (1000000000)
#define MOD (1000000007)
#define MAX (100000)

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

template<typename T1, typename T2>
void chmin(T1 &a, T2 b) {if(a > b) a = b;}
template<typename T1, typename T2>
void chmax(T1 &a, T2 b) {if(a < b) a = b;}

template<typename T1, typename T2>
ll mypow(T1 a, T2 n){
  if(n == 0) return 1;
  if(n == 1) return a;
  if(n % 2) return a * mypow(a, n - 1);
  ll tmp = mypow(a, n / 2);
  return tmp * tmp;
}

ll comb(ll n, ll r){
	ll res = 1;
  rep(i, 0, r){
    res *= n - i;
    res /= i + 1;
  }
  return res;
}

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

void Main(){
  int n; cin >> n;
  string S, T;
  cin >> S >> T;
  rep(i, 0, n){
    cout << S[i] << T[i];
  }
  cout << endl;
  return;
}

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

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << std::fixed << std::setprecision(15);

  Main();

  return 0;
}


Measured memory_bytes: 256
// 23
#include <bits/stdc++.h>
using namespace std;
#define coutc "\033[48;5;196m\033[38;5;15m"
#define endc "\033[0m"
#define endl '\n'
#define M(_1, _2, _3, _4, NAME, ...) NAME
#define rep(...) \
  M(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rep4(_, x, n, s) \
  for (int _ = x; (s < 0) ? _ > n : _ < n; _ += s)
#define rep3(_, x, n) rep4(_, x, n, (x < n ? 1 : -1))
#define rep2(_, n) rep3(_, 0, n)
#define rep1(n) rep2(i, n)
#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
#define len(x) int(x.size())
#define lli __int128_t
#define li long long int
#define ld long double
#ifdef DEBUG
// 3
ostream &operator<<(ostream &o, pair<auto, auto> p) {
  return o << "(" << p.fi << ", " << p.se << ")";
}
// 4
ostream &operator<<(ostream &o, vector<auto> v) {
  rep(i, len(v)) o << setw(7) << right << v[i];
  return o << endc << endl << coutc;
}
// 4
ostream &operator<<(ostream &o, map<auto, auto> m) {
  for (auto &kv : m) o << kv;
  return o;
}
// 7
void debug(const auto &e, const auto &... r) {
  cerr << coutc << e;
  ((cerr << " " << r), ..., (cerr << endc << endl));
}
#else
#define debug(...)
#endif
// 3
void _main(int tc) {
  int n, m;
  cin >> n >> m;

  vector<int> h(n);
  rep(n) cin >> h[i];
  vector<vector<int>> adj(n);
  auto addEdge = [&](int u, int v) {
    adj[u].pb(v);
  };
  // set<pii> st;
  rep(m) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    // if (st.count({u, v})) continue;
    // st.insert({u, v});
    // st.insert({v, u});
    addEdge(u, v);
    addEdge(v, u);
  }
  int ans = 0;
  auto visit = [&](int u) {
    bool flag = 1;
    for (auto & v : adj[u]) {
      if (h[v] >= h[u]) {
        flag = false;
        break;
      }
    }
    if (flag) {
      ans++;
    }
  };

  rep(n) {
    visit(i);
  }
  cout << ans << endl;
}
// 7
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  _main(0), exit(0);
  int tc;
  cin >> tc;
  rep(i, tc) _main(i + 1);
}

Measured memory_bytes: 8720
import java.util.*;


public class Main {
	public static void main (String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] P = new int[N];
		P[0] = sc.nextInt();
		int min = P[0];
		int R = 1;
		for(int i = 1; i < N; i++) {
			P[i] = sc.nextInt();
			if(P[i] <= min) {
				min = P[i];
				R++;
			}
		}
		System.out.println(R);
	}
}

Measured memory_bytes: 65564
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, A, B = mapint()
if abs(A-B)%2==0:
    print(abs(A-B)//2)
else:
    if A>B:
        A, B, = B, A
    c = A + (B-A-1)//2
    d = (N-B+1) + (B-A-1)//2
    print(min(c, d))

Measured memory_bytes: 61928
#include<iostream>
//#include<algorithm>
//#include<cmath>
using namespace std;
int main() {
	int i, j;
	for (i = 1; i < 10; i++)
		for (j = 1; j < 10; j++)
			cout << i << "x" << j << "=" <<i*j << endl;
	return 0;
}

Measured memory_bytes: 2992
#include <stdio.h>
int main() {
    int n, k,ans;
    scanf("%d%d", &n, &k);
    ans = (n - k) / (k - 1) + 1;
    printf("%d\n", (n - k) % (k - 1) != 0 ? ans + 1 : ans);
    return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize("Ofast",3,"inline")
#include<bits/stdc++.h>
using namespace std;
typedef priority_queue<int> p_queue;
typedef long long ll;
ll h,w,n; 
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	cin>>h>>w>>n;
	cout<<(n+max(h,w)-1)/(max(h,w));
	return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
n,m = map(int,input().split())
num = 10**9+7
nots = [int(input()) for i in range(m)]
leng = len(nots)
cnt = 0
dp = [0]*(n+1)
dp[0] = 1
if leng > 0 and nots[0] == 1:
  dp[1] = 0
  nots.pop(0)
  leng -= 1
else:
  dp[1] = 1
if n == 1:
  print(1)
  exit()

for i in range(2,n+1):
  if leng > 0 and nots[cnt] == i:
    dp[i] = 0
    if cnt < leng - 1:
      cnt += 1
  else:
    dp[i] = (dp[i-1] + dp[i-2]) % num
print(dp[n] % num)

Measured memory_bytes: 7848
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<complex>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
#define PI 3.1415926535897932384626433832795028
typedef long long Int;
typedef pair<Int, Int> P;
typedef long double Real;
typedef complex<Real> CP;

struct Trie{
    int c;
    int child[26];
    int cnt[26];
    int p;
    bool fin;
    Trie(){
        fin = false;
        for(int i = 0;i < 26;i++){
            child[i] = -1;
            cnt[i] = 0;
        }        
    }
};
bool have[26];
Trie trie[1100000];
Int p = 1;
Int n;
string str;
vector<int> queries;
int main(){
    cin >> n;
    for(int i = 0;i < n;i++){
        cin >> str;
        reverse(str.begin(), str.end());
        int now = 0;
        for(int i = 0;i < str.size();i++){
            int c = str[i] - 'a';
            if(trie[now].child[c] == -1){
                trie[now].child[c] = p++;
                trie[trie[now].child[c]].p = now;
            }
            now = trie[now].child[c];
            trie[now].c = c;
        }
        trie[now].fin = true;
        queries.push_back(now);
        fill(have, have + 26, false);
        for(int i = str.size() - 1;i >= 0;i--){
            int c = str[i] - 'a';
            have[c] = true;
            now = trie[now].p;
            for(int j = 0;j < 26;j++){
                if(have[j])trie[now].cnt[j]++;
            }        
        }
        
    }
    Int ans = 0;
    for(auto pos:queries){
        int p = trie[pos].p;
        int c = trie[pos].c;
        ans += trie[p].cnt[c] - 1;
    }
    cout << ans << endl;
    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;

#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;


int main() {

	string s;
    cin >> s;

    bool ans = true;

    int n = s.size();

    rep(i, n / 2) {
        if (s[i] != s[n - 1 - i])
            ans = false;
    }

    rep(i, (n / 2) / 2 ) {
        if (s[i] != s[n / 2 - i - 1])
            ans = false;

        if (s[n / 2 + 1 + i] != s[n - i - 1])
            ans = false;
    }

    string Sans = "No";
    if (ans) Sans = "Yes";

    cout << Sans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] a  = new int[N];
		for(int i = 0 ; i < N ; i++) {
			a[i] = sc.nextInt();
		}
		int ans = 1000000007;
		for(int i = -100 ; i <= 100 ; i++) {
			int sum = 0;
			for(int j = 0 ; j < N ; j++) {
				sum += (i - a[j]) * (i - a[j]);
			}
			ans = Math.min(ans, sum);
		}
		System.out.println(ans);
	}
}


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

int main() {
  int N;
  cin >> N;
  int L[N];
  for (int i = 0; i < N; i++) cin >> L[i];
  
  sort(L, L+N);
  
  int subsum = 0;
  for (int i = 0; i < N-1; i++) {
    subsum += L[i];
  }
  
  if (subsum > L[N-1]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[100000];
int b[10000];
int c[100000];
int umn=0;
int main()
{
    long long int umn=0; 
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
     cin>>a[i];
     for(int i=1;i<=n;i++)
     {
     	cin>>b[i];
	 }
	 for(int i=1;i<n;i++)
	 {
	 	cin>>c[i];
	 }
	 for(int i=1;i<=n;i++)
	 {
	 //	cout<<umn<<b[a[i]]<<endl;
	 	umn+=b[a[i]];
	 	if(i!=1&&a[i]==a[i-1]+1)
	 	{
	//	 cout<<a[i]<<" "<<a[i-1]<<endl;
	 	umn+=c[a[i-1]];
	 }
}
	 cout<<umn;
	 return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

#define N 101
#define W 1
#define G 2
#define B 3

int g[N][N], c[N], d[N], f[N], t = 0, n;

void visit(int);

int main(){
  int m, l, o, i, j, t;
  for( i = 0; i < N; i++){
    for( j = 0; j < N; j ++){

      g[i][j] = 0;

    }
  }

  scanf("%d", &n);
  
  for( i = 1; i <= n; i++){

    c[i] = W;

    scanf("%d%d", &m, &l);

    for( j = 1; j <= l; j++){

      scanf("%d", &o);  
      g[m][o] = W;

    }
  }

  for( i = 1; i <= n; i++){

    if( c[i] == W)
      visit( i);
    
    //printf("%d %d %d\n",i,d[i],f[i]);
  }
  
  for( i = 1; i <= n; i++){
    
  printf("%d %d %d\n", i, d[i], f[i]);

  }
    
  return 0;
}

void visit(int x){
  int i;

  c[x] = G;
  d[x] = ++t;

  for( i = 1; i <= n; i++){

    if( g[x][i] == 0)continue;

    if(c[i] == W)      visit(i);
  }
  
  c[x] = B;
  f[x] = ++t;

}

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

#define F first
#define S second
#define gcd __gcd
#define nset __builtin_popcount
#define pb push_back
#define btoe(x) x.begin(), x.end()
#define trim_chains(x) (x).resize(unique(btoe(x)) - (x).begin())
#define remove_dups(x) sort(btoe(x)); trim_chains(x);
#define rep(i, a, b)  for (int i = int(a); i <= int(b); i++)
#define nrep(i, a, b) for (int i = int(a); i >= int(b); i--)
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL)
#define circ_inc(i, n) (i + 1) % int(n)
#define circ_dec(i, n) (i + int(n) - 1) % int(n)
#define round(x) (int)((double)int(x) + 0.5)

void println() { cout << '\n'; }
template <typename Head, typename... Tail>
void println(Head H, Tail... T) {
    cout << " " << H;
    println(T...);
}
void debug_out() { cerr << '\n'; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << H;
    debug_out(T...);
}

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<vector<int> > vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef map<string, int> msi;
typedef istringstream iss;

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

int main() 
{
    FASTIO;
    ll x; cin >> x;
    ll val = 100;
    ll years = 0;

    while(val < x) {
	val = val + val/100;
	years++;
    }
    cout << years << '\n';
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <functional>
#include <cstdio>

using namespace std;

typedef pair<long long int, int> P;

long long int ccc(int a, int b) {
	long long int cc = 1;
	b = min(b, a-b);
	for (int i = 1; i <= b; i++) {
		cc *= (long long int)(a-i+1);
		cc /= (long long int) i;
	}
	return cc;
}

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	vector<long long int> v(n);
	for (int i = 0; i < n; i++) {
		cin >> v[i];
	}
	double dd = 0.0;
	sort(v.begin(), v.end(), greater<long long int>());
	long long int dd2 = 0;
	for (int i = 0; i < a; i++) {
		dd += (double)v[i];
		dd2 += v[i];
	}
	dd /= (double)a;
	//cout << dd << endl;
	
	printf("%.8f\n", dd);

	vector<P> pp;
	P p = P(v[0], 1);
	for (int i = 1; i < n; i++) {
		if (p.first == v[i]) {
			p.second++;
		} else {
			pp.push_back(p);
			p.first = v[i];
			p.second = 1;
		}
	}
	pp.push_back(p);
	long long int sum = 0;
	//cout << 100000000000000*50 << endl;
	for (int i = a; i <= b; i++) {
		long long int dd3 = v[0];
		vector<P> p2;
		P p3 = P(v[0], 1);
		for (int j = 1; j < i; j++) {
			dd3 += v[j];
			if (p3.first == v[j]) {
				p3.second++;
			} else {
				p2.push_back(p3);
				p3.first = v[j];
				p3.second = 1;
			}
		}
		p2.push_back(p3);
		if (dd2*i == dd3*a) {
			long long int ss = 1;
			for (int j = 0; j < p2.size(); j++) {
				if (p2[j].second != pp[j].second) {
					ss *= ccc(pp[j].second, p2[j].second);
				}
			}
			sum += ss;
		} else {
			break;
		}
		//sum += ss;
	}
	cout << sum << endl;
	return 0;
}

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

using namespace std;


const int MAX_N = 100;


int x, y, z;

void solve()
{
    swap(x, y);
    swap(x, z);
    cout << x;
    cout << " ";
    cout << y;
    cout << " ";
    cout << z;
    cout << " ";
}

int main()
{
    cin >> x >> y >> z;
    
    solve();


    return EXIT_SUCCESS;
}

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

int main() {
	int n, c, cakes = 0;
	cin >> n >> c;
	vector<int> p;
	for (int i = 0; i < c; i++) {
		int in;
		cin >> in;
		p.push_back(in);
		cakes += in;
	}
	if (cakes % (n + 1) == 0) {
		cout << cakes / (n + 1) << endl;
	}
	else {
		cout << cakes / (n + 1) + 1 << endl;
	}

	return 0;
}


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

// ------ Class ------ //
class Graph2 {
public:
	static const long long INF = 1000000000000000000;
	int V, E; vector<vector<pair<int, long long> > > G;
	Graph2() : V(0), E(0), G(vector<vector<pair<int, long long> > >()) {}
	Graph2(int v) : V(v), E(0), G(vector<vector<pair<int, long long> > >(v)) {}
	Graph2(vector<vector<pair<int, long long> > > g) : V(g.size()), G(g) { for (int i = 0; i < g.size(); i++) E += g[i].size(); }
	int size() { return V; }
	void add1(int v1, int v2, long long w) { G[v1].push_back(make_pair(v2, w)); E++; }
	void add2(int v1, int v2, long long w) { add1(v1, v2, w); add1(v2, v1, w); }
	bool operator==(const Graph2& g) const { return G == g.G; }
	bool operator!=(const Graph2& g) const { return G != g.G; }
	vector<pair<int, long long> > operator[](int x) { return G[x]; }
	vector<long long> dist(int s) {
		priority_queue<pair<long long, int> > que; que.push(make_pair(0, s));
		vector<long long> d(V, INF); d[s] = 0;
		while (!que.empty()) {
			pair<long long, int> t = que.top(); que.pop();
			int u = t.second;
			for (int i = 0; i < G[u].size(); i++) {
				int v = G[u][i].first; long long e = G[u][i].second;
				if (d[v] > d[u] + e) {
					d[v] = d[u] + e;
					que.push(make_pair(-d[v], v));
				}
			}
		}
		return d;
	}
};

// ------ Main ------ //
int H, W, g; string s[100];
int main() {
	while (cin >> W >> H, H) {
		for (int i = 0; i < H; i++) cin >> s[i];
		Graph2 G(H * W + 1);
		for (int i = 0; i < H; i++) {
			for (int j = 1; j < W; j++) {
				G.add1(i * W + j - 1, i * W + j, (s[i][j - 1] == '#' && s[i][j] != '#') ? 1 : 0);
				G.add1(i * W + j, i * W + j - 1, (s[i][j - 1] != '#' && s[i][j] == '#') ? 1 : 0);
			}
		}
		for (int i = 1; i < H; i++) {
			for (int j = 0; j < W; j++) {
				G.add1(i * W + j - W, i * W + j, (s[i - 1][j] == '#' && s[i][j] != '#') ? 1 : 0);
				G.add1(i * W + j, i * W + j - W, (s[i - 1][j] != '#' && s[i][j] == '#') ? 1 : 0);
			}
		}
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				if (i == 0 || i + 1 == H || j == 0 || j + 1 == W) G.add1(H * W, i * W + j, 0);
				if (s[i][j] == '&') g = i * W + j;
			}
		}
		cout << G.dist(H * W)[g] << endl;
	}
}

Measured memory_bytes: 4204
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long a,b,c,k,k1;
  cin >> a >> b >> c >> k;
  long long ans;
  k1=k;
  k-=a;
  if(k<=0){
    ans=k1;
    cout << ans << endl;
    return 0;
  }
  k1-=a;
  k-=b;
  if(k<=0){
    ans=a+k1*0;
    cout << ans << endl;
    return 0;
  }
  k1-=b;
  k-=c;
  if(k<=0){
    ans=a+b*0-k1;
    cout << ans << endl;
    return 0;
  }
}

Measured memory_bytes: 3636
package main

import (
	"fmt"
	"math"
	"strconv"
)

func main() {
	var a, b string
	fmt.Scan(&a, &b)
	c, _ := strconv.Atoi(a + b)
	s := math.Sqrt(float64(c))
	if s == math.Trunc(s) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

Measured memory_bytes: 512
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <stdlib.h>
#include <time.h>
#include <limits.h>
#include <assert.h>
using namespace std;
int a, b, k;
int main() {
	cin >> a >> b >> k;
	int ans = -1;
	for (int i = min(a, b), j = 0; i >= 1; i--) {
		if (a % i == 0 && b % i == 0) {
			j++;
			if (j == k) ans = i;
		}
	}
	assert(ans != -1);
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


int main(){
    ll q, h, s, d, n;
    cin >> q >> h >> s >> d >> n;

    ll one = min({q*4, h*2, s});

    if (one * 2 <= d) cout << one * n << endl;
    else cout << n/2 * d + n%2 * one << endl;

    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	// Code for A - Sorted Arrays
	var N int
	fmt.Scan(&N)

	sc.Split(bufio.ScanWords)
	A := make([]int, N)
	for i := 0; i < N; i++ {
		A[i] = nextInt()
	}

	B := make([]int, 0)
	B = append(B, A[0])
	for i := 1; i < N; i++ {
		if A[i] != A[i-1] {
			B = append(B, A[i])
		}
	}

	var count int
	var flag int
	for i := 0; i < len(B)-1; i++ {
		if flag == 0 && B[i+1] > B[i] {
			flag = 1
		} else if flag == 0 && B[i+1] < B[i] {
			flag = -1
		} else if flag == 1 && B[i+1] > B[i] {
			continue
		} else if flag == 1 && B[i+1] < B[i] {
			count++
			flag = 0
		} else if flag == -1 && B[i+1] < B[i] {
			continue
		} else if flag == -1 && B[i+1] > B[i] {
			count++
			flag = 0
		}
	}

	fmt.Println(count + 1)
}


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

int main(int argc, char const *argv[])
{
	int a,b;
	cin >> a >> b;
	if(a % 2 == 0 || b % 2 == 0)	cout << "Even" << endl;
	else cout << "Odd" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long X,Y;
    long long baisu;
    long long ans=0;

    cin>>X>>Y;

    for(int i=2;i<100000001;i++){
        baisu=i*X;
        if(baisu%Y!=0){
            ans=baisu;
            break;
        }
    }


    if(ans==0)ans=-1;


    cout<<ans<<endl;

}

Measured memory_bytes: 256
N, Y = map(int, input().split())
for i in range(N+1):
    for j in range(N-i+1):
        if 10000*i + 5000*j + 1000*(N-i-j) == Y:
            print('{} {} {}'.format(i,j,N-i-j))
            exit()
print("-1 -1 -1")


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

#define rep(i,n) for(int i=0;i<(n);++i)
#define loop for(;;)
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;
#define inf (1e9)
#define eps (1e-9)

template<class S, class T> inline
ostream& operator<<(ostream&os, pair<S,T> p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template<class S, class T, class U> inline
ostream& operator<<(ostream&os, tuple<S,T,U> t) {
  return os << '('
    << get<0>(t) << ", "
    << get<1>(t) << ", "
    << get<2>(t) << ')';
}

template<class T> inline
ostream& operator<<(ostream&os, vector<T> v) {
  if (v.size() == 0) { return os << "(empty)"; }
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

template<class T> inline
istream& operator>>(istream&is, vector<T>&v) {
  rep (i, v.size()) is >> v[i];
  return is;
}

//           ^   >  v   <
int dx[] = { -1, 0, 1,  0 };
int dy[] = {  0, 1, 0, -1 };

typedef vector<int> vi;
typedef vector<vi> vvi;

enum {
  HIRA, RENGA, TETSU, MIZU
};

inline
void display(const vvi&f, int x, int y, int d) {
  int h = f.size();
  int w = f[0].size();
  rep (i, h) {
    rep (j, w) {
      if (i == x and j == y) {
        if (d == 0) cout << '^';
        else if (d == 1) cout << '>';
        else if (d == 2) cout << 'v';
        else cout << '<';
      }
      else if (f[i][j] == HIRA) cout << '.';
      else if (f[i][j] == RENGA) cout << '*';
      else if (f[i][j] == TETSU) cout << '#';
      else if (f[i][j] == MIZU) cout << '-';
      else assert(false);
    }
    cout << endl;
  }
}

void solve(bool of) {
  if (of) cout << endl;
  int h, w; cin >> h >> w;

  vvi f(h, vi(w, 0));
  int x, y, d;

  rep (i, h) {
    string s; cin >> s;
    rep (j, w) {
      char c = s[j];
      if (c == '#') f[i][j] = TETSU;
      else if (c == '*') f[i][j] = RENGA;
      else if (c == '-') f[i][j] = MIZU;
      else f[i][j] = HIRA;
      if (c == '^') { x = i; y = j; d = 0; }
      else if (c == '>') { x = i; y = j; d = 1; }
      else if (c == 'v') { x = i; y = j; d = 2; }
      else if (c == '<') { x = i; y = j; d = 3; }
    }
  }

  int k; cin >> k;
  string com; cin >> com;
  for (char c: com) {
    if (c == 'U') {
      d = 0;
      if (x > 0 and f[x-1][y] == HIRA) --x;
    }
    else if (c == 'R') {
      d = 1;
      if (y < w-1 and f[x][y+1] == HIRA) ++y;
    }
    else if (c == 'D') {
      d = 2;
      if (x < h-1 and f[x+1][y] == HIRA) ++x;
    }
    else if (c == 'L') {
      d = 3;
      if (y > 0 and f[x][y-1] == HIRA) --y;
    }
    else {
      int x2 = x, y2 = y;
      loop {
        x2 += dx[d]; y2 += dy[d];
        if (x2 < 0 or x2 >= h or y2 < 0 or y2 >= w) break;
        if (f[x2][y2] == RENGA) {
          f[x2][y2] = HIRA;
          break;
        }
        else if (f[x2][y2] == TETSU) {
          break;
        }
      }
    }
  }

  display(f, x, y, d);

}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout.setf(ios::fixed);
  cout.precision(10);
  random_device dev;
  mt19937 rand(dev());

  int m; cin >> m;
  rep (_, m) solve(_>0);

  return 0;
}

Measured memory_bytes: 1264
N, K = gets.chomp.split(" ").map(&:to_i)
require "set"
all = Set.new((1..N).to_a)
has = Set.new
K.times do |i|
  d = gets.chomp.to_i
  a = gets.chomp.split(" ").map(&:to_i)
  has += a
end
puts (all - has).size


Measured memory_bytes: 14564
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MAX=1e9;
ll mod=998244353 ;
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
//#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define se second
#define fi first
#define maxe max_element
#define mine min_element
#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define debug4(x,y,z,w) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define boost  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
//#define SIZE 5000 + 1

long long expo(ll x,ll n,ll M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return expo((x*x)%M,n/2,M)%M;
    else                             //n is odd
        return (x*expo((x*x)%M,(n-1)/2,M))%M;

}
bool is_pali(string s)
{
    int n=s.length();
    for(int i=0;i<(s.length()/2);i++)
    {
        if(s[i]!=s[n-1-i])return false;
    }
    return true;
}

void solve()
{
 string s;
 cin>>s;
 int n=s.length();
 if(s.length()%2==0)
    cout<<"No"<<endl;
 else
 {
     if(is_pali(s))
     {
         string ss=s.substr(0,(n-1)/2);
         if(is_pali(ss))
         {
             string sss=s.substr((n+1)/2,n-((n+1)/2));
             if(is_pali(sss))
                cout<<"Yes"<<endl;
             else
                cout<<"No"<<endl;
         }
         else
            cout<<"No"<<endl;
     }
     else
        cout<<"No"<<endl;
 }
}

int main(){
    boost;
  solve();
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.HashSet;
import java.util.NoSuchElementException;


public class Main {
	
	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		FastScanner sc=new FastScanner();
		HashSet<String> set=new HashSet<>();
		int N=sc.nextInt();
		for (int i=0;i<N;++i) {
			String S=sc.next();
			set.add(S);
		}
		System.out.println(set.size());
	}
	
	void tr(Object...objects) {System.out.println(Arrays.deepToString(objects));}
}




class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    public boolean hasNext() { skipUnprintable(); return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
    	return (int)nextLong();
    }
}

Measured memory_bytes: 61280
N = int(input())
input2 = input()
t,a = input2.split(' ')
T = int(t)
A = int(a)
input3 = input()
H = list(map(int,input3.split(' ')))

answer = 0
min = 0
for i in range(N):
    heikin = T - H[i] * 0.006
    #print(heikin)
    #print(abs(A - heikin))
    #print(min)
    if i != 0:
        if min > abs(A - heikin):
            min = abs(A - heikin)
            answer = i + 1
    else:
        min = abs(A - heikin)
        answer = 1
print(answer)


Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <climits>
#include <utility>
typedef long long ll;
using namespace std;

int main(void){
  int h, w, i, j;
  vector<vector<int> > a;
  vector<vector<int> > out;
  cin >> h >> w;
  
  a.resize(h,vector<int>(w));
  out.clear();

  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      cin >> a[i][j];
    }
  }

  int n = 0;

  for(i=0;i<h;i++){
    for(j=0;j<w-1;j++){
      if(a[i][j]%2==1){
        //printf("%d %d %d %d\n",i,j,i,j+1);
        out.push_back({i,j,i,j+1});
        ++a[i][j+1];
        ++n;
      }
    }
  }

   for(i=0;i<h-1;i++){
    if(a[i][w-1]%2==1){
      //printf("%d %d %d %d\n",i,w-1,i+1,w-1);
      out.push_back({i,w-1,i+1,w-1});
      ++a[i+1][w-1];
      ++n;
    }
  }

  printf("%d\n",n);

  for(i=0;i<out.size();i++){
    printf("%d %d %d %d\n",out[i][0]+1,out[i][1]+1,out[i][2]+1,out[i][3]+1);
  }

  return 0;
}


Measured memory_bytes: 9904
def combi(x):
    return x * (x-1) //2

n = int(input())
a = list(map(int,input().split()))

#print(a)    #思い出すときに使おう　動きが分かるよ

for i in range(len(a)):
    a[i] -= 1

#print(a)

cnt = [0] * n

for i in range(len(a)):
    cnt[a[i]] += 1

#print(cnt)

total = 0

for i in cnt:
    total += combi(i)

for i in range(n):
    #ans = total
    #ans -= combi(cnt[a[i]])
    #ans += combi(cnt[a[i]]-1)
    ans = total - cnt[a[i]] + 1
    print(ans)

Measured memory_bytes: 26140
# -*- coding: utf-8 -*-
# input
n = int(input())
a = list(map(int, input().split()))
c = o = 0
for i in range(n):
    if a[i] != i+1 and c == 0:
        c = 1
        o = a[i]
        if a[o-1] != i+1:
            print('NO')
            exit()
    elif a[i] != i+1 and c == 1:
        if i+1 != o:
            print('NO')
            exit()
print('YES')


Measured memory_bytes: 3060
import itertools
N = int(input())
XY = [tuple([int(_) for _ in input().split()][::-1]) for _ in range(N)]
XY.sort()


def calc(a, b, c, d, e, f):
    if (c - a) * (e - a) + (d - b) * (f - b) < 0:
        return ((e-c)**2+(f-d)**2)/4
    if (e - c) * (a - c) + (f - d) * (b - d) < 0:
        return ((a-e)**2+(b-f)**2)/4
    if (a - e) * (c - e) + (b - f) * (d - f) < 0:
        return ((a-c)**2+(b-d)**2)/4

    if (e - a) * (b - d) == (c - a) * (b - f):
        vx = max([a, c, e]) - min([a, c, e])
        vy = max([b, d, f]) - min([b, d, f])
        return (vx**2 + vy**2) / 4
    Py = ((e - a) * (a**2 + b**2 - c**2 - d**2) -
          (c - a) * (a**2 + b**2 - e**2 - f**2)) / (2 * (e - a) * (b - d) - 2 *
                                                    (c - a) * (b - f))
    if c - a:
        Px = (2 * (b - d) * Py - a**2 - b**2 + c**2 + d**2) / (2 * (c - a))
    else:
        Px = (2 * (b - f) * Py - a**2 - b**2 + e**2 + f**2) / (2 * (e - a))
    R2 = ((Px - a)**2 + (Py - b)**2)
    return R2


# ps = [(x, y), ...]: ソートされた座標list
def cross(a, b, c):
    return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0])


def convex_hull(ps):
    qs = []
    n = len(ps)
    for p in ps:
        while len(qs) > 1 and cross(qs[-1], qs[-2], p) > 0:
            qs.pop()
        qs.append(p)
    t = len(qs)
    for i in range(n - 2, -1, -1):
        p = ps[i]
        while len(qs) > t and cross(qs[-1], qs[-2], p) > 0:
            qs.pop()
        qs.append(p)
    return qs


XY = convex_hull(XY)[::-1]
N = len(XY)

ans = -1
if N == 2:
    a, b = XY[0]
    c, d = XY[1]
    print(((a - c)**2 + (b - d)**2)**0.5 / 2)
    exit()
for i, j, k in itertools.combinations(range(N), 3):
    a, b = XY[i]
    c, d = XY[j]
    e, f = XY[k]
    r2 = calc(a, b, c, d, e, f)
    if r2 > ans:
        ans=r2
print(ans**0.5)


Measured memory_bytes: 44252