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

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


S = input()
T_s = ["dream", "dreamer", "erase", "eraser"]

while len(S):
    for T in T_s:
        if T == S[-len(T):]:
            S = S[:-len(T)]
            break
    else:
        print("NO")
        break
else:
    print("YES")

Buggy submission (verdict: Runtime Error):
#!python
# -*- coding: utf-8 -*-


S = input() + '_'
T_s = ["dream", "dreamer", "erase", "eraser"]

while True:
    S_ = S
    for T in T_s:
        S = S.replace(T + "_", "_")
        print(S)
    if S_ == S:
        break

if S == "_":
    print("YES")
else:
    print("NO")
Problem p03059 (python)

Fixed submission:
a, b, t = map(int, input().split())
total = 0
for i in range(a, t+1, a):
  total += b
print(total)

Buggy submission (verdict: Runtime Error):
a, b, t = map(int, list(input()))
total = 0
for i in range(a, t+1, a):
  total += b
print(total)

Buggy submission (verdict: Runtime Error):
a, b, t = list(input(''))
total = 0
for i in range(a, t+1, a):
  total += b
print(total)
Problem p03060 (python)

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

if n == 1:
    print(0)
else:
    total = 0
    for v, c in zip(vals, costs):
        resale = v - c
        if resale > 0:
            total += resale
    print(total)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n == 1:
	print(0)
else:
	vals = list(map(int, input().split()))
    costs = list(map(int, input().split()))
 
	total = 0
	for v, c in zip(vals, costs):
    	resale = v - c
        if resale > 0:
        	total += resale
    print(total)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n == 1:
	print(0)
else:
	vals = list(map(int, input().split()))
    costs = list(map(int, input().split()))

	total = 0
	for v, c in zip(vals, costs):
    	resale = v - c
        if resale > 0:
        	total += resale
Problem p03060 (python)

Fixed submission:
import numpy as np
 
n = input()
v = np.array([int(x) for x in input().split()])
c = np.array([int(x) for x in input().split()])
 
profit = v - c
positive_profit = profit[profit > 0]
print(np.sum(positive_profit))

Buggy submission (verdict: Runtime Error):
import numpy as np
 
n = input()
v = np.array([int(x) for x in input().split()])
c = np.array([int(x) for x in input().split()])
 
profit = v - c
positive_profit = profit(profit > 0)
print(np.sum(positive_profit))

Buggy submission (verdict: Runtime Error):
import numpy as np
 
n = input()
v = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
 
profit = v - c
positive_profit = profit(profit > 0)
print(np.sum(positive_profit))

Buggy submission (verdict: Runtime Error):
import numpy as np

n = input()
v = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]

profit = v - c
positive_profit = profit(profit > 0)
print(positive_profit.sum())

Buggy submission (verdict: Runtime Error):
n = input()
v = np.array([int(x) for x in input().split()])
c = np.array([int(x) for x in input().split()])
profit = v -c
positive_profit = profit(profit > 0)
print(positive_profit.sum())

Buggy submission (verdict: Runtime Error):
n = input()
v_list = [int(x) for x in input().split()]
c_list = [int(x) for x in input().split()]
total_profit = 0
for v, c in zip(v_list, c_list)
    profit = v -c
    if profit > 0:
        total_profit += profit
print(total_profit)
Problem p03086 (python)

Fixed submission:
mx, h = [], []
for ch in str(input()):
    if ch in ['A', 'C', 'G', 'T']:
        h += ch
    else:
        mx += [h]
        h = []
else:
    mx += [h]
    print(max([len(l) for l in mx]))

Buggy submission (verdict: Runtime Error):
mx, h = [], []
for ch in input():
    if ch in ['A', 'C', 'G', 'T']:
        h += ch
    else:
        mx += [h]
        h = []
else:
    print(max([len(l) for l in mx]))

Buggy submission (verdict: Runtime Error):
mx, h = [], []
for ch in input():
    print(h)
    if ch in ['A', 'C', 'G', 'T']:
        h += ch
    else:
        mx += [h]
        h = []
else:
    print(max([len(l) for l in mx]))

Buggy submission (verdict: Runtime Error):
mx, h = [], []
for ch in input():
    if ch in ['A', 'C', 'G', 'T']:
        h += ch
    else:
        mx += [h]
        h = []
else:
    print(len(max(mx)))
Problem p03067 (python)

Fixed submission:
A,B,C=map(int,input().split())

if A<B:
    if A<C<B:
        print("Yes")
    else:
        print("No")
else:
    if B<C<A:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
N=int(input())
ls_S=list(input())
i=0
I=0
cnt_1=0
cnt_2=0


while ls_S[i]==".":
    i+=1
    I+=1

for x in range(I,N):
    if ls_S[x]==".":
        ls_S[x]="#"
        cnt_1+=1
for x in range(I,N):
    if ls_S[x]=="#":
        ls_S[x]="."
        cnt_2+=1
if cnt_1>cnt_2:
    print(cnt_2)
else:
    print(cnt_1)
Problem p03068 (python)

Fixed submission:
N=int(input())
ls_S=list(input())
K=int(input())

for i in range(N):
    if ls_S[i]!=ls_S[K-1]:
        ls_S[i]="*"
for s in ls_S:
    print(s,end = "")

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

if A<B:
    if A<C<B:
        print("Yes")
    else:
        print("No")
else:
    if B<C<A:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
N=int(input())
ls_S=list(input())
K=int(input())

for i in range(N-1):
    if ls_S[i]!=ls_S[K]:
        ls_S[i]="*"
for s in ls_S:
    print(s,end = "")
Problem p03101 (python)

Fixed submission:
H,W = map(int,input().split())
h,w = map(int,input().split())

print((H-h) * (W-w))

Buggy submission (verdict: Runtime Error):
H,W = int(input().split())
h,w = int(input().split())

print(H*W - h*w)
Problem p03693 (python)

Fixed submission:
x = input().split()

y = int(x[0]) * 100 + int(x[1]) * 10 + int(x[2])

if y%4 == 0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
x = input().split()

y = x[0] + x[1] + x[2]

if y % 4 == 0:
    print("YES")
else:
    print("NO")
Problem p03694 (python)

Fixed submission:
# -*- coding: utf-8 -*-
 
x = int(input())
#x = 8
 
y = input().split()
#y = ["3","1","4","1","5","9","2","6"]
 
for i in range(x):
    y[i] = int(y[i])
 
Max = max(y)
Min = min(y)
 
ans = Max - Min
 
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

x = int(input())
#x = 8

y = input()
#y = ["3","1","4","1","5","9","2","6"]

for i in range(x):
    y[i] = int(y[i])

Max = max(y)
Min = min(y)

ans = Max - Min

print(ans)
Problem p03695 (python)

Fixed submission:
# -*- coding: utf-8 -*-
#レート 1-399：灰色 :gray
#レート 400-799：茶色 :brown
#レート 800-1199：緑色 : green
#レート 1200-1599：水色 :skyblue
#レート 1600-1999：青色 :blue
#レート 2000-2399：黄色 :yellow
#レート 2400-2799：橙色 :orange
#レート 2800-3199：赤色 :red

x = int(input())
y = input().split()

gray = 0
brown = 0
green = 0
skyblue = 0
blue = 0
yellow = 0
orange = 0
red = 0
other = 0

for i in range(x):
    z = int(y[i]) 
    if z < 400:
       gray = 1 
    elif z < 800:
        brown = 1
    elif z < 1200:
        green = 1
    elif z < 1600:
        skyblue = 1
    elif z < 2000:
        blue = 1
    elif z < 2400:
        yellow = 1
    elif z < 2800:
        orange = 1
    elif z < 3200:
        red = 1
    else:
        other = other + 1

if other >= 1:
    ans_max = gray + brown + green + skyblue + blue + yellow + orange + red + other
    ans_min = gray + brown + green + skyblue + blue + yellow + orange + red + 0
    
    if ans_min == 0:
        ans_min = 1
    
    print(str(ans_min) + " " + str(ans_max))

else:
    ans = gray + brown + green + skyblue + blue + yellow + orange + red + other
    
    print(str(ans) + " " + str(ans))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
#レート 1-399：灰色 :gray
#レート 400-799：茶色 :brown
#レート 800-1199：緑色 : green
#レート 1200-1599：水色 :skyblue
#レート 1600-1999：青色 :blue
#レート 2000-2399：黄色 :yellow
#レート 2400-2799：橙色 :orange
#レート 2800-3199：赤色 :red

x = int(input())

y = input().split()

gray = 0
brown = 0
green = 0
skyblue = 0
blue = 0
yellow = 0
orange = 0
red = 0
other = 0

for i in range(x):
    z = int(y[i]) 
    if z < 400:
       gray = 1 
    elif z < 800:
        brown = 1
    elif z < 1200:
        green = 1
    elif z < 1600:
        skyblue = 1
    elif z < 2000:
        blue = 1
    elif z < 2400:
        yellow = 1
    elif z < 2800:
        orange = 1
    elif z < 3200:
        red = 1
    else:
        other = other + 1

if other > 1:
    ans_max = gray + brown + green + skyblue + blue + yellow + orange + red + other
    ans_min = gray + brown + green + skyblue + blue + yellow + orange + red + 1
    
    print(ans_min & " " & ans_max)

else:
    ans = gray + brown + green + skyblue + blue + yellow + orange + red + other
    
    print(ans & " " & ans)
Problem p03059 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,t = map(int,input().split())
ans = int(b*(t+0.5)/a)
print(c)
Problem p03059 (python)

Fixed submission:
def count_sum_generated_biscuit():
  generation_interval_sec,\
  biscuit_per_generation,\
  initial_target_sec = [int(x) for x in input().split()]
  
  target_sec = initial_target_sec + 0.5
  sum_generated_biscuit\
  = (target_sec // generation_interval_sec) * biscuit_per_generation
  
  return int(sum_generated_biscuit)
  
if __name__ == '__main__':
  print(count_sum_generated_biscuit())

Buggy submission (verdict: Runtime Error):
def calc_max_total_jewels_value():
  jewels = int(input())
  jewel_value = [int(x) for x in input().split()]
  jewel_cost = [int(x) for x in input().split()]
  
  max_total_jewels_value = 0
  for jewel_no in range(jewels):
    max_total_jewels_value += max([0, jewel_value[jewel_no] - jewel_cost[jewel_no]])
    
  return max_total_jewels_value

if __name__ == '__main__':
  print(calc_max_total_jewels_value())
Problem p03076 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

dish_list = [a, b, c, d, e]
min_val = 100
idx = 0
for i, x in enumerate(dish_list):
    if x%10 == 0:
        continue
    val = x % 10
    if val < min_val:
        min_val = val
        idx = i

ans = 0
for i, dish in enumerate(dish_list):
    if i == idx:
        continue

    wait_order =  10 - dish_list[i]%10 if dish_list[i]%10 != 0 else 0

    ans += dish_list[i] + wait_order

print(ans + dish_list[idx])

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

dish_list = [a, b, c, d, e]
min_val = 100
for i, x in enumerate(dish_list):
    if x%10 == 0:
        continue
    val = x % 10
    if val < min_val:
        min_val = val
        idx = i

ans = 0
for i, dish in enumerate(dish_list):
    if i == idx:
        continue

    wait_order =  10 - dish_list[i]%10 if dish_list[i]%10 != 0 else 0

    ans += dish_list[i] + wait_order

print(ans + dish_list[idx])
Problem p03238 (python)

Fixed submission:
N = int(input())
if N==1:
    print('Hello World')
else:
    A = int(input())
    B = int(input())
    print(A + B)

Buggy submission (verdict: Runtime Error):
import sys

N = int(input())

list = []
for i in range(0, N):
    x, y, h = [int(x) for x in input().split()]
    list.append((x, y, h))

for X in range(0, 101):
    for Y in range(0, 101):
        b = True
        H = 0
        for Cx, Cy, Ch in list:
            if Ch != 0:
                H = Ch + abs(X - Cx) + abs(Y - Cy)
        for Cx, Cy, Ch in list:
            h = max(H - abs(X - Cx) - abs(Y - Cy), 0)
            if Ch != h:
                b = False
        if b == True:
            print(X, Y, H)
            sys.exit(0)

Buggy submission (verdict: Runtime Error):
import sys

N = int(input())

list = []
for i in range(0, N):
    x, y, h = [int(x) for x in input().split()]
    list.append((x, y, h))

for X in range(0, 101):
    for Y in range(0, 101):
        b = True
        H = 0
        for Cx, Cy, Ch in list:
            if Ch != 0:
                H = Ch + abs(X - Cx) + abs(Y - Cy)
        for Cx, Cy, Ch in list:
            h = max(H - abs(X - Cx) - abs(Y - Cy), 0)
            if Ch != h:
                b = False
        if b == True:
            print(X, Y, H)
            sys.exit(0)
Problem p03239 (python)

Fixed submission:
import math

N, T = map(int, input().split())

c_list = []
for i in range(N):
    c1, t1=[int(i) for i in input().split()]
    if t1 <= T:
        c_list.append(c1)

if not c_list:
    print('TLE')
else:
    print(min(c_list))

Buggy submission (verdict: Runtime Error):
N, T = map(int, input().split())

ans  1003
for _ in range(N):
    c, t = map(int, input().split())
    if t <= T:
        ans = min(ans, c)

print('TLE' if ans==1003 else ans)
Problem p03240 (python)

Fixed submission:
import sys

N = int(input())

list = []
for i in range(0, N):
    x, y, h = [int(x) for x in input().split()]
    list.append((x, y, h))

for X in range(0, 101):
    for Y in range(0, 101):
        b = True
        H = 0
        for Cx, Cy, Ch in list:
            if Ch != 0:
                H = Ch + abs(X - Cx) + abs(Y - Cy)
        for Cx, Cy, Ch in list:
            h = max(H - abs(X - Cx) - abs(Y - Cy), 0)
            if Ch != h:
                b = False
        if b == True:
            print(X, Y, H)
            sys.exit(0)

Buggy submission (verdict: Runtime Error):
import sys

N = int(input())
xyh = []
for _ in range(N):
    x, y, h = map(int, input().split())
    xyh.append(tuple(x, y, h))

for X in range(101):
    for Y in range(101):
        flag = True
        H = 0
        for cx, cy, ch in xyh:
            if ch != 0:
                H = ch + abs(X - cx) + abs(Y - cy)
        for cx, cy, ch in xyh:
            h  max(h - abs(X - cx) - abs(Y - cy), 0)
            if ch != h:
                flag = False

        if flag:
            print(X, Y, H)
            sys.exit(0)
Problem p03243 (python)

Fixed submission:
import re
import sys

n = int(input())

for i in range(n, 1000):
    if re.match('^([0-9])\\1+$', str(i)):
        print(i)
        sys.exit(0)

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

for i in range(1, 10):
    if n <= i*111:
        print(i*111)
        exit()

Buggy submission (verdict: Runtime Error):
n = input()
zorome = [i*100 + i*10 + i for i in range(1, 10)]

for i in zorome:
    if n <= i:
        print(i)
        exit()
Problem p03260 (python)

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

if (A*B % 2) == 0:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    while b != 0:
        a, b = b, a%b
    return a


def main():
    N, X = map(int, input().split())
    x = [abs(int(i) - X) for i in input().split()] 

    y = x[0]
    for i in range(N):
        if x[i]%y == 0:
            continue
        y = gcd(y, x[i])
    print(y)


if __name__ == '__main__':
    main()
Problem p03261 (python)

Fixed submission:
import sys

N = int(input())
W = [input() for _ in range(N)]

if len(set(W)) != N:
    print('No')
    sys.exit()

prev = W[0][-1]
for w in W[1:]:
    if prev != w[0]:
        print('No')
        sys.exit()
    prev = w[-1]

print('Yes')

Buggy submission (verdict: Runtime Error):
import sys

N = int(input())
W = [input() for _ in range(N)]

if len(set(W)) != len(W):
    print('No')
    sys.exit(1)

prev = W[0][-1]
for w in W[1:]:
    print(w[0], prev)
    if prev != w[0]:
        print('No')
        sys.exit(1)
    prev = w[-1]

print('Yes')
Problem p03274 (python)

Fixed submission:
N, K   = map(int, input().split())
x = list(map(int, input().split()))
 
m = min(b - a + min(abs(a), abs(b)) for a, b in zip(x, x[K-1:]))
print(m)

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

for i in range(n-k+1):
    r = x[i+k-1]
    l = x[i]
    length = abs(r - l) + min(abs(l), abs(r))
    if length < ans:
        ans = length

print(ans)

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

m = min(b - a + min(abs(a), bas(b)) for a, b in zip(x, x[k-1]))
print(m)
Problem p03280 (python)

Fixed submission:
A, B = map(int, input().split())
s = (A * B) - (A + B - 1)
print(s)

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

count = 0
for i in range(1, n+1, 2):
    n_divisor = 1
    for j in range(2, n+1):
        if i%j == 0:
            n_divisor += 1
    if n_divisor == 8:
        count += 1

print(count)
Problem p03285 (python)

Fixed submission:
n = int(input())
for i in range(26):
    for j in range(16):
        if i*4 + j*7 == n:
            print('Yes')
            exit()

print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
for i in range(26):
    for j in range(16):
        if i*$ + j*7 == n:
            print('Yes')
            exit()

print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
for i in range(26):
    for j in range(16):
        if i*$ + j*7 == n:
            print('Yes')
            exit()

print('No')
Problem p03289 (python)

Fixed submission:
s = input()

c1, c2 = False, False

if s[0] == 'A':
    c1 = True

if s[2:-1].count('C') == 1:
    c2 = True

s_lower = s[1:].replace('C', 'c')
c3 = s_lower.islower()

if c1 and c2 and c3:
    print('AC')
else:
    print('WA')

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

c1, c2, c3 = False, False, True

if s[0] == 'A':
    c1 = True

if s[2:-2].count('C') == 1:
    c2 = True

index = [i for i in range(1, len(s))]
for i, st in enumerate(s[1:]):
    if st == 'C':
        index.pop(i)

for idx in index:
    if s[idx].islower():
        continue
    else:
        c3 = False
        break

if c1 and c2 and c3:
    print('AC')
else:
    print('WA')
Problem p03139 (python)

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

n = int(n)
a = int(a)
b = int(b)

ans_max = min(a,b)

if (a + b) > n:
    ans_min = a + b - n 
else:
    ans_min = 0


print(ans_max, end=" ")
print(ans_min)

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

a = input()
b = input()
c = input()

ans = 0

for count in range(n):
    tmp = 0
    if a[count] == b[count]:
        if a[count] != c[count]:
            tmp += 1
    else:
        tmp += 1
        if (a[count] != c[count]) & (b[count] != c[count]):
            tmp += 1
    ans += tmp
    
print(ans)
Problem p03140 (python)

Fixed submission:
n = int(input())

a = input()
b = input()
c = input()

ans = 0

for count in range(n):
    tmp = 0
    if a[count] == b[count]:
        if a[count] != c[count]:
            tmp += 1
    else:
        tmp += 1
        if (a[count] != c[count]) & (b[count] != c[count]):
            tmp += 1
    ans += tmp
    
print(ans)

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

a = input()
b = input()
c = input()

ans = 0

if a == b & b == c:
    ans = 0
else:
    for count in range(n):
        tmp = 0
        if a[count] == b[count]:
            if a[count] != c[count]:
                tmp += 1
        else:
            tmp += 1
            if (a[count] != c[count]) & (b[count] != c[count]):
                tmp += 1
        ans += tmp
    
print(ans)
Problem p03657 (python)

Fixed submission:
a,b=map(int,input().split())
if a%3==0 or b%3==0 or (a+b)%3==0:
    print("Possible")
else:
    print("Impossible")

Buggy submission (verdict: Runtime Error):
n=input()
a=list(map(int,input().split()))
an=[]
def aaa(i):
        b=a[i:]
        c=a[:i]
        x=sum(b)
        y=sum(c)
        return x-y
for i in range(len(a)):
    an+=[aaa(i)]
an=[abs(x) for x in an]
print(min(an))
Problem p03693 (python)

Fixed submission:
r,g,b=map(int,input().split())
x=r*100+g*10+b
if x%4==0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
n=input()
a=list(map(int,input().split()))
a.sort()
print(a[-1]-a[0])
Problem p03695 (python)

Fixed submission:
n=int(input())
pr=list(map(int,input().split()))
rate_color=[]
suge=0
for i in range(n):
    if pr[i]>=3200:
        suge+=1
pr=[x for x in pr if x<=3199]

def cl(x):
    if x<=399:
        return [0]
    elif 400<=x<=799:
        return [1]
    elif 800 <=x<=1199:
        return [2]
    elif 1200 <=x<=1599:
        return [3]
    elif 1600<=x<= 1999:
        return [4]
    elif 2000 <=x<=2399:
        return [5]
    elif 2400 <=x<=2799:
        return [6]
    elif 2800 <=x<=3199:
        return [7]

for i in range(len(pr)):
    x=pr[i]
    rate_color+=cl(x)
color=list(set(rate_color))
color_num=len(color)


max_num=color_num+suge
if color_num==0:
    mini_num=1
else:
    mini_num=color_num
print(mini_num,max_num)

Buggy submission (verdict: Runtime Error):
n=int(input())
pr=list(map(int,input().split()))
rate_color=[]
suge=0
for i in range(n):
    if pr[i]>=3200:
        suge+=1
def cl(x):
    if x<=399:
        return [0]
    elif 400<=x<=799:
        return [1]
    elif 800 <=x<=1199:
        return [2]
    elif 1200 <=x<=1599:
        return [3]
    elif 1600<=x<= 1999:
        return [4]
    elif 2000 <=x<=2399:
        return [5]
    elif 2400 <=x<=2799:
        return [6]
    elif 2800 <=x<=3199:
        return [7]

for i in range(n):
    x=pr[i]
    rate_color+=cl(x)
color=list(set(rate_color))
color_num=len(color)


max_num=color_num+suge
if color_num==0:
    mini_num=1
else:
    mini_num=color_num
print(mini_num,max_num)
Problem p03210 (python)

Fixed submission:
x = int(input())
if x == 3 or x == 5 or x == 7:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
x = int(input())
if x = 3 oe x = 5 or x= 7:
  print("YES")
else:
  print("NO")
Problem p03059 (python)

Fixed submission:
a, b, t = (int(i) for i in input().split()) 

print((t // a) * b)

Buggy submission (verdict: Runtime Error):
a, b, t = (int(i) for i in input().split()) 

return ((t + 0.5) // a) * b
Problem p03086 (python)

Fixed submission:
S = input()
l = []
for i in S:
    l.append(i)

c = 0
cnt = []
for j in range(len(l)):
    if l[j] == 'A' or l[j] == 'T' or l[j] == 'C' or l[j] == 'G':
        c+=1
        cnt.append(c)
    else:
        cnt.append(c)
        c = 0

#print(cnt)
print(max(cnt))

Buggy submission (verdict: Runtime Error):
S = input()
l = []
for i in S:
    l.append(i)

c = 0
cnt = []
for j in range(len(l)):
    if l[j] == 'A' or l[j] == 'T' or l[j] == 'C' or l[j] == 'G':
        c+=1
    else:
        cnt.append(c)
        c = 0

print(max(cnt))

Buggy submission (verdict: Runtime Error):
S = input()
l = []
for i in S:
    l.append(i)

c = 0
cnt = []
for j in range(len(l)):
    if l[j] == 'A' or l[j] == 'T' or l[j] == 'C' or l[j] == 'G':
        c+=1
    else:
        cnt.append(c)
        c = 0

print(max(cnt))
Problem p03071 (python)

Fixed submission:
input_ = list(map(int,input().split()))
x = input_[0]
y = input_[1]
point = max(x,y)
if point == x:
  x -= 1
else:
    y -= 1
point += max(x,y)
print(point)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = input()
a = []
if S[0] == '0':
    a.append(0)
cnt = 1
for i in range(1, N):
    if S[i] != S[i - 1]:
        a.append(cnt)
        cnt = 1
    else:
        cnt += 1

a.append(cnt)
a.append(0)
a.append(0)

ans = s = sum(a[:2*K + 1])
for i in range(2*K + 2, len(a), 2):
    s += a[i] + a[i - 1] - a[i - 2*K - 1] - a[i - 2*K - 2]
    ans = max(ans, s)
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = list(map(int, input()))

Z = [j for j, s in enumerate(S) if (j > 0 and s == 0 and S[j] != S[j-1]) or (j == 0 and s == 0)] + [N]
Y = [j for j, s in enumerate(S) if (j > 0 and s == 1 and S[j] != S[j-1]) or (j == 0 and s == 1)]
result = 0
if len(Z) <= K:
  print(N)
else:
  for i in range(len(Z)-K):
    if i == 0:
      result = Z[i+K]
    else:
      result = max(result, Z[i+K] - Y[i if Y[0] < Z[0] else i-1])
    print(result)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = list(map(int, input()))

Z = [j for j, s in enumerate(S) if (j > 0 and s == 0 and S[j] != S[j-1]) or (j == 0 and s == 0)] + [N]
Y = [j for j, s in enumerate(S) if (j > 0 and s == 1 and S[j] != S[j-1]) or (j == 0 and s == 1)]
result = 0
if len(Z) <= K:
  print(N)
else:
    for i in range(len(Z)-K):
      if i == 0:
        result = Z[i+K]
      else:
        result = max(result, Z[i+K] - Y[i if Y[0] < Z[0] else i-1])
    print(result)