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

Fixed submission:
import bisect

n = int(input())
a = [int(i) for i in input().split()]

target = 0
l = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199]
cnt = [0 for i in range(len(l))]

for i in range(n):
    if a[i] >= 3200:
        target += 1
    else:
        x = bisect.bisect_left(l, a[i])
        # print ("value = " + str(a[i]) + ", x = " + str(x))
        cnt[x] += 1

mi = 0
ma = 0
for i in range(len(l)):
    if cnt[i] != 0:
        mi += 1

ma = mi + target
if mi == 0:
    mi = 1

print (str(mi) + " " + str(ma))

Buggy submission (verdict: Runtime Error):
import bisect

n = int(input())
a = [int(i) for i in input().split()]

target = 0
l = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199]
cnt = [0 for i in range(len(l))]

for i in range(n):
    if a[i] >= 3200:
        target += 1
    else:
        x = bisect.bisect(l, a[i])
        # print ("value = " + str(a[i]) + ", x = " + str(x))
        cnt[x] += 1

mi = 0
ma = 0
for i in range(len(l)):
    if cnt[i] != 0:
        mi += 1

ma = mi + target
if mi == 0:
    mi = 1

print (str(mi) + " " + str(ma))
Problem p02534 (python)

Fixed submission:
n=int(input())
print("ACL"*n)

Buggy submission (verdict: Runtime Error):
s=input().split(" ")
a,b,c,d=int(s[0]),int(s[1]),int(s[2]),int(s[3])
if ((min(a,b)>=c and min(a,b)<=d) or (max(a,b)>=c and max(a,b)<=d)) and ((min(c,d)>=a and min(c,d)<=b) or (max(c,d)>=a and max(c,d)<=b)):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s=input().split(" ")
a,b,c,d=int(s[0]),int(s[1]),int(s[2]),int(s[3])
if min(c,d)>=a and min(c,d)<=b and min(a,b)>=c and min(a,b)<=d:
  print("Yes")
else:
  print("No")
Problem p02761 (python)

Fixed submission:
n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(m)]

for x in range(1000):
    ok = True
    s = str(x)
    if len(s) != n:
        continue
    if not all([int(s[a[i][0] - 1]) == a[i][1] for i in range(m)]):
        continue
    print(x)
    exit(0)

print(-1)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(m)]

for x in range(1000):
    ok = True
    s = str(x)
    if len(s) != n:
        continue
    if not all([int(s[a[i][0] - 1]) == a[i][1] for i in range(m)]):
        continue
    print(x)
    exit(1)

print(-1)
Problem p02936 (python)

Fixed submission:
import sys

n, q = map(int, input().split())
adj = [[] for _ in range(n)]
for _ in range(n-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    adj[a].append(b)

res = [0] * n
for _ in range(q):
    i, x = map(int, input().split())
    res[i-1] += x

parent = [0] * n
stack = [0]
while len(stack) > 0:
    i = stack.pop()
    for j in adj[i]:
        res[j] += res[i]
        stack.append(j)

print(' '.join([str(x) for x in res]))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)


n, q = map(int, input().split())
adj = [[] for _ in range(n)]
for _ in range(n-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    adj[a].append(b)
    adj[b].append(a)

p = [0] * n
for _ in range(q):
    i, x = map(int, input().split())
    p[i-1] += x

parent = [0] * n
res = [0] * n
visited = [False] * n
def dfs(x, n):
    res[x] += n
    visited[x] = True
    for ne in adj[x]:
        if not visited[ne]:
            dfs(ne, n + p[ne])

dfs(0, p[0])
print(' '.join([str(x) for x in res]))
Problem p02991 (python)

Fixed submission:
n, m = map(int, input().split())
uv = [list(map(int, input().split())) for _ in range(m)]
s, t = map(int, input().split())

alist = [[] for _ in range(3*n)]
for u, v in uv:
    u, v = u-1, v-1
    alist[u].append(n+v)
    alist[n+u].append(2*n+v)
    alist[2*n+u].append(v)


# BFS
queue = [s-1]
visited = [-3]*(3*n)
visited[s-1] = 0
while len(queue) > 0:
    q = queue.pop(0)
    for v in alist[q]:
        if visited[v] < 0:
            queue.append(v)
            visited[v] = visited[q] + 1
print(visited[t-1]//3)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
uv = [list(map(int, input().split())) for _ in range(m)]
alist = [[] for _ in range(n)]
for u, v in uv:
    alist[u-1].append(v-1)
s, t = map(int, input().split())

alist3 = [set([]) for _ in range(n)]
for v in range(n):
    for v1 in alist[v]:
        for v2 in alist[v1]:
            for v3 in alist[v2]:
                alist3[v].add(v3)

# BFS
queue = [s]
visited = [-1]*n
visited[s] = 0
while len(queue) > 0:
    q = queue.pop(0)
    for v in alist3[q]:
        if visited[v] < 0:
            queue.append(v)
            visited[v] = visited[q] + 1
print(visited[t])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
uv = [list(map(int, input().split())) for _ im range(m)]
alist = [[] for _ in range(n)]
for u, v in uv:
    alist[u].append(v)
s, t = map(int, input().split())

alist3 = [set([]) for _ in range(n)]
for u, v in uv:
for v in range(n):
    for v1 in alist[v]:
        for v2 in alist[v1]:
            for v3 in alist[v2]:
                alist3[v].add(v2)

# BFS
queue = [s]
visited = [-1]*n
visited[s] = 0
while len(queue) > 0:
    q = queue.pop(0)
    for v in alist3[q]:
        if visited[v] >= 0:
            queue.append(v)
            visited[v] = visited[q] + 1
print(visited[t])
Problem p03006 (python)

Fixed submission:
import collections

def solve(n, points):
    if n == 1:
        return 1
    a = []
    for i in range(n-1):
        for j in range(i + 1, n):
            x = points[i][0] - points[j][0]
            y = points[i][1] - points[j][1]
            if x > 0:
                a.append((x, y))
            elif x < 0:
                a.append((-x, -y))
            else:
                a.append((0, abs(y)))

    c = collections.Counter(a).most_common()[0][1]
    return n - c

n = int(input())
points = [list(map(int, input().split(' '))) for _ in range(n)]
print(solve(n, points))

Buggy submission (verdict: Runtime Error):
import collections

def solve(n, points):
    a = []
    for i in range(n-1):
        for j in range(i + 1, n):
            x = points[i][0] - points[j][0]
            y = points[i][1] - points[j][1]
            if x > 0:
                a.append((x, y))
            elif x < 0:
                a.append((-x, -y))
            else:
                a.append((0, abs(y)))

    c = collections.Counter(a).most_common()[0][1]
    return n - c

n = int(input())
points = [list(map(int, input().split(' '))) for _ in range(n)]
print(solve(n, points))
Problem p03035 (python)

Fixed submission:
a, b = map(int, input().split())
if a >= 13:
    print(b)
elif a >= 6:
    print(b//2)
else:
    print(0)

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

n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
bc = [list(map(int, input().split())) for _ in range(m)]
bc.sort(key=lambda x: x[1], reverse=True)

res = 0
fin = 0
for b, c in bc:
    count = bisect_right(a, c, lo=fin, hi=min(b, len(a))) - fin
    fin += count
    res += count * c
for i in range(fin, len(a)):
    res += a[i]

print(res)
Problem p02613 (python)

Fixed submission:
li = ["AC", "WA", "TLE", "RE"]
from collections import defaultdict
d = defaultdict(int)
N = int(input())
for i in range(N):
  s = input()
  d[s] += 1
for an in li:
  print(f"{an} x {d[an]}")

Buggy submission (verdict: Runtime Error):
AC = 0
WA = 0
TLE = 0
RE = 0
from collections import defaultdict
d = defaultdict(0)
print(d[1])
N = int(input())
for i in range(N):
  s = input()
Problem p02645 (python)

Fixed submission:
print(input()[:3])

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

if abs(A-B) - (V-W)*T <= 0:
  print("YES")
elif A==B:
  print("YES")
else:
  print("NO")
Problem p02669 (python)

Fixed submission:
T = int(input())

for t in range(T):
    N, A, B, C, D = map(int, input().split())
    memo = {}

    def dist(n):
        if n == 0:
            return 0
        if n == 1:
            return D
        if n in memo:
            return memo[n]
        
        ret = min(
            D * n,
            D * abs(n - n//5*5) + C + dist(n//5),
            D * abs(n - (n+4)//5*5) + C + dist((n+4)//5),
            D * abs(n - n//3*3) + B + dist(n//3),
            D * abs(n - (n+2)//3*3) + B + dist((n+2)//3),
            D * abs(n - n//2*2) + A + dist(n//2),
            D * abs(n - (n+1)//2*2) + A + dist((n+1)//2)
        )

        memo[n] = ret
        return ret
    print(dist(N))

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

for t in range(T):
    N, A, B, C, D = map(int, input().split())
    memo = {}

    def dist(n):
        if n == 0:
            return 0
        if n in memo:
            return memo[n]
        
        ret = min(
            D * n,
            D * abs(n - n//5*5) + C + dist(n//5),
            D * abs(n - (n+4)//5*5) + C + dist((n+4)//5),
            D * abs(n - n//3*3) + B + dist(n//3),
            D * abs(n - (n+2)//3*3) + B + dist((n+2)//3),
            D * abs(n - n//2*2) + A + dist(n//2),
            D * abs(n - (n+1)//2*2) + A + dist((n+1)//2)
        )

        memo[n] = ret
        return ret
    print(dist(N))
Problem p02692 (python)

Fixed submission:
N, *ABC = map(int, input().split())
s = [input() for _ in range(N)]

yes_flag = True
ans_list = []

if sum(ABC) == 0:
    yes_flag = False

for i in range(N):
    if not yes_flag:
        break
    u = ord(s[i][0]) - 65
    v = ord(s[i][1]) - 65
    if ABC[u] + ABC[v] == 0:
        yes_flag = False
    elif ABC[u] + ABC[v] == 1:
        if ABC[u] == 1:
            ans_list += [s[i][1]]
            ABC[u] -= 1
            ABC[v] += 1
        else:
            ans_list += [s[i][0]]
            ABC[v] -= 1
            ABC[u] += 1
    elif ABC[u] + ABC[v] == 2:
        # 両方1の場合だけケアが必要
        if ABC[u] * ABC[v] == 1:
            if i == N-1:
                if ABC[u] > 0:
                    ans_list += [s[i][1]]
                else:
                    ans_list += [s[i][0]]
            else:
                if s[i][1] in s[i+1]:
                    ans_list += [s[i][1]]
                    ABC[u] -= 1
                    ABC[v] += 1
                else:
                    ans_list += [s[i][0]]
                    ABC[v] -= 1
                    ABC[u] += 1
        else:
            if ABC[u] > 1:
                ans_list += [s[i][1]]
                ABC[u] -= 1
                ABC[v] += 1
            else:
                ans_list += [s[i][0]]
                ABC[v] -= 1
                ABC[u] += 1
    else:
        if ABC[u] > 1:
            ans_list += [s[i][1]]
            ABC[u] -= 1
            ABC[v] += 1
        else:
            ans_list += [s[i][0]]
            ABC[v] -= 1
            ABC[u] += 1

if yes_flag:
    print("Yes")
    print(*ans_list)
else:
    print("No")

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

yes_flag = True
ans_list = []

if sum(ABC) == 0:
    yes_flag = False

for i in range(N):
    if not yes_flag:
        break
    u = ord(s[i][0]) - 65
    v = ord(s[i][1]) - 65
    if ABC[u] + ABC[v] == 0:
        yes_flag = False
    elif ABC[u] + ABC[v] == 1:
        if ABC[u] == 1:
            ans_list += [s[i][0]]
            ABC[u] -= 1
            ABC[v] += 1
        else:
            ans_list += [s[i][1]]
            ABC[v] -= 1
            ABC[u] += 1
    elif ABC[u] + ABC[v] == 2:
        # 両方1の場合だけケアが必要
        if ABC[u] * ABC[v] == 1:
            if i == N-1:
                ans_list += [s[i][0]]
            else:
                if ABC[u] in s[i+1]:
                    ans_list += [s[i][0]]
                    ABC[u] -= 1
                    ABC[v] += 1
                else:
                    ans_list += [s[i][1]]
                    ABC[v] -= 1
                    ABC[u] += 1
        else:
            if ABC[u] > 1:
                ans_list += [s[i][0]]
                ABC[u] -= 1
                ABC[v] += 1
            else:
                ans_list += [s[i][1]]
                ABC[v] -= 1
                ABC[u] += 1
    else:
        if ABC[u] > 1:
            ans_list += [s[i][0]]
            ABC[u] -= 1
            ABC[v] += 1
        else:
            ans_list += [s[i][1]]
            ABC[v] -= 1
            ABC[u] += 1

if yes_flag:
    print("Yes")
    print(*ans_list)

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

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

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
table = []

for i, a in enumerate(A):
    table.append([a,i])
table.sort(reverse=True)

# DP[i][j] 左端に i 個, 右端に j 個貪欲に詰めたときのうれしさ
DP = [[0 for i in range(N+1)] for j in range(N+1)]
for i in range(1,N+1):
    # i 人目 table[i-1] の幼児を移動させる
    for x in range(i+1):
        y = i - x

        #左端に置く場合と右端に置く場合でmax
        DP[x][y] = max((DP[x-1][y] + table[i-1][0] * abs(table[i-1][1]  - x+1)) * (x>0),\
                     (DP[x][y-1] + table[i-1][0] * abs(table[i-1][1] - (N - y))*(y>0)))


ans = 0
for i in range(N+1):
    for j in range(N+1):
        ans = max(ans, DP[i][j])
print(ans)

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

print(max(N -sum(list(map(int, input().split()))), -1))

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

print(max(N -sum(A), -1))
Problem p02709 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
table = []

for i, a in enumerate(A):
    table.append([a,i])
table.sort(reverse=True)

# DP[i][j] 左端に i 個, 右端に j 個貪欲に詰めたときのうれしさ
DP = [[0 for i in range(N+1)] for j in range(N+1)]
for i in range(1,N+1):
    # i 人目 table[i-1] の幼児を移動させる
    for x in range(i+1):
        y = i - x

        #左端に置く場合と右端に置く場合でmax
        DP[x][y] = max((DP[x-1][y] + table[i-1][0] * abs(table[i-1][1]  - x+1)) * (x>0),\
                     (DP[x][y-1] + table[i-1][0] * abs(table[i-1][1] - (N - y))*(y>0)))


ans = 0
for i in range(N+1):
    for j in range(N+1):
        ans = max(ans, DP[i][j])
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
table = []

for i, a in enumerate(A):
    table.append([a,i])
table.sort()

# DP[i][j] 左端に i 個, 右端に j 個貪欲に詰めたときのうれしさ
DP = [[0 for i in range(N+1)] for j in range(N+1)]
for i in range(1,N+1):
    # i 人目 table[i-1] の幼児を移動させる
    baby, pos = table.pop()
    for x in range(i+1):
        y = i - x

        #左端に置く場合と右端に置く場合でmax
        DP[x][0] = DP[x-1][0] + baby * abs(pos-x+1))
        DP[0][y] = DP[x][y-1] + baby * abs(pos-(N-y))
        if x & y:
            DP[x][y] = max((DP[x-1][y] + baby * abs(pos-x+1)),\
                     (DP[x][y-1] + baby * abs(pos-(N-y)))

ans = 0
for i in range(N+1):
    ans = max(ans, DP[i][N-i])
print(ans)
Problem p02714 (python)

Fixed submission:
N = int(input())
S = input()

ans = S.count('R') * S.count('G') * S.count('B')
for i in range(N):
  for j in range(i+1,N):
    if (i+j)%2 :
      continue
    k = (i+j)//2
    if len(set([S[i],S[k],S[j]])) == 3:
      ans -= 1
      
print(ans)

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

ans = S.count('R') * S.count('G') * S.count('B')
for i in range(N):
  a = S[i]
  for j in range(i+1,N):
    b = S[j]
    if (i+j)%2 :
      continue
    k = (i+j)//2
    if [a,S[k],b].sort() == ['B','G','R']
      ans -= 1
      
print(ans)
Problem p02730 (python)

Fixed submission:
S = input()
N = len(S)
s1 = S[:(N-1)//2]
s2 = S[(N+3)//2-1:]

if S == S[::-1] and s1 == s1[::-1] and s2 == s2[::-1]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S = input()
s1 = S[:(N-1)//2]
s2 = S[(N+3)//2-1:]

if S == S[::-1] and s1 == s1[::-1] and s2 == s2[::-1]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
s = str(N)
n = 0
for i in s:
  n += int(i)
  
if N%n==0:
  print("Yes")
else:
  print("No")
Problem p02744 (python)

Fixed submission:
N = int(input())

def standard_string(N, st):
    if len(st) == N:
        print(st)
    elif st == "":
        standard_string(N, "a")
    else:
        for i in range(97, ord(max(st))+ 2):
            st += chr(i)
            standard_string(N, st)
            st = st[:-1]
standard_string(N, "")

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

def standard_string(N, st):
  if st = "":
    standard_string(N, "a")
  if len(st) == N:
    print(st)
    return 
  for i in range(97, ord(st[-1])+ 1):
    st += char(i)
    standard_string(N, st)
    st = st[:-1]
standard_string(N, "")
Problem p02761 (python)

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

S, C = [], []
for i in range(M):
  s, c = map(int, input().split())
  S += [s-1]
  C += [str(c)]
  
if N == 1:
  for i in range(10):
    flag = 1
    for m in range(M):
      if str(i) != C[m]:
        flag = 0
        break
    if flag:
      print(i)
      break
  else:
    print(-1) 
else:
  for i in range(10**(N-1), 10**N):
    flag = 1
    i_str = str(i)
    for m in range(M):
      if i_str[S[m]] != C[m]:
        flag = 0
        break
    if flag:
      print(i)
      break
  else:
    print(-1)

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

S, C = [], []
for i in range(M):
  s, c = map(int, input().split())
  S += [s-1]
  C += [str(c)]
  
if N == 1:
  for i in range(10):
    flag = 1
    for m in range(M):
      if i_str[S[m]] != C[m]:
        flag = 0
        break
    if flag:
      print(i)
      break
  else:
    print(-1) 
else:
  for i in range(10**(N-1), 10**N):
    flag = 1
    i_str = str(i)
    for m in range(M):
      if i_str[S[m]] != C[m]:
        flag = 0
        break
    if flag:
      print(i)
      break
  else:
    print(-1)

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

S, C = [], []
for i in range(M):
  s, c = map(int, input().split())
  S += [s-1]
  C += [str(c)]
  
if N == 1:
  for i in range(10):
    flag = 1
    for m in range(M):
      if i_str[S[m]] != C[m]:
        flag = 0
        break
      if flag:
        print(i)
        break
    else:
      print(-1) 
else:
  for i in range(10**(N-1), 10**N):
    flag = 1
    i_str = str(i)
    for m in range(M):
      if i_str[S[m]] != C[m]:
        flag = 0
        break
    if flag:
      print(i)
      break
  else:
    print(-1)

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

S, C = [], []
for i in range(M):
  s, c = map(int, input().split())
  S += [s-1]
  C += [str(c)]
  
if N == 1:
  for i in range(10):
    flag = 1
  for m in range(M):
      if i_str[S[m]] != C[m]:
        flag = 0
        break
    if flag:
      print(i)
      break
  else:
    print(-1) 
else:
  for i in range(10**(N-1), 10**N):
    flag = 1
    i_str = str(i)
    for m in range(M):
      if i_str[S[m]] != C[m]:
        flag = 0
        break
    if flag:
      print(i)
      break
  else:
    print(-1)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
N_str = str(N)
flag = 1
kettei = [-1 for i in range(N)]
for i in range(M):
  s, c = map(int, input().split())
  if kettei[s-1] == -1:
    kettei[s-1] = c
  elif kettei[s-1] != c:
    flag = 0
if kettei[0] == 0 :
  flag = 0
    
ans = ""

for i in range(N):
  if kettei[i] == -1:
    ans += "1"
  else:
    ans += kettei[i]
if flag:
  print(ans)
else:
  print(-1)
Problem p02765 (python)

Fixed submission:
N, R = map(int, input().split())
if N >= 10:
  print(R)
else:
  print(R + 100 * (10 - N))

Buggy submission (verdict: Runtime Error):
N, R = map(int, input().split())
if N >= 10:
  print(R)
else:
  print(R - 100 * (10−N))
Problem p02767 (python)

Fixed submission:
N= int(input())
X = list(map(int, input().split()))
mean = round(sum(X)/N)
ans = 0 
for i in range(N):
  ans += (X[i] - mean)**2
  
print(ans)

Buggy submission (verdict: Runtime Error):
N= int(input())
X = list(map(int, input().split()))
mean = X.sum()/N
ans = 0 
for i in range(N):
  ans += (X[i] - mean)**2
  
print(ans)

Buggy submission (verdict: Runtime Error):
N= int(input())
X = list(map(int, input().split()))
mean = X.sum()/N
ans = 0 
for i in range(N):
  ans += (X[i] - mean)**2
  
print(ans)
Problem p02768 (python)

Fixed submission:
from functools import reduce
  
def comb(n, k, p):
  """power_funcを用いて(nCk) mod p を求める"""
  a = reduce(lambda x,y: x*y%p, range(n,n-k,-1))
  b = reduce(lambda x,y: x*y%p, range(1,k+1))
  return (a*pow(b, p-2, p))%p
  
n, a, b = map(int, input().split())

MOD = 10**9 + 7


print((pow(2,n,MOD) - 1 - comb(n, a, MOD) - comb(n, b, MOD))%MOD)

Buggy submission (verdict: Runtime Error):
def power_func(a, b, p):
  """a^b mod p を求める"""
  if b==0: return 1
  if b%2==0:
    d=power_func(a,b//2,p)
    return d*d %p
  if b%2==1:
    return (a*power_func(a,b-1,p ))%p
  
def comb(n, k, p):
  """power_funcを用いて(nCk) mod p を求める"""
  from math import factorial
  if n<0 or k<0 or n<k: return 0
  if n==0 or k==0: return 1
  a = factorial(n) % p
  b = power_func(factorial(k) % p, p-2, p)
  c = power_func(factorial(n-k) % p, p-2, p)
  return (a*b*c)%p
  
n, a, b = map(int, input().split())

MOD = 10**9 + 7


print((pow(2,n,MOD) - 1 - comb(n, a, MOD) - comb(n, b, MOD))
Problem p02797 (python)

Fixed submission:
N, K, S =  map(int, input().split())

if S == 10**9:
    print(' '.join(map(str, ([S]*K + [1]*(N-K)))))
else:
    print(' '.join(map(str, ([S]*K + [S+1]*(N-K)))))

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

if S = 10**9:
    print(' '.join(map(str, ([S]*K + [1]*(N-K)))))
else:
    print(' '.join(map(str, ([S]*K + [S+1]*(N-K)))))
Problem p02802 (python)

Fixed submission:
N, M = map(int, input().split())
ans1 = 0
ans2 = 0
Q = [0] * N
wrong = [0] * N
for i in range(M):
  p, S = map(str, input().split())
  p = int(p) - 1
  if Q[p] == 0 and S == "AC":
    ans1 += 1
    ans2 += wrong[p]
    Q[p] = 1
  elif S == "WA":
    wrong[p] += 1
print(ans1,ans2)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
ans = 0
Q = [0] * N
wrong = [0] * N
for i in (M):
  p, S = map(str, input().split())
  p = int(p) - 1
  if Q[p] == 0 and S == "AC":
    ans += wrong[p]
    Q[p] = 1
  elif S == "WA":
    wrong[p] += 1
print(ans)
Problem p02811 (python)

Fixed submission:
K, X = map(int, input().split())
if K*500 >= X:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
K, X = map(int, input().split())
if K*500 => X:
  print("Yes")
else:
  print("No")
Problem p02848 (python)

Fixed submission:
N = int(input())
st = input()
ans_st = ""

for i in range(len(st)):
  ch_ord = ord(st[i])
  if ch_ord + N > 90:
    ans_st += chr(ch_ord + N - 26)
  else:
    ans_st += chr(ch_ord + N)
print(ans_st)

Buggy submission (verdict: Runtime Error):
N = int(input())
st = input()
ans_st = ""

for i in range(N):
  ch_ord = ord(st[i])
  if ch_ord + N > 122:
    ans_st += chr(ch_ord + N - 26)
  else:
    ans_st += chr(ch_ord + N)
print(ans_st)
Problem p02899 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
li = []
for i, a in enumerate(A):
  li += [[a,i]]
  
li.sort()

for i in range(N):
  print(li[i][1]+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map, input().split())
li = []
for i, a in enumerate(A):
  li += [[a,i]]

li.sort()
for i in range(N):
  print(li[1])
Problem p02913 (python)

Fixed submission:
N = int(input())
S = input()
from collections import deque

def is_ok(l):
    hs = set()
    q = deque()
    for i in range(N-l+1):
        h = S[i:i+l]
        if h in hs:
            return True
        q.append(h)
        if len(q) >= l:
            hs.add(q.popleft())
    return False

ok = 0
ng = N//2+1
while ng-ok > 1:
    m = (ng+ok)//2
    if is_ok(m):
        ok = m
    else:
        ng = m
print(ok)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
length = N//2

while length:
  strings = [S[i:i+length] for i in range(N-length+1)]
  print(length, strings)
  for i in range(N-length+1):
    for j in range(i+length,N-length+1):
      if S[i:i+length] == S[j:j+length]:
        print(length)
        break
  
  length -= 1
else:
  print(0)