akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
constexpr int inf = 1001001001;
#define chmin(x, y) x = min(x, y)
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n;
    string s;
    cin >> n >> s;
    int left = 0, right = n;
    for(int i = 0; i < n; ++i){
        if(s[i] == '#') break;
        ++left;
    }
    for(int i = n - 1; i >= 0; --i){
        if(s[i] == '.') break;
        --right;
    }
    if(right - left <= 0){
        cout << 0 << endl;
        return 0;
    }
    int ans = inf;
    int sz = right - left;
    vector<int> S1(sz + 1, 0), S2(sz + 1, 0);
    for(int i = 0; left + i < right; ++i){
        if(s[left + i] == '#'){
            S1[i + 1] += S1[i] + 1;
            S2[i + 1] += S2[i];
        }
        else{
            S1[i + 1] += S1[i];
            S2[i + 1] += S2[i] + 1;
        }
    }
    for(int i = 0; i <= sz; ++i){
        int foo = S1[i] - S1[0] + S2[sz] - S2[i];
        chmin(ans, foo);
    }
    cout << ans << endl;
}

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

using namespace std;

const double pi = 3.1415926535897932;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
  int x, y, h, m;
  cin >> x >> y >> h >> m;
  double angle = (1.0 * m / 12) + (5.0 * h - m);
  angle = 6.0 * angle * pi / 180;
  double ans = (x * x) + (y * y) - 2 * x * y * cos(angle);
  ans = sqrt(ans);
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 4240
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  Int n,m;
  cin>>n>>m;
  vector<Int> a(n);
  for(Int i=0;i<n;i++) cin>>a[i];
  Int ans=0,res=0;
  map<Int, Int> dp;
  dp[res]++;
  for(Int i=0;i<n;i++){
    res+=a[i];
    res%=m;
    ans+=dp[res];
    //cout<<a[i]<<":"<<res<<":"<<dp[res]<<endl;
    dp[res]++;
  }
  cout<<ans<<endl;
  return 0;
}


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

int main(){
  int N;
  cin >> N;
  vector<int64_t> A(N + 1);
  A.at(0) = 2LL;
  A.at(1) = 1LL;
  
  for(int i = 2; i < N + 1; i++){
    A.at(i) = A.at(i - 1) + A.at(i - 2);
  }
  cout << A.at(N) << 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 res = a[0];
        for(int i=1; i<n; i++) {
            res = div(res, a[i]);
        }

        System.out.println(res);
    }

    static int div(int a, int b) {
        int c = Math.max(a, b);
        int d = Math.min(a, b);
        if(c % d == 0) return d;
        return div(d, c % d);
    }
}


Measured memory_bytes: 50628
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var S = Read();
            var T = Read();

            var ans = 0;
            for (int i = 0; i < 3; i++)
            {
                if (S[i] == T[i])
                    ans++;
            }
            Println(ans);
        }

        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static void YESOrNO(bool e) => Println(e ? "YES" : "NO");

        static void YesOrNo(bool e) => Println(e ? "Yes" : "No");

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());
        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


Measured memory_bytes: 13140
def main():
    n = int(input())
    table = {}
    m = 0
    for i in range(n):
        s = input()
        if s not in table:
            table[s] = 0
        table[s] += 1
        m = max(m, table[s])

    table = dict(filter(lambda x: x[1] == m, table.items()))
    table = sorted(table.items(), key=lambda x: x[0])

    for t in table:
        print(t[0])


main()


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

const int maxn =2e5+10;
const int mod=1e9+7;
int check(int x)
{
    for(ll i=2;i*i<=x;i++)
    {
        if(x%i==0)
            return false;
    }
    return true;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n;
	cin>>n;
	int cnt=0;
	map<ll,int>mp;
	for(ll i=2;i*i<=n;i++)
    {
        if(n%i==0&&check(i))
        {
            ll x=1;
            while(n%i==0)
            {
                x*=i;
                if(mp[x]==0)
                {
                    cnt++;
                    mp[x]=1;
                    x=1;
                }
                n/=i;
            }
        }
    }
    if(n>1)
        cnt++;
    cout<<cnt<<'\n';






}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define endl "\n"
#define inf 1000000007
#define FOR(i, a, b) for(int i=a; i<b; i++)
int dp[1000001] = {0};

void solve(){
	int a, b;
	cin>>a>>b;
	if(2*b>a)cout<<'0';
	else{
		cout<<a-2*b;
	}
}
signed main(){
	#ifdef _DEBUG
		freopen("input.txt", "r", stdin);
    	freopen("output.txt", "w", stdout);
	#endif
	
	ios::sync_with_stdio(false);
	cin.tie(0);
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
 
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

//-------------------------------------

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

ll LCM(ll a, ll b)
{
    return a * b / GCD(a, b);
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll lcm = LCM(c, d);
    ll ans = (b - a + 1) - (b / c + b / d - b / lcm) + ((a - 1) / c + (a - 1) / d - (a - 1) / lcm);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

const int MAX_V = 30000;
int w,h;
struct Edge {
    int to,cost;
    Edge(int to,int cost) : 
        to(to),cost(cost) {}
};
map<pair<P,string>,int> ids;
vector<Edge> G[MAX_V];
template<class T>
bool chmin(T& a,const T& b) {
    if(b<a) {
        a=b;
        return true;
    }

    return false;
}
int to_id(P p,string s) {
    pair<P,string> ps=pair<P,string>(p,s);
    if(!ids.count(ps)) ids[ps]=ids.size();

    return ids[ps];
}
int d[MAX_V];
int dijk(int s,int t) {
    rep(i,MAX_V) d[i]=INF;
    d[s]=0;
    priority_queue<P,vector<P>,greater<P> > que;
    que.push(P(0,s));

    while(que.size()) {
        P p=que.top(); que.pop();
        int v=p.sc;
        int cost=p.fr;

        rep(i,G[v].size()) {
            Edge e=G[v][i];
            if(chmin(d[e.to],d[v]+e.cost)) {
                que.push(P(d[e.to],e.to));
            }
        }
    }

    return d[t];
}


int diff(P p1,P p2) {
    return abs(p1.fr-p2.fr)+abs(p1.sc-p2.sc);
}
string to_s(int n) {
    stringstream ss;
    ss<<n;
    return ss.str();
}
int to_i(string& s) {
    int ret;
    stringstream ss;
    ss<<s;
    ss>>ret;
    return ret;
}
string maze[102][102];
void solve() {
    rep(i,MAX_V) G[i].clear();
    rep(i,h) rep(j,w) cin>>maze[i][j];
    map<string,set<P> > points;
    vector<int> vec;
    rep(y,h) rep(x,w) {
        if(maze[y][x]!=".") points[maze[y][x]].insert(P(y,x));
        if(maze[y][x]!="."&&maze[y][x]!="S"&&maze[y][x]!="G") vec.pb(to_i(maze[y][x]));
    }
    sort(all(vec));
    vec.erase(unique(all(vec)),vec.end());

    /*
    to_id("S");
    rep(i,vec.size()) to_id(to_s(vec[i]));
    to_id("G");
    // */

    rep(i,vec.size()+1) {
        string s=to_s(i);
        string t=to_s(i+1);
        if(i==0) s="S";
        if(i==vec.size()) t="G";
        for(auto& e1 : points[s]) {
            for(auto& e2 : points[t]) {
                // cout<<s<<" -> "<<t<<" : "<<diff(e1,e2)<<endl;
                G[to_id(e1,s)].pb(Edge(to_id(e2,t),diff(e1,e2)));
            }
        }
    }


    cout<<dijk(to_id(*points["S"].begin(),"S"),to_id(*points["G"].begin(),"G"))<<endl;
}

int main() {
    while(cin>>w>>h) {
        if(w+h==0) break;
        solve();
    }
    return 0;
}

Measured memory_bytes: 14224
"use strict"

function func(val){
  return (1+val)/2;
}

function Main(input) {
  input = input.trim().split('\n');
  const N = input[0].trim().split(' ').map(Number)[0];
  const K = input[0].trim().split(' ').map(Number)[1];
  const p = input[1].trim().split(' ').map(Number);

  let arr = [0];
  for(let i=0; i<N; i++){
    arr.push(func(p[i]) + arr[i]);
  }

  let ret = 0;
  const max = N - K;
  for(let i=0; i<=max; i++){
    let tmp = arr[i+K] - arr[i];
    if(ret < tmp) ret = tmp
  }
  console.log(ret);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 36464
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
vector<vector<int>> v;
int n,m;
int st,gl;
int bfs(){
    queue<pair<int,int>> q;
    q.push(make_pair(st,0));
    vector<vector<int>> d(m,vector<int>(3,-1));
    d[st][0]=0;
    while(!q.empty()){
        pair<int,int> now = q.front();
        int pos=now.first,time=now.second;
        q.pop();
        for(int i=0;i<v[pos].size();i++){
            if(d[v[pos][i]][(time+1)%3]>=0) continue;
            d[v[pos][i]][(time+1)%3]=d[pos][time]+1;
            q.push(make_pair(v[pos][i],(time+1)%3));
        }
        
    }
    return d[gl][0];
}
int main(){
    cin>>n>>m;
    v.resize(n);
    rep(i,m){
        int a,b;
        cin>>a>>b;
        a--;b--;
        v[a].push_back(b);
    }
    cin>>st>>gl;
    st--;gl--;
    if(m==0){
        cout<<-1<<endl;
        return 0;
    }
    int ans=bfs();
    if(ans>=0)  ans/=3;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
const double PI = 3.141592653589;

int main() {
    double a, b, x;
    cin >> a >> b >> x;
    cout << fixed << setprecision(10);
    if (x <= a * a * b / 2) {
        cout << 90 - atan(2 * x / (a * b * b)) * 180 / PI << endl;
    } else {
        cout << 90 - atan(a / (2 * (b - x / (a * a)))) * 180 / PI << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

const int MAX_V = 2e2;
vector<int> col(MAX_V, -1);
vector<int> es[MAX_V];
bool able = true;

void dfs(int now){
    for(auto &e: es[now]){
        if(col[e] == -1){
            col[e] = col[now]^1;
            dfs(e);
        }
        else{
            if(col[e] == col[now]) able = false;
        }
    }
}

int main(){
    int N;
    cin >> N;
    string S[N];
    rep(i, N) cin >> S[i];
    int d[N][N];
    rep(i, N) rep(j, N){
        if(S[i][j] == '1') es[i].pb(j), es[j].pb(i);
        if(S[i][j] == '0' && i != j) d[i][j] = inf;
        else d[i][j] = S[i][j]-'0';
    }
    rep(k, N){
        rep(i, N){
            rep(j, N) chmin(d[i][j], d[i][k]+d[k][j]);
        }
    }
    int M = 0;
    rep(i, N){
        rep(j, N) chmax(M, d[i][j]);
    }
    col[0] = 0;
    dfs(0);
    if(!able) cout << -1 << endl;
    else cout << M+1 << endl;
}

Measured memory_bytes: 896
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <numeric>
#include <random>
#include <vector>
#include <array>
#include <bitset>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
 
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

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

Measured memory_bytes: 3652
#include <iostream>
using namespace std;
int main(){
   string N;
   cin>>N;
   bool r=false;
   for(int i=0; i<N.size();i++){
    if(N[i]=='7'){

        r=true;
        break;
    }
   }
   if(r)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;

return 0;
}

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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int V, E;
  cin >> V >> E;

  const int INF = INT_MAX;
  int dis[110][110];
  fill((int*)dis, (int*)(dis + V), INF);
  for (int i = 0; i < V; i++) dis[i][i] = 0;

  for (int i = 0; i < E; i++) {
    int s, t, d;
    cin >> s >> t >> d;
    dis[s][t] = d;
  }
  for (int k = 0; k < V; k++) for (int i = 0; i < V; i++) for (int j = 0; j < V; j++) {
    if (dis[i][k] == INF || dis[k][j] == INF) continue;
    dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
  }
  for (int i = 0; i < V; i++) {
    if (dis[i][i] < 0) {
      cout << "NEGATIVE CYCLE" << endl;
      return 0;
    }
  }
  for (int i = 0; i < V; i++) {
    for (int j = 0; j < V; j++) {
      if (dis[i][j] == INF) cout << "INF";
      else cout << dis[i][j];
      cout << " \n"[j + 1 == V];
    }
  }

  return 0;
}


Measured memory_bytes: 3272
#coding:utf-8
from __future__ import division,print_function
try:
    input = raw_input
except NameError:
    pass

from datetime import datetime
import math

MAXW = 1001

def solve(n, read, write):
    sumR = sum(read)
    sumW = sum(write)

    next = []
    base = -1
    for i in range(n):
        if read[i] < sumR // 2:
            next.append((read[i], write[i]))
        else:
            base = read[i]
    if (len(next) == n):
        print(sumR + sumW)
        return

    dp = [False] * MAXW
    dp[0] = True
    for i in range(n - 1):
        tmp = dp[:]
        for j in range(base + 1):
            if dp[j]:
                na = j + next[i][0]
                nb = j + next[i][0] + next[i][1]
                if na <= base:
                    tmp[na] = True
                if nb <= base:
                    tmp[nb] = True
        dp = tmp
    res = 0
    for i in range(base + 1):
        if dp[i]:
            res = base - i
    print(sumR + sumW + res)

def main():
    while True:
        n = int(input())
        if n == 0: return
        read = []
        write = []
        for i in range(n):
            r, w = map(int, input().split())
            read.append(r)
            write.append(w)
        solve(n, read, write)

main()

Measured memory_bytes: 4652
import bisect
n=int(input())
h=[]
for i in range(n):
  a=int(input())
  if len(h)==0:
    h.append(-1*a)
  elif (-1)*a>=h[-1]:
    h.append(-1*a)
  else:
    index=bisect.bisect_right(h,-1*a)
    h[index]=-1*a
print(len(h))


Measured memory_bytes: 49752
#include<bits/stdc++.h>
using namespace std;
 
 
 long long int dp[100005];
 long long int call( int arr[],int n,int i,int k)
 {
 	if(i>=n-1)
 	return 0;
 	
 	if(dp[i]!=-1)
 	return dp[i];
 	
 	int p=INT_MAX;
 	for(int j=i+1;j<=i+k;j++)
 	{  int t;
 	
	   if(j<n)
      {t=call(arr,n,j,k)+abs(arr[j]-arr[i]);
       p=min(p,t);
      }
    }
     return dp[i]=p;
 }
 
 
 int main()
{   ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n,k;
    cin>>n>>k;
    int arr[n];
    for(int i=0;i<n;i++)
     cin>>arr[i];
     
    for(int i=0;i<=n;i++)
     dp[i]=-1;
     
    cout<<call(arr,n,0,k);
	return 0;
}  

Measured memory_bytes: 10752
h,n = [int(x) for x in input().split()]
d = []
mp = []
for _ in range(n):
    a,b = [int(x) for x in input().split()]
    d.append(a)
    mp.append(b)
ma = max(d)
dp = [[float("inf")]*(h+ma) for i in range(n+1)]
dp[0][0] = 0
for i in range(n):
    for j in range(h+ma):
        if j<d[i]:
            dp[i+1][j] = dp[i][j]
        else:
            dp[i+1][j] = min(dp[i][j],dp[i+1][j-d[i]]+mp[i])
    
ans = dp[n][h:h+ma+1]
print(min(ans))

Measured memory_bytes: 311944
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N, A, B;
    cin >> N >> A >> B;
    int ecnt = 0, mcnt = 0, dcnt = 0;
    
    rep(i, N) {
        int p;
        cin >> p;
        
        if (p <= A) {
            ecnt++;
        }
        else if (p > B) {
            dcnt++;
        }
        else {
            mcnt++;
        }
    }
    
    cout << min(ecnt, min(mcnt, dcnt)) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define MOD (1000000007l)

using namespace std;

int main(void) {
  long N, K;
  cin >> N >> K;
  if ((N+1)/2 >= K) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <stdio.h>
using namespace std;

int main()
{
    string s,p;
    getline(cin,s);
    getline(cin,p);
    s+=s;
    if(s.find(p) <= s.length()){
            cout << "Yes\n";
    }else{
        cout << "No\n";
    }

    return 0;
}


Measured memory_bytes: 3220
// ADITYA JAIN

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

#define f first
#define s second
#define pb push_back
#define all(c) c.begin(),c.end()

#define gi(x) scanf("%d", &x)
#define pi(x) printf("%d", x)
#define gl(x) scanf("%lld", &x)
#define pl(x) printf("%lld", x)
#define sp printf(" ")
#define nl printf("\n")

typedef long long int lld;
typedef long double ldb;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " : " << arg1 << std::endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif
#define mp make_pair
int a[333][333];
lld l[1000010];
vector <pair <int, int> > vv(1000010);

main(){
    ios_base::sync_with_stdio(false);
    int h, w, d;
    cin >> h >> w >> d;
    for(int i = 1; i <= h; ++i){
        for(int j = 1; j <= w; ++j){
            cin >> a[i][j];
            vv[a[i][j]] = mp(i, j);
        }
    }
    for(int i = h*w; i > 0; --i){
        if(i+d <= h*w) l[i] = l[i+d] + abs(vv[i].f-vv[i+d].f) + abs(vv[i].s-vv[i+d].s);
    }
    int q;
    cin >> q;
    while(q--){
        int ll, rr;
        cin >> ll >> rr;
        cout << l[ll] - l[rr] << endl;
    }
}


Measured memory_bytes: 11776
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <vector>
#include <numeric>
#include <algorithm>

using namespace std;
// #define int long long
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)

struct Data{
    string city;
    int ex_pos; // 元の位置
    int num; // 実際のデータ
};

bool wayToSort(const Data &SP, const Data &SP2) {
  if (SP.city == SP2.city){
    return {SP.num > SP2.num};
  }else{
    return {SP.city < SP2.city};
  }
};

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

int main(int argc, const char * argv[]) {

    // source code
    // char s[4];
    int N;
    cin >> N;
    vector<Data> SP(N);
    rep(i,N){
      // cin >> SP[i]
      // string t;
      cin >> SP[i].city >> SP[i].num;
      SP[i].ex_pos = i;

    }

    sort(SP.begin(), SP.end(), wayToSort);

    rep(i,N){
        cout << SP[i].ex_pos+1 << endl;
    }



    return 0;
}

Measured memory_bytes: 256
a = []
a = gets.split.map(&:to_i)
if a[2] >= a[1] + a[0]
puts a[2]-a[1]-a[0]
elsif a[1] >= a[2] + a[0]
  puts a[1]-a[2]-a[0]
elsif a[1] + a[0] >= a[2] && a[2] >= a[1]
  puts 0
elsif a[2] + a[0] >= a[1] && a[1] >= a[2]
  puts 0
end

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

using LL = long long;
int N;
int A, B, C;
LL lb, ub = 1<<30;
std::vector<int> emy;

void solve(int T) {

}

int main() {
	std::cin >> N >> A >> B;
	C = A - B;
	for (int i = 0; i < N; i++) {
		int tmp;
		std::cin >> tmp;
		emy.push_back(tmp);
	}
	std::sort(emy.rbegin(), emy.rend());
	while (ub - lb > 1) {
		LL mid = (ub + lb) / 2;
		LL dam = (LL)B*mid;
		LL con = 0;
		for (int i = 0; i < N; i++) {
			if (dam >= (LL)emy[i])continue;
			else {
				con += ((LL)emy[i] - dam) / (LL)C;
				if (((LL)emy[i] - dam) % (LL)C != 0)con++;
			}
		}
		if (con <= mid)ub = mid;
		else lb = mid;
	}
	std::cout << ub << std::endl;
	return 0;
}

Measured memory_bytes: 892
#include <iostream>
#include <cmath>
#include <queue>
using namespace std;

int main(){
  int a1, a2, a3;
  cin >> a1 >> a2 >> a3;
  priority_queue<int>Q;
  Q.push(abs(a2-a1));
  Q.push(abs(a3-a2));
  Q.push(abs(a1-a3));
  int ret=0;
  Q.pop();
  ret += Q.top();
  Q.pop();
  ret += Q.top();
  cout << ret;
  return 0;
}

Measured memory_bytes: 256
A=int(input())
B=int(input())
C=int(input())
X=int(input())
ans=0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500*i+100*j+50*k==X:
                ans+=1
print(ans)


Measured memory_bytes: 3060
/*
ID: BaKe
PROG:
LANG: C++14
*/
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstdio>
#include <fstream>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <map>

using namespace std;

typedef long long ll;
typedef pair <int, int> pii;

#define F first
#define S second
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()

const int N = 2e6 + 123;
const int INF = 1e9 + 123;
int n;

int main () {
    ios_base :: sync_with_stdio(0);
    cin >> n;
    int mn = INF;
    for(int i = 1; i <= n / 2; ++i) {
        int n1 = i, n2 = n - i, sum1 = 0, sum2 = 0;
        while(n1) {
            sum1 += (n1 % 10);
            n1 /= 10;
        }
        while(n2) {
            sum2 += (n2 % 10);
            n2 /= 10;
        }
        mn = min(mn, (sum1 + sum2));
    }
    cout << mn;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define lb lower_bound
#define ub upper_bound
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T> inline T mpow(T a, T n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}



signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll n,t,a;cin>>n>>t>>a;
  a--;t--;
  VV<int> e(n,V<int>(0));
  V<int> ao(n,0);
  V<bool> used(n,false);
  
  rep(i,0,n-1){
    int x,y;cin>>x>>y;
    x--;y--;
    e[x].pb(y);
    e[y].pb(x);
  }

  queue<int> q;
  q.push(a);
  q.push(0);
  used[a]=true;

  while(q.size()){
    int now=q.front();
    q.pop();
    int dist=q.front();
    q.pop();
    ao[now]=dist;
    rep(i,0,siz(e[now])){
      if(!used[e[now][i]]){
        used[e[now][i]]=true;
        q.push(e[now][i]);
        q.push(dist+1);
      }
    }
  }

  ll mx=0;
  used.assign(n,false);
  q.push(t);
  q.push(0);
  used[t]=true;

  while(q.size()){
    int now=q.front();
    q.pop();
    int dist=q.front();
    q.pop();
    chmax(mx,ao[now]-1);
    for(auto&& i:e[now]){
      if(!used[i] && dist+1<ao[i]){
        used[i]=true;
        q.push(i);
        q.push(dist+1);
      }
    }
  }
  cout<<mx<<ENDL;



}
//( ・ __ ・ ) KEEP BEING ORGANIZED
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 6400
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>

#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define MAX 1000000007

using namespace std;

struct UnionFind{
  vector<int> par,num;

  UnionFind(int N) : par(N),num(N){
    for(int i=0;i<N;i++){
      par[i] = i;
      num[i] = 1;
    }
  }

  int root(int x){
    if(par[x] == x) return x;
    return par[x] = root(par[x]);
  }

  void unite(int x, int y){
    int rx = root(x);
    int ry = root(y);
    if(rx == ry) return;
    par[rx] = ry;
    num[ry] = num[ry]+num[rx]; 
  }

  int get_num(int x){
    int rx = root(x);
    return num[rx];
  }

  bool same(int x, int y){
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};


int main(void){
  int n;
  cin >> n;
  bool flag = true;
  rep(i,n){
    int work;
    cin >> work;
    if(work%2 == 1){
      continue;
    }
    if(work%3 == 0 || work%5 == 0){
      continue;
    }
    flag = false;
  }

  if(flag){
    cout << "APPROVED" << endl;
  }
  else{
    cout << "DENIED" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int R = sc.nextInt();
		int C = sc.nextInt();
		int Y1 = sc.nextInt();
		int X1 = sc.nextInt();
		int Y2 = sc.nextInt();
		int X2 = sc.nextInt();
		int h = Math.abs(Y2 - Y1);
		h = Math.min(h, R - h);
		int w = Math.abs(X2 - X1);
		w = Math.min(w, C - w);
		BigInteger ans = BigInteger.ONE;
		for (int i = 0; i < h; ++i) {
			ans = ans.multiply(BigInteger.valueOf(h + w - i)).divide(BigInteger.valueOf(i + 1));
		}
		if (h * 2 == R) {
			ans = ans.shiftLeft(1);
		}
		if (w * 2 == C) {
			ans = ans.shiftLeft(1);
		}
		System.out.println(ans.mod(BigInteger.valueOf(100000007)));
	}

}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#define int long long

using namespace std;

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string a, b;
    cin >> a >> b;
    if (a.size() + 1 != b.size()) {
        cout << "No";
        return 0;
    }
    if (b.substr(0, a.size()) == a) {
        cout << "Yes";
    }
    else cout << "No";
    return 0;
}



Measured memory_bytes: 3648
import java.util.Scanner;


public class Main {
    static final Scanner sc = new Scanner(System.in);
    static final int MOD = (int) 1E9 + 7;
    
    public static void main(String[] args) {
        int M = nint();
        int D = nint();
        
        int count = 0;
        for (int m = 4; m <= M; m++) {
            for (int d = 10; d <= D; d++) {
                int d10 = d/10;
                int d1 = d%10;
                if (d10 >= 2 && d1 >= 2 && m == d10*d1) {
                    count++;
                }
            }
        }
        System.out.println(count);
    }

    private static long nlong() {
        return sc.nextLong();
    }

    private static int nint() {
        return sc.nextInt();
    }

    private static String nstr() {
        return sc.next();
    }

    private static char[] nsToChars() {
        return sc.next().toCharArray();
    }

    private static long[] nlongs(int n) {
        return nlongs(n, 0, 0);
    }

    private static int[] nints(int n) {
        return nints(n, 0, 0);
    }

    private static int[] nints(int n, int padL, int padR) {
        int[] a = new int[padL + n + padR];
        for (int i = 0; i < n; i++)
            a[padL + i] = nint();
        return a;
    }

    private static long[] nlongs(int n, int padL, int padR) {
        long[] a = new long[padL + n + padR];
        for (int i = 0; i < n; i++)
            a[padL + i] = nlong();
        return a;
    }

    private static String[] nstrs(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = nstr();
        return a;
    }

    private static char[][] nsToChars2D(int h, int w) {
        return nsToChars2D(h, w, 0);
    }

    private static char[][] nsToChars2D(int h, int w, int pad) {
        char[][] a2 = new char[h + pad * 2][w + pad * 2];
        for (int i = 0; i < h; i++)
            System.arraycopy(nsToChars(), 0, a2[pad + i], pad, w);
        return a2;
    }
}


Measured memory_bytes: 23764
#include<iostream>
#include<stdio.h>
#include<vector>//s1.erase(n)=文字列s1の、n文字目以降削除
#include<algorithm>//辞書順=next_permutation
#include<set>
#include<string>//char 小文字のほうが32大きい
#include<sstream>
#include<string.h>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap=数値交換

#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//標準=昇順
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define str string
#define please return
#define AC 0
#define ic_a int a;cin>>a;
#define ic_b int b;cin>>b;
#define ic_s string s;cin>>s;
#define Rapid_pleaseAC_fast cin.tie(0);ios::sync_with_stdio(false)
#define Pi 3.1415926535897932384626
#define nine 1000000000
using ll = long long;
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
typedef long double ld;
const ld eps = 1.0e-12; // 許容される誤差
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

int keta(int n) {
	int sum = 0;
	while (n != 0) {
		sum += n % 10; n /= 10;
	}
	return sum;//Nanashi,tRue,wai
}

/*

 (char)toupper(a[n])=文字列のn文字目を大文字で出力

  pow(a,b)=aのb乗

  */
ld mysqrtl(ld x)
{
	ld a = sqrtl((double)x); // 近似値
	do {
		a = (a + x / a) / 2.0L;
	} while (fabsl(x - a * a) > eps);
	return a;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);

}

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

//平方根を求める。sqrtより精度が高い。
//epsを変えて誤差を調整する。
int main(void) {
	Rapid_pleaseAC_fast;
	llint ans = 0, n = 0, count = 0, sum = 0, near = 1000, r;
	llint  k, num = 0;
	int value_to_remove = 0;
	bool check = false;
	string ss, sss;
	vector<llint> array, counter;
	vector<bool> bo;
	char c;
	vector<char> cclemon;
	cin >> n;
	
	cout <<n+n*n+n*n*n<< endl;
	please AC;
}



Measured memory_bytes: 3196
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        l: [u64; n],
    }
    let mut l = l;
    l.sort();
    let ll = l.pop().unwrap();
    println!(
        "{}",
        if ll < l.iter().sum::<u64>() {
            "Yes"
        } else {
            "No"
        }
    );
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;



int main(){
    string s;
    cin >> s;
    if(s=="ABC"){
        cout << "ARC" << endl;
    }
    else{
        cout << "ABC" << endl;
    }

   

}

Measured memory_bytes: 3592
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
ll INF = 1e18;

int main() {
  //
  ll n;
  cin >> n;
  vl b(n);
  vl op;
  rep(i, n) cin >> b[i];
  for (ll i = n - 1; i >= 0; i--) {
    bool erased = false;
    for (ll j = i + 1; j >= 0; j--) {
      // cout << j << ":" << b[j - 1] << endl;
      if (b[j - 1] == j) {
        b.erase(b.begin() + j - 1);
        op.push_back(j);
        erased = true;
        break;
      }
    }
    if (!erased) {
      cout << -1 << endl;
      return 0;
    }
  }
  reverse(ALL(op));
  rep(i, op.size()) { cout << op[i] << endl; }
  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);

        StringTokenizer st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());

        HashMap<Integer, Set<Integer>> map = new HashMap<>();
        for(int i=1; i<=n; i++){
            map.put(i, new HashSet<Integer>());
        }

        for(int i=0; i<m; i++){
            StringTokenizer pair = new StringTokenizer(br.readLine());
            int v1 = Integer.parseInt(pair.nextToken());
            int v2 = Integer.parseInt(pair.nextToken());

            map.get(v1).add(v2);
            map.get(v2).add(v1);
        }

        int max = 0;
        boolean[] vis = new boolean[n+1];

        for(int i=1; i<=n; i++){
            if(!vis[i]){
                max = Math.max(max, dfs(i, vis, map));
            }
        }

        System.out.println(max);
    }

    static int dfs(int i, boolean[] vis, HashMap<Integer, Set<Integer>> map){
        vis[i] = true;
        int size = 1;

        Set<Integer> fr = map.get(i);
        
        for(int next: fr){
            if(!vis[next]){
                size += dfs(next, vis, map);
            }
        }

        return size;
    }
}


Measured memory_bytes: 167560
#include <stdio.h>
#include <iostream>
#include <set>
#include <vector>
#include <map>
using namespace std;

int main() {

  vector<int> vc;
  std::map<int, int> mp; 
  set<int> st;

  int n;
  cin >> n;

  for (int i = 0; i < n; i++) {
    int num;
    cin >> num;
    vc.push_back(num);
  }
  for (int s = 0; s < n - 1; s++) {
    cout << vc[s] << " ";
  }
  cout << vc[n-1] << endl;

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

    int v = vc[i];
    int j = i - 1;
    while(j >= 0 && vc[j] > v) {
      vc[j+1] = vc[j];
      j--;
    }
    vc[j+1] = v;

    for (int s = 0; s < n - 1; s++) {
      cout << vc[s] << " ";
    }
    cout << vc[n-1] << endl;
  }
}



Measured memory_bytes: 3144
#include<iostream>
#include <string>
#include <algorithm>
using namespace std;
string s;
string sp;
string sb;
string rsp;
string rsb;
string rs;
void solve()
{
    bool ss=false,ssp=false,ssb=false;
    int n=s.length();
    sp=s.substr(0,(n-1)/2);
    sb=s.substr((n+3)/2-1);
    rs=s;
    reverse(rs.begin(),rs.end());
    rsp=sp;
    reverse(rsp.begin(),rsp.end());
    rsb=sb;
    reverse(rsb.begin(),rsb.end());
    if(rs==s)
        ss=true;
    if(rsb==sb)
        ssb=true;
    if(rsp==sp)
        ssp=true;
    if(ss&&ssb&&ssp)
        cout<<"Yes";
    else
        cout<<"No";
}
int main()
{
    cin>>s;
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <stdlib.h>
#include <math.h>


int main(void)
{
	long int i, j;
	long int n, k;
	long int sum;
	long int max;
	long int count;
	long int b[100];
	long int y[100];
	
	scanf("%ld", &n);
	
	b[0] = 1000000;
	
	for(i = 1; i <= n - 1; i++) {
		scanf("%ld", &b[i]);
	}
	
	sum = b[n - 1];
	
	for(i = n - 1; i > 0; i--) {
		if(b[i] > b[i - 1]) {
			sum += b[i - 1];
		} else {
			sum += b[i];
		}
	}
	
	printf("%ld\n", sum);
	
	
	return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
char a[100][100];
int main()
{
    int h,w,i,j;

    while(~scanf("%d%d",&h,&w))
    {
        for(i=0; i<h; i++)
            scanf("%s",a[i]);
        for(i=0; i<h; i++)
            for(j=0; j<w; j++)
                if(a[i][j]=='.')
                    a[i][j]='0';
        for(i=0; i<h; i++)
            for(j=0; j<w; j++)
                if(a[i][j]=='#')
                {
                    if(i-1!=-1)
                    {
                        if(a[i-1][j-1]!='#'&&j-1!=-1)
                            a[i-1][j-1]++;
                        if(a[i-1][j]!='#')
                            a[i-1][j]++;
                        if(a[i-1][j+1]!='#'&&j+1!=w+1)
                            a[i-1][j+1]++;
                    }
                    if(i+1!=h+1)
                    {
                        if(a[i+1][j-1]!='#'&&j-1!=-1)
                            a[i+1][j-1]++;
                        if(a[i+1][j]!='#')
                            a[i+1][j]++;
                        if(a[i+1][j+1]!='#'&&j+1!=w+1)
                            a[i+1][j+1]++;
                    }
                    if(a[i][j-1]!='#'&&j-1!=-1)
                        a[i][j-1]++;
                    if(a[i][j+1]!='#'&&j+1!=w+1)
                        a[i][j+1]++;

                }
        for(i=0; i<h; i++)
        {
            for(j=0; j<w; j++)
                printf("%c",a[i][j]);
            printf("\n");
        }
        memset(a,0,sizeof(a));
    }
    return 0;
}


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

#define debug(x) cerr << #x << ": " << x << endl
#define debugArray(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge] << endl
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
const ll INF = LLONG_MAX/2;
const ll MOD = 1e9+7;
const double EPS=1e-12;

ll gcd(ll x,ll y){
  return y? gcd(y,x%y):x;
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;cin>>N;
  pair<ll,ll> w[N];
  for(ll i=0;i<N;i++){
    cin>>w[i].second>>w[i].first;
  }
  sort(w,w+N);
  ll cur=0;
  bool isok=true;
  for(ll i=0;i<N;i++){
    cur+=w[i].second;
    isok &= cur<=w[i].first;
  }
  cout<<(isok? "Yes":"No")<<endl;
  return 0;
}


Measured memory_bytes: 3328
#include <stdio.h>

struct vector{int a; int b;};

int main(void) {
    int i, n, k, l, p, q, m;
    scanf("%d %d", &n, &k);
    if(k > (n-1)*(n-2)/2){printf("-1\n"); return 0;}
    struct vector v[n*(n-1)/2];
    for(i = 0; i < n-1; ++i){
        v[i].a = 1; v[i].b = i+2;
    }
    p = 2; q = 3;
    for(l = (n-1)*(n-2)/2; l > k; ++i, ++q, --l){
        v[i].a = p; v[i].b = q;
        if(q >= n){++p; q = p;}
    }
    m = i;
    printf("%d\n", m);
    for(i = 0; i < m; ++i){
        printf("%d %d\n", v[i].a, v[i].b);
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)
  
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
  
#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

#define INF 1000000000

typedef double Real;
#define EPS 1e-11
#define EQ(x) (-EPS<x && x<EPS)
typedef complex<Real> P;
Real dot(P a,P b){return real(conj(a)*b);}
Real cross(P a,P b){return imag(conj(a)*b);}

int main(){
  cout.precision(12);
  while(true){
    Real x;
    cin>>x;
    if(x==-1)break;
    Real a = x/2.0;
    while(abs(a*a*a-x)>=0.00001*x){
      a = a-(a*a*a-x)/(3.0*a*a);
    }
    cout<<fixed<<a<<endl;
  }
  return 0;
}

Measured memory_bytes: 1280
// Code for A - Takoyaki
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define FOR(i,x,y) for(ll i=x;i<(ll)(y);i++)

#define MOD 1000000007
#define mod(x) ( (x) % MOD + MOD ) % MOD

#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<typename T, typename U> void view(const std::map<T, U>& m){ for(const auto& e : m){ std::cout << e.first << "=>" << e.second << " "; } std::cout << std::endl; }

int main() {
  int N, X, T;
  cin >> N >> X >> T;

  if (N % X == 0) {
    cout << N / X * T << endl;
    return 0;
  }

  cout << ( (N / X) + 1 ) * T << endl;
  return 0;
}


Measured memory_bytes: 3644
#define _USE_MATH_DEFINES
#define INF 100000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

typedef long long ll;
typedef pair <int,int> P;

static const double EPS = 1e-8;


bool isPrime[10001];

int main(){

	memset(isPrime,1,sizeof(isPrime));

	isPrime[0] = false;
	isPrime[1] = false;
	for(int i=2;i*i<=10000;i++){
		if(isPrime[i]){
			for(int j=i+i;j<=10000;j+=i){
				isPrime[j] = false;
			}
		}
	}

	int N;
	while(~scanf("%d",&N)){
		int res=0;
		for(int i=1,j=N;i<=N;i++,j--){
			if(isPrime[i] && isPrime[j]) res++;
		}

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

Measured memory_bytes: 0