Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
a = list(map(int,input().split()))

machi = 1
toutatu = []
while not machi in set(toutatu):
	toutatu.append(machi)
	machi = a[machi-1]
saigo = machi
num = toutatu.index(saigo)
unchi = toutatu[num:]
cnt = len(unchi)
num = toutatu.index(saigo)

if num > k:
	print(toutatu[k])
else:
	print(unchi[(k-num)%cnt])

Fixed submission:
n,k = map(int,input().split())
a = list(map(int,input().split()))

machi = 1
toutatu = []
pypyosoi = set()
while not machi in pypyosoi:
	toutatu.append(machi)
	pypyosoi.add(machi)
	machi = a[machi-1]

saigo = machi
num = toutatu.index(saigo)
unchi = toutatu[num:]
cnt = len(unchi)

if num > k:
	print(toutatu[k])
else:
	print(unchi[(k-num)%cnt])

#pypyが遅いのは自分のコードが悪いだけごめんねpypyちゃん

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
a = list(map(int,input().split()))
#n個のまち
#1～n　番号
#テレポーターありゅううううううう
# iの転送先a[i]
# kがすこおおおおおおおおおおおお
# k回テレポートつかうとどのまちいく？

# modるか
# nは2*10**5

machi = 1
toutatu = []
while not machi in toutatu:
	toutatu.append(machi)
	machi = a[machi-1]
saigo = machi
num = toutatu.index(saigo)
unchi = toutatu[num:]
cnt = len(unchi)
num = toutatu.index(saigo)

if num > k:
	print(toutatu[k])
else:
	print(unchi[(k-num)%cnt])

Fixed submission:
n,k = map(int,input().split())
a = list(map(int,input().split()))

machi = 1
toutatu = []
pypyosoi = set()
while not machi in pypyosoi:
	toutatu.append(machi)
	pypyosoi.add(machi)
	machi = a[machi-1]

saigo = machi
num = toutatu.index(saigo)
unchi = toutatu[num:]
cnt = len(unchi)

if num > k:
	print(toutatu[k])
else:
	print(unchi[(k-num)%cnt])

#pypyが遅いのは自分のコードが悪いだけごめんねpypyちゃん
Buggy python submission (verdict: Time Limit Exceeded):
import math
a,b,c = map(int,input().split())
maxcnt = -99999
if c <= b-1:
	for x in range(c+1):
		cnt = (a*x)//b - a*(x//b)
		if cnt > maxcnt:
			maxcnt = cnt
else:
	x = b-1
	maxcnt = math.floor(a*x/b) - a* math.floor(x/b)
print(maxcnt)

Fixed submission:
import math
a,b,c = map(int,input().split())
maxcnt = -99999
if c <= b-1:
	x = c
	cnt = (a*x)//b - a*(x//b)
	if cnt > maxcnt:
		maxcnt = cnt
else:
	x = b-1
	maxcnt = math.floor(a*x/b) - a* math.floor(x/b)
print(maxcnt)

Buggy python submission (verdict: Time Limit Exceeded):
# map(int,input().split())
# int(input())
import math
a,b,c = map(int,input().split())
# if a< b 定まらん
# if a>=b a-1
# cの値による？c <= a-2 のとき.
maxcnt = -99999
if c <= b-1:
	for x in range(c+1):
		cnt = math.floor(a*x/b) - a* math.floor(x/b)
		if cnt > maxcnt:
			maxcnt = cnt
else:
	x = b-1
	maxcnt = math.floor(a*x/b) - a* math.floor(x/b)
print(maxcnt)

Fixed submission:
import math
a,b,c = map(int,input().split())
maxcnt = -99999
if c <= b-1:
	x = c
	cnt = (a*x)//b - a*(x//b)
	if cnt > maxcnt:
		maxcnt = cnt
else:
	x = b-1
	maxcnt = math.floor(a*x/b) - a* math.floor(x/b)
print(maxcnt)

Buggy python submission (verdict: Time Limit Exceeded):
# map(int,input().split())
# int(input())
import math
a,b,c = map(int,input().split())
# if a< b 定まらん
# if a>=b a-1
# cの値による？c <= a-2 のとき.
maxcnt = 0
if a<b:
	for x in range(c+1):
		cnt = math.floor(a*x/b) - a* math.floor(x/b)
		if cnt > maxcnt:
			maxcnt = cnt
else:
	if c <= a-2:
		for x in range(c + 1):
			cnt = math.floor(a * x / b) - a * math.floor(x / b)
			if cnt > maxcnt:
				maxcnt = cnt
	else:
		x = a-1
		maxcnt = math.floor(a * x / b) - a * math.floor(x / b)
print(maxcnt)

Fixed submission:
import math
a,b,c = map(int,input().split())
maxcnt = -99999
if c <= b-1:
	x = c
	cnt = (a*x)//b - a*(x//b)
	if cnt > maxcnt:
		maxcnt = cnt
else:
	x = b-1
	maxcnt = math.floor(a*x/b) - a* math.floor(x/b)
print(maxcnt)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
for i in range(1,n+1):
	print(a.count(i))

Fixed submission:
import collections
n=int(input())
a=list(map(int,input().split()))
c=collections.Counter(a)
for i in range(1,n+1):
	print(c[i])
Buggy python submission (verdict: Runtime Error):
# これは, u749194f さんの改造です。
# オリジナルではございません。
# https://atcoder.jp/contests/abc162/submissions/11825963
n = int(input())
s = input()
flag = True
if len(set(s))<=2:
    print(0)
    flag = False
if flag:
    r = [i+1 for i in range(n) if s[i]=='R']
    b = [i+1 for i in range(n) if s[i]=='B']
    g = [i+1 for i in range(n) if s[i]=='G']
    minus = 0
    def cnt_cmb(a, b, c):
        cnt = 0
        for i in a:
            for j in b:
                if (i+j)/2 in c:
                    cnt += 1
        return cnt
    minus += cnt_cmb(r, b, g)
    minus += cnt_cmb(b, g, r)
    minus += cnt_cmb(g, r, b)
    print(len(r)*len(b)*len(g)-minus)

Fixed submission:
print(["No","Yes"]["7" in input()])
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
a = list(map(int,input().split()))
dp = np.full((2, n//2 + 1), -10**18, dtype=np.int64)
"""
dp[i][j] := iは偶奇, jは何個決めるか
"""
dp[0][0] = 0
dp[1][0] = 0
for i in range(n):
	k = i % 2
	dp[k][1:] = np.maximum(dp[1-k][1:], dp[k][:-1]+a[i])

print(max(dp[0][n//2], dp[1][n//2]))

Fixed submission:
import numpy as np
n = int(input())
a = list(map(int,input().split()))
dp = np.full((2, n//2 + 1), -10**18, dtype=np.int64)
"""
dp[i][j] := iは偶奇, jは何個決めるか
"""
dp[0][0] = 0
dp[1][0] = 0
for i in range(n):
	k = i % 2
	for j in [2, 1, 0]:
		if i//2+j <= n//2:
			if i//2-1+j >= 0:
				dp[k][i//2+j] = np.maximum(dp[1-k][i//2+j], dp[k][i//2-1+j]+a[i])

print(max(dp[0][n//2], dp[1][n//2]))
Buggy python submission (verdict: Runtime Error):
print(" ".join([map(str,input().split())]))

Fixed submission:
x,y,z=map(int,input().split())
print(str(z)+" "+str(x)+" "+str(y))

Buggy python submission (verdict: Runtime Error):
d,s,r=map(int,input().split())
print(f"{r} {d} {s}")

Fixed submission:
x,y,z=map(int,input().split())
print(str(z)+" "+str(x)+" "+str(y))
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
print(min([n%abs(n-k), abs(n%abs(n-k)-k)]))

Fixed submission:
n,k=map(int,input().split())
if (n-k)!=0:
	print(min([abs(n%k), abs(abs(n%k)-k)]))
else:
	print("0")
Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())
keta=2
unta=[[]]*10
unta[0]=["1","2","3","4","5","6","7","8","9"]
for _ in range(9):
	for i in range(len(unta[keta-2])):
		if unta[keta-2][i][len(unta[keta-2][i])-1]=="0":
			unta[keta-1].append(("").join(unta[keta-2][i])+"0")
			unta[keta-1].append(("").join(unta[keta-2][i])+"1")
		if unta[keta-2][i][len(unta[keta-2][i])-1]=="9":
			unta[keta-1].append(("").join(unta[keta-2][i])+"8")
			unta[keta-1].append(("").join(unta[keta-2][i])+"9")
		else:
			unta[keta-1].append(("").join(unta[keta-2][i])+str(int(unta[keta-2][i][len(unta[keta-2][i])-1])-1))
			unta[keta-1].append(("").join(unta[keta-2][i])+str(int(unta[keta-2][i][len(unta[keta-2][i])-1])))
			unta[keta-1].append(("").join(unta[keta-2][i])+str(int(unta[keta-2][i][len(unta[keta-2][i])-1])+1))
	keta += 1
unchi=[]
for i in range(10):
	unchi+=unta[i]
print(unchi[k-1])

Fixed submission:
k=int(input())
unta=[[],[],[],[],[],[],[],[],[],[],[],[]]
unta[1]=["1","2","3","4","5","6","7","8","9"]
for keta in range(2,12):
	for i in range(len(unta[keta-1])):
		if unta[keta-1][i][keta-2]=="0":
			unta[keta].append(unta[keta-1][i]+"0")
			unta[keta].append(unta[keta-1][i]+"1")
		elif unta[keta-1][i][keta-2]=="9":
			unta[keta].append(unta[keta-1][i]+"8")
			unta[keta].append(unta[keta-1][i]+"9")
		else:
			unta[keta].append(unta[keta-1][i]+str(int(unta[keta-1][i][keta-2])-1))
			unta[keta].append(unta[keta-1][i]+unta[keta-1][i][keta-2])
			unta[keta].append(unta[keta-1][i]+str(int(unta[keta-1][i][keta-2])+1))
unchi=[]
for i in range(11):
	unchi+=unta[i]
print(unchi[k-1])
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
print((n(n-1)//2)*(m(m-1)//2))

Fixed submission:
n,m=map(int, input().split())
r = 0
if n>=2:
	r += n*(n-1)//2
if m>=2:
	r += m*(m-1)//2
print(r)
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
if k>=2 and s>=2:
	k=h//2
	s=h%2
	print(k*w+s*((w+1)//2))
else:
	print("1")

Fixed submission:
h,w=map(int,input().split())
if h>=2 and w>=2:
	k=h//2
	s=h%2
	print(k*w+s*((w+1)//2))
else:
	print("1")
Buggy python submission (verdict: Runtime Error):
s=input()
q=int(input())
for _ in range(q):
	k=input()
	if k[0] == "1":
		s = s[::-1]
	else:
		if k[2] == "1":
			s = k[4:]+s
		else:
			s = s+k[4:]
print(s)

Fixed submission:
s=input()
if s=="AAA" or s=="BBB":
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
q = int(input())
for i in range(q):
	c=list(input().split())
	if c[0]=="1":
		s=s[:int(c[1])-1]+c[2]+s[int(c[1]):]
	else:
		print(len(set(s[int(c[1])-1:int(c[2])])))

Fixed submission:
n = int(input())
print((n+1)//2)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int, input.split())
count = 0
if a==b:
  count = count + 1
if b==c:
  count = count + 1
if c==a:
  count = count + 1
if count == 1:
  print("Yes")
else:
  print("No")

Fixed submission:
a,b,c = map(int, input().split())
count = 0
if a==b:
  count = count + 1
if b==c:
  count = count + 1
if c==a:
  count = count + 1
if count == 1:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
from collections import Counter
 
#まずは代入
n = int(input())
s = [input() for _ in range(n)]
c = collections.Counter(s).most_common() #もうリストにしちゃった<3
#この時点で, cは個数が多い順に並んでる
#たとえば入力例1だと
#[('vet', 2), ('beet', 2), ('beat', 1), ('bed', 1), ('bet', 1)]
 
ans = []
max = c[0][1] #最大の個数は何か? 数値を代入
for item,count in c:
	if count==max:
		ans.append(item)
	else:
		break #もうこれ以下は弱いのしかないのでbreakします
 
ans.sort() #辞書順に並べる
 
for i in range(len(ans)):
	print(ans[i])

Fixed submission:
n = int(input())
s = []
for i in range(n):
  s.append(input())
s.sort()
k = 0
f = s
maxk = 0
for i in range(n-1):
  if s[i] == s[i+1]:
    k = k+1
    if k == maxk :
      maxk = k
      f.append(s[i])
    elif k > maxk :
      maxk = k
      f = [s[i]]
  else:
    k = 0
for i in range(len(f)):
  print(f[i])
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
p = list(map(int,input().split()))
u = sum(p[0:k])
maxsum = u
for i in range(1, n-k+1):
	u = u + p[i+k-1] - p[i-1]
	if u >= maxsum:
		maxsum = u
print((maxsum+k)/2)

Fixed submission:
s,t=map(str,input().split())
a,b=map(int,input().split())
u=input()
if u == s:
	print(a-1, b)
if u == t:
	print(a, b-1)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
cnt = 0
for i in range(n):
	for j in range(n):
		if i != j and a[i] == a[j]:
			cnt += 1
			break
print(["NO","YES"][cnt==0])

Fixed submission:
n=input();a=list(map(int,input().split()))
print(["YES","NO"][len(set(a))!=len(a)])
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))
maxsum = 0
for i in range(n-k+1):
	cnt = sum(p[i:i+k])
	if cnt >= maxsum:
		maxsum = cnt
print((maxsum+k)/2)

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))
u = sum(p[0:k])
maxsum = u
for i in range(1, n-k+1):
	u = u + p[i+k-1] - p[i-1]
	if u >= maxsum:
		maxsum = u
print((maxsum+k)/2)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))
maxsum = 0
for i in range(n-k+1):
	cnt = sum(p[i:i+k])+k
	if cnt >= maxsum:
		maxsum = cnt
print(maxsum/2)

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))
u = sum(p[0:k])
maxsum = u
for i in range(1, n-k+1):
	u = u + p[i+k-1] - p[i-1]
	if u >= maxsum:
		maxsum = u
print((maxsum+k)/2)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))
eg = [sum(p[i:i+k])+k for i in range(n-k+1)]
maxsum = 0
for i in range(n-k+1):
	cnt = eg[i]/2
	if cnt >= maxsum:
		maxsum = cnt
print(maxsum)

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))
u = sum(p[0:k])
maxsum = u
for i in range(1, n-k+1):
	u = u + p[i+k-1] - p[i-1]
	if u >= maxsum:
		maxsum = u
print((maxsum+k)/2)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))
eg = [(p[i]*(p[i]+1)//2)/p[i] for i in range(n)]
maxsum = 0
for i in range(n-k+1):
	cnt = sum(eg[i:i+k])
	if cnt >= maxsum:
		maxsum = cnt
print(maxsum)

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))
u = sum(p[0:k])
maxsum = u
for i in range(1, n-k+1):
	u = u + p[i+k-1] - p[i-1]
	if u >= maxsum:
		maxsum = u
print((maxsum+k)/2)
Buggy python submission (verdict: Runtime Error):
h,a=map(int, input())
print(h//a+1)

Fixed submission:
h,a=map(int,input().split())
print(int(h/a+0.99995))
Buggy python submission (verdict: Time Limit Exceeded):
h,n = map(int,input().split())
mahou = []
for i in range(n):
	a,b = map(int,input().split())
	mahou.append((a,b))
dp = [10**18 for _ in range(h+1)]
dp[0] = 0
for i in range(h+1):
	for j, k in mahou:
		if j+i <= h:
			dp[j+i] = min(dp[i]+k, dp[j+i])
		else:
			dp[h] = min(dp[i]+k, dp[h])
print(dp[h])

Fixed submission:
h,n = map(int,input().split())
mahou = []
for i in range(n):
	a,b = map(int,input().split())
	mahou.append((a,b))
dp = [10**18 for _ in range(h+1)]
dp[0] = 0
for i in range(h+1):
	for j, k in mahou:
		if j+i <= h:
			dp[j+i] = min(dp[i]+k, dp[j+i])
		else:
			dp[h] = min(dp[i]+k, dp[h])
print(dp[h])
Buggy python submission (verdict: Runtime Error):
n,k,s = map(int,input().split())
if k == 0:
	if s != 10**9:
		print(" ".join([s+1 for _ in range(n)]))
	else:
		print(" ".join(1 for _ in range(n)))
elif s != 10**9:
	ans = [10**9 for _ in range(n)]
	for i in range(k):
		ans[i] = s
	print(" ".join([str(ans[i]) for i in range(n)]))
else:
	ans = [1 for _ in range(n)]
	for i in range(k):
		ans[i] = s
	print(" ".join([str(ans[i]) for i in range(n)]))

Fixed submission:
n,k,s = map(int,input().split())
if k == 0:
	if s != 10**9:
		print(" ".join([str(10**9) for _ in range(n)]))
	else:
		print(" ".join([str(1) for _ in range(n)]))
elif s != 10**9:
	ans = [10**9 for _ in range(n)]
	for i in range(k):
		ans[i] = s
	print(" ".join([str(ans[i]) for i in range(n)]))
else:
	ans = [1 for _ in range(n)]
	for i in range(k):
		ans[i] = s
	print(" ".join([str(ans[i]) for i in range(n)]))

Buggy python submission (verdict: Runtime Error):
n,k,s = map(int,input().split())
if k == 0:
	if s != 10**9:
		print(" ".join([s+1 for _ in range(n)]))
	else:
		print(" ".join([1] for _ in range(n)))
elif s != 10**9:
	ans = [10**9 for _ in range(n)]
	for i in range(k):
		ans[i] = s
	print(" ".join([str(ans[i]) for i in range(n)]))
else:
	ans = [1 for _ in range(n)]
	for i in range(k):
		ans[i] = s
	print(" ".join([str(ans[i]) for i in range(n)]))

Fixed submission:
n,k,s = map(int,input().split())
if k == 0:
	if s != 10**9:
		print(" ".join([str(10**9) for _ in range(n)]))
	else:
		print(" ".join([str(1) for _ in range(n)]))
elif s != 10**9:
	ans = [10**9 for _ in range(n)]
	for i in range(k):
		ans[i] = s
	print(" ".join([str(ans[i]) for i in range(n)]))
else:
	ans = [1 for _ in range(n)]
	for i in range(k):
		ans[i] = s
	print(" ".join([str(ans[i]) for i in range(n)]))
Buggy python submission (verdict: Runtime Error):
import math
x=int(input())
primemode = True
while primemode:
  sos = True
  for n in range(math.floor(math.sqrt(x))):
    if n+1 != 1:
      if x%(n+1) == 0:
        sos = False
  if sos:
    primemode = False
  else:
    x = x+1
print(x)

Fixed submission:
s,t=input().split()
print(t+s)

Buggy python submission (verdict: Runtime Error):
import math
x=int(input())
primemode = True
while primemode:
  x = x+1
  sos = True
  for n in range(math.floor(math.sqrt(x))):
    if n+1 != 1:
      if x%(n+1) == 0:
        sos = False
  if sos:
    primemode = False
print(x)

Fixed submission:
s,t=input().split()
print(t+s)

Buggy python submission (verdict: Runtime Error):
a,b = input()
print(b+a)

Fixed submission:
s,t=input().split()
print(t+s)
Buggy python submission (verdict: Runtime Error):
import math
x=int(input())
primemode = True
while primemode:
  sos = True
  for n in range(math.floor(math.sqrt(x))):
    if n+1 != 1:
      if x\(n+1) == 0:
        sos = False
  if sos:
    primemode = False
  x = x+1
print(x)

Fixed submission:
import math
x=int(input())
primemode = True
while primemode:
  sos = True
  for n in range(math.floor(math.sqrt(x))):
    if n+1 != 1:
      if x%(n+1) == 0:
        sos = False
  if sos:
    primemode = False
  else:
    x = x+1
print(x)
Buggy python submission (verdict: Runtime Error):
import math
a,b=map(int,input().split())
print((a*b)//math.gcd(a,b))

Fixed submission:
import fractions
a,b=map(int,input().split())
print(a*b//fractions.gcd(a,b))

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

Fixed submission:
import fractions
a,b=map(int,input().split())
print(a*b//fractions.gcd(a,b))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
def haitteru(l, x):
	if x in set(l):
		return l.index(x)
	else:
		return -1


cnt = n+2
x = haitteru(a, 1)

if x != -1:
	cnt = 2
	while True:
		x = haitteru(a[x+1:], cnt)
		if x == -1:
			break
		cnt += 1

print(n-cnt+1)

Fixed submission:
import bisect
n=int(input())
a=list(map(int,input().split()))
c=max(a)
ct=[[0] for _ in range(c+1)]
for i in range(n):
	ct[a[i]].append(i+1)
ans = -1
memo = -1
for j in range(c+1):
	if max(ct[j])>memo:
		ans += 1
		memo = ct[j][bisect.bisect_right(ct[j], memo)]
	else:
		break
if ct[1]==[0]:
	print(-1)
else:
	print(n-ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
def haitteru(l, x):
	if x in set(l):
		return l.index(x)
	else:
		return -1


cnt = n+2
x = haitteru(a, 1)

if x != -1:
	cnt = 2
	while True:
		x = haitteru(a[x+1:], cnt)
		if x == -1:
			break
		cnt += 1

print(n-cnt+1)

Fixed submission:
import bisect
n=int(input())
a=list(map(int,input().split()))
c=max(a)
ct=[[0] for _ in range(c+1)]
for i in range(n):
	ct[a[i]].append(i+1)
ans = -1
memo = -1
for j in range(c+1):
	if max(ct[j])>memo:
		ans += 1
		memo = ct[j][bisect.bisect_right(ct[j], memo)]
	else:
		break
if ct[1]==[0]:
	print(-1)
else:
	print(n-ans)
Buggy python submission (verdict: Runtime Error):
r=0
s=input()
for n in len(s):
  if s[n] != s[(-1)*(n+1)]:
    r+=1
print(r/2)

Fixed submission:
f = map(int, input().split())
s = sum(f)
def u(n):
  if n>=22:
    return "bust"
  else:
    return "win"
print(u(s))
Buggy python submission (verdict: Runtime Error):
r = 0
s = input()
for n in len(s):
  k = (-1)*(n+1)
  if s[n] != s[k]:
    r += 1
print(r/2)


Fixed submission:
r = 0
s = input()
for n in range(len(s)):
  if s[n] != s[-n-1]:
    r += 1
print(r//2)

Buggy python submission (verdict: Runtime Error):
r = 0
s = input()
for n in len(s):
  if s[n] != s[(-1)*(n+1)]:
    r = r+1
print(r/2)

Fixed submission:
r = 0
s = input()
for n in range(len(s)):
  if s[n] != s[-n-1]:
    r += 1
print(r//2)

Buggy python submission (verdict: Runtime Error):
r=0
s=input()
for n in len(s):
  if s[n] != s[(-1)*(n+1)]:
    r+=1
print(r/2)

Fixed submission:
r = 0
s = input()
for n in range(len(s)):
  if s[n] != s[-n-1]:
    r += 1
print(r//2)

Buggy python submission (verdict: Runtime Error):
r=0
s=input()
for n in len(s):
  if s[n]!=s[-(n+1)]:
    r+=1
print(r/2)

Fixed submission:
r = 0
s = input()
for n in range(len(s)):
  if s[n] != s[-n-1]:
    r += 1
print(r//2)

Buggy python submission (verdict: Runtime Error):
r=0
s=input()
for n in len(s):
  if s[n]!=s[-n]:
    r+=1
print(r/2)


Fixed submission:
r = 0
s = input()
for n in range(len(s)):
  if s[n] != s[-n-1]:
    r += 1
print(r//2)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
maxketa = max([len(bin(a[i])) for i in range(n)])-2
mod = 10**9+7
ans = 0
for i in range(maxketa):
	ones = 0
	for j in range(n):
		if (a[j] >> i) & 1:
			ones += 1
	ans = (ans + (n-ones)*ones*(2**i)) % mod

print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
maxketa = max([len(bin(a[i])) for i in range(n)])-2
mod = 10**9+7
ans = 0
for i in range(maxketa):
	ones = 0
	for j in range(n):
		if (a[j] >> i) & 1:
			ones += 1
	ans = (ans + (n-ones)*ones*(2**i)) % mod
 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
maxketa = max([len(bin(a[i])) for i in range(n)])-2
array = [[(a[j]>>i) & 1 for j in range(n)] for i in range(maxketa)]
"""
arrayは逆順に並んでることに注意
"""
mod = 10**9+7
tmparrayc = [Counter(array[i]) for i in range(maxketa)]
ans = sum([tmparrayc[i][0]*tmparrayc[i][1]*(2**i) % mod for i in range(maxketa)]) % mod
print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
maxketa = max([len(bin(a[i])) for i in range(n)])-2
mod = 10**9+7
ans = 0
for i in range(maxketa):
	ones = 0
	for j in range(n):
		if (a[j] >> i) & 1:
			ones += 1
	ans = (ans + (n-ones)*ones*(2**i)) % mod
 
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ikeru = [[] for _ in range(n)]
for i in range(n-1):
	a, b = map(int, input().split())
	ikeru[a-1].append((b-1, i))

settansaku = set([])
setmada = {0}
listmada = [(0, None)]  #left: Vertex, right: Color
kouho = 1
num = [0 for _ in range(n-1)]

while kouho != 0:
	for i, cnt in listmada[:]:
		colors = {cnt}
		settansaku.add(i)
		setmada.remove(i)
		listmada.remove((i, cnt))
		kouho -= 1
		for k, j in ikeru[i]:
			if not k in setmada:
				if not k in settansaku:
					setmada.add(k)
					c = 0
					while True:
						if c not in colors:
							listmada.append((k, c))
							colors.add(c)
							num[j] = c
							break
						c += 1
					kouho += 1

print(max(num)+1)
print("\n".join([str(i+1) for i in num]))

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

settansaku = set([])
setmada = {0}
listmada = [(0, None)]  #left: Vertex, right: Color
kouho = 1
num = [0 for _ in range(n-1)]

while kouho != 0:
	for i, cnt in listmada[:]:
		colors = {cnt}
		settansaku.add(i)
		setmada.remove(i)
		listmada.remove((i, cnt))
		kouho -= 1
		c = 0
		for k, j in ikeru[i]:
			if not k in setmada:
				if not k in settansaku:
					setmada.add(k)
					while True:
						if c not in colors:
							listmada.append((k, c))
							colors.add(c)
							num[j] = c
							break
						c += 1
					kouho += 1

print(max(num)+1)
print("\n".join([str(i+1) for i in num]))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ikeru = [[] for _ in range(n)]
for i in range(n-1):
	a, b = map(int, input().split())
	ikeru[a-1].append((b-1, i))

settansaku = set([])
setmada = {0}
listmada = [(0, None)]  #left: Vertex, right: Color
kouho = 1
num = [0 for _ in range(n-1)]

while kouho != 0:
	for i, cnt in listmada[:]:
		colors = {cnt}
		settansaku.add(i)
		setmada.remove(i)
		listmada.remove((i, cnt))
		kouho -= 1
		for k, j in ikeru[i]:
			if not k in setmada:
				if not k in settansaku:
					setmada.add(k)
					c = 0
					while True:
						if c not in colors:
							listmada.append((k, c))
							colors.add(c)
							num[j] = c
							break
						c += 1
					kouho += 1

print(max(num)+1)
print("\n".join([str(i+1) for i in num]))

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

settansaku = set([])
setmada = {0}
listmada = [(0, None)]  #left: Vertex, right: Color
kouho = 1
num = [0 for _ in range(n-1)]

while kouho != 0:
	for i, cnt in listmada[:]:
		colors = {cnt}
		settansaku.add(i)
		setmada.remove(i)
		listmada.remove((i, cnt))
		kouho -= 1
		c = 0
		for k, j in ikeru[i]:
			if not k in setmada:
				if not k in settansaku:
					setmada.add(k)
					while True:
						if c not in colors:
							listmada.append((k, c))
							colors.add(c)
							num[j] = c
							break
						c += 1
					kouho += 1

print(max(num)+1)
print("\n".join([str(i+1) for i in num]))
Buggy python submission (verdict: Runtime Error):
s=input();print([int(s[0])*int(s[2]),-1][len(s)!=3])
  

Fixed submission:
a,b=map(int,input().split());print([a*b,-1][a>9 or b>9])