Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from collections import Counter
def cmb(n):
    if n < 2:
        return 0
    else:
        return (n * (n-1)) // 2

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

cs = Counter(a)
s = 0

for v in cs.values():
    s += cmb(v)

for a in ls:
    print(s - cmb(cs[a]) + cmb(cs[a] - 1))

Fixed submission:
from collections import Counter
def cmb(n):
    if n < 2:
        return 0
    else:
        return (n * (n-1)) // 2

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

cs = Counter(ls)
s = 0

for v in cs.values():
    s += cmb(v)

for a in ls:
    print(s - cmb(cs[a]) + cmb(cs[a] - 1))

Buggy python submission (verdict: Runtime Error):
from collections import Counter
def cmb(n):
    if n < 2:
        return 0
    else:
        return (n * (n-1)) // 2

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

cs = Counter(a)
s = 0

for v in cs.values():
    s += cmb(v)

for a in ls:
    print(s - cmb(c[a]) + cmb(c[a] - 1))

Fixed submission:
from collections import Counter
def cmb(n):
    if n < 2:
        return 0
    else:
        return (n * (n-1)) // 2

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

cs = Counter(ls)
s = 0

for v in cs.values():
    s += cmb(v)

for a in ls:
    print(s - cmb(cs[a]) + cmb(cs[a] - 1))

Buggy python submission (verdict: Runtime Error):
from collections import Counter

def cmb(n):
    if n < 2:
        return 0
    else:
        return n * (n-1) / 2

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

cs = Counter(a)
s = 0

for v in cs.values():
    s += cmb(v)

for a in ls:
    print(s - cmb(c[a]) + cmb(c[a] - 1))

Fixed submission:
from collections import Counter
def cmb(n):
    if n < 2:
        return 0
    else:
        return (n * (n-1)) // 2

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

cs = Counter(ls)
s = 0

for v in cs.values():
    s += cmb(v)

for a in ls:
    print(s - cmb(cs[a]) + cmb(cs[a] - 1))

Buggy python submission (verdict: Time Limit Exceeded):
def counter(lss):
    n = len(lss)
    cnt = 0
    anums = []
    for i in range(1,(n + 1)):
        anum = 0
        for j in range(n):
            if (i == lss[j]):
                anum += 1
        cnt += (anum * (anum - 1)) // 2
    return cnt

n = int(input())

ls = list(map(int,input().split()))

for k in range(n):
    if (k == 0):
        lss = ls[1:n]
    elif (k == n-1):
        lss = ls[0:n-1]
    else:
        lss = ls[0:k] + ls[k + 1:n]
    print(counter(lss))





Fixed submission:
from collections import Counter
def cmb(n):
    if n < 2:
        return 0
    else:
        return (n * (n-1)) // 2

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

cs = Counter(ls)
s = 0

for v in cs.values():
    s += cmb(v)

for a in ls:
    print(s - cmb(cs[a]) + cmb(cs[a] - 1))
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())

rest = []
for i in range(m):
    a,b = input().split()
    rest.apend((int(a),b))

done = False

for i in range(0,1000):
    x = str(i)
    if (len(x) == n):
        ok = True
        for t in rest:
            if (x[t[0] - 1] != t[1]):
                ok = False
                break
        if ok:
            print(i)
            done = True

if not done:
    print(-1)

Fixed submission:
n,m = map(int,input().split())

rest = []
for i in range(m):
    a,b = input().split()
    rest.append((int(a),b))

done = False

for i in range(0,1000):
    x = str(i)
    if (len(x) == n):
        ok = True
        for t in rest:
            if (x[t[0] - 1] != t[1]):
                ok = False
                break
        if ok:
            print(i)
            done = True
            break

if not done:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,k = map(int,input().split())

p = np.array(input().split(),np.int)

ans = 0
qs = (p + 1)/2
for i in range(n-k+1):
    ps = qs[i:(i+k)]
    ans = max(ans,sum(ps))


print(ans)


Fixed submission:
import numpy as np
n,k = map(int,input().split())

p = np.array(input().split(),np.int)


fs = p[:k]
f = sum(fs)
m = n - k + 1
qs = np.zeros(m)
qs[0] = f
if n == k:
    ans = (f + k)/2
    print(ans)
else:
    for i in range(k,n):
        a = qs[i-k] - p[i-k] + p[i]
        qs[i-k+1] = a
    ans = (max(qs)+k) / 2
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,k = map(int,input().split())

p = np.array(list(map(int,input().split())))

def expect(ps,k):
    return sum((ps + 1)/2)

ans = 0
for i in range(n-k+1):
    ps = p[i:(i+k)]
    ans = max(ans,expect(ps,k))


print(ans)


Fixed submission:
import numpy as np
n,k = map(int,input().split())

p = np.array(input().split(),np.int)


fs = p[:k]
f = sum(fs)
m = n - k + 1
qs = np.zeros(m)
qs[0] = f
if n == k:
    ans = (f + k)/2
    print(ans)
else:
    for i in range(k,n):
        a = qs[i-k] - p[i-k] + p[i]
        qs[i-k+1] = a
    ans = (max(qs)+k) / 2
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

ps = list(map(int,input().split()))

a = 1
qs = [ps[0]]
for i in range(1,n):
    if min(qs) >= ps[i]:
        a += 1
    qs.append(ps[i])

print(a)


Fixed submission:
n = int(input())

ps = list(map(int,input().split()))

a = 0
m = n + 1
qs = []
for i in range(n):
    if m >= ps[i]:
        a += 1
    qs.append(ps[i])
    m = min(m,ps[i])
    if ps[i] == 1:
        break

print(a)
Buggy python submission (verdict: Runtime Error):
n = int(input())

ps = list(map(int,input().split()))

qs = list(map(int,input().split()))


a = 0
b = 0
r = 0
for i in range(n):
    if ps[i] == qs[i]:
        continue
    else:
        r = i
        break

ts = ps[r:]
ts.sort()

ns = list(itertools.permutations(ts))
m = len(ns)

for j in range(m):
    if list(ns[j]) == ps[r:]:
        a = j
        break

for l in range(m):
    if list(ns[l]) == qs[r:]:
        b = l
        break
    

print(abs(a-b))


Fixed submission:
import itertools
n = int(input())

ps = list(map(int,input().split()))

qs = list(map(int,input().split()))


a = 0
b = 0
r = 0
for i in range(n):
    if ps[i] == qs[i]:
        continue
    else:
        r = i
        break

ts = ps[r:]
ts.sort()

ns = list(itertools.permutations(ts))
m = len(ns)

for j in range(m):
    if list(ns[j]) == ps[r:]:
        a = j
        break

for l in range(m):
    if list(ns[l]) == qs[r:]:
        b = l
        break
    

print(abs(a-b))
Buggy python submission (verdict: Runtime Error):
n = int(input())

ass = list(map(int,input().split()))

ans = 0
for i in range(60):
    k = 1 << i
    i_1 = sum([k & a for a in ass]) >> i
    ans += i_1 * (n - i_1) << i
    ans = ans % ((10**9) + 7)

print(ans)


Fixed submission:
x,y,z = map(int,input().split())

if x + y + z > 21:
    print('bust')
else:
    print('win')

Buggy python submission (verdict: Runtime Error):
n = int(input())

a = []
xys = [[] for i in range(n)]

for j in range(n):
    a.append(int(input()))
    for i in range(a[j]):
        xys[j].append(list(map(int,input().split())))

ps = []
p = [0 for i in range(n)]
for i in range(n+1):
    for combi in itertools.combinations(range(n),i):
        p = [0 for i in range(n)]
        combi = list(combi)
        for i in combi:
            p[i] = 1
        ps.append(p)

for l in range(2**n):
    for i in range(n):
        if  (ps[l])[i] == 1:
            for j in range(a[i]):
                if ps[l][xys[i][j][0] - 1] != xys[i][j][1]:
                    ps[l] = [0,0,0]

print(max(sum(ps[l]) for l in range(2**n)))

Fixed submission:
x,y,z = map(int,input().split())

if x + y + z > 21:
    print('bust')
else:
    print('win')
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
n = int(input())

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


aas = list(itertools.combinations(a,2))
m = len(aas)

x = 0
for i in range(m):
    x += ((aas[i][0] ^ aas[i][1]) % (10**9 + 7))
    x %= 10**9 + 7

print(x)


Fixed submission:
n = int(input())

ass = list(map(int,input().split()))

ans = 0
for i in range(60):
    k = 1 << i
    i_1 = sum([k & a for a in ass]) >> i
    ans += i_1 * (n - i_1) << i
    ans = ans % ((10**9) + 7)

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())

ass = list(map(int,input().split()))

m = len(bin(max(a))) - 2

ans = 0
for i in range(60):
    k = 1 << i
    i_1 = sum([k & a for a in ass]) >> i
    ans += i_1 * (n - i_1) << i
    ans = ans % ((10**9) + 7)

print(ans)


Fixed submission:
n = int(input())

ass = list(map(int,input().split()))

ans = 0
for i in range(60):
    k = 1 << i
    i_1 = sum([k & a for a in ass]) >> i
    ans += i_1 * (n - i_1) << i
    ans = ans % ((10**9) + 7)

print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**7)

n = int(input())

graph = [[] for i in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    graph[a].append([b,i])

ans = [0]*(N-1)
def col(now,color):
    c = 1
    for (b,j) in graph[now]:
        if c == color:
            c += 1
    ans[j] = c
    col(b,c)
    c += 1

col(0,0)
print(max(ans))
[print(a) for a in ans]


Fixed submission:
s = str(input())

if s == 'SUN':
    print(7)
elif s == 'SAT':
    print(1)
elif s == 'FRI':
    print(2)
elif s == 'THU':
    print(3)
elif s == 'WED':
    print(4)
elif s == 'TUE':
    print(5)
else:
    print(6)
Buggy python submission (verdict: Runtime Error):
n = int(input())

graph = [[] for i in range(n)]
for i in range(1,n):
    a,b = map(int,input().split())
    graph[a-1].append([b,i])


ans = [0]*(n-1)

def col(now,color):
    c = 1
    for [b,j] in graph[now-1]:
        if c == color:
            c += 1
        ans[j-1] = c
        col(b,c)
        c += 1  

col(1,0)
print(max(ans))
for i in range(1,n):
    print(ans[i-1])


Fixed submission:
import sys
sys.setrecursionlimit(10**7)

n = int(input())

graph = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int,input().split())
    a,b = a-1,b-1
    graph[a].append([b,i])

    
ans = [0]*(n-1)

def col(now,color):
    c = 1
    for (b,j) in graph[now]:
        if c == color:
            c += 1
        ans[j] = c
        col(b,c)
        c += 1

col(0,0)
print(max(ans))
for a in ans:
    print(a)
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())

a = []
m = math.floor(a**(1/2))
for i in range(1,m + 1):
    if n % i == 0:
        a.append(i + (n/i) - 2)

print(int(min(a)))


Fixed submission:
import math
n = int(input())

a = []
m = math.floor(n**(1/2))
for i in range(1,m + 1):
    if n % i == 0:
        a.append(i + (n/i) - 2)

print(int(min(a)))

Buggy python submission (verdict: Runtime Error):
import math
n = int(input())

a = []
m = amth.floor(a**(1/2))
for i in range(1,m + 1):
    if n % i == 0:
        a.append(i + (n/i) - 2)

print(int(min(a)))


Fixed submission:
import math
n = int(input())

a = []
m = math.floor(n**(1/2))
for i in range(1,m + 1):
    if n % i == 0:
        a.append(i + (n/i) - 2)

print(int(min(a)))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

t = n - 1

for i in range(1,n+1):
    if n % i == 0:
        j = n / i
        if t > i + j:
            t = i + j -2

print(int(t))


Fixed submission:
import math
n = int(input())

a = []
m = math.floor(n**(1/2))
for i in range(1,m + 1):
    if n % i == 0:
        a.append(i + (n/i) - 2)

print(int(min(a)))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
n = int(input())

ls = list(map(int,input().split()))

cs = list(itertools.combinations(ls,3))

count = 0
for c in cs:
    d = list(c)
    d.sort()
    if d[2] < d[0] + d[1]:
        count += 1
    

print(count)


Fixed submission:
import bisect
n = int(input())

ls = list(map(int,input().split()))

ls.sort()
count = 0
for i in range(n):
    for j in range(i + 1,n):
        t = ls[i] + ls[j]
        index = bisect.bisect_left(ls,t)
        count += max(0,index - j - 1)

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
n = int(input())

ls = list(map(int,input().split()))

sans = list(itertools.combinations(ls,3))
k = len(sans)
count = 0
for i in range(k):
    a = list(itertools.permutations(sans[i]))
    b = 0
    for i in range(6):
        if (a[i])[0] < (a[i])[1] + (a[i])[2]:
            b += 1
    if b == 6:
        count += 1
print(count)


Fixed submission:
import bisect
n = int(input())

ls = list(map(int,input().split()))

ls.sort()
count = 0
for i in range(n):
    for j in range(i + 1,n):
        t = ls[i] + ls[j]
        index = bisect.bisect_left(ls,t)
        count += max(0,index - j - 1)

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

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

for i in range(n):
    print(str(a.index(i+1)+1) + " ",end = "")


Fixed submission:
n = int(input())

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

b = [[] for i in range(n)]
for i in range(n):
    b[a[i]-1] = i+1

print(" ".join(map(str,b)))
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(a,b):
    if a == 0 or b == 0:
        return max(a,b)
    else:
        c = max(a,b) % min(a,b)
        return gcd(c,min(a,b))

def prime(n):
    a = 2
    b = n
    ps = []
    while b != 1:
        if b % a == 0:
            ps.append(a)
            b /= a
        else:
            a += 1
    return ps

def count(ls):
    if ls == []:
        return 0
    else:
        n = len(ls)
        a = 1
        for i in range(n-1):
            if ls[i] != ls[i + 1]:
                a += 1
    return a

a,b = map(int,input().split())

g = gcd(a,b)
ls = prime(g)
print(count(ls) + 1)


Fixed submission:
import math
def gcd(a,b):
    while a > 0 and b > 0:
        if a > b:
            a = a % b
        elif a < b:
            b = b % a
        else:
            b = 0
    return max(a,b)

a,b = map(int,input().split())

def trial(k):
    factor = []
    m = int(math.sqrt(k)) + 1
    for i in range(2,m):
        while k % i == 0:
            k = k // i
            factor.append(i)
    if not factor:
        return [1,k]
    else:
        factor.append(k)
        factor.append(1)
        return factor

k = gcd(a,b)

ps = trial(k)

count = 1
for i in range(len(ps)-1):
    if ps[i] != ps[i + 1]:
        count += 1

print(count)

Buggy python submission (verdict: Runtime Error):
import math
a,b = map(int,input().split())

def trial(k):
    factor = []
    m = int(math.sqrt(k)) + 1
    for i in range(2,m):
        while k % i == 0:
            k = k // i
            factor.append(i)
    if not factor:
        return [1,k]
    else:
        factor.append(k)
        factor.append(1)
        return factor

k = gcd(a,b)

ps = trial(k)

count = 1
for i in range(len(ps)-1):
    if ps[i] != ps[i + 1]:
        count += 1
        
print(count)



Fixed submission:
import math
def gcd(a,b):
    while a > 0 and b > 0:
        if a > b:
            a = a % b
        elif a < b:
            b = b % a
        else:
            b = 0
    return max(a,b)

a,b = map(int,input().split())

def trial(k):
    factor = []
    m = int(math.sqrt(k)) + 1
    for i in range(2,m):
        while k % i == 0:
            k = k // i
            factor.append(i)
    if not factor:
        return [1,k]
    else:
        factor.append(k)
        factor.append(1)
        return factor

k = gcd(a,b)

ps = trial(k)

count = 1
for i in range(len(ps)-1):
    if ps[i] != ps[i + 1]:
        count += 1

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,k,q = map(int,input().split())

a = np.zeros(q,dtype = int)

for i in range(q):
    a[i] = int(input())


score = np.array([k]*n)

for i in range(q):
    score = score - 1
    score[(a[i]-1)] += 1

for i in range(n):
    if score[i] > 0:
        print('Yes')
    else:
        print('No')


Fixed submission:
import numpy as np
n,k,q = map(int,input().split())

a = np.zeros(q,dtype = int)

for i in range(q):
    a[i] = int(input())


score = np.array([k]*n)
sub = np.zeros(n,dtype = int)
for i in range(q):
    sub[a[i]-1] += 1

score = score + sub - q
for i in range(n):
    if score[i] > 0:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())

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


for i in range(m):
    j = a.index(max(a))
    a[j] = int(max(a)/2)

print(sum(a))


Fixed submission:
import heapq
n,m = map(int,input().split())

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


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

heapq.heapify(a)

for i in range(m):
    d = heapq.heappop(a)
    heapq.heappush(a,d/2)

ans = 0
for i in range(n):
    ans += int(-a[i])

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())

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

a.sort()

for i in range(m):
        a[-1] = int(max(a)/2)
        a.sort()

print(sum(a))


Fixed submission:
import heapq
n,m = map(int,input().split())

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


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

heapq.heapify(a)

for i in range(m):
    d = heapq.heappop(a)
    heapq.heappush(a,d/2)

ans = 0
for i in range(n):
    ans += int(-a[i])

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import numpy as np
n = int(input())

p = np.array([(i+1) for i in range(n)])

ps = np.array(list(itertools.permutations(p)))

a = []
for i in range(len(ps)):
    a.append(np.sum(ps[i] % p))

print(max(a))


Fixed submission:
n = int(input())

print(int((n * (n - 1)) // 2))
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)


def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        lines.append(input())
        (n, m) = [int(e) for e in lines[0].split(' ')]
        lines.append(input())
        for _ in range(m):
            lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]
        (n, m) = [int(e) for e in lines[0].split(' ')]

    h_list = [int(e) for e in lines[1].split(' ')]
    ab_list = []
    for i in range(2, m+2):
        ab_list.append([int(e) for e in lines[i].split(' ')])
        
    return (n, m, h_list, ab_list)


def solve(n, m, h_list, ab_list):

    count = 0
    for i in range(1, n+1):

        result = True
        for j in range(m):

            ab = ab_list[j]
            if ab[0] == i and h_list[i-1] <= h_list[ab[1]-1]:
                result = False
                break
            elif ab[1] == i and h_list[i-1] <= h_list[ab[0]-1]:
                result = False
                break
    
        if result:
            count = count + 1




    return  count


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

Fixed submission:
# -*- coding: utf-8 -*-

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)


def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        lines.append(input())
        (n, m) = [int(e) for e in lines[0].split(' ')]
        lines.append(input())
        for _ in range(m):
            lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]
        (n, m) = [int(e) for e in lines[0].split(' ')]

    h_list = [int(e) for e in lines[1].split(' ')]
    ab_list = []
    for i in range(2, m+2):
        ab_list.append([int(e) for e in lines[i].split(' ')])
        
    return (n, m, h_list, ab_list)


def solve(n, m, h_list, ab_list):


    bad_tower = set()
    for j in range(m):

        ab = ab_list[j]
        if h_list[ab[0]-1] <= h_list[ab[1]-1]:
            bad_tower.add(ab[0])
        
        if h_list[ab[1]-1] <= h_list[ab[0]-1]:
            bad_tower.add(ab[1])

        if debug:
            log("j=%d, bad_tower=%s" % (j, bad_tower))
    
    result = n - len(bad_tower)

    return  result


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()
Buggy python submission (verdict: Runtime Error):
import unittest

from A03 import solve
from A03 import parse_input

class TestA03Solve(unittest.TestCase):

    def test_solve(self):

        lines_as_string = """
5
1 1 2 2
"""

        r = parse_input(lines_as_string)
        for i, e in enumerate(r):
            print("e[%d]=%s" % (i, e))
        print("")
        self.assertEqual(solve(*r), [2,2,0,0,0])

        lines_as_string = """
10
1 1 1 1 1 1 1 1 1
"""

        r = parse_input(lines_as_string)
        for i, e in enumerate(r):
            print("e[%d]=%s" % (i, e))
        print("")
        self.assertEqual(solve(*r), [9,0,0,0,0,0,0,0,0,0]) 


if __name__ == '__main__':
    unittest.main()
                                         

Fixed submission:
# -*- coding: utf-8 -*-

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)


def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        lines.append(input())
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]
    
    (n, ) = [int(e) for e in lines[0].split(" ")]
    a = [int(e) for e in lines[1].split(" ")]

    return (n, a)


def solve(n, a):

    result = dict([(i, 0) for i in range(1, n+1)])

    for i in range(n-1):
        result[a[i]] = result[a[i]] + 1

    return  list(result.values())


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()
Buggy python submission (verdict: Runtime Error):
akasaka

Fixed submission:
# -*- coding: utf-8 -*-

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        # for line in sys.stdin:
        #     lines.append(line)
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    s = lines[0]

    return (s, )


def solve(s, ):

    n = len(s)
    ma = (n - 1) // 2 
    mb = (n + 3) // 2

    def test_text(text):
        if debug:
            log("text=%s" % text)
        n = len(text) 
        m = (n - 1) // 2
        result = True
        for i in range(m+1):
            if debug:
                log('(s[%d], s[%d])=(%s, %s)' % (i, -(i+1), s[i], s[-(i+1)]))
            if text[i] != text[-(i+1)]:
                result = False
                break

        return result

    if debug:
        log("s =%s" % s)
        log("ma=%d, sa=%s" % (ma, s[:ma]))
        log("mb=%d, sb=%s" % (mb, s[mb-1:]))

    result1 = test_text(s) 
    result2 = test_text(s[:ma]) 
    result3 = test_text(s[mb-1:]) 
    if debug:
        log('result1=%s, result2=%s, result3=%s' % (result1, result2, result3))

    result  = 'No'
    if result1 and result2 and result3:
        result = 'Yes'


    
    return result
    


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()