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

Fixed submission:
n, k = map(int, input().split())
l = sorted([int(x) for x in input().split()])

print(sum(l[:k]))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input())
l = sorted([int(x) for x in input().split()])

print(sum(l[:k]))
Problem p02783 (python)

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

count = 0
while True:
    h -= a
    count += 1
    if h <= 0:
        break
print(count)

Buggy submission (verdict: Runtime Error):
h, n = map(int, input().split())
dp = [10 ** 9] * (h+1)
dp[0] = 0

for ni in range(n):
  a, b = map(int, input().split())
  for hi in range(h):
    nj = min(j+a, h)
    dp[nj] = min(dp[nj], dp[j] + b)

print(dp[h])
Problem p02801 (python)

Fixed submission:
print(chr(ord(input())+1))

Buggy submission (verdict: Runtime Error):
a
Problem p02802 (python)

Fixed submission:
# history :: {int : (int, bool)}
n, m = [int(x) for x in input().split()]
history = { i+1 : [0, False] for i in range(n)}

for _ in range(m):
  pi, result = input().split()
  translated_pi = int(pi)
  if result == 'WA' and not history[translated_pi][1]:
    history[translated_pi][0] += 1
  else:
    history[translated_pi][1] = True

ac_count = 0
penalty_count = 0
for result in history.values():
  if result[1]:
    ac_count += 1
    penalty_count += result[0]

print("{} {}".format(ac_count, penalty_count))

Buggy submission (verdict: Runtime Error):
r = int(input())
g = int(input())

print(int(g * 2 - r))
Problem p02830 (python)

Fixed submission:
input()
s1, s2 = input().split()
for idx in range(len(s2)):
  print(s1[idx],end='')
  print(s2[idx],end='')
  
print()

Buggy submission (verdict: Runtime Error):
input()
s1, s2 = input().split()
for idx in range(len(s)):
  print(s1[idx],end='')
  print(s2[idx],end='')
  
print()
Problem p02910 (python)

Fixed submission:
s = input()
n = len(s)

f = True

for i in range(0, n, 2):
  if s[i] == 'L':
    f = False

for i in range(1, n, 2):
  if s[i] == 'R':
    f = False
    
print("Yes" if f else "No")

Buggy submission (verdict: Runtime Error):
for i in range(0, n, 2):
  if s[i] == 'L':
    f = False
Problem p02923 (python)

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

h.reverse()
ans = 0
temp = 0
for i in range(n-1):
    if h[i+1] >= h[i]:
        temp += 1
    else:
        ans = max(temp, ans)
        temp = 0

ans = max(temp, ans)
print(ans)

Buggy submission (verdict: Runtime Error):
n, k, q = map(int, input().split())
a = [int(input()) for _ in range(q)]
sc = {i : k for i in range(1, n+1)}
sc[0] = 0

for s in a:
  for i in range(1, n+1):
    if i == s:
      continue
    
    sc[i] -= 1

del sc[0]
for s in sc.values():
  print("Yes" if s > 0 else "No")
Problem p02958 (python)

Fixed submission:
n=int(input())
s=list(map(int,input().split()))
ans=0
p=sorted(s)
for i in range(n):
    if s[i]!=p[i]:
        ans+=1
print("NO" if ans>2 else "YES")

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

count = 0
for i in range(n-1):
  if s[i] > s[i+1]:
    count += 1

print("YES" if count < 3 else "NO")

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

count = 0
for i in range(n-1):
  if int(s[i]) > int(s[i+1]):
    count += 1

print("YES" if count < 3 else "NO")
Problem p03037 (python)

Fixed submission:
n, m = map(int, input().split())
left = 0 # 制約における最小を超える値
right = 10 ** 6 # 制約における最大を超える値
for _ in range(m):
  l, r = map(int, input().split())
  left = max(left, l)
  right = min(right, r)

print(right-left+1 if left <= right else 0)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
left = 0 # 制約における最小を超える値
right = 10 ** 6 # 制約における最大を超える値
for _ in range(m):
  l, r = map(int, input().split())
  left = max(left, l)
  right = min(right, r)
    right = r

print(r-l+1 if l <= r else 0)
Problem p03043 (python)

Fixed submission:
n, k = map(int, input().split())
total_prob = 0
for i in range(1, n+1):
  dice_count = 0
  while (i << dice_count) < k:
    dice_count += 1
  
  total_prob += (1 / n) * (0.5 ** dice_count)
  
print(round(total_prob, 12))

Buggy submission (verdict: Runtime Error):
from collections import deque
n = int(input())
# 最終的に出力する色
colors = [-1] * n
# 重み付き無向グラフ
conns = [set() for _ in [0] * n] 

for x in range(1, n):
  v1, v2, dis = map(int, input().split())
  # (接続ノード, 重み) を加える
  conns[v1-1].add((v2-1, dis))
  conns[v2-1].add((v1-1, dis))

# BFSの為に根ノードを初期化. (基準ノード, 距離)
q = deque([(0, 0)])
# BFS開始
while q:
  v, dis, past = q.popleft()
  
  # 奇数なら1で,偶数なら0で塗る
  colors[v] = dis&1
  
  # 基準ノードから生える各エッジに対し
  for edge, w in conns[v]:
    
    # 根からここまでの距離を足しつつ,新しく探索先を追加.
    q.append((edge, dis + w))

print('\n'.join(map(str, colors)))
Problem p03044 (python)

Fixed submission:
from collections import deque
n = int(input())
# 最終的に出力する色
colors = [-1] * n
# 重み付き無向グラフ
conns = [set() for _ in [0] * n] 

for x in range(1, n):
  v1, v2, dis = map(int, input().split())
  # (接続ノード, 重み) を加える
  conns[v1-1].add((v2-1, dis))
  conns[v2-1].add((v1-1, dis))

# BFSの為に根ノードを初期化. (基準ノード, 距離, 過去のノード)
q = deque([(0, 0, -1)])
# BFS開始
while q:
  v, dis, past = q.popleft()
  
  # 奇数なら1で,偶数なら0で塗る
  colors[v] = dis&1
  
  # 基準ノードから生える各エッジに対し
  for edge, w in conns[v]:
    
    # エッジが既に調べたものなら飛ばす
    if edge == past:
      continue
    # 根からここまでの距離を足しつつ,新しく探索先を追加.
    q.append((edge, dis + w, v))

print('\n'.join(map(str, colors)))

Buggy submission (verdict: Runtime Error):
n = int(input())
# 最終的に出力する色
colors = [-1] * n
# 重み付き無向グラフ
conns = [set() for _ in [0] * n] 

for x in range(1, n):
  v1, v2, dis = map(int, input().split())
  # (接続ノード, 重み) を加える
  conns[v1-1].add((v2-1, dis))
  conns[v2-1].add((v1-1, dis))
  
def dfs(now: int, prev: int,  color: int):
  # 頂点に色を塗る
  colors[now] = color
  # 頂点から生える各エッジに対し
  for edge, w in conns[now]:
    # 親と一緒 -> 無視
    if edge == prev:
      continue
    # 偶数なら同色,奇数なら異色で塗る
    dfs(edge, now, 1-color) if w&1 else dfs(edge, now, color)

# 適当に根ノードを決め,グラフ彩色開始
dfs(0, -1, 1)

print('\n'.join(map(str, colors)))

Buggy submission (verdict: Runtime Error):
from collections import deque
n = int(input())
# 最終的に出力する色
colors = [-1] * n
# 重み付き無向グラフ
conns = [set() for _ in [0] * n] 

for x in range(1, n):
  v1, v2, dis = map(int, input().split())
  # (接続ノード, 重み) を加える
  conns[v1-1].add((v2-1, dis))
  conns[v2-1].add((v1-1, dis))

# BFSの為に根ノードを初期化. (基準ノード, 距離)
q = deque([(0, 0)])
# BFS開始
while q:
  v, dis, past = q.popleft()
  
  # 奇数なら1で,偶数なら0で塗る
  colors[v] = dis&1
  
  # 基準ノードから生える各エッジに対し
  for edge, w in conns[v]:
    
    # 根からここまでの距離を足しつつ,新しく探索先を追加.
    q.append((edge, dis + w))

print('\n'.join(map(str, colors)))
Problem p03206 (python)

Fixed submission:
d = int(input())
print("Christmas " + "Eve " * (5 - d%20))

Buggy submission (verdict: Runtime Error):
N = int(input())
m, *P = sorted([int(input()) for x in range(N)], reverse=True)

"""
m = P[N-1]
P = P[:N-1]
"""

print(sum(P) + m // 2)
Problem p03239 (python)

Fixed submission:
n,T=map(int,input().split())
ans=10000
for i in range(n):
  c,t=map(int,input().split())
  if t<=T:
    ans=min(ans,c)

if ans==10000:
  print("TLE")
else:
  print(ans)

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

max_cost = 10 ** 9

for _ in range(n):
  c, tt = map(int, input().split())
  if tt <= t:
    max_cost = max(max_cost, c)
    
print(max_cost)
Problem p03261 (python)

Fixed submission:
N = int(input())
m = dict()

prev = input()
m[prev] = True
flg = True

for _ in range(N - 1):
  s = input()
  flg = flg and s not in m
  flg = flg and prev[len(prev) - 1] == s[0]
  m[s] = True
  prev = s

print("Yes" if flg else "No")

Buggy submission (verdict: Runtime Error):
N = int(input())
m = dict()

prev = input()
m[prev] = True
flg = True

for _ in range(N - 1):
  s = input()
  flg = all(flg, s not in m, prev[len(prev) - 1] == s[0])
  m[s] = True
  prev = s

print("Yes" if flg else "No")
Problem p03557 (python)

Fixed submission:
from bisect import bisect_left, bisect_right

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

a.sort()
b.sort()
c.sort()

cnt = 0

for b_e in b:
    a_cases = bisect_left(a, b_e)
    c_cases = bisect_right(c, b_e)
    cnt += a_cases * (n - c_cases)
print(cnt)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left, bisect_right

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

an.sort()
bn.sort()
cn.sort()

cnt = 0

for b in bn:
    a = bisect_left(an,b)
    c = bisect_right(cn,b)
    cnt += a * (n-c)
print(cnt)
Problem p03807 (python)

Fixed submission:
input()
a = list(map(int, input().split()))
l = len(list(filter(lambda x : x & 1, a)))
if l & 1:
  print("NO")
else:
  print("YES")

Buggy submission (verdict: Runtime Error):
input()
a = list(map(int, input().split()))
l = len(filter(lambda x : x & 1, a))
if l & 1:
  print("NO")
else:
  print("YES")
Problem p04047 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort()
res = 0
for i in range(0, 2*n, 2):
  res += min(a[i], a[i+1])

print(res)

Buggy submission (verdict: Runtime Error):
5
100 1 2 3 14 15 58 58 58 29
Problem p02664 (python)

Fixed submission:
T = input()

print(T.replace('?', 'D'))

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

print(T.replace('?', 'D'))
Problem p02660 (python)

Fixed submission:
n=int(input())

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr

if n==1:
  print(0)
  exit()  
  
f=factorization(n)
cnt=0
for i in range(len(f)):
  m=2 # 強引
  while f[i][1]>0:
    f[i][1]-=m
    m+=1
    cnt+=1
#    print(f)
print(cnt)

Buggy submission (verdict: Runtime Error):
import math
def is_prime(n):
    if n == 1: return False
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True        

n=int(input())
cnt=0
e=[]# used_list
f=0
pn=[2,3,5,7,11,13,17,19,23,29,31,37,41]
z=[2,3,4,5,7,8,9,16,25,27,32]
if n==1:
  cnt=0

else:
  while not is_prime(n):
    if n%z[f]==0:
      n=n//z[f]
      cnt+=1
      if n==1:break
    f+=1

print(cnt)
Problem p02684 (python)

Fixed submission:
n,k=list(map(int,input().split()))
a=[0]+ list(map(int,input().split()))

visited=[1]

for i in range(n):
  next=a[visited[-1]]
  visited.append(next)
  
loop_end=n
loop_start=n-1
while visited[loop_start]!=visited[loop_end]:
  loop_start-=1
period=loop_end-loop_start
#print(visited) 
#print("p:",period)
#print("(k-n)%period:",(k-n)%period)

if k<n+1:
  print(visited[k])
  exit()
else:
  print(visited[n-period+(k-n)%period])

Buggy submission (verdict: Runtime Error):
n,k=list(map(int,input().split()))
a=[0]+ list(map(int,input().split()))

visited=[1]

for i in range(n):
  next=a[visited[-1]]
  visited.append(next)
  
loop_end=n
loop_start=n-1
while visited[loop_start]!=visited[loop_end]:
  loop_start-=1
period=loop_end-loop_start
#print(visited) 
#print("p:",period)
#print("k%period:",k%period)

if k<n+1:
  print(visited[k])
  exit()
else:
  print(visited[n-(k-n)%period+1])

Buggy submission (verdict: Runtime Error):
n,k=list(map(int,input().split()))
a=[0]+ list(map(int,input().split()))

visited=[1]

for i in range(n):
  next=a[visited[-1]]
  if next in visited:
    loop_end=n+1
    loop_start=visited.index(n)
    period=loop_end-loop_start
  visited.append(next)
#print(visited) 
#print(period)
if k<n+1:
  print(visited[k])
  exit()
else:
  print(visited[k%period])
Problem p02755 (python)

Fixed submission:
import math
a,b=list(map(int,input().split()))
ans=-1
for i in range(1,1100):
  if math.floor(i*0.08)==a and math.floor(i*0.1)==b:
    ans=i
    break
print(ans)

Buggy submission (verdict: Runtime Error):
range(math.floor(a*100/8),math.floor((a+1)*100/8)+1):
Problem p02812 (python)

Fixed submission:
N=int(input())
S=list(input())
x=count=0
search_word=["A","B","C"]
 
for x in range(N-2):
  if S[x]==search_word[0] and S[x+1]==search_word[1] and S[x+2]==search_word[2]:
    count+=1
  x+=1
 
print(count)

Buggy submission (verdict: Runtime Error):
N=int(input())
S=list(input())
x=count=0
search_word=["A","B","C"]
 
for x in range(N):
  if S[x]==search_word[0] and S[x+1]==search_word[1] and S[x+2]==search_word[2]:
    count+=1
  x+=1
 
print(count)

Buggy submission (verdict: Runtime Error):
N=input()
S=list(input())
x=count=0
search_word=["A","B","C"]

for i in S:
  if S[x]==search_word[0] and S[x+1]==search_word[1] and S[x+2]==search_word[2]:
    count+=1
  x+=1

print(count)
Problem p02900 (python)

Fixed submission:
import math,fractions
a,b=list(map(int,input().split()))

def f(n):
    a=[1]
    while n%2==0:
        a.append(2)
        n//=2
    f=3
    while f*f<= n:
        if n%f==0:
            a.append(f)
            n//= f
        else:
            f+= 2
    if n!=1:
        a.append(n)
    return a

def g(n,r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
 
ans=set(f(a))&set(f(b))
#print(ans)
print(len(ans))

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

def f(a,b):
  for i in range(min(a,b),2,-1):
    if a%i==0 and b%i==0:
      max=i
      break
  re=[1,max]
  for i in range(2,max):
    if a%i==0 and b%i==0:re.append(i)
  return re

def g(n):
  for i in range(2,n):
    if n%i==0:return False
  else:return True

ans=[g(i) for i in f(a,b)]
print(ans.count(True))
Problem p02969 (python)

Fixed submission:
print(3*int(input())**2)

Buggy submission (verdict: Runtime Error):
print(3*input()**2)
Problem p02983 (python)

Fixed submission:
l,r=list(map(int,input().split()))
m=2018
for i in range(l,min(r+1,l+2019)):
  for j in range(i+1,min(r+1,l+2019)):
    m=min(m,i*j%2019)
print(m)

Buggy submission (verdict: Runtime Error):
l,r=list(map(int,input().split()))
ans=[]
if r-l==1:print(r*l%2019)
else:
  for i in range(l,r-1):
    for j in range(l+1,r):
      ans.append(i*j%2019)
print(min(ans))
Problem p02995 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,c,d=list(map(int,input().split()))
p=list(range(a,b+1))
q=list(filter(lambda x:x%c!=0 and x%d!=0,p))
print(len(q))

Buggy submission (verdict: Runtime Error):
a,b,c,d=list(map(int,input().split()))
p=list(range(a,b+1))
q=list(filter(lambda x:x%2!=0 and x%3!=0,p))
print(len(q))
Problem p03001 (python)

Fixed submission:
w,h,x,y=list(map(int,input().split()))
ans=1 if w/2==x and h/2==y else 0
print(w*h/2,ans)

Buggy submission (verdict: Runtime Error):
w,h,x,y=list(map(int,input().split()))
ans=0
if w/x>h/y:s=x*h
elif w/x<h/y:s=w*y
else:
  s=x*h
  ans=1
print(s,ans)
Problem p03282 (python)

Fixed submission:
import re
S=str(input())
k=int(input())

if set(S)=={'1'}:
  print(1)
  
else:
  x=re.search(r'[2-9]',S).start()
      
  if S[0]=='1':
    if k<=x:
      print(S[0])
    else:
      print(S[x])     
  else:
    print(S[0])

Buggy submission (verdict: Runtime Error):
import re
S=str(input())
k=int(input())
x=re.search(r'[2-9]',S).start()

if S[0]=='1':
  if k<=x:
    print(S[0])
  else:
    print(S[x])     
  
else:
  print(S[0])

Buggy submission (verdict: Runtime Error):
import re
S=str(input())
k=int(input())
x=re.search(r'[2-9]',S).start()

if S[0]=='1':
  if k<=x:
    print(1)
  else:
    print(S[x])     
  
else:
  print(S[0])
Problem p03578 (python)

Fixed submission:
import collections
 
n = int(input())
d = sorted(list(map(int,input().split())))
m = int(input())
t = list(map(int,input().split()))

cd = collections.Counter(d)
ct = collections.Counter(t)

flg = True
for k in ct.items():
  if k[1] > cd[k[0]]:
    flg = False

print('YES' if flg else 'NO')

Buggy submission (verdict: Runtime Error):
import bisect
 
n = int(input())
d = sorted(list(map(int,input().split())))
m = int(input())
t = list(map(int,input().split()))

flg = True
for i in range(m):
  index = bisect.bisect_left(d,t[i])
  if t[i] == d[index]:
    del d[index]
  else:
    flg = False
    break
 
print('YES' if flg else 'NO')

Buggy submission (verdict: Runtime Error):
import bisect
 
n = int(input())
d = sorted(list(map(int,input().split())))
m = int(input())
t = list(map(int,input().split()))
d.append(d[-1]+1)

flg = True
for i in range(m):
  index = bisect.bisect_left(d,t[i])
  if t[i] == d[index]:
    del d[index]
  else:
    flg = False
    break
 
print('YES' if flg else 'NO')

Buggy submission (verdict: Runtime Error):
import bisect

n = int(input())
d = sorted(list(map(int,input().split())))
m = int(input())
t = list(map(int,input().split()))

flg = True
for i in range(m):
  index = bisect.bisect_left(d,t[i])
  if t[i] == d[index]:
    del d[index]
  else:
    flg = False
    break

print('YES' if flg else 'NO')
Problem p03593 (python)

Fixed submission:
from collections import Counter
 
h, w = map(int, input().split())
a = Counter(''.join(input() for _ in range(h)))
 
center = h * w % 2 
side = (h//2) * (w%2) + (w//2) * (h%2)
corner = (h//2) * (w//2)

for _ in range(center):
    for i in a:
        if a[i] % 2 == 1:
            a[i] -= 1
            break
for _ in range(side):
    for j in a:
        if a[j] % 4 == 2:
            a[j] -= 2
            break

print('Yes' if sum(a[i]%4 for i in a) == 0 else 'No')

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
d = defaultdict(int)

h,w = map(int,input().split())

for hh in range(h):
  s = list(input())
  for ss in s:
    d[ss]+=1

dv  = list(d.values())
d2 = [i for i in dv if i%2 == 0 and i%4 !=0]
d2_2 = [i for i in d2 if i == 2]
d4 = [i for i in dv if i%4 == 0]
d2_e = [i for i in d2 if i != 2]
d_odd  = [i for i in list(d.values()) if i%2 == 1]


if h%2==0:
  if w%2==0:
    if len(dv)==len(d4):
      ans = "Yes"
    else:
      ans = "No"
else:
  if w%2==0:
    if len(d_odd)==0 and len(d2_2)<=1 and all(list(map(lambda x:x%(h*2)==0,d2_e))):
      ans = "Yes"
    else:
      ans = "No"
  else:
    ans = "Yes" if len(dv)==len(d4) else "No"
print(ans)
Problem p03611 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a_min=min(a)
a_max=max(a)

s=list(range(a_min,a_max+1))
t=[0]*(a_max+1)

for i in range(n):
  t[a[i]]+=1

x=sum(t[:2]) #initialize
for j in range(1,len(t)-1):
  x=max(x,t[j-1]+t[j]+t[j+1])

print(x)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a_min=min(a)
a_max=max(a)

s=list(range(a_min,a_max+1))
t=[0]*(a_max+1)

for i in range(n):
  t[a[i]]+=1

x=0
for j in range(1,n-1):
  x=max(x,t[j-1]+t[j]+t[j+1])

print(x)
Problem p03627 (python)

Fixed submission:
import collections
n = int(input())
a = list(map(int,input().split()))

c = sorted(collections.Counter(a).items(),reverse = True)

tmp = 0
ans=[]

for k in c:
  if k[1]>=4:
    tmp = max(tmp,k[0]*k[0])
  if k[1]>=2:
    ans.append(k[0])
  else:
    continue

if len(ans)>=2:
  print(max(ans[0]*ans[1],tmp))
else:
  print(tmp)

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
a = list(map(int,input().split()))
c = sorted(collections.Counter(a).items(),reverse = True)

num2=[]
num4=[]

for k in c:
  if k[1]>=4:
    num4.append(k[0])
  if k[1]>=2:
    num2.append(k[0])

if len(num2)>=2 or len(num4)>=1:
  print(max(num2[0]*num2[1],num4[0]**2))
else:
  print(0)
Problem p03659 (python)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
ans=10**20
sumA=sum(A)
x=0
for i in range(n-1):
  x+=A[i]
  ans=min(ans,abs(sumA-x*2))

print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
ans=10**9
sumA=sum(A)

for i in range(n-1):
  x+=A[i]
  ans=min(ans,abs(sumA-x*2))

print(ans)
Problem p02642 (python)

Fixed submission:
n = int(input())
a_ls = list(map(int, input().split()))
a_ls.sort()
a_max = a_ls[-1]
times_ls = [0] * (a_max + 1)
divisible_ls = [0] * (a_max + 1)
for i in range(n):
    base = a_ls[i]
    times_ls[base] += 1
    times = 2
    while base*times <= a_max:
        divisible_ls[base*times] = 1
        times += 1
ans = 0
for i in range(1,a_max+1):
    if times_ls[i] == 1 and divisible_ls[i] == 0:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a_ls = list(map(int, input().split()))
a_ls.sort(reverse=True)
ans = 0
for i in range(n):
    not_divisible = True
    for j in range(i+1,n):
        if a_ls[i] % a_ls[j] == 0:
            not_divisible = False
            break
    if not_divisible:
        ans += 1
if a_ls[-2] == a_ls[-1]:
    ans -= 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a_ls = list(map(int, input().split()))
a_ls.sort(reverse=True)
ans = 0
for i in range(n):
    not_divisible = True
    for j in range(i+1,n):
        if a_ls[i] % a_ls[j] == 0:
            not_divisible = False
            break
    if not_divisible:
        ans += 1
if a_ls[-2] == a_ls[-1]:
    ans -= 1
print(ans)
Problem p02677 (python)

Fixed submission:
import math
import sys
a,b,h,m = map(int,input().split())
h_ = h*30 + (m/60) * 30
m_ = m*6
alpha = h_ - m_
if 0 < alpha < 180:
    pass
elif alpha == 180:
    print(a+b)
    sys.exit()
elif alpha == 0 or alpha == 360:
    print(abs(a-b))
    sys.exit()
else:
    alpha = 360 - alpha
ans_2 = a**2 + b**2 - 2 * b * a * math.cos(math.radians(alpha))
print(ans_2 ** 0.5)

Buggy submission (verdict: Runtime Error):
import math
import sys
a,b,h,m = map(int,input().split())
h_ = h*30 + (m/60) * 30
m_ = m*6
alpha = h_ - m_
if 0 < alpha < 180:
    pass
elif alpha == 180:
    print(h+m)
    sys.exit()
elif alpha == 0:
    prinnt(abs(a-b))
    sys.exit()
else:
    alpha = 360 - alpha
ans_2 = a**2 + b**2 - 2 * b * a * math.cos(math.radians(alpha))
print(ans_2 ** 0.5)
Problem p02691 (python)

Fixed submission:
from collections import defaultdict
n = int(input())
a_ls = list(map(int, input().split()))
L_dict = defaultdict(int)
for i in range(n):
    Li = a_ls[i] + i + 1
    L_dict[Li] += 1

ans = 0
for j in range(n):
    Rj = j + 1 - a_ls[j]
    ans += L_dict[Rj]
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import combinations
n = int(input())
a_ls = list(map(int, input().split()))
ans = 0
inds = [i for i in range(n)]
for ind_a, ind_b in combinations(inds, 2):
    Sum = a_ls[ind_a] + a_ls[ind_b]
    diff = abs(a-b)
    if Sum == diff:
        ans += 1
print(ans)
Problem p02696 (python)

Fixed submission:
import math
a,b,n = map(int,input().split())
Max = 0
if b != 1:
    x = min(n, b-1)
    while x <= n:
        Max = max(math.floor(a*x/b) - a * math.floor(x/b),Max)
        x += b
else:
    Max = 0
print(Max)

Buggy submission (verdict: Runtime Error):
import math
a,b,n = map(int,input().split())
if b != 1:
    x = min(n, b-1)
    while x <= n:
        Max = max(math.floor(a*x/b) - a*math.floor(x/b),Max)
        x += b
else:
    Max = 0
print(Max)