Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
Ss=[input() for s in range(N)]
count = [s.count("AB") for s in Ss if "AB" in s]
headcount = len([s for s in Ss if s[0]=="B"])
outcount = len([s for s in Ss if s[-1]=="A"])
if headcount==outcount:
    print(sum(count) + min(headcount, outcount)-1)
else:
    print(sum(count)+min(headcount,outcount))

Fixed submission:
R, G, B, N = list(map(int, input().split()))

cnt = 0
for r in range(N//R + 1):
    for g in range((N - r*R)//G + 1):
        if (N-r*R-g*G) % B == 0:
            cnt += 1

print(cnt)
Buggy python submission (verdict: Runtime Error):
N = int(input())
Ss=[input() for s in range(N)]
count = [s.count("AB") for s in Ss]
headcount = sum([s for s in Ss if s[0]=="B" and s[-1]!="A"])
outcount = sum([s for s in Ss if s[-1]=="A" and s[0]!="B"])
multicount = sum([s for s in Ss if s[0]=="B" and s[-1]=="A"])
if outcount==0 and headcount==0:
    print(sum(count)+multicount-1)
else:
    print(sum(count)+min(headcount,outcount)+multicount)

Fixed submission:
N = int(input())
Ss=[input() for s in range(N)]
count = [s.count("AB") for s in Ss]
headcount = len([s for s in Ss if s[0]=="B" and s[-1]!="A"])
outcount = len([s for s in Ss if s[-1]=="A" and s[0]!="B"])
multicount = len([s for s in Ss if s[0]=="B" and s[-1]=="A"])
if outcount==0 and headcount==0:
    if multicount<=0:
        print(sum(count))
    else:
        print(sum(count)+multicount-1)
else:
    print(sum(count)+min(headcount,outcount)+multicount)
Buggy python submission (verdict: Runtime Error):
Ss=[i for i in input()]
anss = []
counter = 0
for i in range(len(Ss)):
    if Ss[i]!="A" and Ss[i]!="C" and Ss[i]!="G" and Ss[i]!="T":
        anss.append(counter)
        counter=0
    else:
        counter+=1
print(max(anss))

Fixed submission:
Ss=[i for i in input()]
anss = []
counter = 0
for i in range(len(Ss)):
    if Ss[i]!="A" and Ss[i]!="C" and Ss[i]!="G" and Ss[i]!="T":
        anss.append(counter)
        counter=0
    else:
        counter+=1
        anss.append(counter)
if len(anss)!=0:
    print(max(anss))
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N,Q=map(int,input().split())
Ss=[i for i in input()]
#S = input()
for i in range(Q):
    l,r = map(int,input().split())
    count = 0
    Sscopy = Ss[l-1:r]
    anslist="".join(Sscopy).split("AC")
    print(len(anslist)-1)

Fixed submission:
N,Q=map(int,input().split())
Ss=[i for i in input()]
counterlist=[0]*N
for s in range(len(Ss)-1):
    if Ss[s]=="A" and Ss[s+1]=="C":
        counterlist[s+1]=1
for c in range(len(counterlist)-1):
    counterlist[c+1]+=counterlist[c]
for i in range(Q):
    l,r = map(int,input().split())
    print(counterlist[r-1]-counterlist[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
N,Q=map(int,input().split())
Ss=[i for i in input()]
#S = input()
for i in range(Q):
    l,r = map(int,input().split())
    count = 0
    Sscopy = Ss[l-1:r]
    ans=0
    while True:
        #print(count)
        #print(ans)
        #print(Sscopy)
        if "A" not in Sscopy[ans:]:
            break
        else:
            indexnumber = Sscopy.index("A",ans)
            if indexnumber == len(Sscopy)-1:
                break
            if Sscopy[indexnumber+1]=="C":
                ans = indexnumber+1
                count+=1
        #print("========================")
    print(count)

Fixed submission:
N,Q=map(int,input().split())
Ss=[i for i in input()]
counterlist=[0]*N
for s in range(len(Ss)-1):
    if Ss[s]=="A" and Ss[s+1]=="C":
        counterlist[s+1]=1
for c in range(len(counterlist)-1):
    counterlist[c+1]+=counterlist[c]
for i in range(Q):
    l,r = map(int,input().split())
    print(counterlist[r-1]-counterlist[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
N,Q=map(int,input().split())
Ss=[i for i in input()]
#S = input()
for i in range(Q):
    l,r = map(int,input().split())
    count = 0
    Sscopy = Ss[l-1:r]
    for j in range(len(Sscopy)-1):
        if Sscopy[j]=="A"and Sscopy[j+1]=="C":
            count+=1
    print(count)

Fixed submission:
N,Q=map(int,input().split())
Ss=[i for i in input()]
counterlist=[0]*N
for s in range(len(Ss)-1):
    if Ss[s]=="A" and Ss[s+1]=="C":
        counterlist[s+1]=1
for c in range(len(counterlist)-1):
    counterlist[c+1]+=counterlist[c]
for i in range(Q):
    l,r = map(int,input().split())
    print(counterlist[r-1]-counterlist[l-1])
Buggy python submission (verdict: Time Limit Exceeded):
import re
S = (input())
advance = len(S)
ans = 0
while True:  
    count = re.findall("01",S)
    S = S.replace("01","")
    ans+=len(count)*2
    count = re.findall("10",S)
    S = S.replace("10","")
    ans+=len(count)*2
    if advance==len(S):
        break
    advance = len(S)
print(ans)

Fixed submission:
S = [i for i in input()]
zero = S.count("0")
iti = S.count("1")
print(min(zero,iti)*2)

Buggy python submission (verdict: Time Limit Exceeded):
import re
S = (input())
ans = 0
while True:
    if "01" in S:
        count = re.findall("01",S)
        S = S.replace("01","")
        ans+=len(count)*2
    elif "10" in S:
        count = re.findall("10",S)
        S = S.replace("10","")
        ans+=len(count)*2
    else:
        break
print(ans)

Fixed submission:
S = [i for i in input()]
zero = S.count("0")
iti = S.count("1")
print(min(zero,iti)*2)

Buggy python submission (verdict: Time Limit Exceeded):
S = (input())
ans = 0
while True:
    if "01" in S:
        S = S.replace("01","",1)
        ans+=2
    elif "10" in S:
        S = S.replace("10","",1)
        ans+=2
    else:
        break
print(ans)

Fixed submission:
S = [i for i in input()]
zero = S.count("0")
iti = S.count("1")
print(min(zero,iti)*2)

Buggy python submission (verdict: Time Limit Exceeded):
def delete(S):
    check=False
    for s in range(len(S)-1):
        if S[s]=="0" and S[s+1]=="1":
            del S[s]
            del S[s]
            check=True
            break
        if S[s]=="1" and S[s+1]=="0":
            del S[s]
            del S[s]
            check=True
            break
    return check,S
S= [i for i in input()]
ans= 0
check=True
while check == True:
    check,S = delete(S)
    if check == False:
        break
    else:
        ans+=2
print(ans)

Fixed submission:
S = [i for i in input()]
zero = S.count("0")
iti = S.count("1")
print(min(zero,iti)*2)
Buggy python submission (verdict: Runtime Error):
S = input().split("/")
if S[1]<=4:
    print("Heisei")
else:
    print("TBD")

Fixed submission:
S = input().split("/")
tuki = S[1]
hi = S[2]
if int(tuki)<4:
    print("Heisei")
else:
    if int(tuki)==4 and int(hi)<=30:
        print("Heisei")
    else:
        print("TBD")

Buggy python submission (verdict: Runtime Error):
S = input().split("/")
tuki = S[1]
hi = S[2]
print(int(tuki))
if int(tuki)<4:
    print("Heisei")
else:
    if int(tuki)==4 and hi<=30:
        print("Heisei")
    else:
        print("TBD")

Fixed submission:
S = input().split("/")
tuki = S[1]
hi = S[2]
if int(tuki)<4:
    print("Heisei")
else:
    if int(tuki)==4 and int(hi)<=30:
        print("Heisei")
    else:
        print("TBD")
Buggy python submission (verdict: Runtime Error):
D = int(input)
if D == 25:
    print("Christmas")
elif D ==24:
    print("Christmas Eve")
elif D == 23:
    print("Christmas Eve Eve")
elif D == 22:
    print("Christmas Eve Eve Eve")

Fixed submission:
D = int(input())
if D == 25:
    print("Christmas")
elif D ==24:
    print("Christmas Eve")
elif D == 23:
    print("Christmas Eve Eve")
elif D == 22:
    print("Christmas Eve Eve Eve")
Buggy python submission (verdict: Runtime Error):
N,T = map(int,input().split())
ans = [c for c,t in sorted([(input().split()) for i in range(N)],key=lambda x :x[1]) if int(t)<=T][0]
if len(ans)!=0:
    print(ans)
else:
    print("TLE")

Fixed submission:
N,T = map(int,input().split())
ans = [int(c) for c,t in [(input().split()) for i in range(N)] if int(t)<=T]
if len(ans)!=0:
    print(min(ans))
else:
    print("TLE")

Buggy python submission (verdict: Runtime Error):
N,T = map(int,input().split())
ans = [c for c,t in sorted([(input().split()) for i in range(N)],key=lambda x :x[1]) if int(t)<=T][-1]
if len(ans)!=0:
    print(ans)
else:
    print("TLE")

Fixed submission:
N,T = map(int,input().split())
ans = [int(c) for c,t in [(input().split()) for i in range(N)] if int(t)<=T]
if len(ans)!=0:
    print(min(ans))
else:
    print("TLE")
Buggy python submission (verdict: Runtime Error):
H,W = map(int,input().split())
ahw = [strlist for strlist in [[s for s in input()] for i in range(H)] if "#" in strlist]
tenti = []
for h in range(H-1):
   m =  [ah for ah in ahw[h]]
   if "#" in m:
       tenti.append(m)
for ahwnum in range(len(ahw)):
    print("".join([num for num in tenti[ahwnum]]))

Fixed submission:
H,W = map(int,input().split())
ahw = [strlist for strlist in [[s for s in input()] for i in range(H)] if "#" in strlist]
tenti = []
for h in range(W):
   m =  [ah[h] for ah in ahw]
   if "#" in m:
       tenti.append(m)
for ahwnum in range(len(ahw)):
    print("".join([num[ahwnum] for num in tenti]))
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
print((N*2)//math.gcd(N,2))

Fixed submission:
import math
N = int(input())
if N%2==0:
    print(N)
else:
    print(N*2)
Buggy python submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
ansnums = [A+k for k in K]
ansnums.extend([B-k for k in K])
ansnums = sorted(set(ansnums))
for i in ansnums:
    print(i)

Fixed submission:
A,B,K = map(int,input().split())
ansnums = [A+k for k in range(K) if A+K<=B]
ansnums.extend([B-k for k in range(K) if B-k>=A])
ansnums = sorted(set(ansnums))
for i in ansnums:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
A,B,K = map(int,input().split())
ansnums =[i for i in range(B-K+1,B+1)]
nums = [i for j,i in enumerate(range(A,B+1)) if j<K or i in ansnums]
anss = sorted(set(nums))
for i in anss:
    print(i)

Fixed submission:
A,B,K = map(int,input().split())
ansnums = [A+k for k in range(K) if A+K<=B]
ansnums.extend([B-k for k in range(K) if B-k>=A])
ansnums = sorted(set(ansnums))
for i in ansnums:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
A,B,K = map(int,input().split())
nums = [i for i in range(A,B+1)]
anss = []
anss.extend(nums[:K])
anss.extend(nums[-K:])
anss = sorted(set(anss))
for i in anss:
    print(i)

Fixed submission:
A,B,K = map(int,input().split())
ansnums = [A+k for k in range(K) if A+K<=B]
ansnums.extend([B-k for k in range(K) if B-k>=A])
ansnums = sorted(set(ansnums))
for i in ansnums:
    print(i)
Buggy python submission (verdict: Runtime Error):
N = int(input())
Ss = set([input() for s in range(N)])
if len(Ss)==3:
    print("Three")
else:
    print("Four")

Fixed submission:
N = int(input())
An = set(input().split())
if len(An)==3:
    print("Three")
else:
    print("Four")
Buggy python submission (verdict: Runtime Error):
S = [i for i in input()]
if S[0]=="Y" and S[1] == "A" and S[2]=="K" and S[3] == "I":
  print("Yes")
else:
  print("No")

Fixed submission:
S = [i for i in input()]
if len(S)>=4:
  if S[0]=="Y" and S[1] == "A" and S[2]=="K" and S[3] == "I":
    print("Yes")
  else:
    print("No")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
atcoder

Fixed submission:
s = [i for num,i in enumerate(input()) if num%2==0]
print("".join(s))
Buggy python submission (verdict: Runtime Error):
N = [i for i in input()]
check = True
for i in range(N):
    if N[i] != N[-i]:
       check = False
       break
if check ==True:
    print("Yes")
else:
    print("No")

Fixed submission:
N = [i for i in input()]
check = True
if N[0] == N[-1]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
an= sorted(set([input() for n in range(N)]))
print(an[-1]-an[0])

Fixed submission:
N = int(input())
an= sorted(set([int(n) for n in input().split()]))
print(an[-1]-an[0])
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())
if 1 in A or 1 in B:
    if A==1 and B==1:
        print("Draw")
    elif A==1:
        print("Alice")
    else:
        print("Bob")
else:
    if A>B:
        print("Alice")
    elif B>A:
        print("Bob")
    else:
        print("Draw")

Fixed submission:
A,B = map(int,input().split())
if A == 1 or B == 1:
    if A==1 and B==1:
        print("Draw")
    elif A==1:
        print("Alice")
    else:
        print("Bob")
else:
    if A>B:
        print("Alice")
    elif B>A:
        print("Bob")
    else:
        print("Draw")
Buggy python submission (verdict: Time Limit Exceeded):
K,S = map(int,input().split())
ans = 0
for k in range(0,K+1):
    for i in range(0,K+1):
        for j in range(0,K+1):
            if k+i+j==S:
                ans+=1
print(ans)

Fixed submission:
K,S = map(int,input().split())
ans = 0
for k in range(0,K+1):
    for i in range(0,K+1):
        if S-(k+i)<=K and S-(k+i)>=0:
            ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
Ts=list(map(int,input().split()))
M = int(input())
for i in range(M):
    p,x = map(int,input().split())
    anslist = copy.deepcopy(Ts)
    anslist[p-1]=x
    print(sum(anslist))

Fixed submission:
import copy
N = int(input())
Ts=list(map(int,input().split()))
M = int(input())
for i in range(M):
    p,x = map(int,input().split())
    anslist = copy.deepcopy(Ts)
    anslist[p-1]=x
    print(sum(anslist))
Buggy python submission (verdict: Time Limit Exceeded):
a,b,x = map(int,input().split())
ans=0
for i in range(a,b+1):
    if i%x==0:
        ans+=1
print(ans)

Fixed submission:
a,b,x = map(int,input().split())
print(b//x-(a-1)//x)
Buggy python submission (verdict: Time Limit Exceeded):
a,b = map(int,input().split())
count = [i for i in range(a,b+1) if i<0]
if 0 in [i for i in range(a,b+1)]:
    print("Zero")
elif len(count)%2==0:
    print("Positive")
else:
    print("Negative")

Fixed submission:
a,b = map(int,input().split())
if 0 >=a and 0<=b:
    print("Zero")
elif a>0 and b>0:
    print("Positive")
else:
    if (b-a+1)%2==0:
        print("Positive")
    else:
        print("Negative")
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split(" ")
if a>b:
	print("safe")
else:
    print("unsafe")
    


Fixed submission:
a,b=map(int,input().split(" "))
if a>b:
    print("safe")
else:
    print("unsafe")
Buggy python submission (verdict: Time Limit Exceeded):
y = 0
x = []
new = []
things = int(input())

for i in range(things):
    p = input()
    x.append(p)
for i in x:
    if i not in new:
        new.append(i)

print(len(new))

Fixed submission:
s = set([])
things = int(input())

for i in range(things):
    p = input()
    s.add(p)

print(len(s))

Buggy python submission (verdict: Time Limit Exceeded):
uL = []
oL = []

things = int(input())

for i in range(things):
    p = input()
    uL.append(p)

x = [oL.append(x) for x in uL if x not in oL]

print(len(x))

Fixed submission:
s = set([])
things = int(input())

for i in range(things):
    p = input()
    s.add(p)

print(len(s))

Buggy python submission (verdict: Time Limit Exceeded):
uL = []
oL = []
c = 0

things = int(input())
for i in range(things):
    p = input()
    uL.append(p)
    
x = [oL.append(x) for x in uL if x not in oL]

print(len(x))

Fixed submission:
s = set([])
things = int(input())

for i in range(things):
    p = input()
    s.add(p)

print(len(s))

Buggy python submission (verdict: Time Limit Exceeded):
u_list = []
uo_list = []
e = int(input())

for i in range(e):
    u = input()
    uo_list.append(u)
    if u not in u_list:
        u_list.append(u)

print(len(u_list))

Fixed submission:
s = set([])
things = int(input())

for i in range(things):
    p = input()
    s.add(p)

print(len(s))

Buggy python submission (verdict: Time Limit Exceeded):
u_list = []
uo_list = []
e = int(input())

for i in range(e):
    u = input()
    uo_list.append(u)
    
unique = [u_list.append(x) for x in uo_list if x not in u_list]
print(len(unique))

Fixed submission:
s = set([])
things = int(input())

for i in range(things):
    p = input()
    s.add(p)

print(len(s))

Buggy python submission (verdict: Runtime Error):
N = int(raw_input())
s = set()
for _ in range(N):
    S = raw_input()
    s.add(S)
print(len(s))

Fixed submission:
N = int(input())
s = set()
for _ in range(N):
    S = input()
    s.add(S)
print(len(s))
Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
    import math
    t = int(raw_input())
    print(t * math.pi)

Fixed submission:
import math
t = int(input())
print(t * math.pi * 2)

Buggy python submission (verdict: Runtime Error):
r = raw_input()
import math
print(math.pi * r)

Fixed submission:
import math
t = int(input())
print(t * math.pi * 2)

Buggy python submission (verdict: Runtime Error):
r = raw_intput()
import math
print(math.pi * r)

Fixed submission:
import math
t = int(input())
print(t * math.pi * 2)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(s) for s in input().split(" ")]
R = [0] * (A + 1)
for a in A:
	R[a - 1] += 1
for a in R:
  print(a)

Fixed submission:
N = int(input())
A = [int(s) for s in input().split(" ")]
R = [0] * (len(A) + 1)
for a in A:
	R[a - 1] += 1
for a in R:
  print(a)

Buggy python submission (verdict: Time Limit Exceeded):
import collections
N=int(input())
A=[int(s) for s in input().split(" ")]

for i in range(1,N+1):
    count=A.count(i)
    print(count)

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

List = [0] * (n)
for i in range(n-1):
    List[A[i]-1] += 1

for i in List:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
import collections
N=int(input())
A=[int(s) for s in input().split(" ")]

for i in range(1,N+1):
    if A==[]:
        break
    count=A.count(i)
    print(count)

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

List = [0] * (n)
for i in range(n-1):
    List[A[i]-1] += 1

for i in List:
    print(i)

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=[int(s) for s in input().split(" ")]

Max=max(A)


for i in range(1,Max+1):
    count=0
    if i==1:
        pos=A.pop(0)
    while pos==i:
        count+=1
        pos=A.pop(0)
        if A==[]:
            count+=1
            break
    print(count)

for i in range(N-Max):
    print(0)

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

List = [0] * (n)
for i in range(n-1):
    List[A[i]-1] += 1

for i in List:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
import collections
N=int(input())
A=[int(s) for s in input().split(" ")]

List=[]
for i in range(1,N+1):
    print(A.count(i))


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

List = [0] * (n)
for i in range(n-1):
    List[A[i]-1] += 1

for i in List:
    print(i)
Buggy python submission (verdict: Runtime Error):
K,N=map(int,input().split())
A=[int(s) for s in input().split(" ")]

Smax=0
for i in range(K):
    S=0
    if i==0:
        S=max(abs(A[0]-A[-1]),abs(A[0]-A[1]))
    elif i==K-1:
        S=max(abs(A[-1]-A[0]),abs(A[-1]-A[-2]))
    else:
        S=max(abs(A[i]-A[i+1]),abs(A[i]-A[i-1]))
    if Smax<S:
        Smax=S

print(K-Smax)

Fixed submission:
K,N=map(int,input().split())
A=[int(s) for s in input().split(" ")]

Smax=0
for i in range(N):
    S=0
    if i!=N-1:
        if A[i+1]>A[i]:
            S=A[i+1]-A[i]
        else:
            S=A[i]-A[i+1]
    else: 
        if A[0]>A[-1]:
            S=A[0]-A[-1]
        else:
            S=A[-1]-A[0]
    
    if S>K/2:
        S=K-S
    if Smax<S:
        Smax=S

print(K-Smax)
Buggy python submission (verdict: Runtime Error):
H,W=int(input().split(" "))

print(int(H*W/2))

Fixed submission:
import math
H,W=[int(s) for s in input().split(" ")]

if H==1 or W==1:
    print(min(H,W))
else:
    print(math.ceil(H*W/2))
Buggy python submission (verdict: Runtime Error):
A,B=[int(s) for s in input().split(" ")]
N1list=[]
N2list=[]

for i in range(0,10,1):
    N1list.append((A+(i/10))/0.08)   
    N2list.append((B+(i/10))/0.1)

N3=-2
N1list.sort(reverse=True)
N2list.sort(reverse=True)

if N1list[9]<N2list[0]:
    for i in range(10):
        N=N1list[i]
        if N==int(N):
            for j in range(10):
                if N==N2list[j]:
                    N3=N
                    break
        else:
            N4=-1
else:
    N4=-1
            
print(int(N3) if N4<N3 else N4)

Fixed submission:
N,A,B=[int(s) for s in input().split(" ")]
Ans1=N//(A+B)
Ans2=N%(A+B)
if Ans2>A:
    Ans3=A
else:
    Ans3=Ans2

Ans=A*Ans1+Ans3

print(int(Ans))
Buggy python submission (verdict: Runtime Error):
A,B=[int(s) for s in input().split(" ")]
N1list=[]
N2list=[]

for i in range(0,10,1):
    N1list.append((A+(i/10))/0.08)   
    N2list.append((B+(i/10))/0.1)

N3=-2
N1list.sort(reverse=True)
N2list.sort(reverse=True)

for i in range(len(N1list)+1):
    N=N1list[i]
    if N==int(N):
        for j in range(len(N2list)+1):
            if N==N2list[j]:
                N3=N
                break
    else:
        N4=-1

print(int(N3) if N4<N3 else N4)

Fixed submission:
import math
A,B=[int(s) for s in input().split(" ")]
list=[]
for i in range(1010):
    if math.floor(i*0.08)==A and math.floor(i*0.1)==B:
            list.append(i)
list.sort()

print(-1 if list==[] else list[0])
Buggy python submission (verdict: Runtime Error):
A,B,C=[int(s) for s in input().split()]
if A==B=C:
    print("No")
elif A!=B!=C:
    print("No")
else:
    print("Yes")

Fixed submission:
A,B,C=[int(s) for s in input().split()]
if A==B==C:
    print("No")
elif A!=B and B!=C and A!=C:
    print("No")
else:
    print("Yes")