akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <bitset>
#include <utility>
using namespace std;
#define REP(I,N) for (I=0;I<N;I++)
#define rREP(I,N) for (I=N-1;I>=0;I--)
#define rep(I,S,N) for (I=S;I<N;I++)
#define rrep(I,S,N) for (I=N-1;I>=S;I--)
#define FOR(I,S,N) for (I=S;I<=N;I++)
#define rFOR(I,S,N) for (I=N;I>=S;I--)
typedef unsigned long long ULL;
typedef long long LL;
const int INF=0x3f3f3f3f;
const LL INFF=0x3f3f3f3f3f3f3f3fll;
const LL M=1e9+7;
const LL maxn=1e6+7;
const double eps=0.00000001;
LL gcd(LL a,LL b){return b?gcd(b,a%b):a;}
template<typename T>inline T abs(T a) {return a>0?a:-a;}
template<typename T>inline T powMM(T a,T b){T ret=1;for (;b;b>>=1ll,a=1ll*a*a%M) if (b&1) ret=1ll*ret*a%M;return ret;}

int MIN[maxn],lazy[maxn];
inline void add(int x,int val){
    lazy[x]+=val;MIN[x]+=val;
}void update(int x,int l,int r,int val,int L,int R){
    if (l<=L&&R<=r){add(x,val);return;}
    if (lazy[x]){
        add(x<<1,lazy[x]);
        add(x<<1|1,lazy[x]);
        lazy[x]=0;
    }int mid=(L+R)/2;
    if (l<=mid) update(x<<1,l,r,val,L,mid);
    if (mid<r) update(x<<1|1,l,r,val,mid+1,R);
    MIN[x]=min(MIN[x<<1],MIN[x<<1|1]);
}int n,m;
vector<int> have[maxn];
int i,j,k;
int l,r;
int ans;
int main(){
    scanf("%d%d",&n,&m);
    FOR(i,1,n){
        scanf("%d%d",&l,&r);
        have[l].push_back(r);
    }
    FOR(i,1,m) update(1,i,i,m-i+1,1,m+1);
    ans=min(0,m-n);//为啥会有这个问题呢
    FOR(i,0,m){
        if (i!=0) update(1,i+1,m+1,1,1,m+1);
        for (int r:have[i])
            update(1,i+1,r,-1,1,m+1);
        ans=min(ans,MIN[1]);
    }printf("%d\n",-ans);
}
/*
*/


Measured memory_bytes: 34560
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)
function main()
  N = parseInt(readline())
  S = String["" for i in 1:N]
  for i in 1:N
    S[i]=chomp(readline())
  end
  ac=count(S.=="AC")
  wa=count(S.=="WA")
  tle=count(S.=="TLE")
  re=count(S.=="RE")
  #N,K = parseMap(split(readline()))
  #p = parseMap(split(readline()))
#  println("$N,$S")
  println("AC x $ac")
  println("WA x $wa")
  println("TLE x $tle")
  println("RE x $re")
  #println("$p")
#  if mod(a,1000) != 0
#    println(1000-mod(a,1000))
#  else
#    println(0)
#  end
end
main()


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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb push_back

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v)
{
    os << "{";
    rep(i, v.size()) os << v[i] << (i == (int)v.size() - 1 ? "" : ", ");
    os << "}";
    return os;
}
template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }
struct in
{
    const size_t n = 0;
    in() = default;
    in(size_t n) : n(n){};
    template <typename T>
    operator T()
    {
        T ret;
        cin >> ret;
        return ret;
    }
    template <typename T>
    operator vector<T>()
    {
        assert(n != 0);
        vector<T> ret(n);
        for (auto &x : ret)
            cin >> x;
        return ret;
    }
};

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    int a = in(), b = in(), c = in();
    setint st;
    int tmp = a;
    while (1)
    {
        if (st.count(tmp % b) == 0)
        {
            if (tmp % b == c)
            {
                YES;
                return;
            }
            st.insert(tmp % b);
        }
        else
        {
            break;
        }
        tmp += a;
    }
    NO;
}

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


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

long long int a,b;

signed main()
{
    ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	cin>>a>>b;
	if ((a+b)%2!=0) cout<<"IMPOSSIBLE";else cout<<(a+b)/2;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define NIL NULL

struct node {
  int key;
  struct node *right;
  struct node *left;
  struct node *parent;
};
typedef struct node * Node;
Node root;
void Insert(int );
void inorder(Node );
void preorder(Node );

int main()
{
  int i,j,k;
  char c[10];
  scanf("%d",&k);
  
  for(i=0;i<k;i++)
    {
      scanf("%s",&c[0]);
      if(c[0]=='i')
	{
	  scanf("%d",&j);
	  Insert(j);
	}
      else if(c[0]=='p') 
	{
	  inorder(root);
	  printf("\n");
	  preorder(root);
	  printf("\n");
	}
    }
  return 0;
}

void Insert(int p)
{
  Node x=root;
  Node y=NIL;
  Node z;
  
  z=malloc(sizeof(struct node));
  z->key=p;
  z->left=NIL;
  z->right=NIL;
  
  while(x!=NIL)
    {
      y=x;
      if(z->key < x->key) x=x->left;
      else x=x->right;

      z->parent=y;
    }
  if(y==NIL) root=z;
  else if(z->key < y->key) y->left=z;
  else  y->right=z;
}

void inorder(Node x)
{
  if(x==NIL) return;
  inorder(x->left);
  printf(" %d",x->key);
  inorder(x->right);
}

void preorder(Node x)
{
  if(x==NIL) return;
  printf(" %d",x->key);
  preorder(x->left);
  preorder(x->right);
}

Measured memory_bytes: 24040
#include <cassert>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)

typedef long long ll;

ll layers[55];
ll ps[55];

ll solve(int n, ll x) {
  if(x == layers[n]) {
    return ps[n];
  } else if(x == 1) {
    return 0;
  } else if(x <= 1 + layers[n-1]) {
    return solve(n-1, x-1);
  } else if(x == 1 + layers[n-1] + 1) {
    return ps[n-1] + 1;
  } else if(x <= 1 + layers[n-1] + 1 + layers[n-1]) {
    return ps[n-1] + 1 + solve(n-1, x-(1 + layers[n-1] + 1));
  } else {
    assert(false);
  }
}


int main(void) {
  int n;
  ll x;
  cin >> n >> x;
  layers[0] = 1;
  ps[0] = 1;
  REP(i, n) {
    ps[i+1] = ps[i]*2 + 1;
    layers[i+1] = layers[i]*2 + 3;
  }
  ll res = solve(n, x);
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
ARG_N, ARG_K, ARG_S = gets.split.map(&:to_i)

result = Array.new ARG_N
ARG_N.times do |i|
  if i < ARG_K
    result[i] = ARG_S
  else
    if ARG_S == 10**9
      result[i] = 1
    else
      result[i] = ARG_S+1
    end
  end
end
puts result.join(" ")

Measured memory_bytes: 4988
#include <bits/stdc++.h>
#define fir first
#define sec second
#define pb 	push_back
#define ll  long long
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int>
#define debug(x) cerr<<#x<<" =: "<<x<<endl;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define Find find_by_order
#define Order order_of_key
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
mt19937 mrand(random_device{}());
ll rnd(ll x) { return mrand() % x;}
ll ksm(ll a,ll b,ll mod){ll ans=1;a%=mod;while(b){if(b&1) ans=ans*a%mod;b>>=1;a=a*a%mod;}return ans;}
ll phi(ll n){ll ans=n;for(ll i=2;i*i<=n;i++){if(n%i==0) {while(n%i==0) n/=i;ans=ans*(i-1)/i;}}if(n>1) ans=ans*(n-1)/n;return ans;}
//head

const int maxn = 1e6 + 7;
vector<int> vec[maxn];
int a[maxn], ans[maxn];
set<int> s;

int main (){
    int n; cin >> n;
    set<string> s;
    for (int i = 0; i < n; i++){
        string ss; cin >> ss;
        s.insert(ss);
    }
    cout << s.size() << endl;

    return 0;
}


Measured memory_bytes: 42664
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef vector<vector<int>> vv;
typedef pair<int, int> P;

// input
int N;

const ll MOD = 1e9 + 7;
vector<map<string, ll>> w;


void input() {
    cin >> N;
}


bool judge(string s) {
    rep(i, 2) if (s.substr(i, 3) == "AGC") return false;
    rep(i, 3) {
        swap(s[i], s[i + 1]);
        rep(i, 2) if (s.substr(i, 3) == "AGC") return false;
        swap(s[i], s[i + 1]);
    }
    return true;
}


void solve(int i, char c) {
    for (auto p : w[i - 1]) {
        string s = p.first;
        ll v = p.second;
        string t = s + c;
        if (judge(t)) {
            t = t.substr(1, 3);
            w[i][t] = (w[i][t] + v) % MOD;
        }
    }
}


int main() {
    input();
    w = vector<map<string, ll>>(N + 1);
    w[0]["XXX"] = 1;
    rep(i, N) {
        for (char c : {'A', 'C', 'G', 'T'}) {
            solve(i + 1, c);
        }
    }
    ll ans = 0;
    for (auto p : w[N]) ans += p.second;
    ans %= MOD;
    cout << ans << endl;
}


Measured memory_bytes: 4076
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        String result = ((a*b) % 2) == 0 ? "Even" :"Odd";
        System.out.println(result);
    }
}

Measured memory_bytes: 21076
# AGC008 A Simple Calculator

x, y = map(int, input().split())
_x = abs(x)
_y = abs(y)

if x > 0 and y > 0:
    if x <= y:
        print(y-x)
    else:
        print(x-y+2)
elif x * y < 0:
    print(abs(_y-_x)+1)
elif x == 0:
    if y >= 0:
        print(y)
    else:
        print(_y+1)
elif y == 0:
    if x > 0:
        print(x+1)
    else:
        print(_x)
else:
    if _x < _y:
        print(_y-_x+2)
    else:
        print(_x-_y)

Measured memory_bytes: 3064
/** Which of the favors of your Lord will you deny ? **/

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

#define LL long long
#define PII pair<int,int>
#define PLL pair<LL,LL>
#define F first
#define S second

#define ALL(x)      (x).begin(), (x).end()
#define READ        freopen("alu.txt", "r", stdin)
#define WRITE       freopen("vorta.txt", "w", stdout)

#ifndef ONLINE_JUDGE
#define DBG(x)      cout << __LINE__ << " says: " << #x << " = " << (x) << endl
#else
#define DBG(x)
#define endl "\n"
#endif

template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p);
template <class T>
ostream &operator <<(ostream &os, vector<T>&v);
template <class T>
ostream &operator <<(ostream &os, set<T>&v);

inline void optimizeIO()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

#define int long long

const int nmax = 2e5+7;
const int mod = 1e9+7;

map<int,int>dp;

int add(int a,int b)
{
    return (a+b) %mod;
}

int solve(int n)
{
    if(n<=0) return 0;
    if(n==1) return 1;

    if(dp.find(n)!=dp.end()) return dp[n];

    int &ret = dp[n];

    if(n%2==0) return ret = add(2LL*solve(n/2) , solve(n/2 - 1));
    else return ret = add (2LL*solve(n/2) , solve(n/2 + 1));
}


int32_t main()
{
    optimizeIO();

    int n;
    cin>>n;

    int ans = solve(n+1);
    DBG(ans);
    cout<<ans<<endl;

    return 0;
}

/**

**/

template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p)
{
    os<<"{"<<p.first<<", "<<p.second<<"} ";
    return os;
}
template <class T>
ostream &operator <<(ostream &os, vector<T>&v)
{
    os<<"[ ";
    for(T i:v)
    {
        os<<i<<" " ;
    }
    os<<" ]";
    return os;
}

template <class T>
ostream &operator <<(ostream &os, set<T>&v)
{
    os<<"[ ";
    for(T i:v)
    {
        os<<i<<" ";
    }
    os<<" ]";
    return os;
}


Measured memory_bytes: 3624
package main

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

func main() {
	// init
	var N int
	fmt.Scan(&N)
	VS := make([]int, N)
	CS := make([]int, N)
	var sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := 0; i < N; i++ {
		fmt.Scan(&VS[i])
	}
	for i := 0; i < N; i++ {
		fmt.Scan(&CS[i])
	}

	// loop
	ans := 0
	for i := 0; i < N; i++ {
		if VS[i] > CS[i] {
			ans += VS[i] - CS[i]
		}
	}

	// output
	fmt.Println(ans)
}

Measured memory_bytes: 640
#include<stdio.h>

int main(void){

    int W,H,x,y,r;

    scanf("%d %d %d %d %d",&W, &H, &x, &y, &r);
 
    
    if(((x + r) <= W) && ((y + r) <= H) &&
       ((x - r) >= 0) && ((y - r) >= 0)){
       printf("Yes\n");
       }else{
       printf("No\n");
       }

       return 0;

}

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

int main() {
    ll n;
    ll h[100];
    std::cin >> n;
    for (int i = 0; i < n; i++) {
        std::cin >> h[i];
    }
    ll result = 0;
    for (int i = 0; i < n; i++) {
        while(h[i]>0){
            h[i]--;
            for (int j = i+1; j < n; j++) {
                if(h[j]>0){
                    h[j]--;
                    continue;
                }else{
                    break;
                }
            }
            result++;
        }
    }
    std::cout << result << std::endl;
}



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

int main() {
  int n;
  cin>>n;
  
  bool flag =false;
  for(int i=0;i<n;i++){
    string tmp;
    cin>>tmp;
    if (tmp=="Y") flag=true;
  }
  if(flag) puts("Four");
  else puts("Three");
  
}
	

Measured memory_bytes: 256
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")


def main():
    N = int(input())
    D_list = list(map(int, input().split()))
    M = int(input())
    T_list = list(map(int, input().split()))

    c = Counter(D_list)
    for t in T_list:
        if c[t] <= 0:
            print("NO")
            return
        c[t] -= 1
    print("YES")


if __name__ == '__main__':
    main()


Measured memory_bytes: 43992
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main{

	public static void main(String args[]) throws IOException{
		new Main().mainrun();
	}

	private BufferedReader br ;
	private int N,time;
	private Node[] L;
	private Integer[] D,F;
	private boolean[] flag;

	private void mainrun() throws NumberFormatException, IOException{
		br = new BufferedReader(new InputStreamReader(System.in));

		N = Integer.parseInt(br.readLine());
		L = new Node[N];

		D = new Integer[N];
		F = new Integer[N];

		flag = new boolean[N];
		Arrays.fill(flag, true);
		time = 0;

		for(Integer i = 0;i < N;i++) {
			L[i] = new Node(i);
		}

		for(int i = 0;i < N;i++) {
			String[] str = br.readLine().split(" ");
			int id = Integer.parseInt(str[0]) - 1;
			L[id].id = id;

			L[id].setArray(Integer.parseInt(str[1]));

			for(int j = 0;j < Integer.parseInt(str[1]);j++) {
				int child = Integer.parseInt(str[j + 2]);

				L[id].child[j] = child - 1;
			}
		}

		for(int i = 0;i < N;i++) {
			if(flag[i]) {
				putTime(i);
			}
		}

		for(int i = 0;i < N;i++) {
			System.out.printf("%d %d %d\n", i+1,D[i],F[i]);
		}

		br.close();
	}

	private void putTime(int id) {
		time++;

		flag[id] = false;
		D[id] = time;
		
		for(Integer i : L[id].child) {
			if(flag[i]) {
				flag[i] = false;
				putTime(i);
			}
		}
		time++;
		F[id] = time;
	}
}

class Node{
	public int id;
	public Integer[] child;

	public Node(int id)
	{
		this.id = id;
	}

	public void setArray(int n) {
		child = new Integer[n];
	}
}



Measured memory_bytes: 25272
#include<bits/stdc++.h>
using namespace std;
long long ans,n,su[200010],sux[200010],x;
int i,j;
int main()
{
	cin>>n;
	for (i=1;i<=n;i++)
	{
		cin>>x;
		su[i]=su[i-1]+x;
		sux[i]=sux[i-1]^x;
	}
    for (i=j=1;i<=n;i++)
	{
        for(;su[i]-su[j-1]!=(sux[i]^sux[j-1]);j++);
         ans+=i-j+1;
    }
	cout<<ans;
}

Measured memory_bytes: 3328
s = gets.chomp

ans = 0
len = s.length-1


[0, 1].repeated_permutation(len) do |bit|
  tmp_char = s[0]

  len.times do |i|
    tmp_char += '+' if bit[i] == 1
    tmp_char += s[i+1]
  end
  
  # evalはやめておく
  # ans += eval(tmp_char)
  ans += tmp_char.split('+').map(&:to_i).inject(:+)
end

p ans

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

#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define sz(v) (int) v.size()

const long long Q =  1000000000000000000;

int main(){

    long long num ;
    cin >> num;

    int ans = 0;

    for( long long d = 2 ; d * d <= num ; ++d ){

        if( num % d == 0 ){
            int cnt = 1;
            int aux = 0;
            while( num % d == 0 ){
                num /= d;
                aux++;
                if( aux == cnt ){
                    ans++;
                    cnt++;
                    aux = 0;
                }
            }
        }
    }

    if( num > 1 ) ans++;

    cout << ans ;
    return 0;
}

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

#define llint long long int

using namespace std;

int main(){
    int N, K;

    cin >> N >> K;

    vector<bool> have(N, false);

    for(int i = 0; i < K; i ++){
        int d;

        cin >> d;

        for(int j = 0; j < d; j ++){
            int A;

            cin >> A;

            have[A - 1] = true;
        }
    }
    int ans = 0;

    for(int i = 0; i < N; i ++){
        if(have[i] == false){
            ans ++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	string s;
	cin >> s;
	int n = s.size();
	vector<vector<int> > dp;
	dp.resize(n);
	for(int i = 0; i < n; ++i) {
		dp[i].resize(2);
	}
	dp[n - 1][0] = s.back() - '0';
	dp[n - 1][1] = 10 - (s.back() - '0');
	for(int i = n - 2; i >= 0; --i) {
		dp[i][0] = min(dp[i + 1][0] + s[i] - '0', dp[i + 1][1] + s[i] - '0' + 1);
		dp[i][1] = min(dp[i + 1][0] + 10 - (s[i] - '0'), dp[i + 1][1] +	9 - (s[i] - '0'));
	}
	cout << min(dp[0][0], dp[0][1] + 1) << '\n';
	return 0;
}

Measured memory_bytes: 55964
#include<bits/stdc++.h>
#define MAX_N 505
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
int m,s,d,c;

int par[MAX_N];
int rank[MAX_N];

void init(int n){
  for(int i=0;i<n;i++){
    par[i]=i;
    rank[i]=0;
  }
}

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

void unite(int x,int y){
  x=find(x);
  y=find(y);
  if(x==y)return;
  if(rank[x]<rank[y])par[x]=y;
  else{
    par[y]=x;
    if(rank[x]==rank[y])rank[x]++;
  }
}

bool same(int x,int y){return find(x)==find(y);}

vector<P1> G,v;
int n,ans0,ans1;

void solve(){
  sort(G.begin(),G.end());
  init(n);
  for(int i=0;i<G.size();i++){
    if(same(G[i].second.first,G[i].second.second))continue;
    unite(G[i].second.first,G[i].second.second);
    v.push_back(G[i]);
  }
  for(int i=0;i<(int)v.size();i++){
    init(n);
    for(int j=0;j<(int)v.size();j++){
      if(i==j)continue;
      unite(v[j].second.first,v[j].second.second);
    }
    int f=0;
    for(int j=0;j<(int)G.size();j++)
      if(!same(G[j].second.first,G[j].second.second))
	if(v[i].first==G[j].first)
	  if(v[i]!=G[j])f=1;
    if(!f)ans0++,ans1+=v[i].first;
  }
  cout<<ans0<<' '<<ans1<<endl;
}

int main(){
  cin>>n>>m;
  for(int i=0;i<m;i++){
    cin>>s>>d>>c;
    s--,d--;
    G.push_back(P1(c,P(s,d)));
  }
  solve();
  return 0;
}

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

int main() {
  int n;
  cin >> n;

  vector<int> p(n);
  int tmp = 0, max_p = 0;
  for (int i = 0; i < n; i++) {
    cin >> p[i];
    max_p = max(max_p, p[i]);
    tmp += p[i];
  }

  cout << tmp - max_p / 2 << endl;


}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
using namespace std;
#define int long long

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n; cin >> n;
    vector<int> m(4);
    m.at(3) = n%10; n /= 10;
    m.at(2) = n%10; n /= 10;
    m.at(1) = n%10; n /= 10;
    m.at(0) = n%10; n /= 10;

    vector<int> rekkyo(4);

    while(rekkyo.at(0) == 0){
        int sum = m.at(0);
        for(int i = 1;i < 4;i ++){
            if(rekkyo.at(i) == 0) sum += m.at(i);
            else sum -= m.at(i);
        }

        if(sum == 7) break;

        rekkyo.at(3) ++;
        for(int i = 3;i >0;i --){
            if(rekkyo.at(i) == 2){
                rekkyo.at(i) = 0;
                rekkyo.at(i-1) ++;
            }
        }
    }

    cout << m.at(0);
    for(int i = 1;i < 4;i ++){
        if(rekkyo.at(i) == 0) cout << '+';
        else cout << '-';

        cout << m.at(i);
    }

    cout << "=7" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>


using namespace std;

int main(){
    int R;
    cin>>R;
    if(R<1200)cout<<"ABC";
    else if(R<2800)cout<<"ARC";
    else cout<<"AGC";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
L = [list(map(int, input().split())) for _ in range(N)]
ALL = sum(list(map(lambda x: x[1:], L)), [])

ans = 0
for i in set(ALL):
    if ALL.count(i) is N:
        ans += 1

print(ans)


Measured memory_bytes: 3064
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] array = new int[3];
        for (int i = 0; i < array.length; i++) {
            array[i] = sc.nextInt();
        }

        Arrays.sort(array);
        if (array[0] == 5 && array[1] == 5 && array[2] == 7) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

Measured memory_bytes: 25300
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,K,C;
    cin >> N >> K >> C;
    string S;
    cin >> S;
    vector<ll> pos;
    rep(i,0,N){
        if(S[i] == 'o') pos.push_back(i);
    }
    ll cnt1[200010] = {}, cnt2[200010] = {};
    ll cur = pos[0];
    cnt1[pos[0]] = 1;
    ll sz = pos.size();
    rep(i,0,K-1){
        ll val = cur + C + 1;
        ll nxt = lower_bound(pos.begin(), pos.end(), val) - pos.begin();
        cnt1[pos[nxt]] = i+2;
        cur = pos[nxt];
    }
    cur = pos[sz-1];
    cnt2[pos[sz-1]] = K;
    rep(i,0,K-1){
        ll val = cur - C - 1;
        ll nxt = upper_bound(pos.begin(), pos.end(), val) - pos.begin();
        cnt2[pos[nxt-1]] = K-1-i;
        cur = pos[nxt-1];

    }
    // printa(cnt, N);
    rep(i,0,N){
        if(cnt1[i] == cnt2[i] && cnt1[i] != 0){
            print(i+1);
        }
    }

    

}


Measured memory_bytes: 6536
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf=0x3f3f3f3f;
int main(){
	ll n,a,b;
	cin>>n>>a>>b;
	ll c;
	if(n%(a+b)>=a) c=a;
	else c=n%(a+b);
	ll s=n/(a+b)*a+c;
	cout<<s;
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		byte arrayLength = Byte.parseByte(in.readLine());
		byte[] array = new byte[arrayLength];
		short count = 0;
		String[] strData = in.readLine().split(" ");
		for (byte i = 0; i < arrayLength; i++) {
			array[i] = Byte.parseByte(strData[i]);
		}
		for (int x = 0; x < arrayLength; x++) {
			for (byte y = (byte) (arrayLength - 1); y > x; y--) {
				if (array[y] < array[y - 1]) {
					byte temp = array[y];
					array[y] = array[y - 1];
					array[y - 1] = temp;
					count++;
				}
			}
		}
		for (int z = 0; z < arrayLength; z++) {
			if (z == arrayLength - 1) {
				System.out.println(array[z]);
			} else {
				System.out.print(array[z] + " ");
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 16964
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>
#include<queue>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define dump(a) cout << a << endl; 

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

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}


int get2Digit(Int num) {
	int cnt = 0;
	while (num > 0) {
		if (num % 2 != 0) {
			return cnt;
		}
		cnt++;
		num /= 2;
	}
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0; true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

void ansYes(bool a) {
	if (a == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}

void ansYES(bool a) {
	if (a == true) cout << "YES" << endl;
	else cout << "NO" << endl;
}


Int euclidean_gcd(Int a, Int b) {
	while (true) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

typedef pair<int, int> pai;


//ここまでライブラリ
//ここから本文
int main() {
	string a;
	cin >> a;
	dump("ABC" + a);
}

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

int dp[301][18];
int solve(int amount, int num) {
  // cerr << "solve(" << amount << "," << num << ")" << endl;
  if(amount == 0) return 1;
  if(num < 0) return 0;
  int &res = dp[amount][num];
  if(res != -1) return res;
  res = 0;
  for(int k = num; k >= 1; --k) {
    if(amount - k*k >= 0) res += solve(amount - k*k, k);
  }
  return res;
}

int main() {
  memset(dp, -1, sizeof(dp));
  while(true) {
    int N; cin >> N;
    if(N == 0) break;
    cout << solve(N, 17) << endl;
  }
}

Measured memory_bytes: 1188
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#define inf 20021225
using namespace std;

int main()
{
	int n,i,ans=inf,c,t,tt;
	scanf("%d%d",&n,&tt);
	for(i=1;i<=n;i++)
	{
		scanf("%d%d",&c,&t);
		if(t<=tt)	ans=min(ans,c);
	}
	if(ans==inf)	printf("TLE\n");
	else	printf("%d\n",ans);
	return 0;
}

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

int main () {
  string n;
  cin >> n;

  bool ans=false;
  if (n[0]==n[1] && n[1]==n[2]) ans=true;
  if (n[1]==n[2] && n[2]==n[3]) ans=true;

  if (ans) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <vector>
#include <queue>
#include <unordered_map> 
#include <iomanip>
#include <random>
#include <future>
#include <thread>
#include <utility>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define INF (INT_MAX/3)
#define PSB push_back
#define PN 1000000007
typedef long long LL;
#define int long long


//booooooooooooost
//#include <boost/multiprecision/cpp_int.hpp>
//#include <boost/multiprecision/cpp_dec_float.hpp>
//namespace mp = boost::multiprecision;	//多倍長整数(mp::cpp_int), 多倍長小数(mp::cpp_dec_float_100)



LL inv_mod(LL a, LL m)
{
	LL b, x, u, q, tmp;

	b = m; x = 1; u = 0;
	while (b > 0) {
		q = a / b;
		tmp = u; u = x - q * u; x = tmp;
		tmp = b; b = a - q * b; a = tmp;
	}

	return (x < 0) ? m + x : x;
}



signed main() {

	int N;
	vector<int> a;
	cin >> N;
	for (int i = 0; i < 3 * N; ++i) {
		int ai;
		cin >> ai;
		a.push_back(ai);
	}

	priority_queue<int, vector<int>, greater<int>> pq1;
	priority_queue<int> pq2;
	int pqsum1 = 0, pqsum2 = 0;
	for (int k = 0; k < N; ++k) {
		pq1.push(a[k]);
		pqsum1 += a[k];
	}
	for (int k = 2 * N; k < 3 * N; ++k) {
		pq2.push(a[k]);
		pqsum2 += a[k];
	}

	vector<int> ans;
	for (int k = N; k < 2 * N + 1; ++k) {

		ans.push_back(pqsum1);

		//更新
		pq1.push(a[k]);
		pqsum1 += (a[k] - pq1.top());
		pq1.pop();
	}

	reverse(a.begin(), a.end());
	for (int k = N; k < 2 * N + 1; ++k) {

		ans[2 * N - k] -= pqsum2;

		//更新
		pq2.push(a[k]);
		pqsum2 += (a[k] - pq2.top());
		pq2.pop();
	}

	cout << *max_element(ans.begin(), ans.end()) << endl;
	

	return 0;
}

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

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

    class A
    {
        public static void FiftyFifty()
        {
            string s = Input.getString();

            if(s[0] == s[1] && s[1] == s[2])
            {
                Console.WriteLine("No");
            }
            else if ( s[0] == s[1]  &&  s[2] == s[3] )
            {
                Console.WriteLine("Yes");
            }
            else if( s[1] == s[2] && s[0] == s[3])
            {
                Console.WriteLine("Yes");
            }
            else if( s[0] == s[2] && s[1] == s[3])
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            } 
        }
    }
  
    class Input
    {
        public static int getInt()
        {
            int i = int.Parse(Console.ReadLine());
            return i;
        }

        public static string getString()
        {
            string s = Console.ReadLine();
            return s;
        }
        public static int[] getIntArray()
        {
            string[] s = Console.ReadLine().Split(' ');
            int[] num = s.Select(x=>int.Parse(x)).ToArray();
            return num;
        }
    }

    class Output
    {
        public static void writeInt(int i)
        {
            Console.WriteLine(i);
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <map>
#include <string>


using namespace std;
int main(){
    string s, t;
    cin >> s >> t;
    int count = 0;
    for(int i = 0; i < 3; ++i){
        if(s[i] == t[i])++count;
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn main() {
    let n = read::<u32>();
    if n % 2 == 0 {
        println!("{}", 0.5);
    } else {
        println!("{}", (n+1) as f64 /(2*n) as f64);
    }
}


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

const int MAX = 100;

int g[MAX][MAX];
int ta[MAX][MAX];

vector<int> hg[MAX];

class union_find{
	const int n;
	vector<int> dat;
public:
	union_find(int n) : n(n), dat(n, -1){}
	int find(int a){
		return dat[a] < 0 ? a : dat[a] = find(dat[a]);
	}
	void unite(int a, int b){
		a = find(a), b = find(b);
		if(a == b) return;
		if(dat[a] > dat[b]) swap(a, b);
		dat[a] += dat[b];
		dat[b] = a;
	}
	bool same(int a, int b){
		return find(a) == find(b);
	}
	int size(int a){
		return -dat[find(a)];
	}
};

bool cnt[MAX];
vector<pair<int, int>> res;

bool dfs(int v, int prev){
	bool t = cnt[v];
	for(auto to : hg[v]) if(to != prev) {
		t ^= dfs(to, v);
	}
	if(t){
		if (v < prev) res.emplace_back(v, prev);
		else res.emplace_back(prev, v);
	}
	return t;
}

int main()
{
	int n, m;
	cin >> n >> m;
	for(int i = 0;i < m;i++){
		int a, b;
		cin >> a >> b;--a, --b;
		g[a][b] = g[b][a] = 1;
	}
	union_find uf(n), uf2(n);
	for(int i = 0;i < n;i++){
		for(int j = 0;j < i;j++) {
			if (!g[i][j]) {
				if(!uf.same(i, j)){
					hg[i].push_back(j);
					hg[j].push_back(i);
					uf.unite(i, j);
				}
				else{
					ta[i][j] = ta[j][i] = 1;
				}
			}
			else{
				uf2.unite(i, j);
			}
		}
	}
	for(int i = 0;i < n;i++){
		for(int j = 0;j < i;j++) if (ta[i][j] && !uf2.same(i, j)) {
			uf2.unite(i, j);
			g[i][j] = g[j][i] = 1;
			res.emplace_back(j, i);
		}
	}
	for(int i = 0;i < n;i++){
		for(int j = 0;j < n;j++) if (i != j) {
			cnt[i] ^= g[i][j];
		}
	}
	bool ng = false;
	for(int i = 0;i < n;i++) if(uf.find(i) == i){
		ng |= dfs(i, -1);
	}
	if(ng){
		cout << -1 << endl;
		return 0;
	}
	int k = res.size();
	sort(res.begin(), res.end());
	res.erase(unique(res.begin(), res.end()), res.end());
	for(auto p : res){
		uf2.unite(p.first, p.second);
	}
	if(uf2.size(0) != n){
		cout << -1 << endl;
		return 0;
	}
	if((int)res.size() != k){
		cout << -1 << endl;
		return 0;
	}
	cout << k << endl;
	for(auto& p : res){
		cout << p.first + 1 << ' ' << p.second + 1 << endl;
	}
	return 0;
}




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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

ll power(ll a, ll b){
	ll res=1;
	while(b>0){
		if(b&1){
			res=res*a%MOD;
		}
		a=a*a%MOD;
		b>>=1;
	}
	return res;
}

int cnt[30];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout<<setprecision(10)<<fixed;
	int n;
	string s;
	cin>>n>>s;
	REP(i, n){
		++cnt[s[i]-'a'];
	}
	ll ans=1;
	REP(i, 26){
		if(cnt[i]==1){
			ans=(ans*2)%MOD;
		}
		else{
			ans=(ans*(cnt[i]+1))%MOD;
		}
	}
	ans=(ans-1+MOD)%MOD;
	cout<<ans<<'\n';
	return 0;
}


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

namespace AtCoder.Contests.ABC161
{
    /// <summary>
    /// 
    /// </summary>
    static class A
    {
        static void Main(string[] args)
        {
            var x = NextInt();
            var y = NextInt();
            var z = NextInt();

            Console.WriteLine(z + " " + x + " " + y);
        }

        #region Console
        static int _index = 0;
        static string[] _buffer;

        static string Next()
        {
            if (_buffer == null || _index >= _buffer.Length)
            {
                _buffer = Console.ReadLine().Split();
                _index = 0;
            }

            return _buffer[_index++];
        }
        static int NextInt()
        {
            return int.Parse(Next());
        }
        static long NextLong()
        {
            return long.Parse(Next());
        }
        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }
        static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }
        static int[] ReadIntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }
        static int[] ReadIntArray(int n)
        {
            var a = new int[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = ReadInt();
            }
            return a;
        }
        static long[] ReadLongArray()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }
        static long[] ReadLongArray(int n)
        {
            var a = new long[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = ReadLong();
            }
            return a;
        }
        static List<T> ReadObjects<T>(int n, Func<int[], T> creator)
        {
            var l = new List<T>(n);

            for (int i = 0; i < n; i++)
            {
                var a = ReadIntArray();
                l.Add(creator(a));
            }

            return l;
        }

        static int[,] ReadMatrix(int n, int m)
        {
            var r = new int[n, m];
            for (int i = 0; i < n; i++)
            {
                var a = ReadIntArray();
                for (int j = 0; j < m; j++)
                {
                    r[i, j] = a[j];
                }
            }
            return r;
        }
        #endregion
    }
}


Measured memory_bytes: 11220
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

int a[100010];
int b[100010];
int c[100010];
int dp[3][100010];

int main(){ _;
  int n;cin>>n;
  REP(i,n)cin>>a[i]>>b[i]>>c[i];
  dp[0][0]=dp[1][0]=dp[2][0]=0;
  REP(i,n){
    dp[0][i+1]=a[i]+max(dp[1][i],dp[2][i]);
    dp[1][i+1]=b[i]+max(dp[0][i],dp[2][i]);
    dp[2][i+1]=c[i]+max(dp[0][i],dp[1][i]);
  }
  cout<<max(max(dp[0][n],dp[1][n]),dp[2][n])<<endl;
}


Measured memory_bytes: 2560
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();
            int n = S.length();
            int n1 = (int) Math.ceil((n - 1) / 2);
            int n2 = (int) Math.ceil((n + 3) / 2);

            String s1 = S.substring(0, n1);
            String s2 = S.substring(n2 - 1);

            boolean test1 = palindrome(S);
            boolean test2 = palindrome(s1);
            boolean test3 = palindrome(s2);

            if (test1 == true && test2 == true && test3 == true) {
                out.println("Yes");
                return;
            }
            out.println("No");

        }

        boolean palindrome(String arg) {
            char str[] = arg.toCharArray();
            for (int i = 0; i < str.length / 2; i++) {
                if (str[i] != str[str.length - i - 1]) return false;
            }
            return true;
        }

    }
}



Measured memory_bytes: 23124
import itertools
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

n=int(input())

ans = 0

for i in range(1,n+1):
    for j in range(1,n+1):
        for k in range(1,n+1):
            ans += gcd(i,j,k)
            

print(ans)


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

using namespace std;

int main() {
	int a, b, cnt;

	cin >> a >> b;
	cnt = 1;
	if (a < b) {
		cnt = b / a;
		if (b%a != 0) {
			++cnt;
		}
	}
	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 3112
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N=int(input())
    l=[2,1]
    for i in range(N):
        l.append(l[i]+l[i+1])
    print(l[N])
    
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include <iostream>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n){
    int x;
    cin >> x;
    x--;
    a[x] = i+1;
  }
  rep(i, n) cout << a[i] << ' ';
  cout << endl;
  
  return 0;
}

Measured memory_bytes: 3672
function Main(input) {
	input = input.split("\n");
	const n = parseInt(input[0]);
	const s = input[1].split("");
	const k = parseInt(input[2]);
	var st = "";

	var h = s[k-1];
	for (i=0;i<n;i++){
		if (s[i] == h) {
			st = st + h;
		} else {
			st = st + "*";
		}
	}
	console.log(st);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
import sys
input = sys.stdin.readline
D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]
t = [0] * D
for i in range(D): t[i] = int(input())

last = [0] * 26
def score(day, score):
  for i in range(26): score -= (day - last[i]) * c[i]
  return score
res = 0
for d in range(D):
  contest = t[d] - 1
  last[contest] = d + 1
  res = score(d + 1, res) + s[d][contest]
  print(res)

Measured memory_bytes: 71176
#include <bits/stdc++.h>
#define lli long long int
using namespace std;
const int mod = 1e9+7;
lli power(lli x, lli  y,lli p)  
{  
    lli res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}  
int main() {
 //   cout<<"Hello World!";
    int n;
    cin>>n;
    lli ans = power(10,n,mod);
    ans%=mod;
    ans-=power(9,n,mod);
    if(ans<0)
    ans+=mod;
    ans%=mod;

    ans-=power(9,n,mod);
    if(ans<0)
    ans+=mod;
    ans%=mod;
    ans+=power(8,n,mod);
    ans%=mod;
    cout<<ans<<endl;
}


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

int main(){
  int n;
  cin >> n;
  for(int i=1; i<=n; i++){
    if(i%3==0){
      cout << " " << i;
    }
    else{
      int x=i;
      while(true){
        if(x%10==3){
          cout << " " << i;
          break;
        }
        if(x<10)break;
        x/=10;
      }
    }
    
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 3124
#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#define ll long long
#define ld long double

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rrep(i, a, b) for(ll i = a; i >= b; --i)

#define pii pair<int, int>
#define pll pair<ll, ll>

#define fi first
#define se second

#define pb push_back
#define eb emplace_back

#define vi vector<int>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define all(a) a.begin(), a.end()

#define endl '\n'
using namespace std;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
  
const int MOD=1e9+7;
const ll INF=1e18;
const double PI=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
 
const int MAX=510000;

ll dp[50][2];
// 0なら一致，1ならsmaller 
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
   
  ll n,k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  
  memset(dp,-1,sizeof(dp));
  dp[0][0]=0;
  rep(i,50){
    ll bit = 1ll<<(49-i);
    
    int sum = 0;
    rep(i,n) if(a[i] & bit) sum++;
    
    ll val0=bit*sum;
    ll val1=bit*(n-sum);
    
    //小さいからの小さい
    if(dp[i][1] != -1){
      chmax(dp[i+1][1],dp[i][1]+max(val0,val1));
    }
    //一致からの小さい
    if(dp[i][0] != -1){
      if(k&bit){
        chmax(dp[i+1][1],dp[i][0]+val0);
      }
    }
    //一致からの一致
    if(dp[i][0] != -1){
      if(k&bit) chmax(dp[i+1][0],dp[i][0]+val1);
      else chmax(dp[i+1][0],dp[i][0]+val0);
    }
  }
  
  cout << max(dp[50][0],dp[50][1]) << endl;
      
      
    
    
  return 0;
}


Measured memory_bytes: 3932
N, X = [int(elem) for elem in input().split()]
h_burger = [None] * (N + 1)
p_burger = [None] * (N + 1)
h_burger[0] = 1
p_burger[0] = 1
for i in range(1, N + 1):
    h_burger[i] = h_burger[i - 1] * 2 + 3
    p_burger[i] = p_burger[i - 1] * 2 + 1


def num_patties(l, x):
    if l == 0:
        return 1 if x >= 1 else 0
    else:
        if x <= h_burger[l - 1] + 1:
            return num_patties(l - 1, x - 1)
        elif x == h_burger[l - 1] + 2:
            return p_burger[l - 1] + 1
        else:
            return p_burger[l - 1] + 1 \
                + num_patties(l - 1, x - h_burger[l - 1] - 2)


print(num_patties(N, X))


Measured memory_bytes: 3064
n = int(input())
table = []
for i in range(n):
    nest_table = []
    s, p = input().split()
    p = int(p)
    nest_table.append(s)
    nest_table.append(p)
    nest_table.append(i+1)
    table.append(nest_table)
    for j in range(i, 0, -1):
        if table[j][0] < table[j-1][0]:
            keep = table[j]
            table[j] = table[j-1]
            table[j-1] = keep
        elif table[j][0] == table[j-1][0]:
            if table[j][1] > table[j-1][1]:
                keep = table[j]
                table[j] = table[j-1]
                table[j-1] = keep    

for i in range(n):
    print(table[i][2])

Measured memory_bytes: 3064