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

Fixed submission:
N= int(input())
lead_N = int(str(N)[0]) 
end_N = int(str(N)[len(str(N)) - 1])
ans = 0
#print(str(100)[len(str(100)) - 1])
for i in range(1, N + 1):
  lead = int(str(i)[0])
  end = int(str(i)[len(str(i)) - 1])
  # 一桁
  if lead == end:
    ans += 1
  #2桁以上ループ lead + 中間 + end　
  for j in range((len(str(N)) - 2) + 1):
    if end == 0:
      #末尾が0
      continue
    elif end > lead_N and j == (len(str(N)) - 2) :
      #生成する整数がNに収まらない場合
      continue
    elif end == lead_N and j == (len(str(N)) - 2):
      #生成する整数の一部がNに収まらない場合
      #中間の数字
      if len(str(N)) >= 3:
        ans += int(str(N)[1:len(str(N)) - 1])

      if lead <= end_N:
        ans += 1
      #print("b")
      pass
    else:
      #何も気にしないときは組み合わせの分だけたす
      ans += 10 ** j

print(ans)

Buggy submission (verdict: Runtime Error):
N= int(input())
lead_N = int(str(N)[0]) 
end_N = int(str(N)[len(str(N)) - 1])
ans = 0
#print(str(100)[len(str(100)) - 1])
for i in range(1, N + 1):
  lead = int(str(i)[0])
  end = int(str(i)[len(str(i)) - 1])
  # 一桁
  if lead == end:
    ans += 1
  #2桁以上ループ lead + 中間 + end　
  for j in range((len(str(N)) - 2) + 1):
    if end == 0:
      #末尾が0
      continue
    elif end > lead_N and j == (len(str(N)) - 2) :
      #生成する整数がNに収まらない場合
      continue
    elif end == lead_N and j == (len(str(N)) - 2):
      #生成する整数の一部がNに収まらない場合
      #中間の数字
      if len(str(N)) >= 3
        ans += int(str(N)[1:len(str(N)) - 1])

      if lead <= end_N:
        ans += 1
      #print("b")
      pass
    else:
      #何も気にしないときは組み合わせの分だけたす
      ans += 10 ** j

print(ans)

Buggy submission (verdict: Runtime Error):
N= int(input())
lead_N = int(str(N)[0]) 
end_N = int(str(N)[len(str(N)) - 1])
ans = 0
#print(str(100)[len(str(100)) - 1])
for i in range(1, N + 1):
  lead = int(str(i)[0])
  end = int(str(i)[len(str(i)) - 1])
  # 一桁
  if lead == end:
    ans += 1
  #2桁以上ループ lead + 中間 + end　
  for j in range((len(str(N)) - 2) + 1):
    if end == 0:
      #末尾が0
      continue
    elif end > lead_N and j == (len(str(N)) - 2) :
      #生成する整数がNに収まらない場合
      continue
    elif end == lead_N and j == (len(str(N)) - 2):
      #生成する整数の一部がNに収まらない場合
      #中間の数字

      ans += int(str(N)[1:len(str(N)) - 1])

      if lead <= end_N:
        ans += 1
      #print("b")
      pass
    else:
      #何も気にしないときは組み合わせの分だけたす
      ans += 10 ** j

print(ans)

Buggy submission (verdict: Runtime Error):
N= int(input())
lead_N = int(str(N)[0]) 
end_N = int(str(N)[len(str(N)) - 1])
ans = 0
#print(str(100)[len(str(100)) - 1])
for i in range(1, N + 1):
  lead = int(str(i)[0])
  end = int(str(i)[len(str(i)) - 1])
  # 一桁
  if lead == end:
    ans += 1
  #2桁以上ループ lead + 中間 + end　
  for j in range((len(str(N)) - 2) + 1):
    if end == 0:
      #末尾が0
      continue
    elif end > lead_N and j == (len(str(N)) - 2) :
      #生成する整数がNに収まらない場合
      continue
    elif end == lead_N and j == (len(str(N)) - 2):
      #生成する整数の一部がNに収まらない場合
      #中間の数字

      ans += int(str(N)[1:len(str(N)) - 1])

      if lead <= end_N:
        ans += 1
      #print("b")
      pass
    else:
      #何も気にしないときは組み合わせの分だけたす
      ans += 10 ** j

print(ans)
Problem p02948 (python)

Fixed submission:
N, M = map(int,input().split())
A_B = [list(map(int, input().split())) for i in range(N)]

#日数ごとの集合を作る
jobs = {m: [] for m in range(1, M + 1)}
for ab in A_B:
  if ab[0] in jobs:
    jobs[ab[0]].append(ab[1])
#print(jobs)

#日数の少ない仕事からループして最適解を見つける
import heapq
q = []
ans = 0
#仕事にかかる日数のループであって経過日のループではない
for m in range(1, M + 1):
    for b in jobs[m]:
      #qには小さい順で格納される
      heapq.heappush(q, -b)
    #print(q)
    #qが空でないとき
    if len(q) > 0:
      #現時点での日数以下の仕事で一番稼げるものを取り出す
      neg_b = heapq.heappop(q)
      ans += -neg_b

print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int,input().split())
A_B = [list(map(int, input().split())) for i in range(N)]

#日数ごとの集合を作る
jobs = {m: [] for m in range(1, M + 1)}
for ab in A_B:
  if a in jobs:
    jobs[ab[0]].append(ab[1])
#print(jobs)

#日数の少ない仕事からループして最適解を見つける
import heapq
q = []
ans = 0
#仕事にかかる日数のループであって経過日のループではない
for m in range(1, M + 1):
    for b in jobs[m]:
      #qには小さい順で格納される
      heapq.heappush(q, -b)
    #print(q)
    #qが空でないとき
    if len(q) > 0:
      #現時点での日数以下の仕事で一番稼げるものを取り出す
      neg_b = heapq.heappop(q)
      ans += -neg_b

print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int,input().split())
A_B = [list(map(int, input().split())) for i in range(N)]

#日数ごとの集合を作る
jobs = {m: [] for m in range(1, M + 1)}
for ab in A_B:
  jobs[ab[0]].append(ab[1])
#print(jobs)

#日数の少ない仕事からループして最適解を見つける
import heapq
q = []
ans = 0
#仕事にかかる日数のループであって経過日のループではない
for m in range(1, M + 1):
    for b in jobs[m]:
      #qには小さい順で格納される
      heapq.heappush(q, -b)
    #print(q)
    #qが空でないとき
    if len(q) != 0:
      #現時点での日数以下の仕事で一番稼げるものを取り出す
      neg_b = heapq.heappop(q)
      ans += -neg_b

print(ans)
Problem p02951 (python)

Fixed submission:


res = str(input())

list = res.split(" ")

a = int(list[0])
b = int(list[1])
c = int(list[2])
transferrable = a - b

if c <= transferrable:
    c = 0

else:
    c -= transferrable

print(c)

Buggy submission (verdict: Runtime Error):

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


transferrable = a - b

if c <= transferrable:
    c = 0

else:
    c -= transferrable

print(c)

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


transferrable = a - b

if c <= transferrable:
    c = 0

else:
    c -= transferrable

print(c)
Problem p02629 (python)

Fixed submission:
num = int(input())
s = 'abcdefghijklmnopqrstuvwxyz'
ans = ''
while num > 26:
    num, rest = divmod(num, 26)
    ans += s[rest - 1]
    if rest == 0:
        num -= 1
    #num -= 1
    #print(ans, num, rest)
    
ans += s[num - 1]
print(ans[::-1])

Buggy submission (verdict: Runtime Error):
num = int(input())
ans = ''
while num > 26:
    num, rest = divmod(num, 26)
    ans += s[rest - 1]
    #print(ans)
ans += s[num - 1]
print(ans[::-1])
Problem p02695 (python)

Fixed submission:
import itertools
n, m, q = map(int, input().split())
abcd = [tuple(map(int, input().split())) for _ in range(q)]
Max = 0
for A in itertools.combinations_with_replacement(range(1, m + 1), n):
    #score = sum([d for a, b, c, d in abcd if C[b - 1] - C[a - 1] == c])
    score = 0
    for ai, bi, ci, di in abcd:
        if A[bi - 1] - A[ai - 1] == ci:
            score += di
    Max = max(Max, score)
    #print(C)
print(Max)

Buggy submission (verdict: Runtime Error):
import itertools
n, m, q = map(int, input().split())
abcd = [tuple(map(int, input().split())) for _ in range(q)]
Max = 0
for A in itertools.combinations_with_replacement(range(1, m + 1) n):
    #score = sum([d for a, b, c, d in abcd if C[b - 1] - C[a - 1] == c])
    score = 0
    for ai, bi, ci, di in abcd:
        if A[bi - 1] - A[ai - 1] == ci:
            score += di
    Max = max(Max, score)
    #print(C)
print(Max)
Problem p02699 (python)

Fixed submission:
s, w = map(int, input().split())
if s <= w:
    print('unsafe')
else:
    print('safe')

Buggy submission (verdict: Runtime Error):
s = input()
cnt = 0
ans = []
for i in range(0, len(s) - 3):
    j = i
    num = ''
    while j < len(s):
        juhuku = 0
        num += s[j]
        if int(num) % 2019 == 0 and num != '0':
            #print(i, j)
            if j not in ans:
                ans.append(j)
            juhuku = ans.count(i - 1)
            cnt += 1 + juhuku
        j += 1
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
cnt = 0
ans = []
for i in range(0, len(s) - 3):
    j = i
    num = ''
    while j < len(s):
        juhuku = 0
        num += s[j]
        if int(num) % 2019 == 0 and num != '0':
            print(i, j)
            if j not in ans:
                ans.append(j)
            juhuku = ans.count(i - 1)
            cnt += 1 + juhuku
        j += 1
cnt, ans

Buggy submission (verdict: Runtime Error):
s = input()
cnt = 0
ans = []
for i in range(0, len(s) - 3):
    j = i
    num = ''
    while j < len(s):
        juhuku = 0
        num += s[j]
        if int(num) % 2019 == 0 and num != '0':
            #print(i, j)
            if j not in ans:
                ans.append(j)
            juhuku = ans.count(i - 1)
            cnt += 1 + juhuku
        j += 1
print(cnt)
Problem p02711 (python)

Fixed submission:
N =input()
if N[0] == '7' or N[1] == '7' or N[2] == '7':
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
s = input()
R_cnt = [0] * (N + 1)
B_cnt = [0] * (N + 1)
G_cnt = [0] * (N + 1)
for i in range(N):
    if s[i] == 'R':
        R_cnt[i + 1] = R_cnt[i] + 1
        B_cnt[i + 1] = B_cnt[i]
        G_cnt[i + 1] = G_cnt[i]
    elif s[i] == 'B':
        R_cnt[i + 1] = R_cnt[i]
        B_cnt[i + 1] = B_cnt[i] + 1
        G_cnt[i + 1] = G_cnt[i]
    else:
        R_cnt[i + 1] = R_cnt[i]
        B_cnt[i + 1] = B_cnt[i]
        G_cnt[i + 1] = G_cnt[i] + 1
ans = 0
for i in range(N - 2):
    for j in range(i + 1, N - 1):
        if s[i] == s[j]:
            continue
            
        if s[i] == 'R' and s[j] == 'B' or s[i] == 'B' and s[j] == 'R':
            ans += G_cnt[N] - G_cnt[j]
        elif s[i] == 'B' and s[j] == 'G' or s[i] == 'G' and s[j] == 'B':
            ans += R_cnt[N] - R_cnt[j]
        elif s[i] == 'R' and s[j] == 'G' or s[i] == 'G' and s[j] == 'R':
            ans += B_cnt[N] - B_cnt[j]
        if j + (j - i) < N and s[i] != s[j] != s[j + (j - i)] != s[i]:
            ans -= 1
print(ans)
Problem p02726 (python)

Fixed submission:
N, X, Y = map(int, input().split())

g = [[]  for i in range(N)]
for i in range(N):
    u = i
    v = i + 1
    if v < N:
        g[u].append(v)
        g[v].append(u)

g[X - 1].append(Y - 1)
g[Y - 1].append(X - 1)

from collections import deque
dis = [[float('Inf')] * N for _ in range(N)]
count = [0] * (N - 1)
def bfs(i):
    d = [False] * N
    que = deque()
    #for j in g[i]:
    que.append(i)
    d[i] = True
    dis[i][i] = 0
    pre = i
    while que:
        p = que.popleft()

        for k in g[p]:
            if d[k]:
                continue
            else:
                d[k] = True
                que.append(k)
                dis[i][k] = dis[i][p] + 1
                dis[k][i] = dis[i][p] + 1
                count[dis[i][k] - 1] += 1 
                #count[dis[k][i] - 1] += 1
        pre = p

for i in range(N):
    bfs(i)

for i in range(N - 1):
    print(count[i] // 2)

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

g = [[]  for i in range(N)]
for i in range(N):
    u = i
    v = i + 1
    if v < 5:
        g[u].append(v)
        g[v].append(u)

g[X - 1].append(Y - 1)
g[Y - 1].append(X - 1)

from collections import deque
dis = [[float('Inf')] * N for _ in range(N)]
count = [0] * (N - 1)
def bfs(i):
    d = [False] * N
    que = deque()
    #for j in g[i]:
    que.append(i)
    d[i] = True
    dis[i][i] = 0
    pre = i
    while que:
        p = que.popleft()

        for k in g[p]:
            if d[k]:
                continue
            else:
                d[k] = True
                que.append(k)
                dis[i][k] = dis[i][p] + 1
                dis[k][i] = dis[i][p] + 1
                count[dis[i][k] - 1] += 1 
                #count[dis[k][i] - 1] += 1
        pre = p

for i in range(N):
    bfs(i)

for i in range(N - 1):
    print(count[i] // 2)
Problem p02754 (python)

Fixed submission:
n, a, b = map(int, input().split())
div, rest =divmod(n, (a + b))
#div, rest
ans = a * div
if rest >= a:
    ans += a
else:
    ans += rest
print(ans)

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
s = ""
b_cnt = 0
while len(s) + (a + b) <= n:
    s += "b"*a + "r"*b
    b_cnt += 1
rest = n - len(s)
ans = a * b_cnt + rest
print(ans)

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
s = ""
while len(s) <= n:
    s += 'b' * a + 'r' * b
cnt = 0
for si in s[:n]:
    if si == 'b':
        cnt += 1
Problem p02935 (python)

Fixed submission:
def solve(N, values):
    while len(values) > 1:
        values.sort()
        x = values.pop(0)
        y = values.pop(0)
        values.append((x + y) / 2)
    return values[0]


N = int(input())
values = [int(v) for v in input().split()]
ans = solve(N, values)
print(ans)

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


while len(v) > 1:
   v =　sorted(v)
   v1 = v.pop(0)
   v2 = v.pop(0)
   v.append((v1+v2)/2)
print(v[0])

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


while len(v_sort) > 1:
   v_sort =　sorted(v)
   v1 = v_sort.pop(0)
   v2 = v_sort.pop(0)
   v_sort.append((v1+v2)/2)
print(v_sort[0])
Problem p02951 (python)

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

Buggy submission (verdict: Runtime Error):
s = input()
max_ = 0
pre = s[0]
ren = 1
for i in range(1, len(s)):
    if s[i] == pre:
        ren += 1
        max_ = max(max_, ren)
    else:
        ren = 1
        pre = s[i]
from collections import deque
status = deque([[1] * len(s)])
for i in range(max_):
    sta = [0] * len(s)
    if s[1] == 'L':
        sta[0] = status[i][1]
    else:
        sta[0] = 0
    if s[-2] == 'R':
        sta[-1] = status[i][-2]
    else:
        sta[-1] = 0
    a = [[1] * len(s)]
    for j in range(1, len(s) - 1):
        #print(sta)
        if s[j - 1] == 'R':
            sta[j] += status[i][j - 1]
        if s[j + 1] == 'L':
            sta[j] += status[i][j + 1]
    status.append(sta)
for i in range(1 + max_ - 2):
    status.popleft()
if (max_ - 2) % 2 == 0:
    print(' '.join([str(i) for i in status[1]]))
else:
    print(' '.join([str(i) for i in status[0]]))
Problem p03073 (python)

Fixed submission:
s = list(input())
s1 = []
s2 = []
for i in range(len(s)):
    if i % 2 == 0:
        s1.append('0')
        s2.append('1')
    else:
        s1.append('1')
        s2.append('0')
min_1 = 0
#for i in range(2):
for i in range(len(s)):
    if s[i] != s1[i]:
        min_1 += 1
        
min_2 = 0
for i in range(len(s)):
    if s[i] != s2[i]:
        min_2 += 1
print(min(min_1, min_2))

Buggy submission (verdict: Runtime Error):
s = list(input())
s1 = []
s2 = []
for i in range(len(s)):
    if i % 2 == 0:
        s1.append('0')
        s2.append('1')
    else:
        s1.append('1')
        s2.append('0')
print(min(min_1, min_2))
Problem p03107 (python)

Fixed submission:
s = input()
s_list = list(s)

print(min(s_list.count('1'), s_list.count('0')) * 2)

Buggy submission (verdict: Runtime Error):
s_list = list(s)

print(min(s_list.count('1'), s_list.count('0')) * 2)
Problem p03137 (python)

Fixed submission:
N, M = map(int, input().split())
x = list(map(int, input().split()))
if N >= M:
    print(0)
    quit()


x.sort()
s = [0] * (M - 1)
for i in range(M - 1):
    s[i] = x[i + 1] - x[i]

s.sort(reverse=True)

res = sum(s)
if M == 1:
    print(0)
    quit()
else:
    for i in range(N - 1):
        res -= s[i]

print(res)

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

x.sort()
s = [0] * (M - 1)
for i in range(M - 1):
    s[i] = x[i + 1] - x[i]

s.sort(reverse=True)

res = sum(s)
if M == 1:
    print(0)
    quit()
else:
    for i in range(N - 1):
        res -= s[i]

print(res)

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

x.sort()
s = [0] * (M - 1)
for i in range(M - 1):
    s[i] = x[i + 1] - x[i]

s.sort(reverse=True)

res = sum(s)
if M == 1:
    print(0)
else:
    for i in range(N - 1):
        res -= s[i]

print(res)

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

x.sort()
s = [0] * (M - 1)
for i in range(M - 1):
    s[i] = x[i + 1] - x[i]

s.sort(reverse=True)
res = sum(s)
for i in range(N - 1):
    res -= s[i]
print(res)
Problem p03208 (python)

Fixed submission:
N, K = map(int, input().split())
H = [int(input()) for _ in range(N)]

H = sorted(H)
ans = float('Inf')
for i in range(N - (K - 1)):
    ans = min(ans, H[i + (K - 1)] - H[i])
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
H = [int(input()) for _ in range(N)]

H = sorted(H)
ans = float('Inf')
for i in range(N - K + 1):
    ans = min(ans, H[i + 2] - H[i])
print(ans)
Problem p03295 (python)

Fixed submission:
from operator import itemgetter

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

# 区間の終端でソート
ab = sorted([tuple(map(int, input().split())) for i in range(m)], key=itemgetter(1))
# 前回除いた橋
removed = -1
ans = 0

for a, b in ab:
    # a が removed より大きい = まだ取り除いてない
    if a > removed:
        removed = b - 1
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
S = []
for i in range(M):
     a, b = map(int, input().split())
    S.append([a, b])
    
from operator import itemgetter
S = sorted(S, key=itemgetter(1))
ans = 0
last = -1*float('Inf')
for si in S:
    if si[0] >= last:
        ans += 1
        last = si[1]
print(ans)
Problem p02685 (python)

Fixed submission:
n,m,k = map(int,input().split())
mod = 998244353
ans = 0

def comb(n, r, mod):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % mod
  
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
 
for i in range(2, n+1):
    fact.append((fact[-1] * i) % mod)
    inv.append((-inv[mod % i] * (mod // i)) % mod)
    factinv.append((factinv[-1] * inv[-1]) % mod)


for i in range(k+1):
    a = pow(m-1, n-i-1, mod)
    b = comb(n-1,i,mod)
    ans += (a*b)%mod
ans *= m
print(ans%mod)

Buggy submission (verdict: Runtime Error):
n,m,k = map(int,input().split())
mod = 998244353
ans = 0

def comb(n,k,mod):
    nCk = 1

    for i in range(n-k+1, n+1):
        nCk *= i
        nCk %= mod
 
    for i in range(1,k+1):
        nCk *= pow(i,mod-2,mod)
        nCk %= mod
    return nCk

a1 = pow(m-1, n-k-2, mod)  
b1 = 1  
for i in range(k,-1,-1):
    a = (a1*(m-1))%mod
    b = comb(n-1,i,mod)
    ans += a*b
ans *= m
print(ans%mod)
Problem p02699 (python)

Fixed submission:
s,w = map(int,input().split())
if s<=w:
  print("unsafe")
else:
  print("safe")

Buggy submission (verdict: Runtime Error):
n = len(s)
cou = [0 for i in range(n+1)]
cou[1]= s[-1]
coum = [0 for i in range(2019)]
for i in range(1,n):
  cou[i+1] = s[n-i-1]+ str(cou[i])
  a = int(cou[i+1])
  coum[a%2019] += 1
coum[0] += 1
coum[int(s[-1])]+= 1
ans = 0
for i in coum:
    ans += i*(i-1)*0.5
print(int(ans))
Problem p02753 (python)

Fixed submission:
a,b,c = input()
if a==b==c:
  print('No')
 
else:
  print('Yes')

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

sum = b + c

#何セットあるか確かめる
set = int(a / sum)
#print(set)

#セットの中にある青玉の個数
blue_1 = set * b 
#print(blue_1)

#最後のあまりを数える
amari = a % sum
#print(amari)

if amari <= b:
  print(blue_1 + amari)
  
else :
  print(blue_1 + b)
Problem p02759 (python)

Fixed submission:
N = int(input())

if N%2 ==0:
  ans = N/2
  print(int(ans))
  
else :
  ans = N/2 + 0.5
  print(int(ans))

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

if N%2 ==0:
  ans = N%2
  print(ans)
  
else :
  ans = N%2 + 0.5
  print(int(ans))
Problem p02771 (python)

Fixed submission:
#3つの数字をリストにする
data = input().split( )
#場合わけ
if (data[0] == data[1] or data[1] == data[2] or
   data[2] ==data[0]) and not data[1]== data[2]==data[0] :
    print("Yes")

else:
    print("No")

Buggy submission (verdict: Runtime Error):
#3つの数字をリストにする
data = input().split( )
#場合わけ
if (data[0] == data[1] or data[1] == data[2] or
   data[2] ==data[0]) and data[1]!= data[2]!=data[3] :
    print("Yes")

else:
    print("No")
Problem p02777 (python)

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

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

If a = e;
		print(c-1,d)
		
else;
		print(c,d-1)
Problem p02793 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
so_list = [0 for i in range(10**6)]
mod = 10**9+7

def fac(n):
    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
            if so_list[i]<cnt:
              so_list[i]= cnt
    if temp!=1:
    #  print(temp)
      if so_list[temp]==0:
        so_list[temp]=1
for i in range(n):
  a1 = a[i]
  fac(a1)
l = 1
for i in range(len(so_list)):
  if so_list[i]!=0:
    l *= pow(i,so_list[i],mod)
    l %= mod
ans = 0
#print(l)
for i in a:
  t = pow(i,mod-2,mod)
  ans += (l*t)%mod
print(ans%mod)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
so_list = [0 for i in range(10**4)]
mod = 10**9+7

def fac(n):
    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
            if so_list[i]<cnt:
              so_list[i]= cnt
    if temp!=1:
      if so_list[temp]==0:
        so_list[temp]=1
for i in range(n):
  a1 = a[i]
  fac(a1)
l = 1
for i in range(len(so_list)):
  if so_list[i]!=0:
    l *= pow(i,so_list[i],mod)
    l %= mod
ans = 0
#print(l)
for i in a:
  t = pow(i,mod-2,mod)
  ans += (l*t)%mod
print(ans%mod)
Problem p02829 (python)

Fixed submission:
a= int(input())
b= int(input())
if a+b ==3:
		print(3)
		
elif  a+b == 4:
		print(2)
 
else:
		print(1)

Buggy submission (verdict: Runtime Error):
a,b = [i for i in int(input())]
if a+b =3:
		print(3)
		
elif  a+b = 4:
		print(2)

else:
		print(1)

Buggy submission (verdict: Runtime Error):
a,b = [int(input()) in i for range(2)]
if a+b =3:
		print(3)
		
elif  a+b = 4:
		print(2)

else:
		print(1)
Problem p02835 (python)

Fixed submission:
a,b,c = map(int,input().split())
if a+b+c >= 22:
		print("bust")
		
else:
		print("win")

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
if a+b+c = 22:
		print("bust")
		
else:
		print("win")
Problem p02847 (python)

Fixed submission:
a = input()
if a == "SAT":
		print(1)
		
elif a == "FRI" :
		print(2)
		
elif a == "THU" :
		print(3)
			
elif a == "WED" :
		print(4)		
		
elif a == "TUE" :
		print(5)		
	
elif a == "MON" :
		print(6)

else :
		print(7)

Buggy submission (verdict: Runtime Error):
a,b,x = map(int,input().split())
mi = 0
ma = 10**9+1
while ma-mi>1:
  me = int((mi+ma)/2)
  if a*me+b*len(str(me))<=x:
    mi = me
  else:
    ma = me
print(mi)
Problem p02862 (python)

Fixed submission:
x,y = map(int,input().split())
mod = 10**9+7
if (x+y)%3!=0:
  print(0)
  exit()
if 2*min(x,y)<max(x,y):
  print(0)
  exit()
n = (2*x-y)//3
m = (2*y-x)//3
#n+mCm
if n==0 or m==0:
  print(1)
  exit()
def ka(x):
  a = 1
  while x!=1:
    a *= x
    x -= 1
    a%= mod
  return a

ans = (ka(n+m)*pow(ka(m),mod-2,mod)%mod)*(pow(ka(n),mod-2,mod))%mod
print(ans)

Buggy submission (verdict: Runtime Error):
x,y = map(int,input().split())
mod = 10**9+7

mx = 10**6
fact = [1]*(mx+1)
for i in range(mx):
  fact[i+1] = fact[i]*(i+1)%mod
def inv(n):
  return pow(n,mod-2,mod)
if (x%3==0 and y%3==0) or (x%3==1 and y%3==2) or (x%3==2 and y%3==1):
  n = int(2*x/3-y/3)
  m = int(-x/3 + 2*y/3)
  s += fact[n+m]*inv(fact[n])*inv(fact[m])%mod
  print(s)
else:
  print(0)
Problem p02879 (python)

Fixed submission:
a,b =map(int,input().split())
if 1 <= a <=9 and 1 <= b <=9:
		print(a*b)
		
else:
		print(-1)

Buggy submission (verdict: Runtime Error):
a,b =map(int,input().split())
if 1 <= a,b <=9:
		print(a*b)
		
else:
		print(-1)
Problem p03077 (python)

Fixed submission:
n = int(input())
l = list(int(input()) for i in range(5))
a = -(-n//min(l))+4
print(a)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(int(input()) for i in range(n))
a = -(-n//min(l))+4
print(a)