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

Fixed submission:
n,m = map(int,input().split())
sum = {}
ans = 0

for i in range(0,n):
  K = list(map(int,input().split()))
  for j in range(1,K[0] + 1):
    if K[j] not in sum:
      sum[K[j]] = 1
    else:
      sum[K[j]] += 1
for k in sum:
  if sum[k] == n:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input())
sum = {}
ans = 0

for i in range(n):
  k = list(map(int,input().split()))
  for j in range(1,k[0] + 1):
    if k[j] not in sum:
      sum[k[j]] = 1
    else:
      sum[k[j]] += 1
for l in sum:
  if sum[l] == n:
    ans += 1
print(ans)
Problem p03146 (python)

Fixed submission:
a = [int(input())]

for i in range(100000):
  if a[i] % 2 == 0:
    a.append(a[i]//2)
  else:
    a.append(3*a[i] + 1)
    
  if a[i+1] in a[:i]:
    print(i+2)
    break

Buggy submission (verdict: Runtime Error):
a = [int(input())]

for i in range(100000):
  if a[i] % 2 == 0:
    a.append(a[i]//2)
    else:
      a.append(3*a[i] + 1)
    
    if a[i+1] in a[:i]:
      print(i+2)
      break

Buggy submission (verdict: Runtime Error):
a = [int(input())]

for i in range(100000):
  if a[i] % 2 == 0:
    a.append(a[i]//2)
    else:
      a.append(3*a[i] + 1)
    
    if a[i+1] in a[:i]
      print(i+2)
      break
Problem p03206 (python)

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 submission (verdict: Runtime Error):
D = int(input())
if(D == 25):
  print("Christmas")
else if(D == 24):
  print("Christmas Eve")
else if(D == 23):
  print("Christmas Eve Eve")
else if(D == 22):
  print("Christmas Eve Eve Eve")
Problem p03211 (python)

Fixed submission:
s = input()
imin = 753
for i in range(len(s)-2):
  if(abs(int(s[i] + s[i+1] + s[i+2]) - 753) )< imin:
     imin = abs(int(s[i] + s[i+1] + s[i+2])-753)
print(imin)

Buggy submission (verdict: Runtime Error):
s = input()
imin = 753
for i in range(len(s)-2):
  if(abs(int(s[i] + s[i+1] + s[i+2]) - 753) < imin:
     imin = abs(int(s[i] + s[i+1] + s[i+2])-753)
print(imin)
Problem p03219 (python)

Fixed submission:
X,Y = map(int, input().split())
print(int (X + Y/2))

Buggy submission (verdict: Runtime Error):
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
tmp = 1000000
ans = 0

for i in range(n):
  c = t - h[i] * 0.006
  d = a - c
  if d < 0:
    d = -d
  if d < tmp:
    tmp = d
    ans = i + 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
tmp = 1000000
ans = 0
for i in range(n):
  c = t - h[i] * 0.006
  d = a - c
  if d < 0:
    d = -d
  if d < tmp:
    tmp = d
    ans = i + 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
tmp = 1000000
ans = 0
for i in range(n):
  c = t - h[i] * 0.006
  d = a - c
  if d < 0:
    d = -d
  if d < tmp:
    tmp = d
    ans = i + 1
print(ans)

Buggy submission (verdict: Runtime Error):
X,Y = map(int, input().split())
print(int X + Y/2)

Buggy submission (verdict: Runtime Error):
X,Y = map(int, input().split())
Y = 2/Y
print(int X + Y/2)
Problem p03220 (python)

Fixed submission:
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
tem = [abs(a - (t - i * 0.006)) for i in h]
print(tem.index(min(tem)) + 1)

Buggy submission (verdict: Runtime Error):
n = int(input())
t, a = map(int,input().split())
h = list(map(int,input().split()))
tem = [ans(a - ( t - i * 0.006)) for i in h]
print(tem.index(min(tem)) + 1)

Buggy submission (verdict: Runtime Error):
N = int(input())
T, A = map(int, (input().split()))
H = list(map(int, (input().split())))
tem_diff = [abs(A - (T - i * 0.006)) for i in H]
print(tem_diff.index(min(tem_diff)) + 1)

n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
tem = [abs(a - (t - i * 0.006)) for i in h]
print(tem.index(min(tem)) + 1)
Problem p03239 (python)

Fixed submission:
N, T = map(int, input().split())
 
c = []
for i in range(N):
    ci, ti = map(int, input().split())
    c.append([ci, ti])
 
c.sort(key=lambda x:x[0])
 
for i in range(len(c)):
    if c[i][1] <= T:
        print(c[i][0])
        exit()
print('TLE')

Buggy submission (verdict: Runtime Error):
N,T = map(int,input().split())
c,t = [list(map(int,input.split())) for i in N]
min_c = 1000
hantei = 0
ans = 0
for i in N:
  tmp = 0
  if t[i] <= T:
    tmp = 1
    hantei += 1
  if tmp == 1:
    if c[i] < min_c:
      min_c = c[i]
      ans = i+1
print ans if hantei>0 else 'TLE'

Buggy submission (verdict: Runtime Error):
N,T = map(int,input().split())
c,t = [list(map(int,input.split())) for i in N]
min_c = 1000
hantei = 0
ans = 0
for i in N:
  tmp = 0
  if t[i] <= T:
    tmp = 1
    hantei += 1
  if tmp == 1:
    if c[i] < min_c:
      min_c = c[i]
      ans = i+1
print(ans)
Problem p03261 (python)

Fixed submission:
n = int(input())
data = [input().rstrip() for _ in range(n)]
used = [data[0]]
 
for i in range(1, n):
    if data[i][0] == data[i - 1][-1] and data[i] not in used:
        used.append(data[i])
    else:
        print("No")
        exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
n = int(input())
w = [input().rsprit() for i in range(n)]
use = [w[0]]
for i in range(1,n):
  if w[i][0] == w[i-1][-1] and w[i] not in use:
    use.append(w[i])
  else:
    print('No')
    exit()
print('Yes')
Problem p03264 (python)

Fixed submission:
K = int(input())
if(K%2 == 0):
  print(int((K/2)**2))
else:
  print(int(((K-1)/2)*((K+1)/2)))

Buggy submission (verdict: Runtime Error):
K = int(input())
if(K%2 == 0):
  print(int((K/2)**2)
else:
  print(int((K/2)*(K/2+1)))
Problem p03280 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
count_ans = 0
for i in range(n//2 + 1):
  count_y = 0
  for j in range(2*i+2):
    if j > 0:
      if (2 * i + 1)%j == 0:
        count_y += 1
  if count_y == 8:
    count_ans += 1
print(count_ans)
Problem p03281 (python)

Fixed submission:
n = int(input())
count_ans = 0
for i in range(n//2 + 1 if n%2 ==1 else n//2):
  count_y = 0
  for j in range(2*i+2):
    if j > 0:
      if (2 * i + 1)%j == 0:
        count_y += 1
  if count_y == 8:
    count_ans += 1
print(count_ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
count_ans = 0
for i in range(n//2 + 1):
  count_y = 0
  for j in range(i):
    if i%j == 0:
      count_y += 1
  if count_y == 8:
    count_ans += 1
print(count_ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
count_ans = 0
for i in range(n//2 + 1):
  count_y = 0
  for j in range(i):
    if i%j == 0:
      count_y += 1
  if count_y = 8:
    count_ans += 1
print(count_ans)
Problem p03324 (python)

Fixed submission:
d,n = map(int,input().split())
if n < 100:
  ans = (100 ** d) * n
  print(ans)
else:
  ans = (100 ** (d+1)) + 100 ** d
  print(ans)

Buggy submission (verdict: Runtime Error):
d,n = map(int,input())
ans = (100 ** d) * n
print(ans)
Problem p03328 (python)

Fixed submission:
a,b = map(int,input().split())
tmp = b - a
count = 0
for i in range(tmp):
  count += i
print(count - a)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input())
tmp = b - a
count = 0
for i in range(tmp):
  count += i+1
print(count - a)
Problem p03400 (python)

Fixed submission:
n = int(input())
d,x = map(int,input().split())
count = x
a = [int(input()) for i in range(n)]
for i in range(n):
  j = 0
  while j * a[i] + 1 <= d:
    count += 1
    j += 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
d,x = map(int,input().split())
count = x
for i in range(n):
  a[i] = int(input())
  count += d//a + 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
d,x = map(int,input().split())
a = [n]
count = x
for i in range(n):
  a[i] = int(input())
  count += d//a[i] + 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
d,x = map(int,input().split())
a = []
count = x
for i in range(n):
  a[i] = int(input())
  count += d//a[i] + 1
print(count)
Problem p03105 (python)

Fixed submission:
A,B,C = list(map(int,input().split()))
if A * C > B:
    print(int(B / A))
else:
    print(C)

Buggy submission (verdict: Runtime Error):
A,B,C = list(map(int,input().split()))
if A * C > B:
    print(int(B / A))
else:
    print((C)
Problem p03109 (python)

Fixed submission:
S = input()
print('Heisei' if S <= '2019/04/30' else 'TBD')

Buggy submission (verdict: Runtime Error):
S = input()
2 print('Heisei' if S <= '2019/04/30' else 'TBD')
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):
N = int(input())
if N == 1:
  print("Hello World")
else:
  A, B = list(map(int,input().split()))
  print(A + B)
Problem p03288 (python)

Fixed submission:
R = int(input())
if R < 1200:
    print("ABC")
elif R < 2800:
    print("ARC")
else:
    print("AGC")

Buggy submission (verdict: Runtime Error):
R = int(input())
if R < 1200:
    ptint("ABC")
elif R < 2800:
    print("ARC")
else:
    print("AGC")

Buggy submission (verdict: Runtime Error):
R = int(input())
if R < 1200:
    ptint("ABC")
elif R < 2800:
    print("ARC")
else:
    print("AGC")
Problem p03078 (python)

Fixed submission:
x,y,z,k = [int(num) for num in input().split()]
a_cake,b_cake,c_cake = [sorted([int(num) for num in input().split()],reverse=True)[:k] for _ in range(3)]

sum_cake=list()
for i,a in enumerate(a_cake,1):
    for j,b in enumerate(b_cake,1):
        if(i*j>k):
            break
        for n,c in enumerate(c_cake,1):
            if(i*j*n>k):
                break
            sum_cake.append(a+b+c)


sum_cake.sort(reverse=True)

for i in sum_cake[:k]:
    print(i)

Buggy submission (verdict: Runtime Error):
x,y,z,k = [int(i) for i in input().split()]

cakes_types = [[int(i) for i in input().split()] for _ in range(3)]


for types in cakes_types:
    types.extend([0 for _ in range(max(x,y,z)-len(types))])
    types.sort(reverse=True)

sum_list = list()

for i in range(k):
    sum_taste = 0;
    for j in range(3):
        sum_taste += cakes_types[j][i]
    sum_list.append(sum_taste)

print(sum_list)
Problem p03231 (python)

Fixed submission:
def gcd(a, b):
	if a > b:
		a, b = b, a
	if a % b == 0:
		return b
	while a % b != 0:
		c = a% b
		a = b
		b = c
	else:
		return c

def lcmCalc(x, y):
	return (x * y) // gcd(x, y)

n, m = map(int, input().split())
s = input()
t = input()

lcm = lcmCalc(n, m)

# str1 = ""
# for i in range(lcm):
# 	str1 += "-"

flg = 0
for i in range(n):
	index = i * lcm // n + 1
	if (index - 1) % (lcm // m) == 0:
		j = (index - 1) // (lcm // m)
		if s[i] != t[j]:
			print("-1")
			flg = 1
			break
if flg == 0:
	print(lcm)


# 	str1 = str1[:index] + s[i] + str1[index+1:]

# flg = 0
# for i in range(m):
# 	index = i * lcm // m + 1
# 	if str1[index:index+1] != "-" and str1[index:index+1] != t[i]:
# 		print("-1")
# 		flg = 1
# 		break

# if flg == 0:
# 	print(lcm)

Buggy submission (verdict: Runtime Error):
import math

def lcmCalc(x, y):
	return int((x * y) / math.gcd(x, y))

n, m = map(int, input().split())
s = input()
t = input()

lcm = lcmCalc(n, m)

str1 = ""
for i in range(lcm):
	str1 += "-"

for i in range(n):
	index = int(i * lcm / n + 1)
	str1 = str1[:index] + s[i] + str1[index+1:]

flg = 0
for i in range(m):
	index = int(i * lcm / m + 1)
	if str1[index:index+1] != "-" and str1[index:index+1] != t[i]:
		print("-1")
		flg = 1
		break

if flg == 0:
	print(lcm)

Buggy submission (verdict: Runtime Error):
import math

def lcm(x, y):
	return int((x * y) / math.gcd(x, y))

n, m = map(int, input().split())
s = input()
t = input()

lcm = lcm(n, m)

str1 = ""
for i in range(lcm):
	str1 += "-"

for i in range(n):
	index = int(i * lcm / n + 1)
	str1 = str1[:index] + s[i] + str1[index+1:]

flg = 0
for i in range(m):
	index = int(i * lcm / m + 1)
	if str1[index:index+1] != "-" and str1[index:index+1] != t[i]:
		print(-1)
		flg = 1
		break

if flg == 0:
	print(lcm)

Buggy submission (verdict: Runtime Error):
import math

def lcm(x, y):
	return (x * y) // math.gcd(x, y)

n, m = map(int, input().split())
s = input()
t = input()

lcm = lcm(n, m)

str1 = ""
for i in range(lcm):
	str1 += "-"

for i in range(n):
	index = i * lcm // n + 1
	str1 = str1[:index] + s[i] + str1[index+1:]

flg = 0
for i in range(m):
	index = i * lcm // m + 1
	if str1[index:index+1] != "-" and str1[index:index+1] != t[i]:
		print(-1)
		flg = 1
		break

if flg == 0:
	print(lcm)

Buggy submission (verdict: Runtime Error):
import math

def lcm(x, y):
	return (x * y) // math.gcd(x, y)

n, m = map(int, input().split())
s = input()
t = input()

lcm = lcm(n, m)

str1 = ""
str2 = ""
for i in range(lcm):
	str1 += "-"
	str2 += "-"

for i in range(n):
	index = i * lcm // n + 1
	str1 = str1[:index] + s[i] + str1[index+1:]

flg = 0
for i in range(m):
	index = i * lcm // m + 1
	if str1[index:index+1] != "-" and str1[index:index+1] != t[i]:
		print(-1)
		flg = 1
		break

if flg == 0:
	print(lcm)
Problem p03493 (python)

Fixed submission:
s = input()

cnt = 0
for c in s:
	if c == "1":
		cnt += 1
print(cnt)

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

cnt = 0
for c in s:
	if c == "1":
		cnt += 1
print(cmt)
Problem p03085 (python)

Fixed submission:
s=input()
if s=="A":
    print("T")
elif s=="T":
    print("A")
elif s=="C":
    print("G")
else:
    print("C")

Buggy submission (verdict: Runtime Error):
s=input()
if s="A":
    print("T")
elif s="T":
    print("A")
elif s="C":
    print("G")
else:
    print("C")
Problem p03385 (python)

Fixed submission:
s=set(input())
a=set(["a","b","c"])
print("Yes"if s==a else"No")

Buggy submission (verdict: Runtime Error):
s=set(input())
a=set("a","b","c")
print("Yes"if s==a else"No")
Problem p03698 (python)

Fixed submission:
s = input()
s1=[]
for i in range(len(s)):
  s1.append(s[i])
s2 = set(s1)
if len(s2) == len(s1):
  print("yes")
else:
  print("no")

Buggy submission (verdict: Runtime Error):
s = input()
ans=0
for i in range(len(s)):
  if s[i] == s[i+1]:
    ans += 1
if ans > 0:
  print("no")
else:
  print("yes")
Problem p03699 (python)

Fixed submission:
a=sorted([int(input()) for _ in [0]*int(input())])
s1=-1
if sum(a) % 10 != 0:
    print(sum(a))
else:
    for i in range(len(a)): #リスト中の10の倍数でなく最小の数を探す
        if a[i] % 10 !=0:
            s1=i
            break
    if s1!=-1:
        a.pop(s1)
        print(sum(a))
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
a=sorted([int(input()) for _ in [0]*int(input())])
if sum(a) % 10 != 0:
    print(sum(a))
else:
    for i in range(len(a)): #リスト中の10の倍数でなく最小の数を探す
        if a[i] % 10 !=0:
            s1=i
            break
    a.pop(s1)
    print(sum(a))
Problem p03759 (python)

Fixed submission:
a,b,c = map(int, input().split())
d = b - a
e = c - b
if d == e:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
o = input()
e = input()
r = ''
for i in range(len(o)):
  r += o[i]
  if i < len(e):
    r += e[i]
print(r)

Buggy submission (verdict: Runtime Error):
#すぬけ君は新しくできたプログラミングコンテストに会員登録しました。 登録に使ったパスワードを覚えておく自信が無かったすぬけ君は、 手元の紙にパスワードをメモしておくことにしました。 ただし、そのままメモをすると誰かにパスワードを盗まれてしまうかもしれないので、 文字列の偶数番目の文字と奇数番目の文字をそれぞれ別々の紙にメモしておくことにしました。
#パスワードの奇数番目の文字だけを順番を変えずに取り出した文字列 O と、 偶数番目の文字だけを順番を変えずに取り出した文字列 E が与えられます。 すぬけ君のかわりにパスワードを復元してください。
o = input()
e = input()
r = ''
for i in range(len(o)):
  r += o[i]
  if i < len(e):
    r += e[i]
print(r)
Problem p03085 (python)

Fixed submission:
a=input()
if a=="A":
    print("T")
elif a=="T":
    print("A")
elif a=="C":
    print("G")
elif a=="G":
    print("C")

Buggy submission (verdict: Runtime Error):
a=input()
if a=="A":
    print("T")
else if a=="T":
    print("A")
else if a=="C":
    print("G")
else if a=="G":
    print("C")
Problem p03323 (python)

Fixed submission:
a,b=map(int,input().split())
if a>8 or b>8:
  print(":(")
else:
  print("Yay!")

Buggy submission (verdict: Runtime Error):
a,b=int(input().split())
if a>8|b>8:
  print(":(")
else:
  print("Yay!")
Problem p03337 (python)

Fixed submission:
a,b=map(int,input().split())
print(max(a*b,a-b,a+b))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().sprit())
print(max([a*b,a-b,a+b]))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().sprit())
print(max(a*b,a-b,a+b))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().sprit())
max=int(a+b)
if max<a*b:
  max=int(a*b)
else if max<a-b:
  max=int(a-b)
print(max)
Problem p04043 (python)

Fixed submission:
a=list(map(int,input().split()))
a=sorted(a)
if a==[5,5,7]:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
a=list(map(int,input().split()))
a=sorted(a)
print(a)
if a=[5,5,7]:
    print("YES")
else:
    print("NO")
Problem p03385 (python)

Fixed submission:
x = input()
a = b = c = 1
for i in range(3):
    if x[i] == 'a':
        a -= 1
    elif x[i] == 'b':
        b -= 1
    else:
        c -= 1
if a == 0 and b == 0 and c == 0: 
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,k = map(int, input().split())
if a + k - 1 < b:
  min_ = a + k - 1
else:
  for i in range(a, b + 1):
    print(i)
  exit(0)
max_ = b - k + 1
for i in range(a, min_ + 1):
    print(i)
for i in range(max_, b + 1):
    print(i)

Buggy submission (verdict: Runtime Error):
x[] = input().split()
a = b = c = 1
for i in 3:
    if x[i] == 'a':
        a--;
    elif x[i] == 'b':
        b--;
    else:
        c--;
if a == 0 and b == 0 and c == 0: 
    print("Yes")
else:
    print("No")
Problem p03391 (python)

Fixed submission:
import math

n = int(input())
c = -1
sum_ = 0
for i in range(n):
    a, b = map(int, input().split())
    sum_ += a
    if a > b:
        if c == -1:
            c = b
        if b < c:
            c = b
if c == -1:
    print(0)
else:
    print(sum_ - c)

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
c = -1
sum_ = 0
for i in range(n):
    a, b = map(int, input().split())
    sum_ += a
    if a > b:
        if c == -1:
            c = b
        if b > c:
            c = b
if c == -1:
    print("0")
else:
    print(s - c)
Problem p03266 (python)

Fixed submission:
N,K = list(map(int,input().split()))
print(int((N//K)**3) if K%2 == 1 else int((N//K)**3)+int((N//(K//2) - N//K)**3))

Buggy submission (verdict: Runtime Error):
N,K = list(map(int,input().split()))
D = N//(K//2) - N//K
print(int((N//K)**3) if K%2 == 1 else int((N//K)**3)+int(D**3))
Problem p03105 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,k = map(int, input().split())
import math
import sys
c = math.gcd(a, b)
ls = []
for i in range(1, c):
    if c % i == 0:
        ls.append(i)

print(ls[k-1])
Problem p03544 (python)

Fixed submission:

N = int(input())
i = 2
a = 2
b = 1

if N == 1:
  print(1)
else:
  while i <= N:
    c = a + b
    a = b
    b = c
    i = i + 1

  print(c)

Buggy submission (verdict: Runtime Error):
# N = list(map(int, input().split()))
# print(N[0], N[1], N[2])
# print(N[1])
# print(N[2])

N = int(input())
i = 2
a = 2
b = 1

while i <= N:
  c = a + b
  a = b
  b = c
  i = i + 1

print(c)
Problem p03105 (python)

Fixed submission:
A,B,C = (int(i) for i in input().split())
sho=B//A

if sho >= C :
    print(C)
else:
    print(sho)

Buggy submission (verdict: Runtime Error):
A,B,C = (int(i) for in input().split())
sho=B//A

if sho >= C :
    print(C)
else:
    print(sho)
Problem p03085 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Fri Apr  5 13:45:00 2019

@author: adachi-lab
"""

input_code = input()

list_1 = []

if input_code == 'A' or input_code == 'T':
    list_1 = ['A','T']
    list_1.remove(str(input_code))
    print(list_1[0])
    
else:
    list_1 = ['C','G']
    list_1.remove(str(input_code))
    print(list_1[0])

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Fri Apr  5 17:16:14 2019

@author: adachi-lab
"""

input_1 = input()
S = input()
l = []
r = []


N = input_1.split()[0]
Q = input_1.split()[1]

for i in range(int(Q)):
    input_3 = input()
    l.append(int(input_3.split()[0]))
    r.append(int(input_3.split()[1]))

W = [(S[x-1:y]).count('AC') for (x, y) in zip(l, r)]

for i in range(len(W)):
    print(W[i])

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Fri Apr  5 17:16:14 2019

@author: adachi-lab
"""

input_1 = input()
S = input()
l = []
r = []


N = input_1.split()[0]
Q = input_1.split()[1]

for i in range(int(Q)):
    input_3 = input()
    l.append(int(input_3.split()[0]))
    r.append(int(input_3.split()[1]))

W = [(S[x-1:y]).count('AC') for (x, y) in zip(l, r)]

for i in range(len(W)):
    print(W[i])
Problem p03086 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Fri Apr  5 16:48:09 2019

@author: adachi-lab
"""

input_code = input()
L1 = len(input_code)
list_3 = []
list_4 = []
list_5 = []

for w in range(L1):
    list_3.append(0)
    list_4.append(0)


for i in range(L1):
    code = input_code[i]
    if code == 'A' or code == 'C' or code == 'G' or code == 'T':
        list_3[i] = 1
        
c = 0

for n,m in zip(list_3,list_4):
    
    if n == m:
        c = 0
        list_5.append(c)
        
    else:
        c += 1
        list_5.append(c)
        
print(max(list_5))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Fri Apr  5 14:11:52 2019

@author: adachi-lab
"""

input_code = str(input())
L1 = len(input_code)

list_3 = []
for w in range(L1):
    list_3.append(w)


x = 0
for i in range(L1):
    code = input_code[i]
    if code == 'A' or code == 'C' or code == 'G' or code == 'T':
        list_3.remove(x)
    
    x+=1

L3 = len(list_3)
list_4 = []

if list_3[0] == 0:
    for q in range(L3-1):
        list_4.append(list_3[q+1]-list_3[q]-1)
    list_4.append(L1-list_3[L3-1]-1)
    
    
else:
    list_3.insert(0,0)
    list_4.append(list_3[1])
    for q in range(L3):
        list_4.append(list_3[q+1]-list_3[q]-1)
    list_4.append(L1-list_3[L3]-1)
    list_4.pop(1)
    
    


print(max(list_4))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Fri Apr  5 14:11:52 2019

@author: adachi-lab
"""

input_code = str(input())
L1 = len(input_code)

list_3 = []
for w in range(L1):
    list_3.append(w)


x = 0
for i in range(L1):
    code = input_code[i]
    if code == 'A' or code == 'C' or code == 'G' or code == 'T':
        list_3.remove(x)
    
    x+=1

L3 = len(list_3)
list_4 = []

if list_3[0] == 0:
    for q in range(L3-1):
        list_4.append(list_3[q+1]-list_3[q]-1)
    list_4.append(L1-list_3[L3-1]-1)
    
    
else:
    list_3.insert(0,0)
    list_4.append(list_3[1])
    for q in range(L3):
        list_4.append(list_3[q+1]-list_3[q]-1)
    list_4.append(L1-list_3[L3]-1)
    list_4.pop(1)
    
    


print(max(list_4))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Fri Apr  5 14:11:52 2019

@author: adachi-lab
"""

input_code = str(input('入力;'))
L1 = len(input_code)

list_3 = []
for w in range(L1):
    list_3.append(w)


x = 0
for i in range(L1):
    code = input_code[i]
    if code == 'A' or code == 'C' or code == 'G' or code == 'T':
        list_3.remove(x)
    
    x+=1

L3 = len(list_3)
list_4 = []

if list_3[0] == 0:
    for q in range(L3-1):
        list_4.append(list_3[q+1]-list_3[q]-1)
    list_4.append(L1-list_3[L3-1]-1)
    print(list_4)
    
else:
    list_3.insert(0,0)
    list_4.append(list_3[1])
    for q in range(L3):
        list_4.append(list_3[q+1]-list_3[q]-1)
    list_4.append(L1-list_3[L3]-1)
    list_4.pop(1)
    print(list_4)
    


print(max(list_4))