akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<math.h>
int main(){
  int a,b;
  double PI=3.1415926535;
  double x=0,y=0;
  int r=90;
  while(scanf("%d,%d",&a,&b),a||b){
    y+=a*sin(2*PI*r/360);
    x+=a*cos(2*PI*r/360);
    r=(r-b+360)%360;
  }
  printf("%d\n%d\n",(int)x,(int)y);
  return 0;
}

Measured memory_bytes: 604
#include <stdio.h>
 
int main() {
  long long int n, m, number;
  
  scanf("%lld %lld", &n, &m);

  if (n > m / 2) {
    number = m / 2;
  } else {
    number = n;
    m -= n * 2;
    number += m / 4;
  }
  printf("%lld\n", number);
  return 0;
}


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

using namespace std;

int main(){
	
	long long a, b, c, d; cin>>a>>b>>c>>d;
	long long wyn = b*d;
	wyn = max(wyn, a*c);
	wyn = max(wyn, b*c);
	wyn = max(wyn, a*d);
	cout<<wyn;	
	return 0;
}


Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args)
	{
		Scanner s=new Scanner(System.in);
		
		int n=s.nextInt();
		double k=s.nextInt();
		
		double[] arr=new double[n];
		
		double max=0;
		
		for(int i=0;i<n;i++)
		{
			arr[i]=s.nextInt();
			
			max=Math.max(max,arr[i]);
		}
		
		long start=0;
		long end=1000000001;
		
		double ans=max;
		
		while(start<=end)
		{
			long mid=(start+end)/2;
			
			double count=0;
			
			for(int i=0;i<n;i++)
			{
				if(arr[i]>mid)
				count=count+Math.floor(arr[i]/mid);
			}
			
			if(count<=k)
			{
				ans=mid;
				end=mid-1;
			}
			else
			{
				start=mid+1;
			}
			
		}
		
		System.out.println((long)Math.min(ans,max));
		
	}
	
}

Measured memory_bytes: 62592
#include <bits/stdc++.h>
#include <map>
#include <algorithm> 
#include <vector> 
#include <string.h> 
#include <math.h> 
#include <stdio.h> 
#include <stdlib.h> 
#include <chrono> 
#include <thread> 
#include <iomanip>
#include <typeinfo>
 
//define
#define trav(i,v)   for(auto i: v)
#define rep(i,n)    for(int i=0;i<n;i++)
#define repu(i,k,n) for(int i=k;i<=n;i++)
#define repd(i,k,n) for(int i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define all(v)  v.begin(), v.end()
#define itn int 

//typedef
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, int > > vpp;
 
const long long MOD = 1000000007;
// const long long MOD = 998244353;
const long long inf = 100000000000000;

using namespace std;

ll modpow(ll x,ll n){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}

ll power(ll x, ll n)
{
    ll res=1;
    while(n>0){
        if(n&1) res=res*x;
        x=x*x;
        n>>=1;
    }
    return res;
}

void solve()
{
    int n;
    cin>>n;
    vll v(n+1);
    ll sum=0;
    repu(i,1,n)
    {
        cin>>v[i];
        sum+=v[i];
        sum%=MOD;
    }
    ll ans=0;
    repu(i,1,n)
    {
        sum=sum+MOD-v[i];
        sum%=MOD;
        ans+=sum*v[i];
        ans%=MOD;
    }
    cout<<ans<<endl;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int t = 1, tt=1;
    // cin>>t;
    while(tt<=t)
    {
        // cout<<"Case #"<<tt<<": ";
        solve();
        tt++;
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 4776
import math
 
a = []
for i in range(5):
  a.append(int(input()))

m = 9
j = 0
for i in range(5):
  if 0 < a[i] % 10 < m:
          m = a[i] % 10
          j = i

a[j], a[4] = a[4], a[j]

for i in range(5):
  if i != 4:
        a[i] = int(math.ceil(a[i] / 10) * 10)
  #print(a)
  
print(sum(a))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/
 

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


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

    int n, k; cin >> n >> k;
    if((n-1)*(n-2)/2 < k){
        cout << -1 << endl;
        return 0;
    }

    int cnt = (n-1)*(n-2)/2 - k;
    vector<pair<int,int>> ans;

    for(int i=2; i<=n; ++i) ans.push_back(make_pair(1, i));
    int left = 2, right = 3;

    for(int i=0; i<cnt; ++i){
        ans.push_back(make_pair(left, right));
        
        if(right == n){
            ++left;
            right = left+1;
        }
        else{
            ++right;
        }
    }

    cout << ans.size() << endl;
    for(auto e:ans) cout << e.first << ' ' << e.second << endl;
    
    return 0;
}



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

using namespace std;


int main() {
    vector<set<int>> pos(26);
    int N, Q;
    string S;
    cin >> N >> S >> Q;
    for (int i = 0; i < S.length(); i++) {
        int index = S[i] - 'a';
        pos[index].insert(i + 1);
    }

    for (int i = 0; i < Q; i++) {
        int c, x, y;
        char ch;
        cin >> c >> x;
        if (c == 1) {
            cin >> ch;
            pos[S[x - 1] - 'a'].erase(x);
            S[x - 1] = ch;
            pos[S[x - 1] - 'a'].insert(x);
        } else {
            int cnt = 0;
            cin >> y;
            for (int j = 0; j < 26; j++) {
                // BECAREFUL TO USE REFERENCE.
                // If you don't, it will take an awful lot of time
                // to copy the set everytime.
                // e.g., `auto alph_set = pos[j]`
                auto &alph_set = pos[j];
                auto it = alph_set.lower_bound(x);
                if (it != alph_set.end() && *it <= y)
                    cnt++;
            }
            // cout << cnt << endl;
            printf("%d\n", cnt);
        }
    }
}


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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    int n;cin>>n;
    VI a(n);
    REP(i,n){
        cin>>a[i];
    }

    VI v1(1e5+10);
    VI v2(1e5+10);
    for(int i=0;i<n-1;i+=2){
        v1[a[i]]++;
        v2[a[i+1]]++;
    }

    int m10=0,idx10=0,m11=0;
    int m20=0,idx20=0,m21=0;

    REP(i,1e5+10){
        if(v1[i]>=m10){
            m11=m10;
            m10=v1[i];
            idx10=i;
        }
        else if(v1[i]>=m11){
            m11=v1[i];
        }
        if(v2[i]>=m20){
            m21=m20;
            m20=v2[i];
            idx20=i;
        }
        else if(v2[i]>=m21){
            m21=v2[i];
        }
    }
    LL result=0;
    if(idx10!=idx20){
        result=n/2-m10 + n/2-m20;
    }
    else{
        result=n-max(m10+m21,m11+m20);
    }
    cout<<result<<endl;



	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int a = input.nextInt();
        int b = input.nextInt();
        int sum = a * n;
        if(sum > b) System.out.println(b);
        else System.out.println(sum);
    }
}


Measured memory_bytes: 21844
N=int(input())
A=list(map(int,input().split()))
dp=[0]*(10**6+1)
ans=0
for i in A:
  if dp[i]==0:
    for j in range(i,10**6+1,i):
      dp[j]+=1
  else:
    dp[i]+=1
for i in A:
  if dp[i]==1:
    ans+=1
print(ans)


Measured memory_bytes: 32228
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define dd double
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
ll forbid[N];
ll check(ll k){
	while(k){
		ll rem= k%10;
		if(forbid[rem])
			return 0;
		k/=10;
	}
	return 1;
}

int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//ios_base& scientific (ios_base& str);
ll k, n;
cin >> k >> n;
for(int i=0; i<n ;i++){
	ll num;
	cin >> num;
	forbid[num]=1;
}
for(int i=k;;i++){
	if(check(i)){
		cout << i;
		break;
	}
}

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int ans = 0;
    if(s.size() % 2) ans++;
    if(s[0] == s[s.size() - 1]) ans++;
    if(ans % 2 == 0) cout << "Second" << endl;
    else cout << "First" << endl;
}

Measured memory_bytes: 512
// C++(Clang 10.0.0)

//GCC用 ナゾです
//#pragma GCC target("avx")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")

#include <iostream>
#include <stdio.h>
#include <stdlib.h> //rand() 0~RAND_MAX2147483647
#include <math.h>
#include <time.h>   //srand((unsigned int)time(NULL));
#include <unistd.h> //sleep
#include <algorithm>
#include <cmath>
#include <vector>
#include <regex> //正規表現
#include <map>
#include <unordered_map>
#include <set>
#include <cassert> //assart(x>=0) -> x<0の時異常終了
#include <numeric>
#include <iterator>
#include <list>
#include <tuple>
#include <queue>

using namespace std;
#define ll long long int
#define FOR(i,min,max) for(ll i=(min);i<(max);i++)
#define FOReq(i,min,max) for(ll i=(min);i<=(max);i++)
#define FORREV(i,max,min) for(ll i=(max)-1;i>=(min);i--)
#define FORREVeq(i,max,min) for(ll i=(max);i>=(min);i--)

#define all(vec) (vec).begin(),(vec).end()

const int MOD=1e9+7;
const int MOD2=998244353;
const int not0=1;
const int INF=2000000001;
const ll INFll=2e18;
//const int MAX_V=10000;
const double  Micro=1e-5;

int UnUsedVariable(){
    if(INF || Micro || MOD || INFll || MOD2 || not0){;}
    return 0;
}

#define inarray(array,min,max) FOR(i,min,max){cin>>array[i];}
#define inarrayW(arrayA,arrayB,min,max) FOR(i,min,max){cin>>arrayA[i]>>arrayB[i];}
//#define br printf("\n");
#define br cout<<"\n";
#define OutputAndReturn0(x) {cout<<(x)<<endl;return 0;}
#define elif else if

#define issame(a,b,c,d) ((a)==(b) and (b)==(c) and (c)==(d))
#define isdiff3(a,b,c) ((a)!=(b) and (b)!=(c) and (c)!=(a))
#define isdiff4(a,b,c,d) ((a)!=(b) and (b)!=(c) and (c)!=(a) and (d)!=(a) and (d)!=(b) and (d)!=(c))
#define isdiff5(a,b,c,d,e) ((a)!=(b) and (b)!=(c) and (c)!=(a) and (d)!=(a) and (d)!=(b) and (d)!=(c) and (e)!=(a) and (e)!=(b) and (e)!=(c) and (e)!=(d))
#define Func3(f,a,b,c) (f)((f)((a),(b)),(c))
#define Func4(f,a,b,c,d) (f)((f)((f)((a),(b)),(c)),(d))

inline int isEven(int x){return x%2==0;}
inline int isOdd (int x){return x%2==1;}
inline ll samepair(ll x){return x*(x-1)/2;}
inline void printD(double d){printf("%15.15lf ",d);}
inline ll  gcd(ll a,ll b){ if(b==0)return a;else return gcd(b,a%b);}//最大公約数 なお一方が0なら答えは他方になるので番兵は０で良い また、負の数もOK -4%3=-1となるため
inline ll  lcm(ll a,ll b){return a*b/gcd(a,b);}//MODやオーバーフローには注意！
//inline ll  ceil(double a){return (ll)a+1;}
//ans = accumulate(A, A+N, 0, [](int a, int b) {return gcd(a,b);});
//auto count = std::count_if(v.begin(), v.end(), [](int x) { return x == 1 || x == 3; } );

ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

//累積和　しゃくとり法　木構造　DP キュー　乱択アルゴリズム　嘘解法　ハッシュ　next_permulation

//課題：DP 木構造　Xor


ll attack(ll hp){
    if(hp==1)return 1;
    return 2*attack(hp/2)+1;
}

ll probNow(){
    double ans;ans=0;
    ll H;
    cin>>H;
    
    OutputAndReturn0(attack(H));
    
    return 0;
}


signed main(){
    cin.tie(0);    //cinとcoutの結び付き解除（cout時にcinの内容を吐き出さなくなる）
    ios::sync_with_stdio(false);  //coutとprintfの結び付き解除（coutとprintfを同時に使うな！）
    probNow();
    return 0;
}


Measured memory_bytes: 888
import java.util.*;
import java.util.stream.*;

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();
    }
 
    for (int i = 1; i < N; i++) {
      if (A[i - 1] < A[i]) {
        A[i]--;
      } 
      else {
        if (A[i - 1] != A[i]) {
          System.out.println("No");
          return;
        }
      }
    }
    System.out.println("Yes");
  }
}

Measured memory_bytes: 50760
import math 

all_list = []

for i in range(5):
  a = int(input())

  all_list.append(a)
  
last_list = [x % 10 for x in all_list if x % 10 > 0]
last_list2 = [x for x in all_list if x % 10 > 0]

if len(last_list) > 0:
  last_x = last_list2[last_list.index(min(last_list))]
  all_list.remove(last_x)
else:
  last_x = 0

sum_list = [math.ceil(x / 10) * 10 for x in all_list]

m = sum(sum_list) + last_x
print(m)

Measured memory_bytes: 3064
def solve():
  n = int(input())
  h = list(int(i) for i in input().split())
  ans = 1
  tp = h[0]
  for i in range(n-1):
    if tp <= h[i+1]:
      ans += 1
      tp = max(tp,h[i+1])
    else:
      continue
  print(ans)
solve()

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

using namespace std;

const int N = 1e2+7;

int m1, m2, d1, d2;

int main()
{
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    cin >> m1 >> d1 >> m2 >> d2;
    cout << (m1 != m2) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdlib.h>     /* srand, rand */
#include <time.h>       /* time */
#include <bits/stdc++.h>
#include <cmath>
#include <iomanip>
#include <iterator> 
using namespace std;

#define f first
#define s second

#define pb push_back
#define pp pop_back
#define mp make_pair

#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()
#define clr(a,v) memset(a, v, sizeof(a))

#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)
#define reflex ios_base::sync_with_stdio(false)

#define nl '\n'
#define ioi exit(0);


#define PI 3.14159265

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
//~ const int N= (int)2e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
//const int mod = 1000000007;
const ll linf = (ll)1e18 + 7;

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


int main() { 
	int k, a, b; cin>> k >> a >> b;
	bool ok = false;
	for (int i = a; i <= b; i++) {
		if (i% k ==0)
			ok = true;
	}
	if (ok) {
		cout<<"OK";
	}
	else
		cout<<"NG";
	return 0;
} 




Measured memory_bytes: 3596
#include <iostream>
using namespace std;
double x[4], y[4];
double f(int a, int b, int c)
{
	return ((y[c]-y[a])*(x[b]-x[a])-(y[b]-y[a])*(x[c]-x[a]));
}
int main()
{
	while (cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3])
	{
		if (f(0, 1, 2)*f(0, 1, 3) > 0 && f(1, 2, 0)*f(1, 2, 3) > 0 && f(2, 0, 1)*f(2, 0, 3) > 0)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#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<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int MOD = 1000000007;
const int INF = 1e9;

const int mod = 1000000007;
const int inf = 1e9;
#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    int x, a, b;
    cin >> x >> a >> b;
    if(-a+b <= 0) {
        cout << "delicious" << endl;
    }else if(-a+b <= x) {
        cout << "safe" << endl;
    }else {
        cout << "dangerous" << endl;
    }
}

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

public class Prog
{
  public void run()
  {
    int N = int.Parse(Console.ReadLine());
    var input = Console.ReadLine().Split();
    int[] A = Array.ConvertAll(input, int.Parse);
    int min = A[0];
    int max = A[0];
    for(int i=0;i<N;i++) {
      min = Math.Min(min,A[i]);
      max = Math.Max(max,A[i]);
    }
    Console.WriteLine(max - min);
  }
  public static void Main()
  {
    var prog = new Prog();
    prog.run();
  }
}

Measured memory_bytes: 13268
#include "bits/stdc++.h"
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define all(v,a,b) v.begin(a),v.end(b)
#define in cin>>
#define out cout<<
#define endl <<endl
#define INF 100000000000

int main()
{
	int N;
	in N;
	out N*N endl;
}


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

int main(){
    int N;  cin >> N;
    map<string, ll> M;
    for(int i=0; i<N; i++){
        string s;  cin >> s;
        sort(s.begin(), s.end());
        M[s]++;
    }

    ll ans = 0;
    for(auto m: M){
        ll cnt = m.second;
        ans += cnt*(cnt-1)/2;
    }
    cout << ans << endl;
}


Measured memory_bytes: 11136
N = int(input())
T, A = list(map(int, input().split()))
H = list(map(int, input().split()))
AveT = []
diff = []

for i in range(N):
	AveT.append(T - H[i]*0.006)
	diff.append(abs(AveT[i] - A))

for i in range(N):
	if diff[i] == min(diff):
		place = i + 1

print(place)

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main(){
    int N;
    cin >> N;
    for(int a=1; a<=9; a++){
        for(int b=1; b<=9; b++){
            if(a*b==N){
            cout <<"Yes"<<endl;
            return 0;
            }
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
        int W,H,x,y,r;

        cin >> W >> H >> x >> y >> r;

        if ( x-r >= 0 && x+r <= W )
        {
                if( y-r >= 0 && y+r <= H )
                {
                        cout << "Yes" << endl;
                        return 0;
                }
        }

        cout << "No" << endl;

return 0;
}



Measured memory_bytes: 3120
/*    Don’t Quit
    
    When things go wrong as they sometimes will;
        When the road you’re trudging seems all uphill;
            When the funds are low, and the debts are high;
                And you want to smile, but you have to sigh;
                    When care is pressing you down a bit
                        Rest if you must, but don’t you quit.
*/
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define pb push_back
//#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=1e9+7;
const int N=3e5+10;
int32_t main()
{
    int n,m;
    cin>>n>>m;
    if(n==1&&m==1)
    {
        cout<<1<<endl;
        return 0;
    }
    if(n==1)
    {
        cout<<m-2<<endl;
        return 0;
    }
    if(m==1)
    {
        cout<<n-2<<endl;
        return 0;
    }
    int k=(m-2)*(n-2);
    cout<<k<<endl;










}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int a, b;
    int ans[7];
    int i;
    
    for (i = 0; i < 7; i++){
        scanf("%d %d", &a, &b);
        ans[i] = a - b;
    }
    
    for (i = 0; i < 7; i++){
        printf("%d\n", ans[i]);
    }
    
    return (0);
}

Measured memory_bytes: 600
process.stdin.on("data",function(c){
	var x=(c+"").trim().split("\n"),n=+x[0],a=[];
	while(a[n]=n--);
	x.slice(2).some(function(s,p){
		s=s.split(",");
		p=a[+s[0]];
		a[+s[0]]=a[+s[1]];
		a[+s[1]]=p;
	});
	a.slice(1).some(function(a){
		console.log(a);
	});
}).resume();

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

#define ll long long
#define rep(i,N) for(ll i=0; i<N; i++)
const int mx = 2e5;

int truth[15];

void inc2(int a){
  if(a>14) return;
  truth[a]++;
  if(truth[a]>1){
    truth[a]=0;
    inc2(a+1);
  }
  return;
}
void inc(void){
  inc2(0);
  return;
}

int main(void){
  
  int N;
  cin >> N;
  int shogen[N][N], shogensu[N];
  rep(i,N){
    rep(j,N){
      shogen[i][j]=-1;
    }
    shogen[i][i] = 1;
  }
  
  rep(i,N){
    cin >> shogensu[i];
    rep(j,shogensu[i]){
      int x,y;
      cin >> x>>y;
      shogen[i][x-1]=y;
    }
  }
  
  rep(i,15) truth[i]=0;
  int maxt[15];
  int max=0;
  for(int i=0; i<pow(2,N); i++){//真実を生成
    int honest=0;
    
    //あり得る真実か判断
    bool tisok=true;
    rep(j,N){
      if(truth[j]==1){
        rep(k,N){
          if(shogen[j][k]!=-1
             &&shogen[j][k]!=truth[k]){
            tisok=false;
          }
        }
      }/*else if(truth[j]==0){
        rep(k,N){
          if(shogen[j][k]!=-1
             &&shogen[j][k]==truth[k]){
            tisok=false;
          }
        }
      }*/
    }
    if(tisok){
    
    rep(j,N){//証言嘘を探す
      bool lied=false;
      if(truth[j]==0) lied = true;
      rep(k,N){
        if(shogen[j][k]!=-1){
          if(shogen[j][k]==truth[k]){
          }else{
            lied = true;
          }
        }
      }
      
      if(!lied) honest++;
    }
    if(max<honest)  max=honest;
    }
    inc();
  }
  cout << max;
  
  return 0;
}

Measured memory_bytes: 256
import math
A,B,N = map(int,input().split())
max = 0
m = []
def f(x):
  return math.floor(A*x/B) - A*math.floor(x/B)

if N < B:
  max = f(N)
elif N == B:
  max = f(N-1)
else:
  max = f(B-1)
print(max)


Measured memory_bytes: 9180
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1e9;

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main()
{
    int N,K;
    cin >> N >> K;
    int l[50];
    for(int i = 0; i < N; ++i) cin >> l[i];
    sort(l, l+N, greater<int>());
    int ans = 0;
    for(int i = 0; i < K; ++i){
        ans += l[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
from operator import itemgetter
 
sys.setrecursionlimit(500005)
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()
 
n, q = na()
a = na()
lasts = [-1] * (n+1)
rs = []
for i in range(n):
  if lasts[a[i]] != -1:
    rs.append((lasts[a[i]], i))
  lasts[a[i]] = i
 
rs.sort(key=itemgetter(0))
 
qs = []
for i in range(q):
  u = na()
  qs.append((u[0]-1, u[1]-1, i))
qs.sort(key=itemgetter(0))
 
def addfenwick(ft, i, v):
  if v == 0 or i < 0: return
  i += 1
  while i < len(ft):
    ft[i] += v
    i += i&-i
 
def sumfenwick(ft, i):
  s = 0
  i += 1
  while i > 0:
    s += ft[i]
    i -= i&-i
  return s
 
ft = [0] * (n+10)
anss = [0] * q
p = len(rs)-1
for q in qs[::-1]:
  while p >= 0 and rs[p][0] >= q[0]:
    addfenwick(ft, rs[p][1], 1)
    p -= 1
  anss[q[2]] = q[1]-q[0]+1-sumfenwick(ft, q[1])
 
for v in anss:
  print(v)

Measured memory_bytes: 238080
h,w,k=map(int,input().split())
g=[[int(c) for c in input()] for _ in range(h)]
s=[[0]*(w+1) for _ in range(h+1)]
for i in range(h):
  for j in range(w):
    s[i+1][j+1]=s[i+1][j]+s[i][j+1]+g[i][j]-s[i][j]
ssum=lambda u,d,l,r:s[d][r]-s[u][r]-s[d][l]+s[u][l]
a=h+w
for i in range(2**(h-1)):
  e=[]
  u=d=ch=0
  for j in range(h):
    d+=1
    if i>>j&1<1:
      e+=[(u,d)]
      if d<h:
        ch+=1
        u=d
  l=r=cw=0
  while r<w:
    if max(ssum(u,d,l,r+1) for u,d in e)>k:
      if r==l: break
      cw+=1
      l=r
    r+=1
  else:
    a=min(a,ch+cw)
print(a)

Measured memory_bytes: 3436
#include <bits/stdc++.h> 
using namespace std; 
long long int n,w;
long long int solve(long long int index,long long int weight,vector<long long int> weights,vector<long long int> values,vector<vector<long long int> > &dp)
{
    
    long long int sum=0;
    if(index>=n)
    return 0;

    if(weight==0)
    return 0;

    if(dp[index][weight]!=-1)
    return dp[index][weight];
    if(weights[index]<=weight)
    {sum=max((values[index]+solve(index+1,weight-weights[index],weights,values,dp)),(solve(index+1,weight,weights,values,dp)));
    return dp[index][weight]=sum;}
    else {
    return dp[index][weight]=(solve(index+1,weight,weights,values,dp));
    }
}
int main()
{
    cin>>n>>w;
    long long int x,y;
    vector<long long int> weights;vector<long long int> values;
    for(long long int i=0;i<n;i++)
    {
        cin>>x>>y;
        weights.push_back(x);
        values.push_back(y);
    }
    long long int index=0;long long int weight=w;
    vector<vector<long long int> > dp( n , vector<long long int> (w+1, -1));
    cout<<solve(index,weight,weights,values,dp);
}




Measured memory_bytes: 82216
#include <stdio.h>

int main(){
  int N,W,i,j;
  char A[100][100];

  scanf("%d %d", &N,&W);
  for(i=0;i<N;i++){
    scanf("%s",A[i]);
  }

  int B[100]={0};
  int C[100]={0};
  for(i=0;i<N;i++){
    for(j=0;j<W;j++){
      if(A[i][j]=='#'){
        B[i]=1;
      }
    }
  }
  for(i=0;i<W;i++){
    for(j=0;j<N;j++){
      if(A[j][i]=='#'){
        C[i]=1;
      }
    }
  }



  for(i=0;i<N;i++){
    for(j=0;j<W;j++){
      if(B[i]==1&&C[j]==1){
        printf("%c",A[i][j]);
      }
    }
    if(B[i]==1){
      printf("\n");
    }
  }
  return 0;
}



Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;

struct edge{
    int to;
    int cost;
    edge(int a, int b){
        to=a;
        cost=b;
    }
};
typedef pair<long long, int> P;

struct D{
    vector<edge> G[200008]; //Graph
    long long d[200008],INF=1e18;
    
    void AddEdge(int from, int to, int cost){
        G[from].push_back(edge(to, cost));
    }
    
    void dijkstra(int n, int s){
        priority_queue<P, vector<P>, greater<P>> q;
        fill(d,d+n+1,INF);
        d[s]=0;
        q.push(P(0,s));
        while(!q.empty()){
            P p=q.top();
            q.pop();
            int v=p.second;
            if(d[v]<p.first)continue;
            for(int i=0;i<G[v].size();i++){
                edge e=G[v][i];
                if(d[e.to]>d[v]+e.cost){
                    d[e.to]=d[v]+e.cost;
                    q.push(P(d[e.to],e.to));
                }
            }
        }
    }
};



int main(void){
    int n,m,a[1000],b[1000],c[1000],x=0;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>a[i]>>b[i]>>c[i];
        a[i]--;
        b[i]--;
    }
    for(int i=0;i<m;i++){
        D d;
        for(int j=0;j<m;j++){
            if(j!=i){
                d.AddEdge(a[j],b[j],c[j]);
                d.AddEdge(b[j],a[j],c[j]);
            }
        }
        d.dijkstra(n,a[i]);
        if(d.d[b[i]]<c[i])x++;
        
    }
    cout<<x<<endl;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
using ll = long long;

int main() {
    int A, B;
    cin >> A >> B;
    if(A >= 13) {
        cout << B;
    }else if(A >= 6){
        cout << B/2;
    }else{
        cout << 0;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    long long ans=0, i, cnt=0;
    cin >> s;
    for(i=0;i<s.size();i++){
        if(s.at(i)=='B') cnt++;
        else if(s.at(i)=='W') ans=ans+cnt;
    } 
    cout << ans <<endl;
    return 0;
}

Measured memory_bytes: 640
# -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)


def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()[:-1]


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


N = z()
A = zz()

diff = [0]*(N-1)
prev = A[0]
for i in range(1, N):
    diff[i - 1] = A[i] - A[i - 1]
ans = 0
# n日目に全部売ってゲームを終わるとする
for n in range(N):
    money = 1000
    kabu = 0
    for i in range(N):
        if (i == n):
            money += kabu*A[i]
            kabu = 0
            ans = max(ans, money)
            # print(i)
            break

        if (diff[i] > 0):
            buy_kabu = (money//A[i])
            money -= (A[i]*buy_kabu)
            kabu += buy_kabu
        else:
            money += kabu*A[i]
            kabu = 0

        # print(money, kabu)
print(ans)


Measured memory_bytes: 42004
using System;
 
class Program
{
    static void Main()
    {
    	string[] s = Console.ReadLine().Split(' ');
		int r = int.Parse(s[0]);
		int c = int.Parse(s[1]);
    	
    	var table = new int [r, c];
    	
    	for(int i = 0; i < r; i++) {
    		string[] t = Console.ReadLine().Split(' ');
    		
    		for(int j = 0; j < c; j++) {
    			table[i, j] = int.Parse(t[j]);
    		}
    	}
    	
    	for(int i = 0; i < r; i++) {
    		int sum = 0;
    		for(int j = 0; j < c; j++) {
    			Console.Write(table[i, j] + " ");
    			sum += table[i, j];
    		}
    		Console.WriteLine(sum);
    	}
    	
    	int sum1 = 0;
		for(int j = 0; j < c; j++) {
			int sum2 = 0;
			for(int i = 0; i < r; i++) {
				sum2 += table[i, j];
			}
			Console.Write(sum2 + " ");
			sum1 += sum2;
		}
		Console.WriteLine(sum1);
    }
}

Measured memory_bytes: 9372
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int) n; i++)
using ll = long long;
template <class T>
using vt = vector<T>;
using vvi = vector<vector<int>>;

int main(){
  int N, A, B;
  string S;
  cin >> N >> A >> B >> S;

  int cnt = 0, cb = 0;
  rep(i, N) {
    if(A + B > cnt && S[i]!='c') {
      if(S[i]=='a') {
        cout << "Yes" << endl;
        ++cnt;
      }
      else if(S[i]=='b' && B > cb){
          ++cb;
          ++cnt;
          cout << "Yes" << endl;
      }
      else
        cout << "No" << endl;
    }
    else
      cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 896
N=int(input())
A=list(map(int, input().split()))
ans=0
INF=1000

def solve(L):
    global ans
    if len(L)==1:
        ans+=L[0]
    else:
        min=INF
        index=-1
        for i in range(len(L)):
            if L[i]<=min:
                index=i
                min=L[i]
        for i in range(len(L)):
            L[i]-=min
        ans+=min

        if 0<index<len(L)-1:
            solve(L[:index])
            solve(L[index+1:])
        elif index==0:
            solve(L[index+1:])
        else:
            solve(L[:index])

solve(A)
print(ans)


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

int main(){
  long long n,d,ans=0;
  cin >> n >> d;
  long long x[n][d];
  for(int i=0;i<n;i++){
    for(int j=0;j<d;j++){
      cin >> x[i][j];
    }
  }
  for(int i=0;i<n-1;i++){
    for(int j=i+1;j<n;j++){
      long long sum=0;
      for(int k=0;k<d;k++){
        sum+=(x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
      }
      if(((long long)sqrt(sum)*(long long)sqrt(sum)) == sum){
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
using namespace std;
#define MAX 300000
typedef long long ll;

int main(){
  int a,b,ans;
  cin>>a>>b;
  if(a==b) ans=2*a;
  else ans=max(a,b)*2-1;

  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <stdexcept>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define debug(a) cout << (a) << endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;
template <class T>
bool chmax(T &a, const T &b)
{
	if (a < b)
	{
		a = b;
		return 1;
	}
	return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
	if (a > b)
	{
		a = b;
		return 1;
	}
	return 0;
}

ll M = 1000000007;

void solve()
{
	int n;
	int nabc[3]={0,0,0};
	cin>>n;
	rep(i,3){
		cin>>nabc[i];
	}
	vector<vector<int>>cnt(n,vector<int>(3));
	vector<string> t={"AB","AC","BC"};
	map<int,pair<int,int>>num;
	num[0]=make_pair(0,1);
	num[1]=make_pair(0,2);
	num[2]=make_pair(1,2);
	//int cnt[3]={0,0,0};
	bool ok=true;
	string sabc="ABC";
	vector<char>ans;
	vector<string>vs(n);
	rep(i,n){
		string s;
		cin>>s;
		vs[i]=s;
		
	}
	rep(i,n){
		string s=vs[i];
		rep(j,3){
			if(s==t[j]){
				int a=num[j].x ,b =num[j].y	;
				if(nabc[a]>0&& nabc[b]>0){
					if(nabc[a]>nabc[b]){
						nabc[a]--;
						nabc[b]++;
						ans.push_back(sabc[b]);
					}else if(nabc[a]<nabc[b]){
						nabc[a]++;
						nabc[b]--;
						ans.push_back(sabc[a]);
					}else{
						if(i!=n-1){
							rep(k,3){
								if(vs[i+1]==t[k]){
									int c=num[k].x,d=num[k].y;
									if(c==a or d==a){
										nabc[b]--;
										nabc[a]++;
										ans.push_back(sabc[a]);
									}else{
										nabc[a]--;
										nabc[b]++;
										ans.push_back(sabc[b]);
									}
								}
							}
						}else{
							ans.push_back(sabc[a]);
						}
					}
				}else if(nabc[a]>0){
					nabc[a]--;
					nabc[b]++;
					ans.push_back(sabc[b]);
				}else if(nabc[b]>0){
					nabc[b]--;
					nabc[a]++;
					ans.push_back(sabc[a]);
				}else{
					ok=false;
				}
			}
		}
	}
	if(ok){
		cout<<"Yes"<<endl;
		rep(i,n){
			cout<<ans[i]<<endl;
		}
	}else{
		cout<<"No"<<endl;
	}
}

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


Measured memory_bytes: 12180
w,h,n=map(int,input().split())
w_d=0
h_d=0
for i in range(n):
  x,y,a=map(int,input().split())
  if a==1:
    w_d=max(w_d,x)
  if a==2:
    w=min(w,x)
  if a==3:
    h_d=max(h_d,y)
  if a==4:
    h=min(h,y)
if w<=w_d or h<=h_d:
  print(0)
else:
  print((w-w_d)*(h-h_d))

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<sstream>
#include<string>
#include<math.h>
using namespace std;

struct card
{
	int num;
	char val;
};

int main()
{
	int n;
	card bb[50], se[50];
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		char sss;
		int q;
		cin >> sss >> q;
		bb[i].val = sss; se[i].val = sss;
		bb[i].num = q; se[i].num = q;
	}
	for (int i = 0; i < n; i++)
	{
		for (int s = n - 1; s > i; s--)
		{
			if (bb[s].num < bb[s - 1].num)
			{
				card m = bb[s];
				bb[s] = bb[s - 1];
				bb[s - 1] = m;
			}
		}
	}
	for (int i = 0; i < n; i++)
	{
		cout << bb[i].val << bb[i].num;
		if (i != n - 1)cout << " ";
	}
	cout << endl;
	cout << "Stable" << endl;
	for (int i = 0; i < n; i++)
	{
		int j=se[i].num;
		int w=i;
		for (int h = i + 1; h < n; h++)
		{
			if (j > se[h].num)
			{
				j = se[h].num;
				w = h;
			}
		}
		card a = se[w];
		se[w] = se[i];
		se[i] = a;
	}
	bool aho = false;
	for (int i = 0; i < n; i++)
	{
		if (bb[i].val != se[i].val)aho = true;
		cout <<(char)se[i].val << se[i].num;
		if (i != n - 1)cout << " ";
	}
	cout << endl;
	if (aho)cout << "Not stable" << endl;
	else cout << "Stable" << endl;
	return 0;

}

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

int main(){
  int N,M,X;
  cin >> N >> M >> X;
  int A[N];
  for(int i = 0 ; i < M ; i++){
    cin >> A[i];
  }
  int cnt1,cnt2;
  cnt1 = cnt2 = 0;
  for(int i = 0 ; i < M ; i++){
    if(A[i] < X)cnt1++;
    else cnt2++;
  }
  cout << min(cnt1,cnt2) << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=410;
const ll INF=1e15;
int a[N];
ll sum[N],dp[N][N];
int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9') {if (ch=='-') f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9') x=(x<<1)+(x<<3)+(ch&15),ch=getchar();
	return x*f;
}
int main()
{
	int n=read();
	for (register int i=1;i<=n;++i) a[i]=read(),sum[i]=sum[i-1]+a[i];
	for (register int i=1;i<=n;++i)
	  for (register int j=1;j<=n;++j)
	    dp[i][j]=INF;
	for (register int i=1;i<=n;++i) dp[i][i]=0;
	for (register int i=n;i>=1;--i)
	  for (register int j=i+1;j<=n;++j)
	  {
	  	for (register int k=i;k<=j-1;++k) dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j]);
	  	dp[i][j]+=sum[j]-sum[i-1];
	  }
	printf("%lld\n",dp[1][n]);
	return 0;
}

Measured memory_bytes: 1536
# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()

# int(input())
# map(int, input().split())

n = int(input())
s = input()

x = None
ans = 0
for c in s:
    if c != x:
        x = c
        ans += 1
print(ans)


Measured memory_bytes: 39664
// https://atcoder.jp/contests/abc159/tasks/abc159_b

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

bool is_kaibun(string s) {
  ll n = s.size();

  rep(i, n) {
    unless(i < n - 1 - i) break;
    unless(s[i] == s[n - 1 - i]) return false;
  }

  return true;
}

void solve() {
  string S;
  cin >> S;
  ll N = S.size();

  bool res = is_kaibun(S) && is_kaibun(S.substr(0, (N - 1) / 2)) &&
             is_kaibun(S.substr((N + 3) / 2 - 1, N - (N + 3) / 2 + 1));

  if (res) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

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

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

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 256
//Zory-2019
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pr;
#define FR first
#define SE second
#define MP make_pair
#define PB push_back
#define vc vector
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bin(x) (1ll<<(x))
#define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
#define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
#define Debug printf("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define debug(x) cerr<<#x<<'='<<x<<endl
namespace mine
{
    ll qread()
    {
        ll ans=0,f=1;char c=getchar();
        while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
        while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
        return ans*f;
    }
    void write(ll num){if(num<0) putchar('-'),num=-num;if(num>=10) write(num/10);putchar('0'+num%10);}
    void write1(ll num){write(num);putchar(' ');}
    void write2(ll num){write(num);putchar('\n');}
    template<typename T> void chmax(T &x,const T y) {x=(x>y?x:y);}
    template<typename T> void chmin(T &x,const T y) {x=(x<y?x:y);}
    ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

    const int INF=0x3f3f3f3f;
    const int MOD=998244353;
    int mm(const int x){return x>=MOD?x-MOD:x;}
    template<typename T> void add(T &x,const int &y){x=(x+y>=MOD?x+y-MOD:x+y);}
    ll qpower(ll x,ll e,int mod=MOD){ll ans=1;while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
    ll invm(ll x){return qpower(x,MOD-2);}
    const int N=1e6+10;

    bool ok[N];
    void solve(int t)
    {
        fo(i,0,N-1) if(ok[i] and i+t<N) ok[i+t]=1;
    }
    void main()
    {
        ok[0]=1;
        fo(i,100,105) solve(i);write(ok[qread()]);
    }
};//(ans+MOD)%MOD
signed main()
{
    srand(time(0));
    mine::main();
}


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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())
#define put(a) ((cout) << (a) << (endl))
#define putf(a, n) ((cout) << (fixed) << (setprecision(n)) << (a) << (endl))
#define deg2rad(x) (((x)*PI) / (180.0))
#define rad2deg(x) (((x) * (180.0)) / PI)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class T> static inline T gcd(T a, T b);
template <class T> static inline T lcm(T a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);
template <class T> T mod(T a, T m);

int main(int argc, char* argv[]) {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> a(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &a[i]);
  }

  ll ans = 0;
  rep(i, 0, N) {
    if (a[i] % 2 == 1) continue;
    while (a[i] % 2 == 0) {
      ans++;
      a[i] /= 2;
    }
  }

  put(ans);
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

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;
}

template <class T> inline T gcd(T a, T b) { return __gcd(a, b); }

template <class T> inline T lcm(T a, T b) { return (a * b) / gcd(a, b); }

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

template <class T> T mod(T a, T m) { return (a % m + m) % m; }


Measured memory_bytes: 384
n=gets.to_i
b=gets.split.map(&:to_i)
ans=[]

unless b.each_with_index.all?{|v,i|v<=i+1}
  puts -1
  exit
end

until b.empty?
  (b.size-1).downto(0){|i|
    if b[i]==i+1
      ans << b[i]
      b.delete_at i
      break
    end
  }
end
puts ans.reverse

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

using namespace std;
using ll = long long;

int main()
{
	int n;
	cin >> n;
	vector<pair<int, int>> v(n);
	for (auto&& x : v)
	{
		int a, b;
		cin >> a >> b;
		x = make_pair(b, a);
	}

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

	int time = 0;

	for (auto&& x : v)
	{
		time += x.second;
		if (time > x.first)
		{
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 1920
/*9:00 UTC+4.5
Contest2 [Cloned]
End: 2019-09-02 13:00 UTC+4.5
04:00:00
Ended
Overview
Problem
Status
Rank (04:00:00)
0 Comments
Previous12345…Next
Username

Amirack
Prob
	Result 
	Time
(ms)	Mem
(MB)	Lang 
	Submit Time
Amirack
E
Wrong Answer
C++
6 days ago
Amirack
E
Language Rejected
C++
6 days ago
Amirack
B
Accepted
6	1.4	
C++
6 days ago
Amirack
B
Wrong Answer
C++
6 days ago
Amirack
A
Accepted
1	0.3	
C++
6 days ago
           
All Copyright Reserved © 2010-2019 Xu Han
Server Time: 2019-09-08 18:16:44 UTC+4.5

#21598412 | Amirack's solution for [AtCoder-2687] [Problem B]
Status
Accepted
Time
6ms
Memory
1408kB
Length
1046
Lang
C++14 (GCC 5.3.0)
Submitted
2019-09-02 10:16:44
Shared

RemoteRunId
7304502
25.0 / 25.0
Select Code
*/
#include <bits/stdc++.h>
using namespace std;
typedef  long long ll ;
const int maxn=1e2+3,maxxn=1e4+2;
vector<pair<int,int> >v[maxn][maxn];
bool mark[maxn][maxn];
int ans[maxn][maxn];
pair<int,int>p[maxxn];
int c;
void dfs(int u,int k){
    mark[u][k]=1;
    if(p[c].first<=0)c++;
    ans[u][k]=p[c].second;
    p[c].first--;
    for(int i=0;i<v[u][k].size();i++){
        int x1=v[u][k][i].first,y1=v[u][k][i].second;
        if(!mark[x1][y1])dfs(x1,y1);
    }
}
int main() {
    int h,w,n;
    cin>>h>>w>>n;
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        p[i]=make_pair(x,i+1);
    }
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            if(j+1<=w)v[i][j].push_back(make_pair(i,j+1));
            if(j-1>0)v[i][j].push_back(make_pair(i,j-1));
            if(i+1<=h)v[i][j].push_back(make_pair(i+1,j));
            if(i-1>0)v[i][j].push_back(make_pair(i-1,j));
        }
    }
    dfs(1,1);
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++)cout<<ans[i][j]<<" ";
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 1408