Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
s=input()
print(len(s))
for i in range(len(s)):
    if s[i]=="h":
        if i<len(s)-1:
            if s[i+1]=="i":
                print("Yes")
                break
	print("No")


Fixed submission:
s=input()
a=len(s)//2
if len(s)%2==1:
    print("No")
else:
    if s=="hi"*a:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Runtime Error):
s=input()
 
for i in range(len(s)):
  if s[i]=="h":
    if i<len(s):
      s[i+1]=="i":
        print("yes")
print("no")

Fixed submission:
s=input()
a=len(s)//2
if len(s)%2==1:
    print("No")
else:
    if s=="hi"*a:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Runtime Error):
s=input()

for i in range(len(s):
               if s[i]=="h":
                if s[i+1]=="i":
                 print("yes")
                 exit()
                       
               

Fixed submission:
s=input()
a=len(s)//2
if len(s)%2==1:
    print("No")
else:
    if s=="hi"*a:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
n=input()

if n="AAA" or n="BBB":
  print("No")
else:
  print("Yes")

Fixed submission:
n=input()

if n=="AAA" or n=="BBB":
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
import math
R = int(input())
circumference = 2 * math.pi * R
print("%.20f" % circumference())

Fixed submission:
import math
R = float(input())
circumference = 2 * math.pi * R
print("%.20f" % circumference)
Buggy python submission (verdict: Runtime Error):
    x = list(map(int,input().split()))
    if len(set(x))== 2:
        print("Yes")
    else:
        print("No")

Fixed submission:
x = list(map(int,input().split()))
if len(set(x))== 2:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
arr = [input() for _ in range(n)]
dic = {}
for i in range(n):
    if arr[i] not in dic:
        dic[arr[i]] = 1
    else:
        dic[arr[i]] += 1
largest = max(dic.values())
ans = []
for keys in dic.keys():
    if dic[keys] == largest:
        ans.append(keys)
ans = sorted(ans)
for words in ans:
    print(words)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))

for a in A:
    if a % 2 == 1:
        continue
    if a % 3 == 0 or a % 5 == 0:
        continue
    print('DENIED')
    exit()
print('APPROVED')
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
input = stdin.readline

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

cum = 1
over = False
for x in a:
    if x == 0:
        cum = 0
        break

    cum *= x
    if (cum > 1e18):
        over = True

print(-1) if (over and cum != 0) else print(cum)


Fixed submission:
from sys import stdin
input = stdin.readline

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

cum = 1
over = False
for x in a:
    if x == 0:
        cum = 0
        break

if cum == 0:
    print(0)
else:
    for x in a:
        cum *= x
        if (cum > 1e18):
            over = True
            break
    print(-1) if over else print(cum)

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

cum = 1
over = False
for x in a:
    if x == 0:
        cum = 0
        break

    cum *= x
    if (cum > 1e18):
        over = True

print(-1) if (over and cum != 0) else print(cum)


Fixed submission:
from sys import stdin
input = stdin.readline

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

cum = 1
over = False
for x in a:
    if x == 0:
        cum = 0
        break

if cum == 0:
    print(0)
else:
    for x in a:
        cum *= x
        if (cum > 1e18):
            over = True
            break
    print(-1) if over else print(cum)
Buggy python submission (verdict: Runtime Error):
import math

a,b = map(int, input().split())
print(math.fsum([b] * a))

Fixed submission:
import math
from decimal import *

sa, sb = input().split()
a = Decimal(sa)
b = Decimal(sb)
lb = Decimal(b * Decimal(100))

ans = Decimal(Decimal(a * lb) // Decimal(100))
print(int(ans))

Buggy python submission (verdict: Runtime Error):
import math
from decimal import *

sa, sb = input().split()
a = Decimal(sa)
b = float(sb)
lb = Decimal(b * 100)

ans = Decimalc(Decimal(a * lb) // Decimal(100))
print(int(ans))


Fixed submission:
import math
from decimal import *

sa, sb = input().split()
a = Decimal(sa)
b = Decimal(sb)
lb = Decimal(b * Decimal(100))

ans = Decimal(Decimal(a * lb) // Decimal(100))
print(int(ans))
Buggy python submission (verdict: Runtime Error):
from scipy.spatial import distance


def main():
    h, w = map(int, input().split())
    a = [list(map(int, input().split())) for _ in range(h)]
    op = []
    c = 0

    for y in range(h):
        if y % 2 == 0:
            for x in range(w):
                if (c == 1):
                    a[y][x] += 1
                    c = 0

                if a[y][x] % 2 == 1:
                    c = 1
                    x, y = x + 1, y + 1
                    if (x == w):
                        if y != h:
                            op.append([y, x, y + 1, x])
                        else:
                            break
                    else:
                        op.append([y, x, y, x + 1])
                    x, y = x - 1, y - 1

        else:
            for x in reversed(range(w)):
                if (c == 1):
                    a[y][x] += 1
                    c = 0

                if a[y][x] % 2 == 1:
                    c = 1
                    x, y = x + 1, y + 1
                    if (x == 1):
                        if y != h:
                            op.append([y, x, y + 1, x])
                        else:
                            break
                    else:
                        op.append([y, x, y, x - 1])
                    x, y = x - 1, y - 1

    print(len(op))
    for o in op:
        print(' '.join(map(str, o)))


main()


Fixed submission:
from scipy.spatial import distance


def main():
    h, w = map(int, input().split())
    a = [list(map(int, input().split())) for _ in range(h)]
    op = []
    c = 0

    for y in range(h):
        if y % 2 == 0:
            for x in range(w):
                if (c == 1):
                    a[y][x] += 1
                    c = 0

                if a[y][x] % 2 == 1:
                    c = 1
                    x, y = x + 1, y + 1
                    if (x == w):
                        if y != h:
                            op.append([y, x, y + 1, x])
                        else:
                            break
                    else:
                        op.append([y, x, y, x + 1])
                    x, y = x - 1, y - 1

        else:
            for x in reversed(range(w)):
                if (c == 1):
                    a[y][x] += 1
                    c = 0

                if a[y][x] % 2 == 1:
                    c = 1
                    x, y = x + 1, y + 1
                    if (x == 1):
                        if y != h:
                            op.append([y, x, y + 1, x])
                        else:
                            break
                    else:
                        op.append([y, x, y, x - 1])
                    x, y = x - 1, y - 1

    print(len(op))
    for o in op:
        print(' '.join(map(str, o)))


main()
Buggy python submission (verdict: Time Limit Exceeded):
import math

n = int(input())
li = [int(x) for x in input().split()]
ans = 0
isAvailable = False
for a in li:
    if a % 2 == 0:
        isAvailable = True
        for _ in range(a):
            if a % 2 == 0:
                a /= 2
                ans += 1
if isAvailable:
    print(ans)
else:
    print(0)


Fixed submission:
import math

n = int(input())
li = [int(x) for x in input().split()]
ans = 0
isAvailable = False
for a in li:
    if a % 2 == 0:
        isAvailable = True
        while(a % 2 == 0):
            a /= 2
            ans += 1
if isAvailable:
    print(ans)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
import math

n = int(input())
print(pow(2, math.floor(math.log2(n))))


Fixed submission:
import math

n = int(input())
print(pow(2, math.floor(math.log2(n))))
Buggy python submission (verdict: Runtime Error):
s,t = input()
if s == t:
  print(0)
count = 0
for i in range(len(s)):
  if s[i] != t[i]:
    count += 1
print(count)
    

Fixed submission:
s = input()
t = input()

count = 0
for i in range(len(s)):
  if s[i] != t[i]:
    count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
s=input()
if AAA or BBB:
  print("No")
else:
  print("Yes")

Fixed submission:
s=input()
if s=="AAA" or s=="BBB":
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
ABC = input("The element of S: ")
ARC = input("The element of S: ")
if ABC == "S":
    print("ABC")
if ARC == "S":
    print("ARC")


Fixed submission:
s = input()
if s == "ABC":
    print("ARC")
if s == "ARC":
    print("ABC")
Buggy python submission (verdict: Runtime Error):
d, t, s  = map(int, input().split())
if d =< t * s :
    print("Yes")
else :
    print("No")

Fixed submission:
d, t, s  = map(int, input().split())
if d <= t * s :
    print("Yes")
else :
    print("No")
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
f = [0] * n
sqrt_n = int(math.sqrt(n)) +1
for i in range(n) :
    for x in range(1,sqrt_n) :
        for y in range(1,sqrt_n) :
            for z in range(1,sqrt_n) :
                if x*x+y*y+z*z+x*y+y*z+z*x == i+1 :
                    f[i] += 1
for _ in range(n) :
    print(f[_])


Fixed submission:
l, r, d = map(int, input().split())
count = 0
for i in range(l,r+1) :
    if i%d == 0 :
        count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n, a, b = map(int, input().split())
red = 0 ; blue = 0
while n >= 0 :
    if n > a :
        n -= a
        blue += a
    else :
        blue += n
        break
    if n > b :
        n -= b
        red += b
    else :
        red += b
        break
print(blue)


Fixed submission:
n, a, b = map(int, input().split())
red = 0 ; blue = 0
if n >= a + b :
    stack = n // (a+b)
    red += b * stack
    blue += a * stack
    n -= (a+b) * stack
if n > a :
    n -= a
    blue += a
else :
    blue += n
if n > b :
    n -= b
    red += b
else :
    red += n
print(blue)

Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
list = [0] * n
idx = 0
while True :
    if a < list.count(0) :
        for i in range(idx,idx+a) :
            list[i] = "b"
        idx += a
    elif a == list.count(0) :
        for i in range(idx,idx+a) :
            list[i] = "b"
        break
    else :
        for i in range(idx,idx+list.count(0)) :
            list[i] = "b"
        break

    if b < list.count(0) :
        for i in range(idx,idx+b) :
            list[i] = "a"
        idx += b
    elif b == list.count(0) :
        for i in range(idx,idx+b) :
            list[i] = "a"
        break
    else :
        for i in range(idx,idx+list.count(0)) :
            list[i] = "a"
        break
print(list.count("b"))


Fixed submission:
n, a, b = map(int, input().split())
red = 0 ; blue = 0
if n >= a + b :
    stack = n // (a+b)
    red += b * stack
    blue += a * stack
    n -= (a+b) * stack
if n > a :
    n -= a
    blue += a
else :
    blue += n
if n > b :
    n -= b
    red += b
else :
    red += n
print(blue)

Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
list = [0] * n
idx = 0
while True :
    if a < list.count(0) :
        for i in range(idx,idx+a) :
            list[i] = "b"
        idx += a
    elif a == list.count(0) :
        for i in range(idx,idx+a) :
            list[i] = "b"
        break
    else :
        for i in range(idx,idx+list.count(0)) :
            list[i] = "b"
        break

    if b < list.count(0) :
        for i in range(idx,idx+b) :
            list[i] = "a"
        idx += b
    elif b == list.count(0) :
        for i in range(idx,idx+b) :
            list[i] = "a"
        break
    else :
        for i in range(idx,idx+list.count(0)) :
            list[i] = "a"
        break
print(list.count("b"))


Fixed submission:
n, a, b = map(int, input().split())
red = 0 ; blue = 0
if n >= a + b :
    stack = n // (a+b)
    red += b * stack
    blue += a * stack
    n -= (a+b) * stack
if n > a :
    n -= a
    blue += a
else :
    blue += n
if n > b :
    n -= b
    red += b
else :
    red += n
print(blue)
Buggy python submission (verdict: Runtime Error):
n = int(input())
d = {}
for _ in range(n) :
    s = input()
    if s in d :
        d[s] += 1
    else :
        d[s] = 1

mx = max(d.values())
for s in sorted(k for k in d if d[k] == m) :
    print(s)


Fixed submission:
n = int(input())
d = {}
for _ in range(n) :
    s = input()
    if s in d :
        d[s] += 1
    else :
        d[s] = 1

mx = max(d.values())
for s in sorted(k for k in d if d[k] == mx) :
    print(s)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
words_list = list()
cnt = []
ans = []
for i in range(n) :
    words_list.append(input())
candidates = list(set(words_list))
for word in candidates :
    cnt.append(words_list.count(word))
mx = max(cnt)
for i in range(len(cnt)) :
    if cnt[i] == mx :
        ans.append(candidates[i])
ans = sorted(ans)
for i in range(len(ans)) :
    print(ans[i])


Fixed submission:
n = int(input())
d = {}
for _ in range(n) :
    s = input()
    if s in d :
        d[s] += 1
    else :
        d[s] = 1

mx = max(d.values())
for s in sorted(k for k in d if d[k] == mx) :
    print(s)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
words_list = list()
cnt = []
d = {}
for i in range(n) :
    words_list.append(input())
candidates = sorted(list(set(words_list)))
for word in candidates :
    cnt.append(words_list.count(word))
mx = max(cnt)
for i in range(len(cnt)) :
    if cnt[i] == mx :
        print(candidates[i])


Fixed submission:
n = int(input())
d = {}
for _ in range(n) :
    s = input()
    if s in d :
        d[s] += 1
    else :
        d[s] = 1

mx = max(d.values())
for s in sorted(k for k in d if d[k] == mx) :
    print(s)
Buggy python submission (verdict: Time Limit Exceeded):
h = int(input())
list = []
list.append(h)
count = 0
while list.count(1) != len(list) :
    max_index = list.index(max(list))
    list[max_index] //= 2
    list.append(list[max_index])
    count += 1
print(count+len(list))


Fixed submission:
h = int(input())
layer = 0
branch_set = 0
while True :
    if h > 1 :
        h //= 2
        layer += 1
        continue
    else :
        break

for i in range(0, layer) :
    branch_set += 2 ** i

print(branch_set + 2**layer)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(n) :
    if i == 0 :
        count += 1
    else :
        mn = min(p[0:i+1])
        if mn == p[i] :
            count += 1
print(count)


Fixed submission:
n = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(n) :
    if i == 0 :
        mn = p[i]
        count += 1
    else :
        if mn > p[i] :
            mn = p[i]
            count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
n = int(input())
g = [[-1]* 15 for _ in range(15)]
for i in range(n) :
    m = int(input())
    for j in range(n) :
        x, y = map(int, input().split())
        #人iが「人xはyである」と証言している
        g[i][x-1] = y

ans = 0
for i in range(1<<n) :
    honest = [0] * n
    for j in range(n) :
        if (i>>j) & 1 == 1 :
            honest[j] = 1
    #ここまでですべての組み合わせを網羅している
    ok = True
    for j in range(n) :
        if honest[j] : #正直者の証言だけ検証する
            for k in range(n) :
                if g[j][k] == -1 :
                    continue
                if g[i][j] != honest[k] :
                    ok = False
            if ok :
                ans = max(ans, honest.count(1))
print(ans)


Fixed submission:
n = int(input())
g = [[-1 for _ in range(15)] for _ in range(15)]
for i in range(n) :
    m = int(input())
    for j in range(m) :
        x,y = map(int, input().split())
        #人iが「人xはyである」と証言している
        g[i][x-1] = y

ans = 0
for i in range(1<<n) :
    honests = [0] * n
    for j in range(n) :
        if (i>>j) & 1 :
            honests[j] = 1
    ok = True
    for j in range(n) :
        if honests[j] : #正直者の証言だけ検証する
            for k in range(n) :
                if g[j][k] == -1 :
                    continue
                if g[j][k] != honests[k] :
                    ok = False
    if ok :
        ans = max(ans, honests.count(1))

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
rank = [0] * n
for idx in range(n) :
    rank[idx] = a.index(idx+1)
    print(rank[idx]+1,end=" ")


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
rank = [0] * n
for idx in range(n) :
    rank[a[idx]-1] = idx + 1

for i in range(n) :
    print(rank[i], end=" ")

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
rank = [0] * n
for idx in range(n) :
    rank[idx] = a.index(idx+1)

for _ in range(n) :
    print(rank[_]+1,end=" ")


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
rank = [0] * n
for idx in range(n) :
    rank[a[idx]-1] = idx + 1

for i in range(n) :
    print(rank[i], end=" ")
Buggy python submission (verdict: Time Limit Exceeded):
n, k, q = map(int, input().split())
point = [k] * n
for i in range(q) :
    a = int(input())
    for j in range(n) :
        if j != a - 1 :
            point[j] -= 1
for _ in range(n) :
    if point[_] <= 0 :
        print("No")
    else :
        print("Yes")


Fixed submission:
n, k, q = map(int, input().split())
a = list(int(input()) for i in range(q))
add = [0] * n
def func(x) :
    return k-q+x
for i in range(q) :
    add[a[i]-1] += 1
point = list(map(func, add))
for _ in range(n) :
    if point[_] <= 0 :
        print("No")
    else :
        print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
list = []
for i in range(n) :
    list.append(int(input()))
for i in range(n) :
    sorted_list = sorted(list, reverse=True)
    idx = sorted_list.index(list[i])
    sorted_list.pop(idx)
    print(sorted_list[0])


Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
sorted_list = sorted(a, reverse=True)
a_max = sorted_list[0]
a_sec = sorted_list[1]
for i in range(n) :
    if a[i] != a_max :
        print(a_max)
    else :
        print(a_sec)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
d = list(map(int, input().split()))
min = min(d)
max = max(d)
count = 0
for k in range(min,max+1) :
    abc = 0 ; arc = 0
    for idx in range(n) :
        if d[idx] >= k :
            arc += 1
        else :
            abc += 1
    if abc == arc :
        count += 1
print(count)


Fixed submission:
n = int(input())
d = sorted(map(int, input().split()))
med_idx = int(n/2)
print(d[med_idx]-d[med_idx-1])
Buggy python submission (verdict: Runtime Error):
"""
ビット全探索
"""
n, m = map(int, input().split())
lamps = [list(map(lambda x:int(x)-1, input().split()))[1:] for _ in range(m)]
p = list(map(int, input().split()))

#ビット全探索
for i in range(2**n) :
    for r in range(m) :
        on = 0
        for j in range(n) :
            #j桁目が1であるかどうかを調べる
            #jがsに含まれているかどうか調べる
            if (i>>j) & 1 == 1 and j in lamps[r] :
                on += 1
        if on % 2 != p[r] :
            break
    else :
        ans += 1
print(ans)


Fixed submission:
"""
ビット全探索
"""
n, m = map(int, input().split())
lamps = [list(map(lambda x:int(x)-1, input().split()))[1:] for _ in range(m)]
p = list(map(int, input().split()))
ans = 0
#ビット全探索
for i in range(2**n) :
    for r in range(m) :
        on = 0
        for j in range(n) :
            #j桁目が1であるかどうかを調べる
            #jがsに含まれているかどうか調べる
            if (i>>j) & 1 == 1 and j in lamps[r] :
                on += 1
        if on % 2 != p[r] :
            break
    else :
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
max = 0
count = 0
for x in S :
    if x in "ATGC" :
        count += 1
    else :
        max = max(max, count)
        count = 0
max = max(max, count)
print(max)


Fixed submission:
S = input()
mx = 0
count = 0
for x in S :
    if x in "ATGC" :
        count += 1
    else :
        mx = max(mx, count)
        count = 0
mx = max(mx, count)
print(mx)

Buggy python submission (verdict: Runtime Error):
S = input()
max = 0
count = 0
for x in S :
    if x in "ATGC" :
        count += 1
    else :
        max = max(max, count)
        count = 0
max = max(max, count)
print(max)


Fixed submission:
S = input()
mx = 0
count = 0
for x in S :
    if x in "ATGC" :
        count += 1
    else :
        mx = max(mx, count)
        count = 0
mx = max(mx, count)
print(mx)
Buggy python submission (verdict: Runtime Error):
x1, y1, x2, y2 = map(int, input().split())
nx = x2
ny = y2
l = []
for i in range(2) :
    dx, dy = -dy, dx
    nx += dx
    ny += dy
    l.append(nx)
    l.append(ny)
print(l[0], l[1], l[2], l[3])


Fixed submission:
x1, y1, x2, y2 = map(int, input().split())
dx = x2 - x1
dy = y2 - y1
nx = x2
ny = y2
l = []
for i in range(2) :
    dx, dy = -dy, dx
    nx += dx
    ny += dy
    l.append(nx)
    l.append(ny)
print(l[0], l[1], l[2], l[3])
Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
num_list = list(range(a,b+1))

if (b-a+1) <= 2 *k :
    for i in range(b-a+1) :
        print(num_list[i])
else :
    smaller = num_list[:k]
    larger = num_list[-k:]
    ans = smaller + larger
    for i in range(k*2) :
        print(ans[i])


Fixed submission:
a, b, k = map(int, input().split())
if (b-a+1) <= 2 * k :
    count = a
    while count <= b :
        print(count)
        count += 1
else :
    for i in range(k) :
        print(a+i)
    for i in range(k) :
        print(b-((k-1)-i))

Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
num_list = list(range(a,b+1))
smaller = num_list[:k]
larger = num_list[-k:]
ans = smaller + larger
for i in range(k*2) :
    print(ans[i])


Fixed submission:
a, b, k = map(int, input().split())
if (b-a+1) <= 2 * k :
    count = a
    while count <= b :
        print(count)
        count += 1
else :
    for i in range(k) :
        print(a+i)
    for i in range(k) :
        print(b-((k-1)-i))
Buggy python submission (verdict: Runtime Error):
n = input()
if n[1:] == "9"*(len(n)-1) :
    l = list(n)
    print(sum(n))
else :
    l = list(n)
    ans = (len(n)-1) * 9 + int(l[0]) - 1
    print(ans)

Fixed submission:
n = input()
if n[1:] == "9" * (len(n)-1) :
    print(int(n[0])+9*(len(n)-1))
else :
    print(int(n[0])+9*(len(n)-1)-1)

Buggy python submission (verdict: Runtime Error):
n = input()
if n[1:] == "9"*(len(n)-1) :
    l = list(n)
    print(sum(n))
else :
    l = list(n)
    ans = (len(n)-1) * 9 + int(l[0]) - 1
    print(ans)


Fixed submission:
n = input()
if n[1:] == "9" * (len(n)-1) :
    print(int(n[0])+9*(len(n)-1))
else :
    print(int(n[0])+9*(len(n)-1)-1)