Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03096 (python)

Fixed submission:
N=int(input())
l=[]
l_value=[]
i=0
stack=-1
for i in range(N):
    if i < N:
        l.append(input())
list_simple=[]
for i in l:
    if stack != i:
        list_simple.append(i)
    stack = i
dp_dict=[0]*200001
dp=1
for i in list_simple:
    i=int(i)
    dp = dp_dict[i] +dp
    dp_dict[i] = dp
print(dp%(10**9+7))

Buggy submission (verdict: Runtime Error):
N=int(input())
l=[]
l_value=[]
i=0
stack=-1
for i in range(N):
    if i <= N:
        stack=input()
        l.append(stack)
list_simple=[]
for i in l:
    if stack != i:
        list_simple.append(i)
dp_dict=[]
dp=1
for i in list_simple:
    if c not in dp_dict:
        dp_dict[c] = 0
    dp = dp_dict[c] +dp
    dp_dict[c] = dp
print(dp)
Problem p03943 (python)

Fixed submission:
a,b,c=map(int,input().split())
a=int(a)
b=int(b)
c=int(c)
avarage=(a+b+c)/2
if a!=avarage and b!=avarage and c!=avarage:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
c=input()
a=int(a)
b=int(b)
c=int(c)
avarage=(a+b+c)/2
if a!=avarage and b!=avarage and c!=avarage:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
c=input()
avarage=(a+b+c)/2
if a==avarage or b==avarage or c==avarage:
    print("Yes")
else:
    print("No")
Problem p02582 (python)

Fixed submission:
s=input()
ans=0


if 'RR' in s:
    ans=2
else:
    ans=1

if not 'R' in s:
    ans=0

if s=='RRR':
    ans=3
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import accumulate

n, k = map(int, input().split())
P = list(map(int, input().split()))
C = list(map(int, input().split()))

visited = [0] * n

A = []
for i in range(1, n + 1):
    if visited[i - 1] == 1:
        continue
    s = i
    X = []
    while True:
        s = P[s - 1]
        X.append(C[s - 1])
        visited[s - 1] = 1
        if s == i:
            break
    A.append(X)

ANS=[]

for a in A:
    b=[0]+a+a
    d=list(accumulate(b))
    if k%len(a)==0:
        x=len(a)
    else:
        x=k%len(a)
    y=k//len(a)
    cnt=-(10**18)

    for i in range(1,x+1):
        for j in range(len(a)+1):
            cnt=max(d[i+j]-d[j],cnt)

    if sum(a)<0:
        ANS.append(cnt)
    else:
        ANS.append(cnt+sum(a)*y)

print(max(ANS))
Problem p02641 (python)

Fixed submission:
x,n=map(int,input().split())
P=list(map(int,input().split()))
Q=[-1,0]
for i in range(1,102):
    if i not in P:
        Q.append(i)

ans=10**9
A=[]
for i,q in enumerate(Q):
    A.append([i,abs(q-x)])
A.sort(key=lambda x:(x[1],x[0]))
print(Q[A[0][0]])

Buggy submission (verdict: Runtime Error):
import bisect
x,n=map(int,input().split())
P=list(map(int,input().split()))
Q=[]
for i in range(1,101):
    if i not in P:
        Q.append(i)

i=bisect.bisect_left(Q,x)

if abs(Q[i-1]-x)>abs(Q[i]-x):
    print(Q[i])
else:
    print(Q[i-1])
Problem p02642 (python)

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

m=max(A)

X=[0]*(m+1)

A.sort()

for i in range(n):
    for j in range(A[i],m+1,A[i]):
        X[j]+=1

ans=0

for i in range(n):
    if X[A[i]]==1:
        ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))

m=max(A)

X=[True]*(m+1)

A.sort()

for i in range(n):
    for j in range(A[i]*2,m+1,A[i]):
        X[j]=False

if A[0]==A[1]:
    ans=0
else:
    ans=1

for i in range(1,n):
    if A[i-1]==A[i]:
        continue
    if X[A[i]]==True:
        ans+=1
print(ans)
Problem p02678 (python)

Fixed submission:
from _collections import deque
n,m=map(int,input().split())
X=[[] for _ in range(n)]
visited=[0]*(n+1)
ANS=[0]*n
ANS[0]=1
for i in range(m):
    a,b=map(int,input().split())
    X[a-1].append(b-1)
    X[b-1].append(a-1)

q=deque([0])
visited[0]=1
while len(q)>0:
    s=q.popleft()
    for x in X[s]:
        if visited[x]:
            continue
        q.append(x)
        ANS[x]=s
        visited[x]=1
print('Yes')
for ans in ANS[1:]:
    print(ans+1)

Buggy submission (verdict: Runtime Error):
from _collections import deque
n,m=map(int,input().split())
X=[[] for _ in range(n)]
visited=[0]*(n+1)
ANS=[0]*n
ANS[0]=1
for i in range(m):
    a,b=map(int,input().split())
    X[a-1].append(b-1)
    X[b-1].append(a-1)

q=deque([0])
visited[0]=1
while len(q)>0:
    s=q.popleft()
    for x in X[s]:
        if visited[x]:
            continue
        q.append(x)
        ANS[x]=s
        visited[x]=1
    print(ANS)
print('Yes')
for ans in ANS[1:]:
    print(ans+1)
Problem p02702 (python)

Fixed submission:
from collections import defaultdict
s=input()
n=len(s)
N=defaultdict(int)
x=0
for i in reversed(range(n)):
    x+=int(s[i])*pow(10,(n-i-1),2019)
    x%=2019
    N[x]+=1
ans=N[0]
for j in N.values():
    ans+=j*(j-1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
N=[0]*2020
x=0
for i in reversed(range(n)):
    x+=int(s[i])*(10**(n-i-1))
    N[x%2019]+=1
ans+=N[0]
for j in N:
    ans+=j*(j-1)//2
print(ans)
Problem p02761 (python)

Fixed submission:
n,m=map(int,input().split())
a=[]
for _ in range(m):
    s,c=map(int,input().split())
    a.append([s,c])

ans=-1
if n==1:
    for i in range(10):
        x=str(i)
        c=0
        for j in range(m):
            if x[a[j][0]-1] == str(a[j][1]):
                c+=1          
        if c==m:
            ans=i
            break
else:
    for i in range(10**(n-1),10**n):
        x=str(i)
        c=0
        for j in range(m):
            if x[a[j][0]-1] == str(a[j][1]):
                c+=1          
        if c==m:
            ans=i
            break
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[]
for _ in range(m):
    s,c=map(int,input().split())
    a.append([s,c])

ans='-1'
for i in range(10**n):
    x=str(i)
    c=0
    for j in range(m):
        if x[a[j][0]-1] == str(a[j][1]):
            c+=1
    if c==m:
        ans=i
        break
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
x=[]
for _ in range(n):
    x.append([])

for _ in range(m):
    s,c=map(int,input().split())
    x[s-1].append(c)
ans=''
for i in range(n):
    if len(set(x[i]))>=2:
        ans='-1'
        break
    elif len(x[i])==0 and i==0:
        ans+='1'
    elif len(x[i])==0 and i!=0:
        ans+='0'
    else:
        if x[0][0]==0 and n==1:
            ans='0'
            break
        elif x[0][0]==0 and n!=1:
            ans='-1'
            break
        ans+=str(x[i][0])

print(int(ans))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
x=[]
for _ in range(n):
    x.append([])

for _ in range(m):
    s,c=map(int,input().split())
    x[s-1].append(c)
ans=''
for i in range(n):
    if len(set(x[i]))>=2:
        ans='-1'
        break
    elif len(x[i])==0 and i==0:
        ans+='1'
    elif len(x[i])==0 and i!=0:
        ans+='0'
    else:
        if x[0][0]==0 and n==1:
            ans='0'
            break
        elif x[0][0]==0 and n!=1:
            ans='-1'
            break
        ans+=str(x[i][0])

print(int(ans))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
x=[]
for _ in range(n):
    x.append([])

for _ in range(m):
    s,c=map(int,input().split())
    x[s-1].append(c)
ans=''
for i in range(n):
    if len(set(x[i]))>=2:
        ans='-1'
        break
    if len(x[i])==0 and i==0:
        ans='1'
    if len(x[i])==0 and i!=0:
        ans='0'
    ans+=str(x[i][0])
print(int(ans))
Problem p02768 (python)

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

s=pow(2,n,10**9+7)-1
x=1
for i in range(a):
    x*=(n-i)
    x%=(10**9+7)
    x*=pow(i+1,10**9+5,10**9+7)
y=1
for i in range(b):
    y*=(n-i)
    y%=(10**9+7)
    y*=pow(i+1,10**9+5,10**9+7)

print((s-x-y)%(10**9+7))

Buggy submission (verdict: Runtime Error):
from scipy.special import comb

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

s=(2**n-1)%(10**9+7)
x=comb(n,a,exact=True)%(10**9+7)
y=comb(n,b,exact=True)%(10**9+7)

print(s-x-y)
Problem p02787 (python)

Fixed submission:
h,n=map(int,input().split())
H=[]
A=[]
for i in range(n):
    a,b=map(int,input().split())
    H.append([a,b])
    A.append(a)
a_max=max(A)
dp=[10**10]*(h+a_max+1)
dp[0]=0
for i in range(1,h+a_max+1):
    for j in range(n):
        if i-H[j][0]<0:
            dp[i]=min(dp[i],H[j][1])
        else:
            dp[i]=min(dp[i],dp[i-H[j][0]]+H[j][1])
print(min(dp[h:h+a_max+1]))

Buggy submission (verdict: Runtime Error):
h,n=map(int,input().split())
dp=[10**10]*(h+1)
dp[0][0]=1
X=[]
for i in range(n):
    a,b=map(int,input().split())
    X.append([a,b])


for i in range(h):
    for j in range(n):
        k=min(i+X[j][0],h)
        dp[k]=min(dp[k],dp[i]+X[j][1])
print(dp[h])
Problem p02802 (python)

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

N=[]

for i in range(n):
    N.append([0,0])

co=0
pe=0
for i in range(m):
    p,s=input().split()
    p=int(p)
    if s=='WA':
        N[p-1][0]+=1
    elif N[p-1][1]!=1:
        pe+=N[p-1][0]
        co+=1
        N[p-1][1]=1

print(str(co)+' '+str(pe))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())

N=[]

for i in range(n):
    N.append([0,0])

co=0
pe=0
for i in range(m):
    p,s=input().split()
    p=int(p)
    if s=='WA':
        N[p-1][0]+=1
    elif N[p-1][1]!=1:
        pe+=N[p][0]
        co+=1
        N[p-1][1]=1

print(str(co)+' '+str(pe))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())

N=[[0,0]*n]
co=0
pe=0
for i in range(m):
    p,s=input().split()
    p=int(p)
    if s=='WA':
        N[p-1][0]+=1
    elif N[p-1][1]!=1:
        pe+=N[p-1][0]
        co+=1
        N[p-1][1]=1

print(str(co)+' '+str(pe))
Problem p02845 (python)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
N=[3]+[0]*n
mod=10**9+7
ans=1

for a in A:
    ans*=N[a]
    ans%=mod
    N[a]-=1
    N[a+1]+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
N=[0]*(10**6)
ans=10**9+7
if len([a for a in A if a==0])==1:
    ans=3
else:
    ans=6

for a in A:
    N[a]+=1
    if a!=0:
        ans*=N[a-1]%mod
        N[a-1]-=1
print(ans)
Problem p02855 (python)

Fixed submission:
from _collections import deque
h,w,k=map(int,input().split())
S=[input() for _ in range(h)]
A=deque([])
cnt=1

def func(X):
    global cnt
    ANS=[]
    c=X.count('#')
    a=0
    for x in X:
        ANS.append(cnt)
        if x=='#':
            cnt+=1
            a+=1
            if a==c:
                for _ in range(w-len(ANS)):
                    ANS.append(cnt-1)
                break
    A.append(ANS)



for i in range(h):
    if S[i].count('#')==0 and i!=0 and len(A)!=0:
        A.append(A[-1])
    elif S[i].count('#')!=0:
        func(S[i])

if len(A)!=h:
    for _ in range(h-len(A)):
        A.appendleft(A[0])

for ans in A:
    print(*ans)

Buggy submission (verdict: Runtime Error):
from _collections import deque
h,w,k=map(int,input().split())
S=[input() for _ in range(h)]
A=deque([])
cnt=1

def func(X):
    global cnt
    ANS=[]
    c=X.count('#')
    a=0
    for x in X:
        ANS.append(cnt)
        if x=='#':
            cnt+=1
            a+=1
            if a==c:
                for _ in range(w-len(ANS)):
                    ANS.append(cnt-1)
                break
    A.append(ANS)



for i in range(h):
    if S[i].count('#')==0 and i!=0:
        A.append(A[-1])
    elif S[i].count('#')!=0:
        func(S[i])

if S[0].count('#')==0:
    A.appendleft(A[0])

for ans in A:
    print(*ans)

Buggy submission (verdict: Runtime Error):
from _collections import deque
h,w,k=map(int,input().split())
S=[input() for _ in range(h)]
A=deque([])
cnt=1

def func(X):
    global cnt
    ANS=''
    c=X.count('#')
    a=0
    for x in X:
        ANS+=str(cnt)
        if x=='#':
            cnt+=1
            a+=1
            if a==c:
                ANS+=str(cnt-1)*(w-len(ANS))
                break
    A.append(ANS)



for i in range(h):
    if S[i].count('#')==0 and i!=0:
        A.append(A[-1])
    elif S[i].count('#')!=0:
        func(S[i])

if S[0].count('#')==0:
    A.appendleft(A[0])

for ans in A:
    print(*[int(n) for n in ans])
Problem p02923 (python)

Fixed submission:
n=int(input())
H=list(map(int,input().split()))
c=0
C=[]

    

for i in range(n-1):
    if H[i]>=H[i+1]:
        c+=1
    else:
        C.append(c)
        c=0
    if i==n-2:
        C.append(c)
if len(H)!=1:        
    ans=max(C)
else:
    ans=0

print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
H=list(map(int,input().split()))
c=0
C=[]
for i in range(n-1):
    if H[i]>=H[i+1]:
        c+=1
    else:
        C.append(c)
        c=0
    if i==n-2:
        C.append(c)
print(max(C))
Problem p02936 (python)

Fixed submission:
from collections import deque

n,q=map(int,input().split())

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



c=[0]*n

for j in range(q):
    p,x=map(int,input().split())
    c[p-1]+=x

used=[0]*n
used[0]=1
next=deque([0])

while next:
    v=next.popleft()
    cost=c[v]
    for nv in g[v]:
        if used[nv]:
            continue
        used[nv]=1
        next.append(nv)
        c[nv]+=cost

print(*c)

Buggy submission (verdict: Runtime Error):
from collections import deque

n, q = map(int, input().split())

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

c = [0] * n

for j in range(q):
    p, x = map(int, input().split())
    c[p - 1] += x

used = [0] * n
used[0] = 1

def dfs(x):
    cost=c[x]
    for nx in g[x]:
        if used[nx]:
            continue
        used[nx]=1
        c[nx]+=cost
        dfs(nx)
dfs(0)
print(*c)

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
X=[[] for _ in range(n)]
for i in range(n-1):
    a,b=map(int,input().split())
    X[a-1].append(b-1)

C=[0]*n

def dfs(p,x):
    C[p]+=x
    for i in X[p]:
        dfs(i,x)


for i in range(q):
    p,x=map(int,input().split())
    dfs(p-1,x)

print(*C)
Problem p02995 (python)

Fixed submission:
import fractions
a,b,c,d=map(int,input().split())
a-=1
y=int(c*d/fractions.gcd(c,d))

p=a-((a//c)+(a//d)-(a//y))

q=b-((b//c)+(b//d)-(b//y))

print(int(q-p))

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d=map(int,input().split())
a-=1
y=int(c*d/math.gcd(c,d))

p=a-((a//c)+(a//d)-(a//y))

q=b-((b//c)+(b//d)-(b//y))

print(int(q-p))
Problem p03006 (python)

Fixed submission:
n=int(input())
M=[]
for i in range(n):
    x,y=map(int,input().split())
    M.append([x,y])
M.sort(key=lambda x:(x[0],x[1]))
X=[]
Y=[]
for i in range(n-1):
    for j in range(i+1,n):
        a=M[i][0]-M[j][0]
        b=M[i][1]-M[j][1]
        if not [a,b] in Y:
            Y.append([a,b])
            X.append(1)
        else:
            X[Y.index([a,b])]+=1
ans=n
for i in range(len(Y)):
    ans=min(ans,n-X[i])
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
n=int(input())
M=[]
for i in range(n):
    x,y=map(int,input().split())
    M.append([x,y])
M.sort(key=lambda x:(x[0],x[1]))
X=defaultdict(int)
for i in range(n-1):
    for j in range(i+1,n):
        a=M[i][0]-M[j][0]
        b=M[i][1]-M[j][1]
        X[(a,b)]+=1
print(n-max(X.values()))
Problem p03044 (python)

Fixed submission:
from collections import deque
n=int(input())
X=[[] for _ in range(n)]
for i in range(n-1):
    u,v,w=map(int,input().split())
    X[u-1].append([v-1,w])
    X[v-1].append([u-1,w])
C=[0]*n
q=deque([])
for v,w in X[0]:
    q.append([v,w])
visited=[0]*n

while q:
    v,w=q.popleft()

    if visited[v]==1:
        continue
    visited[v]=1
    if w%2==0:
        C[v]=0
    else:
        C[v]=1
    for pv,pw in X[v]:
        q.append([pv,pw+w])

for c in C:
    print(c)

Buggy submission (verdict: Runtime Error):
from collections import deque
n=int(input())
X=[[] for _ in range(n)]
for i in range(n-1):
    u,v,w=map(int,input().split())
    X[u-1].append([v-1,w])
    X[v-1].append([u-1,w])
C=[0]*n
q=deque([])
for i in range(len(X[0])):
    q.append([X[0][i]])
visited=[0]*n

while q:
    v,w=q.popleft()
    if visited[v]==1:
        continue
    visited[v]=1
    if w%2==0:
        C[v]=C[u]
    else:
        if C[u]==0:
            C[v]=1
        else:
            C[v]=0
    for pv,pw in X[v]:
        q.append([pv,pw])

for c in C:
    print(c)
Problem p03074 (python)

Fixed submission:

n,k=map(int,input().split())
s=input()

I=[0]

for i in range(n-1):
    if s[i]!=s[i+1]:
        I.append(i+1)
        
r=len(I)

for _ in range(10**6):
        I.append(n)

X=[]

for i in range(r):
    if s[I[i]]=='0':
        X.append(I[i+2*k]-I[i])
    else:
        X.append(I[i+2*k+1]-I[i])

print(max(X))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()

I=[0]

for i in range(n-1):
    if s[i]!=s[i+1]:
        I.append(i+1)
        
r=len(I)

for _ in range(10**5):
        I.append(n)

X=[]

for i in range(r):
    if s[I[i]]=='0':
        X.append(I[i+2*k]-I[i])
    else:
        X.append(I[i+2*k+1]-I[i])

print(max(X))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()

I=[0,]

for i in range(n-1):
    if s[i]!=s[i+1]:
        I.append(i+1)

if len(I)<k:
    for _ in range(10**5):
        I.append(n)

print(I)

X=[]

for i in range(len(I)):
    if s[I[i]]=='0':
        X.append(I[i+2*k]-I[i])
    else:
        X.append(I[i+2*k+1]-I[i])

print(max(X))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()

I=[0,]

for i in range(n-1):
    if s[i]!=s[i+1]:
        I.append(i+1)

if len(I)<k:
    I.extend([n]*(10**5))

X=[]

for i in range(len(I)):
    if s[I[i]]=='0':
        X.append(I[i+2*k]-I[i])
    else:
        X.append(I[i+2*k+1]-I[i])

print(max(X))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()

I=[0,]

for i in range(n-1):
    if s[i]!=s[i+1]:
        I.append(i+1)

if len(I)<k:
    I.extend([n+1]*(2*k+1))

X=[]

for i in range(len(I)):
    if s[I[i]]=='0':
        X.append(I[i+2*k]-I[i])
    else:
        X.append(I[i+2*k+1]-I[i])

print(max(X))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()

I=[0,]

for i in range(n-1):
    if s[i]!=s[i+1]:
        I.append(i+1)

if len(I)<k:
    I.extend([n+1]*(k-len(I)))

X=[]

for i in range(len(I)):
    if s[I[i]]=='0':
        X.append(I[i+2*k]-I[i])
    else:
        X.append(I[i+2*k+1]-I[i])

print(max(X))

Buggy submission (verdict: Runtime Error):

n,k=map(int,input().split())
s=input()

X=[]
cnt=0
if len(s)>=2:
    for i in range(n-1):
        cnt+=1
        if s[i]=='0' and s[i+1]=='1':
            X.append(cnt)
            cnt=0
        elif s[i]=='1' and s[i+1]=='0':
            X.append(cnt)
            cnt=0
        elif i==n-2:
            X.append(cnt)
    
    if s[-1]!=s[-2]:
        X.append(1)
    else:
        X[-1]+=1
else:
    X=[s]


if s[0]=='1':
    if k>=len(X[1::2]):
        print(n)
    else:
        z=X[1::2]
        o=X[::2]
        ans=sum(o[:k+1])+sum(z[:k])
        for i in range(len(z)-k):
            ans=max(ans,ans-z[i]-o[i]+z[i+k]+o[i+k+1])
        print(ans)
else:
    if k>=len(X[0::2]):
        print(n)
    else:
        z=X[::2]
        o=X[1::2]
        ans=sum(z[:k])+sum(o[:k])
        for i in range(len(o)-k):
            ans=max(ans,ans-o[i]-z[i]+o[i+k]+z[i+k+1])
        print(ans)
Problem p03086 (python)

Fixed submission:
s=input()

res=0
for i in range(len(s)+1):
    for j in range(i+1,len(s)+1):
        cnt=0
        for x in s[i:j]:
            if x not in ['A','G','C','T']:
                break
            cnt+=1
        if res<cnt:
            res=cnt

print(res)

Buggy submission (verdict: Runtime Error):
s=input()
res=0
for i in range(len(s)+1):
    for j in range(i+1,len(s)+1):
       
        if set(list(s[i:j]))|{'A','G','C','T'}=={'A','G','C','T'}:
            cnt=len(s[i:j])
        if res<cnt:
            res=cnt

print(res)

Buggy submission (verdict: Runtime Error):
s=input()
res=0
for i in range(len(s)+1):
    for j in range(i+1,len(s)+1):
        print(list(s[i:j]))
        if set(list(s[i:j]))|{'A','G','C','T'}=={'A','G','C','T'}:
            cnt=len(s[i:j])
        if res<cnt:
            res=cnt

print(res)

Buggy submission (verdict: Runtime Error):
s=input()
res=0
for i in range(len(s)):
    for j in range(i+1,len(s)):
        if set(list(s[i:j]))|{'A','G','C','T'}=={'A','G','C','T'}:
            cnt=len(s[i:j])
        if res<cnt:
            res=cnt

print(res)
Problem p03087 (python)

Fixed submission:
n,q=map(int,input().split())
s=input()+'Z'
A=[0]*(n+1)
cnt=0
for i in range(n):
    A[i]=cnt
    if s[i]=='A' and s[i+1]=='C':
        cnt+=1
ANS=[]
for i in range(q):
    l,r=map(int,input().split())
    ANS.append(A[r-1]-A[l-1])
for ans in ANS:
    print(ans)

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=input()
A=[0]*(n+1)
cnt=0
for i in range(n):
    A[i]=cnt
    if s[i]=='A' and s[i+1]=='C':
        cnt+=1
ANS=[]
for i in range(q):
    l,r=map(int,input().split())
    ANS.append(A[r-1]-A[l-1])
for ans in ANS:
    print(ans)

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=input()
A=[0]*(n+1)
cnt=0
for i in range(n):
    A[i]=cnt
    if s[i]=='A' and s[i+1]=='C':
        cnt+=1
ANS=[]
for i in range(q):
    l,r=map(int,input().split())
    ANS.append(A[r-1]-A[l-1])
for ans in ANS:
    print(ANS)

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())

s=input()
X=[0]*len(s)
for i in range(len(s)-1):
    if s[i]=='A' and s[i+1]=='C':
        X[i]+=1

A=[]

for i in range(q):
    l,r=map(int,input().split())
    ans=(X[l-1:r]).count(1)
    if s[r-1]=='A' and s[r]=='C':
        A.append(ans-1)
    else:
        A.append(ans)
        
for x in A:
    print(x)

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=input()
V=[0]*n
X=[]
for i in range(q):
    l,r=map(int,input().split())
    X.append([l,r])

for i in range(n-1):
    if s[i:i+2]=='AC':
        V[i]+=1

for i in range(q):
    ans=sum(V[X[i][0]-1:X[i][1]])
    if s[X[i][1]-1]=='A' and s[X[i][1]]=='C':
        ans-=1
    print(ans)
Problem p03145 (python)

Fixed submission:
a,b,c=map(int,input().split())
 
x=[a,b,c]
 
x.sort()
 
print(int(x[0]*x[1]/2))

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

x=[a,b,c]

x.sort()

print(x[0]*x[1]/2]
Problem p03241 (python)

Fixed submission:
N,M = map(int, input().split())
L = []
 
for i in range(1,int(M**0.5)+1):
    if M % i == 0:
        L.append(i)
        L.append(int(M / i))
L1 = [i for i in L if M / i >= N]
print(max(L1))

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
L = []
 
for i in range(1,(M**0.5)+1):
    if M % i == 0:
        L.append(i)
        L.append(int(M / i))
L1 = [i for i in L if M / i >= N]
print(max(L1))