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

Fixed submission:
import math
import collections
 
N = int(input())
prime_number = False
ans = 0
 
def trial_division(n):
    #素因数を格納するリスト
    factor = []
    #2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    #リストが空ならそれは素数
    if not factor:
      global prime_number
      prime_number = True
      return
    else:
        factor.append(n)
        return factor

list_num = trial_division(N)

if N == 1:
  ans = 0
elif prime_number:
  ans = 1
else:
  if 1 in list_num:
    prime_list = list_num[:-1]
  else:
    prime_list = list_num
  counter = collections.Counter(prime_list)
  for key,val in counter.items():
    temp = val
    for i in range(1,val+1):
      if temp-i > 0:
        temp -= i
        ans += 1
      elif temp-i == 0:
        temp -= i
        ans += 1
        break
      else:
        break
    
print(ans)

Buggy submission (verdict: Runtime Error):
import math
import collections
 
N = int(input())
prime_number = False
ans = 0
 
def trial_division(n):
    #素因数を格納するリスト
    factor = []
    #2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    #リストが空ならそれは素数
    if not factor:
      global prime_number
      prime_number = True
      return
    else:
        factor.append(n)
        return factor
 
list_num = trial_division(N)
 
if prime_number:
  ans = 1
else:
  if 1 in list_num:
    prime_list = list_num[:-1]
    counter = collections.Counter(prime_list)
    for key,val in counter.items():
      temp = val
      for i in range(1,val+1):
        if temp-i > 0:
          temp -= i
          ans += 1
        elif temp-i == 0:
          temp -= i
          ans += 1
          break
        else
          break
    
print(ans)

Buggy submission (verdict: Runtime Error):
import math
import collections

N = int(input())
prime_number = False
ans = 0

def trial_division(n):
    #素因数を格納するリスト
    factor = []
    #2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    #リストが空ならそれは素数
    if not factor:
      global prime_number
      prime_number = True
      return
    else:
        factor.append(n)
        return factor

list_num = trial_division(N)

if prime_number:
  ans = 1
else:
  if 1 in list_num:
    prime_list = list_num[:-1]
    counter = collections.Counter(prime_list)
    for key,val in counter.items():
      temp = val
      for i in range(1,val+1):
        if temp-i > 0:
          temp -= i
          ans += 1
        elif temp-i == 0:
          temp -= i
          ans += 1
          break
        elsea
          break
    
print(ans)
Problem p02683 (python)

Fixed submission:
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,M,X = map(int, readline().split())
data = np.array(read().split(), np.int64)
data = data.reshape(N,-1)
C = data[:,0]
A = data[:,1:]

cost = np.zeros(1<<N, np.int64)
ability = np.zeros((1<<N, M), np.int64)

for i in range(N):
  cost[1<<i:1<<(i+1)] = cost[:1<<i] + C[i]
  ability[1<<i:1<<(i+1)] = ability[:1<<i] + A[i]

ok = np.all(ability >= X, axis=1)

x = cost[ok]
answer = -1 if len(x) == 0 else x.min()
print(answer)

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

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,M,X = map(int, readline().split())
data = np.array(read().split(), np.int64)
data = data.reshape(N,-1)
C = data[:,0]
A = data[:,1:]

cost = np.zeros(1<<N, np.int64)
dability = np.zeros((1<<N, M), np.int64)

for i in range(N):
  cost[1<<i:1<<(i+1)] = cost[:1<<i] + C[i]
  ability[1<<i:1<<(i+1)] = ability[:1<<i] + A[i]
  
ok = np.all(ability >= X, axis=1)

x = cost[ok]
answer = -1 if len(x) == 0 else x.min()
print(answer)
Problem p02687 (python)

Fixed submission:
S = input()

if S == 'ARC':
  print('ABC')
elif S == 'ABC':
  print('ARC')

Buggy submission (verdict: Runtime Error):
S = input()
if S == 'ABC':
  print('ARC')
elif S == 'ARC'):
  print('ARC')
Problem p02690 (python)

Fixed submission:
import math
 
x = int(input())
x_pow = round(math.pow(x, 1/5))
ok = 0
 
for a in range(-300,300):
  for b in range(-300,300):
    if a**5 - b**5 == x:
      print(a,b)
      ok = 1
      exit()

Buggy submission (verdict: Runtime Error):
import math

x = int(input())
x_pow = round(math.pow(x, 1/5))
ok = 0

for a in range(-x_pow-10, x_pow+10):
  for b in range(-x_pow-10, x_pow+10):
    if a**5 - b**5 == x:
      print(a,b)
      ok = 1
      eixt()
Problem p02717 (python)

Fixed submission:
import sys
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
X,Y,Z = map(int, readline().split())
 
A,B,C = Z,X,Y
 
print(A,B,C)

Buggy submission (verdict: Runtime Error):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

X,Y,Z = map(int, readline())

A,B,C = Z,X,Y

print(A,B,C)
Problem p02742 (python)

Fixed submission:
h,w = map(int, input().split())
 
a = h*w
 
if h==1 or w==1:
  print(1)
elif a%2==0:
  print(a//2)
else:
  print(a//2+1)

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

a = h*w

if a%2==0:
  print(a//2)
else:
  pirnt(a//2+1)
Problem p02767 (python)

Fixed submission:
N=int(input())
X=list(map(int,input().split()))
ans=10**9
 
for i in range(1,101):
  temp=0
  for j in range(N):
    temp+=(X[j]-i)**2
  else:
    ans=min(ans,temp)
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
X=list(map(int,input().split()))
ans=10**9

for i in range(1,101):
  temp=0
  for j in range(N):
    temp+=(X[i]-j)**2
  else:
    ans=min(ans,temp)
print(ans)
Problem p02772 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 'DENIED'
 
for i in range(n):
  if a[i]%2 == 1:
    continue
  else:
    if a[i]%3==0 or a[i]%5==0:
      continue
    else:
      break
else:
  ans = 'APPROVED'
 
print(ans)

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

for i in range(n):
  if a[i]%2 == 1:
    continue
  else:
    if a[i]%3==0 or a[i]%5==0:
      continue
    else:
      break
else:
  ans = APPROVED

print(ans)
Problem p02780 (python)

Fixed submission:
import sys

N,K=map(int,input().split())
P=list(map(int,input().split()))
Q=[(1+p)/2 for p in P]
temp=sum(Q[:K])
ans=temp
for i in range(N):
  try:
    temp=temp-Q[i]+Q[i+K]
    ans=max(ans,temp)
  except:
    pass
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
import sys

N,K=map(int,input().split())
P=list(map(int,input().split()))
Q=[(1+p)/2 for p in P]
temp=sum(Q[:K])
ans=temp
for i in range(N-3):
  temp=temp-Q[i]+Q[i+K]
  ans=max(ans,temp)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
import sys

N,K=map(int,input().split())
P=list(map(int,input().split()))
Q=[(1+p)/2 for p in P]
temp=sum(Q[:K])
ans=temp
for a,i in enumerate(range(N-4)):
  temp=temp-Q[i]+Q[i+K]
  ans=max(ans,temp)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
P=list(map(int,input().split()))
P=P.sort(reverse=True)
P=P[:K]
ans=0

for p in P:
  ans+=(1+p)/2
print(ans)
Problem p02791 (python)

Fixed submission:
N=int(input())
L=list(map(int,input().split()))
ans=1
M=L[0]
for i in range(1,N):
  if M>=L[i]:
    M=L[i]
    ans+=1
  else:
    continue
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
L=map(int,input().split())
ans=1
M=L[0]
for i in range(1,N):
  if M>=L[1]:
    M=L[1]
    ans+=1
  else:
    continue
print(ans)
Problem p02817 (python)

Fixed submission:
S,T = input().split()
print(T,S, sep='')

Buggy submission (verdict: Runtime Error):
print(S,T)
Problem p02830 (python)

Fixed submission:
import sys
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
N = int(readline())
S,T = read().decode('utf-8').rstrip().split()
 
ans = []
 
for i in range(N):
  ans.append(S[i])
  ans.append(T[i])


print(''.join(ans))

Buggy submission (verdict: Runtime Error):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
S,T = map(int, readline().split())

ans = []

for i in range(N):
  ans.append(S[i])
  ans.append(T[i])

print(''.join(ans))
Problem p02888 (python)

Fixed submission:
import bisect
n = int(input())
l = list(map(int, input().split()))
count = 0
l = sorted(l)

for i in range(n-2):
  for j in range(i+1, n-1):
    k = bisect.bisect_left(l, l[i]+l[j])
    count += k -j - 1
print(count)

Buggy submission (verdict: Runtime Error):
import bisect
n = int(input())
l = List(map(int, input().split()))
count = 0
l = sorted(l)

for i in range(n-2):
  for j in range(i+1, n-1):
    k = bisect.bisect_left(l, l[i]+l[j])
    count += k -j - 1
print(count)
Problem p02900 (python)

Fixed submission:
import fractions
import math
a,b = map(int, input().split())
g = fractions.gcd(a,b)
ans = 1

for i in range(2, int(math.sqrt(g))+1):
  if g%i == 0:
    ans += 1
    while True:
      g //= i
      if g%i != 0:
        break
if (g != 1):
  ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import fractions
import math
a,b = map(int, input().split())
g = fractions.gcd(a,b)
ans = 1

for i in range(2, math.sqrt(g)+1):
  if g%i == 0:
    ans += 1
    while True:
      g //= i
      if g%i != 0:
        break
print(ans)

Buggy submission (verdict: Runtime Error):
import fractions
a,b = map(int, input().split())
g = fractions.gcd(a,b)
l = [0]*(g-1)

for i in range(2, g+1):
  if g%i == 0 and min(a,b)%i == 0:
    for j in range(2, i):
      if i%j == 0:
        break
    else:
      l[i] = 1

print(l.count(1)+1)
Problem p02918 (python)

Fixed submission:
n,k = map(int, input().split())
s = input()
ans = 0
for i in range(len(s)-1):
	if s[i] == s[i+1]:
		ans += 1
ans += 2*k
 
print(min(ans, n-1))

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
s = list(x for x in input())
ans = 0

if s[0] == 'R':
  s.insert(0, 'L')
if s[-1] == 'R':
  s.append('L')
s.append(0)
l = []
r = []


for i in range(len(s)-1):
  if s[i] == 'L':
    l.append(i)
    if s[i+1] == 'L':
      ans += 1
      
for i in range(len(l)-1):
  r.append(l[i+1] - l[i] - 1)

r.sort(reverse = True)

for i in range(k):
  if r[i] != 0:
    ans += r[i] + 1
  else:
    break

if n == 1:
  print(0)
elif n == 2:
  print(1)
elif ans == n:
  print(n-1)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
s = list(x for x in input())
ans = 0

if s[0] == 'R':
  s.insert(0, 'L')
if s[-1] == 'R':
  s.append('L')
s.append(0)
l = []
r = []


for i in range(len(s)-1):
  if s[i] == 'L':
    l.append(i)
    if s[i+1] == 'L':
      ans += 1
      
for i in range(len(l)-1):
  r.append(l[i+1] - l[i] - 1)

r.sort(reverse = True)

for i in range(k):
  if r[i] != 0:
    ans += r[i] + 1
  else:
    break

if n == 1:
  print(0)
elif ans == n:
  print(n-1)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
s = list(x for x in input())
ans = 0

if s[0] == 'R':
  s.insert(0, 'L')
if s[-1] == 'R':
  s.append('L')
s.append(0)
l = []
r = []


for i in range(len(s)-1):
  if s[i] == 'L':
    l.append(i)
    if s[i+1] == 'L':
      ans += 1
      
for i in range(len(l)-1):
  r.append(l[i+1] - l[i] - 1)

r.sort(reverse = True)

for i in range(k):
  if r[i] != 0:
    ans += r[i] + 1

if ans == n:
  print(n-1)
else:
  print(ans)
Problem p02923 (python)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
count = [0]
ans = []

for i in range(n-1):
  if h[i] < h[i+1]:
    count.append(i+1)
  if i == n - 2:
    if h[n-2] >= h[n-1]:
      count.append(n)

for i in range(len(count) - 1):
  ans.append(count[i+1] - count[i] - 1)

if n == 1:
  print(0)
else:
  print(max(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
count = [0]
ans = []

for i in range(n-1):
  if h[i] < h[i+1]:
    count.append(i+1)
  if i == n - 2:
    if h[n-2] >= h[n-1]:
      count.append(n)

for i in range(len(count) - 1):
  ans.append(count[i+1] - count[i] - 1)

print(max(ans))
Problem p02927 (python)

Fixed submission:
M,D = map(int,input().split())
ans = 0
for i in range(1, M+1):
  for j in range(1, D+1):
    if j < 22:
      continue
    else:
      j = str(j)
      d1 = int(j[0])
      d2 = int(j[1])
      if d1>=2 and d2>=2 and i == d1*d2:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
M,D = input().split()
ans = 0
for i in range(1, M+1):
  for j in range(1, D+1):
    if j < 22:
      continue
    else:
      j = str(j)
      if M == int(j[0]) * int(j[1]):
        ans += 1
print(ans)
Problem p02928 (python)

Fixed submission:
N,K = map(int,input().split())
A = list(map(int,input().split()*2))
base1 = 0
base2 = 0
for i in range(N):
  count1=0
  count2=0
  for j in range(i+1,i+N+1):
    if A[i] > A[j]:
      if j < N:
        count1+=1
      else:
        count2+=1
  base1+=count1
  base2+=count2

ans = (base1*K*(K+1) + base2*K*(K-1))//2
div = 10**9 + 7
print(ans%div)

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

class Bit:
  def __init__(self, n):
    self.size = n
    self.tree = [0] * (n + 1)
  
  def sum(self, i):
    s = 0
    while i > 0:
      s += self.tree[i]
      i -= i & -i
    return s
  
  def add(self, i, x):
    while i <= self.size:
      self.tree[i] += x
      i += i & -i

n,k = map(int, input().split())
aaa = list(map(int, input().split()))
MOD = 10**9 + 7
bit = Bit(2001)
single = 0
for a in reversed(aaa):
  single += bit.sum(a)
  bit.add(a + 1, 1)
ans = single * k % MOD
coef = k * (k - 1) // 2 % MOD
cnt = Counter(aaa)
before = 0
for a,c in sorted(cnt.items()):
  ans = (ans + c * before * conf) % MOD
  before += c
print(ans)

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

class Bit:
  def __init__(self, n):
    self.size = n
    self.tree = [0] * (n + 1)
  
  def sum(self, i):
    s = 0
    while i > 0:
      s += self.tree[i]
      i -= i & -1
    return s
  
  def add(self, i, x):
    while i <= self.size:
      self.tree[i] += x
      i += i & -i

n,k = map(int, input().split())
aaa = list(map(int, input().split()))
MOD = 10**9 + 7
bit = Bit(2001)
single = 0
for a in reversed(aaa):
  single += bit.sum(a)
  bit.add(a + 1, 1)
ans = single * k % MOD
coef = k * (k - 1) // 2 % MOD
cnt = Counter(aaa)
before = 0
for a,c in sorted(cnt.items()):
  ans = (ans + c * before * conf) % MOD
  before += c
print(ans)

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

class Bit:
  def __init__(self, n):
    self.size = n
    self.tree = [0] * (n + 1)
  
  def sum(self, i):
    s = 0
    while i > 0:
      s += self.tree[i]
      i -= i & -1
    return s
  
  def add(self, i, x):
    while i <= self.size:
      i += i & -i

n,k = map(int, input().split())
aaa = list(map(int, input().split()))
MOD = 10**9 + 7
bit = Bit(2001)
single = 0
for a in reversed(aaa):
  single += bit.sum(a)
  bit.add(a + 1, 1)
ans = single * k % MOD
coef = k * (k - 1) // 2 % MOD
cnt = Counter(aaa)
before = 0
for a,c in sorted(cnt.items()):
  ans = (ans + c * before * conf) % MOD
  before += c
print(ans)
Problem p02939 (python)

Fixed submission:
from collections import deque
s = deque(x for x in input())
s.append('END')
k = 0
l = [s.popleft()]
while True:
  if s[0] == 'END':
    break
  elif l[k] == s[0]:
    if s[1] == 'END':
      break
    else:
      l.append(s.popleft()+s.popleft())
  else:
    l.append(s.popleft())
  k += 1
print(len(l))

Buggy submission (verdict: Runtime Error):
from collections import deque
s = deque(x for x in input())
s.append(0)
k = 0
l = [s.popleft()]
while True:
  if s[0] == 0:
    break
  elif l[k] == s[0]:
    l.append(s.popleft()+s.popleft())
  else:
    l.append(s.popleft())
  k += 1
print(len(l))

Buggy submission (verdict: Runtime Error):
from collections import deque
s = deque(x for x in input())
s.append(0)
k = 0
l = [s[0]]
while True:
  if s[0] == 0:
    break
  elif l[k] == s[0]:
    l.append(s.popleft()+s.popleft())
  else:
    l.append(s.popleft())
  k += 1
print(len(l))

Buggy submission (verdict: Runtime Error):
from collections import deque
s = deque(x for x in input())
s.append(0)
k = 0
l = [s[0]]
while True:
  if s[0] == 0:
    break
  elif l[k] == s[0]:
    l.append(s.popleft()+s.popleft())
  else:
    l.append(s.popleft())
  k += 1
print(k)
Problem p02945 (python)

Fixed submission:
A,B = input().split()
A,B = int(A),int(B)
ans = [A+B,A-B,A*B]
ans.sort()
print(ans.pop())

Buggy submission (verdict: Runtime Error):
A,B = input().split()
A,B = int(A),int(B)
ans = [A+B,A-B,A*B]
sort(ans)
print(ans.pop())
Problem p02947 (python)

Fixed submission:
N = int(input())
s = [''.join(sorted(input())) for i in range(N)]
ans=0
dict={}
for i in s:
  if i in dict:
    ans+=dict[i]
    dict[i]+=1
  else:
    dict[i]=1
print(ans)

Buggy submission (verdict: Runtime Error):
N = input()
s = [''.join(sorted(input())) for i in range(N)]
ans=0
dict={}
for i in s:
  if i in dict:
    ans+=dict[i]
    dict[i]+=1
  else:
    dict[i]=1
print(ans)

Buggy submission (verdict: Runtime Error):
N = input()
s = [''.join(sorted(input())) for i in range(N)]
ans=0
dict={}
for i in s:
  if i in dict:
    ans+=dict
    dict[i]+=1
  else:
    dict[i]=1
print(ans)
Problem p02981 (python)

Fixed submission:
n,a,b = map(int,input().split())
ans = 0
if n * a > b:
  ans = b
else:
  ans = n * a
print(ans)

Buggy submission (verdict: Runtime Error):
n,a,b = map(input().split())
ans = 0
if n * a > b:
  ans += b
else:
  ans += n * a
print(ans)
Problem p02993 (python)

Fixed submission:
s = [x for x in input()]
ans = 'Good'
for i in range(3):
  if s[i] == s[i+1]:
    ans = 'Bad'
    break
print(ans)

Buggy submission (verdict: Runtime Error):
s = [x for x in input()]
for _ in range(3):
  if s[i] == s[i+1]:
    print('Bat')
    break
  else:
    print('Good')
Problem p02994 (python)

Fixed submission:
n,l = map(int, input().split())
a = []
ans = 0
for i in range(1, n+1):
  a.append([l + i - 1, abs(l + i - 1)])
a = sorted(a, key = lambda x:x[1], reverse = True)
a.pop()
for i in range(n-1):
  ans += a[i][0]
print(ans)

Buggy submission (verdict: Runtime Error):
n,l = map(int, input().split())
a = []
ans = 0
for i in range(1, n+1):
  a.append([l + i - 1, abs(l + i - 1)])
a = sorted(a, key = lambda x:x[1], reverse = True)
a.pop()
for _ in range(n-1):
  ans += a[0]
print(ans)
Problem p02995 (python)

Fixed submission:
import fractions
a,b,c,d = map(int, input().split())
gcd = fractions.gcd(c,d)
lcm = c * d // gcd
num = [c,d,lcm]
l = b - a + 1
temp = []

for i in range(3):
  count = 0
  if l - num[i] >= 0:
    count += l // num[i]
    if l % num[i] != 0:
      if b % num[i] < (b - (l % num[i]) + 1) % num[i]:
        count += 1
  else:
    if b % num[i] < l:
        count += 1
  temp.append(count)

ans = l - (temp[0] + temp[1] - temp[2])
print(ans)

Buggy submission (verdict: Runtime Error):
import fractions
a,b,c,d = map(int, input().split())
gcd = fractions.gcd(c,d)
lcm = c * d / gcd
num = [c,d,lcm]
l = b - a + 1
count = 0
temp = []

for i in range(3):
  if l - num[i] >= 0:
    count += (num[i] - 1) * (l // num[i]) + (l % num[i])
  else:
    for j in range(a,b+1):
      if j % c == 0:
        count += 1
  temp.append(count)

ans = l - (count[0] + count[1] - count[2])
print(ans)
Problem p03060 (python)

Fixed submission:
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0

for i in range(n):
  if v[i] - c[i] > 0:
    ans += v[i] - c[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
v = map(int, input().split())
c = map(int, input().split())
ans = 0

for i in range(n):
  if v[i] - c[i] > 0:
    ans += v[i] - c[i]
print(ans)
Problem p03061 (python)

Fixed submission:
import fractions
N=int(input())
l1=list(map(int,input().split()))
l2=[0]*(N+1)
l3=[0]*(N+1)
for i in range(N):
  l2[i+1]=fractions.gcd(l2[i],l1[i])
for j in range(N-1,0,-1):
  l3[j-1]=fractions.gcd(l3[j],l1[j])
ans=1
for k in range(N):
  ans=max(ans,fractions.gcd(l2[k],l3[k]))
print(ans)

Buggy submission (verdict: Runtime Error):
import fractions
n = int(input())
a = list(map(int, input().split()))
a.sort()
 
if len(a) == 2:
  print(max(a))
else:
  gcd_1 = fractions.gcd(a[0], a[1])
  gcd_2 = fractions.gcd(a[0], a[2])
  gcd_3 = fractions.gcd(a[1], a[2])
  if gcd_1 == gcd_2 and gcd_2 == gcd_3:
    print(gcd_1)
  elif gcd_1 == gcd_2:
    if gcd_1 < gcd_3:
      print(fractions.gcd(gcd_3, a[3]))
    else:
      print(fractions.gcd(gcd_1, a[3]))
  elif gcd_2 == gcd_3:
    if gcd_2 < gcd_1:
      print(fractions.gcd(gcd_1, a[3]))
    else:
      print(fractions.gcd(gcd_2, a[3]))
  elif gcd_1 == gcd_3:
    if gcd_1 < gcd_2:
      print(fractions.gcd(gcd_2, a[3]))
    else:
      print(fractions.gcd(gcd_1, a[3]))
  else:
    temp=[gcd_1, gcd_2, gcd_3]
    print(fractions.gcd(max(temp), a[4]))
Problem p03086 (python)

Fixed submission:
s = list(x for x in input())
temp = 0
ans = []
for i in range(len(s)):
  if s[i] == 'A' or s[i] == 'C' or s[i] =='G' or s[i] =='T':
    temp += 1
    if i == len(s) - 1:
      ans.append(temp)
  else:
    ans.append(temp)
    temp = 0
print(max(ans))

Buggy submission (verdict: Runtime Error):
s = list(x for x in input())
temp = 0
ans = []
for i in s:
  if i == 'A' or i == 'C' or i =='G' or i =='T':
    temp += 1
    if i == len(s) - 1:
      ans.append(temp)
  else:
    ans.append(temp)
    temp = 0
print(max(ans))

Buggy submission (verdict: Runtime Error):
s = list(x for x in input())
temp = 0
ans = []
for i in s:
  if i == 'A' or i == 'C' or i =='G' or i =='T':
    temp += 1
    if i == len(s-1):
      ans.append(temp)
  else:
    ans.append(temp)
    temp = 0
print(max(ans))

Buggy submission (verdict: Runtime Error):
s = list(x for x in input())
temp = 0
ans = []
for i in s:
  if i == 'A' or i == 'C' or i =='G' or i =='T':
    temp += 1
    if i == len(s):
      ans.append(temp)
  else:
    ans.append(temp)
    temp = 0
print(max(ans))

Buggy submission (verdict: Runtime Error):
s = list(x for x in input())
temp = 0
ans = []
for i in s:
  if i == 'A' or i == 'C' or i =='G' or i =='T':
    temp += 1
  else:
    ans.append(temp)
    temp = 0
print(max(ans))
Problem p03103 (python)

Fixed submission:
n,m = map(int, input().split())
d = {}
ans = 0
for _ in range(n):
  a,b = map(int, input().split())
  if a in d:
    d[a] += b
  else:
    d[a] = b

d = sorted(d.items(), key= lambda x: x[0])

for i in range(len(d)):
  if m >= d[i][1]:
    ans += d[i][0] * d[i][1]
    m -= d[i][1]
  else:
    ans += d[i][0] * m
    break
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
d = {}
ans = 0
for _ in range(n):
  a,b = map(int, input().split())
  if a in d:
    d[a] += b
  else:
    d[a] = b

d = sorted(d.items(), key= lambda x: x[0])

for i in range(n):
  if m >= d[i][1]:
    ans += d[i][0] * d[i][1]
    m -= d[i][1]
  else:
    ans += d[i][0] * m
    break
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
d = {}
ans = 0
for _ in range(n):
  a,b = map(int, input().split())
  d[a] = b

d = sorted(d.items(), key= lambda x: x[0])

for i in range(n):
  if m >= d[i][1]:
    ans += d[i][0] * d[i][1]
    m -= d[i][1]
  else:
    ans += d[i][0] * m
    break
print(ans)
Problem p03126 (python)

Fixed submission:
n,m = map(int, input().split())
k = [list(map(int, input().split())) for _ in range(n)]
dic = {x:0 for x in range(1,m+1)}
ans = 0
for i in range(n):
  for j in range(1, k[i][0] + 1):
    dic[k[i][j]] += 1

for a,b in dic.items():
  if b == n:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
l = [0] * m

for i in range(n):
  k = list(map(int, input().split()))
  for j in range(1, k[0]+1):
    l[k[j-1]] += 1
print(l.count(n))