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

Fixed submission:
import sys
sys.setrecursionlimit(10**9)

global color 
global adlist
color = [0 for _ in range(100001)] 

def make_adlist(N, uvw):
  global adlist
  adlist = [[] for _ in range(N)]
  for u, v, w in uvw:
    adlist[u-1] += [[v-1, w%2]]
    adlist[v-1] += [[u-1, w%2]]
  return adlist 

def dfs(v, c):
  global color
  global adlist
  color[v] = c
  for next_v, w in adlist[v]:
    if color[next_v] != 0:
      continue
    if color[next_v] == 0 and w % 2 != 0:
      dfs(next_v, -c)
    elif color[next_v] == 0 and w % 2 == 0:
      dfs(next_v, c)

  return 


def main():
  N = int(input())
  uvw = [list(map(int, input().split())) for _ in range(N-1)]
  adlist = make_adlist(N, uvw)
  dfs(0, 1)
  for c in color[:N]:
    if c == 1:
      print(1)
    else:
      print(0)


if __name__ == "__main__":
  main()

Buggy submission (verdict: Runtime Error):
N = int(input())
graph = [[] for _ in range(N)]
for _ in range(N-1):
  u, v, w = map(int, input().split())
  u -= 1
  v -= 1
  graph[u] += [[v, w]]
  graph[v] += [[u, w]]

color = [-1]*N 
def dfs(v, c):
  color[v] = c
  for next_v, w in graph[v]:
    if color[next_v] == c and w % 2 != 0:
      return 
    if color[next_v] == -1 and w % 2 == 0:
      dfs(next_v, c)# == False:
      #return False
    if color[next_v] == -1 and w % 2 != 0:
      dfs(next_v, abs(1-c)) #== False:
      #return False
  return True

dfs(0, 0)
for c in color:
  print(c)

Buggy submission (verdict: Runtime Error):
N = int(input())
graph = [[] for _ in range(N)]
for _ in range(N-1):
  u, v, w = map(int, input().split())
  u -= 1
  v -= 1
  graph[u] += [[v, w]]
  graph[v] += [[u, w]]

color = [-1]*N 
def dfs(v, c):
  color[v] = c
  for next_v, w in graph[v]:
    if color[next_v] == c and w % 2 != 0:
      return False
    if color[next_v] == -1 and w % 2 == 0 and dfs(next_v, c) == False:
      return False
    if color[next_v] == -1 and w % 2 != 0 and dfs(next_v, abs(1-c)) == False:
      return False
  return True

dfs(0, 0)
for c in color:
  print(c)

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

global color 
global adlist
color = [0 for _ in range(100001)] 

def make_adlist(N, uvw):
  global adlist
  adlist = [[] for _ in range(N)]
  for u, v, w in uvw:
    adlist[u-1] += [[v-1, w]]
  return adlist 

def dfs(v, c, dis):
  global color
  color[v] = c
  for next_v, w in adlist[v]:
    if color[next_v] == c:
      return False
    if color[next_v] == 0 and (dis+w) % 2 != 0:
      return dfs(next_v, -c, dis+w)
    elif color[next_v] == 0 and (dis+w) % 2 == 0:
      return dfs(next_v, c, dis+w)
    elif color[next_v] == -c and (dis+w) % 2 == 0:
      return True 
    else:
      return False

  return True


def main():
  N = int(input())
  uvw = [list(map(int, input().split())) for _ in range(N-1)]
  for i in range(N):
    if color[i] == 0:
      dfs(i, 1, 0)
  for c in color[:N]:
    if c == 1:
      print(1)
    else:
      print(0)


if __name__ == "__main__":
  main()
Problem p03076 (python)

Fixed submission:
li = [int(input()) for _ in range(5)]
li_mod = [[i % 10, i] for i in li if i % 10 != 0]
li_mod_r = [i for i in li if i % 10 == 0]
li_mod = sorted(li_mod, reverse = True)
time = 0
if li_mod != []:
  for lis in li_mod[:-1]:
    time += lis[1] + (10-lis[0])
  time += li_mod[-1][1]
if li_mod_r != []:
  time += sum(li_mod_r)
#time += li_mod[-1][1]
print(time)

Buggy submission (verdict: Runtime Error):
li = [int(input()) for _ in range(5)]
li_mod = [[i % 10, i] for i in li if i % 10 != 0]
li_mod_r = [i for i in li if i % 10 == 0]
li_mod = sorted(li_mod, reverse = True)
time = 0
for lis in li_mod[:-1]:
  time += lis[1] + (10-lis[0])
time += sum(li_mod_r)
time += li_mod[-1][1]
print(time)
Problem p03086 (python)

Fixed submission:
S = list(input())
m = 0
count = 0
for i in range(len(S)):
    for j in range(i, len(S)):
        count = 0
        #switch = False
        for s in list(S[i:j+1]):
            #print(s, list(S[i:j+1]), count)
            if s in ['A', 'G', 'T', 'C']:
                count += 1
            else:
                if m <= count:
                    m = count
                count = 0
                switch = True
            if m <= count:
                m = count


print(m)

Buggy submission (verdict: Runtime Error):
for i in range(len(S)):
    for j in range(i, len(S)):
        count = 0
        print(list(S[i:j+1]))
        for s in list(S[i:j+1]):
            if s in ['A', 'G', 'T', 'C']:
                count += 1
            else:
                if m <= count:
                    m = count
                count = 0
print(m)
Problem p03262 (python)

Fixed submission:
import fractions
from functools import reduce

def gcd(numbers):
    return reduce(fractions.gcd, numbers)

city_num, ori = list(map(int, input().split()))
cityies = list(map(int, input().split()))
stan = cityies[0]
difference = [abs(ori-stan)]

if len(cityies) > 1:
    for city in cityies[1:]:
        diff = abs(city - stan)
        difference.append(diff)

max_num = gcd(difference)
print(max_num)

Buggy submission (verdict: Runtime Error):
import fractions
from functools import reduce

def gcd(numbers):
    return reduce(math.gcd, numbers)

city_num, ori = list(map(int, input().split()))
cityies = list(map(int, input().split()))
stan = cityies[0]
difference = [abs(ori-stan)]
print(difference)
print(gcd([2, 4, 6, 8]))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd(numbers):
    return reduce(math.gcd, numbers)

city_num, ori = list(map(int, input().split()))
cityies = list(map(int, input().split()))
stan = cityies[0]
difference = [abs(ori-stan)]
print(difference)
print(gcd([2, 4, 6, 8]))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd(numbers):
    return reduce(math.gcd, numbers)

city_num, ori = list(map(int, input().split()))
cityies = list(map(int, input().split()))
stan = cityies[0]
difference = [abs(ori-stan)]
if len(cityies) > 1:
    for city in cityies[1:]:
        diff = abs(city - stan)
        difference.append(diff)

max_num = gcd(difference)
print(max_num)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd(numbers):
    return reduce(math.gcd, numbers)

city_num, ori = list(map(int, input().split()))
cityies = list(map(int, input().split()))
stan = cityies[0]
difference = [abs(ori-stan)]
for city in cityies[1:]:
    diff = abs(city - stan)
    difference.append(diff)

max_num = gcd(difference)
print(max_num)
Problem p03282 (python)

Fixed submission:
import math
S = list(map(int, input()))
K = int(input())
count = 0
after_S = 0
days = 5000000000000000-1
for n in S:
    if n == 1:
        count += 1
    else:
        break
if count > 0 and math.log(count) >= math.log(K):
    print(1)
else:
    for n in S:
        after_S += days * math.log(n)
        if after_S >= math.log(K):
            print(n)
            break

Buggy submission (verdict: Runtime Error):

S = list(map(int, input()))
K = int(input())
if S[0] == 1:
    print(S[1])
else:
    print(S[0])
Problem p03290 (python)

Fixed submission:
import math
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(d)]
n = sum([pc[i][0] for i in range(d)])
prob = []
comp = [0 for _ in range(len(pc))]
for i in range(len(pc)):
    prob += [100*(i+1)] * (pc[i][0])
for i in range(len(pc)):
    comp[i] = pc[i][0]
ans = float('inf')

for i in range(2 ** d):
    score = 0
    num = 0
    max_num = 0
    for j in range(d):
        #print("score:", score, "num:", num, "j:", j, "i:", i)
        if (i>>j) & 1:
            score += 100*(j+1)*pc[j][0] + pc[j][1]
            num += pc[j][0]
            
        else:
            max_num = max(max_num, j+1)
            #if max_num == j+1:
                #max_num -= 1 
    if score < g:
        add_n = math.ceil((g-score)/(100*(max_num)))
        #if i == 24:
            #print(num, add_n, score, max_num)
        #print("add_n:", add_n, max_num)
        if add_n < pc[max_num-1][0]:
            num += add_n
            score += add_n * (100*(max_num+1))

    #print(score, num)
    if score >= g:
        ans = min(ans, num)
        #print(num,i)

print(ans)

Buggy submission (verdict: Runtime Error):
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(d)]
ans = []
for i in range(2**d):
    tmp = 0
    cnt = 0
    gg = g 
    bag = []
    for j in range(d):
        if (i>>j)&1:
            # すべて解く
            tmp += 100*(j+1)*pc[j][0] + pc[j][1]
            cnt += pc[j][0]
            bag += [j]

    if tmp > gg:
        ans += [cnt]
    else:
        gg -= tmp 
        for j in range(d-1, -1, -1):
            if j not in bag:
                c = (gg-1)//(100*(j+1))+1
                if 0 <= c <= pc[j][0]:
                    gg -= 100*(j+1)*c + pc[j][1]
                    cnt += c 
                if gg <= 0:
                    ans += [cnt]
                    break
        
print(min(ans))
Problem p03401 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.insert(0, 0)
A.append(0)
a = 0
cost = 0
for i in A:
    b = i
    cost += abs(a-b)
    a = b
cost += abs(A[-1])

ori = cost
for i in range(1, len(A)-1):
    cost += abs(A[i-1]-A[i+1])
    cost -= abs(A[i-1]-A[i])+abs(A[i+1]-A[i])
    print(cost)
    cost  = ori

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

def dd_cost(L):
    c = 0
    M = L[:]
    for i in range(len(L)):
        if L[i] < 0:
            L[i] = -1
        elif L[i] > 0:
            L[i] = 1
        else:
            L[i] = 0
    L = np.array(L)
    L = L[1:]-L[:-1]
    for i in range(len(L)):
        if L[i] < 0 or L[i] > 0:
            c += abs(M[i]) * 2
    c += abs(M[-1]) * 2
    print(c)

for i in range(len(A)):
    dd_cost(A[:i]+A[i+1:])
Problem p03436 (python)

Fixed submission:
from collections import deque
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]
moves = ((1, 0), (-1, 0), (0, 1), (0, -1))
cnt = [[float('inf') for _ in range(w)] for _ in range(h)]
cnt[0][0] = 0

def bfs():
    q = deque([(0, 0)])
    while q:
        y, x = q.popleft()
        for dy, dx in moves:
            if 0 <= y+dy < h and 0 <= x+dx < w and s[y+dy][x+dx] != '#' and cnt[y+dy][x+dx] == float('inf'):
                q.append([y+dy, x+dx])
                cnt[y+dy][x+dx] = cnt[y][x] + 1
    
bfs()
if cnt[h-1][w-1] != float('inf'):
    short_path = cnt[h-1][w-1]
    ans = 0
    ans += short_path + 1
    for i in range(h):
        for j in range(w):
            if s[i][j] == '#':
                ans += 1

    ans = h*w - ans 
    print(ans)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
from collections import deque
H, W = map(int, input().split())
s = [list(input()) for _ in range(H)]
moves = ((1, 0), (0, 1), (0, -1), (-1, 0))

def bfs(sy, sx):
    q = deque([[sy, sx]])
    dist = [[float('inf')]*(W) for _ in range(H)]
    dist[sy][sx] = 0

    while q:
        y, x = q.popleft()
        for dy, dx in moves:
            ny = y + dy
            nx = x + dx
            if 0 <= ny < H and 0 <= nx < W and s[ny][nx] == '.' and dist[ny][nx] == float('inf'):
                dist[ny][nx] = dist[y][x] + 1
                q += [[ny, nx]]

    return dist

d = bfs(0, 0)

if d[-1][-1] == float('inf'):
    print(-1)
    exit()

ans = H*W 
for i in range(H):
    for j in range(W):
        if s[i][j] == '#':
            ans -= 1

ans -= d[-1][-1] + 1
print(ans
Problem p03504 (python)

Fixed submission:
N, C = map(int, input().split())
stc = [list(map(lambda x:int(x), input().split())) for _ in range(N)]

stc = sorted(stc, key=lambda x:(x[2], x[0], x[1]))
l = []
i = N-1
s, t, c = 0, 0, 0
while i >= 0:
    if stc[i][2] == stc[i-1][2] and stc[i][0] == stc[i-1][1]:
        s = stc[i-1][0]
        if t == 0:
            t = stc[i][1]
        c = stc[i][2]
    else:
        if s != 0:
            l += [[s, t, c]]
            s, t, c = 0, 0, 0
        else:
            l += [stc[i]]

    i -= 1
        
imos = [0]*(2*10**5+1)
for s, t, c in l:
    imos[s-1] += 1
    imos[t] -= 1

for i in range(len(imos)-1):
    imos[i] = imos[i] + imos[i-1]

print(max(imos))

Buggy submission (verdict: Runtime Error):
N, C = map(int, input().split())
stc = [list(map(lambda x:2*int(x), input().split())) for _ in range(N)]

stc = sorted(stc, key=lambda x:(x[2], x[0], x[1]))
l = []
i = N-1
s, t, c = 0, 0, 0
while i >= 0:
    if stc[i][2] == stc[i-1][2] and stc[i][0] == stc[i-1][1]:
        s = stc[i-1][0]
        if t == 0:
            t = stc[i][1]
        c = stc[i][2]
    else:
        if s != 0:
            l += [[s, t, c]]
            s, t, c = 0, 0, 0
        else:
            l += [stc[i]]

    i -= 1
        
imos = [0]*(10**5+1)
for s, t, c in l:
    imos[s-1] += 1
    imos[t] -= 1

for i in range(len(imos)-1):
    imos[i] = imos[i] + imos[i-1]

print(max(imos))
Problem p03549 (python)

Fixed submission:
n, m = map(int, input().split())
t = 1900*m + 100*(n-m)
p = (2)**m
print(t*p)

Buggy submission (verdict: Runtime Error):

#include <bits/stdc++.h>
using namespace std;

int main() {

  int n, m;
  cin >> n >> m;
  cout << (1900*m + 100 * (n-m)) * pow(2, m);
}
Problem p03579 (python)

Fixed submission:
from collections import Counter
import sys
sys.setrecursionlimit(1000000)

global color 
global adlist

def make_adlist(N, AB):
  global adlist
  for a, b in AB:
    adlist[a] += [b]
    adlist[b] += [a]

def dfs(v, c):
  color[v] = c
  for u in adlist[v]:
    if color[u] == c:
      return False
    if color[u] == 0 and dfs(u, -c)==False:
      return False
  return True

def main():
  global color 
  global adlist
  N, M = map(int, input().split())
  AB = [list(map(lambda x:int(x)-1, input().split())) for _ in range(M)]
  color = [0 for _ in range(N)]
  adlist = [[] for _ in range(N)]
  make_adlist(N, AB)
  if dfs(0, 1):
    B = color.count(-1)
    W = color.count(1)
    print(B*W-M)
  else:
    print(N*(N-1)//2-M)

if __name__ == "__main__":
  main()

Buggy submission (verdict: Runtime Error):

import numpy as np 
n, m = map(int, input().split())
g = [[] for _ in range(n)]
for _ in range(m):
  u, v = map(lambda x: int(x)-1, input().split())
  g[u] += [v]
  g[v] += [u]

col = [0]*n 
def dfs(u, c):
  col[u] = c 
  for v in g[u]:
    if col[v] == c:
      return False
    if (col[v] == 0 and not dfs(v, -c)):
      return False

  return True


if dfs(0, 1):
  col = np.array(col)
  b = len(col[col==1])
  w = len(col) - b
  print(b*w-m)
else:
  print(n*(n-1)//2-m)
Problem p03625 (python)

Fixed submission:
from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
d = defaultdict(int)
for i in a:
  d[i] += 1
l = [0, 0]
for k, v in d.items():
  if v >= 4 and k >= max(l):
    l = [k, k]
  elif v >= 2 and k >= min(l):
    l = sorted(l)
    l[0] = k
print(l[0]*l[1])

Buggy submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
ca = Counter(A)
ca = sorted(ca.items(), key=lambda x:-x[0])
cnt = 0
m = []
for k, v in ca:
  if v >= 2:
    cnt += 1
    m += [k]
  if cnt >= 2:
    break

print(m[0]*m[1])
Problem p03645 (python)

Fixed submission:
from collections import defaultdict
n, m = map(int, input().split())
bridges = [list(map(int, input().split())) for _ in range(m)]
first_bridge = []
second_bridge = []
bri_dict = defaultdict(list)
for bridge in bridges:
  bri_dict[bridge[0]].append(bridge[1])
  bri_dict[bridge[1]].append(bridge[0])
for bridge in bridges:
  if bridge[1] == n:
    second_bridge.append(bridge[0])

flag = False
for island in second_bridge:
  if 1 in bri_dict[island]:
    flag = True
  
if flag:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
graph = [[] for _ in range(N)]
for _ in range(M):
  a, b = map(lambda x:int(x)-1, input().split())
  graph[a] += [b]
  graph[b] += [a]
dist = [float('inf')]*N

def dfs(u, pre, cnt):
  dist[u] = cnt
  for v in graph[u]:
    if v != pre and cnt+1 < dist[v]:
      dfs(v, u, cnt+1)

    
dfs(0, -1, 0)
if 0 < dist[N-1] <= 2:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')
Problem p03681 (python)

Fixed submission:
import math
n, m = map(int, input().split())
MOD = 1000000007
count_n = 0
count_m = 0
count = 0
if abs(n-m) == 1:
  count_n = math.factorial(n) % MOD
  count_m = math.factorial(m) % MOD
  count = count_m * count_n % MOD
elif abs(n-m) == 0:
  count_n = math.factorial(n) % MOD
  count_m = math.factorial(m) % MOD
  count = 2 * count_m * count_n % MOD
else:
  count = 0

print(count % MOD)

Buggy submission (verdict: Runtime Error):
import math
n, m = map(int, input().split())
MOD = 1000000007
a, b = n, m
count_n = n
count_m =m
count = 0
if abs(n-m) == 1:
  count_n = math.factorial(n) / MOD
  count_m = math.factorial(m) / MOD
  count = count_m * count_n % MOD
elif abs(n-m) == 0:
  count_n = math.factorial(n) % MOD
  count_m = math.factorial(m) % MOD
  count = 2 * count_m * count_n % MOD
else:
  count = 0

print(count % MOD)
Problem p03682 (python)

Fixed submission:
import itertools
import heapq
from heapq import heappush, heappop
global G, inp_x, inp_y

def input_graph(N):
  global G, inp_x, inp_y
  inp_x = []
  inp_y = []
  for i in range(N):
    x, y = map(int, input().split())
    inp_x.append((x, i))
    inp_y.append((y, i))
  inp_x.sort()
  inp_y.sort()
  for i in range(N-1):
    xa = inp_x[i][1]
    xb = inp_x[i+1][1]
    ya = inp_y[i][1]
    yb = inp_y[i+1][1]
    cost_x = abs(inp_x[i][0]-inp_x[i+1][0])
    cost_y = abs(inp_y[i][0]-inp_y[i+1][0])
    G[xa] += [(cost_x, xb)]
    G[xb] += [(cost_x, xa)]
    G[ya] += [(cost_y, yb)]
    G[yb] += [(cost_y, ya)]

  
def prim(V):
  global G, used
  edgelist = []
  for e in G[0]:
    heappush(edgelist, e)
  used[0] = True
  res = 0
  while edgelist:
    minedge = heappop(edgelist)
    if used[minedge[1]]:
      continue 
    v = minedge[1]
    used[v] = True 
    for e in G[v]:
      if not used[e[1]]:
        heappush(edgelist, e)
    res += minedge[0]
  return res

def main():
  global G, used
  N = int(input())
  G = [[] for _ in range(N)]
  used = [False for _ in range(N)]
  input_graph(N)
  print(prim(N))

if __name__ == "__main__":
  main()

Buggy submission (verdict: Runtime Error):
import itertools
import heapq
from heapq import heappush, heappop
global G

def input_graph(N, xy):
  comb_list = list(itertools.combinations(xy, 2))
  for i in range(N*(N-1)//2):
    a, b = comb_list[i]
    an, ax, ay = a 
    bn, bx, by = b 
    cost = min(abs(ax-bx), abs(ay-by))
    G[an] += [(cost, bn)]
    G[bn] += [(cost, an)]

def prim(V):
  global G, used 
  edgelist = []
  for e in G[0]:
    heappush(edgelist, e)
  used[0] = True
  res = 0
  while edgelist:
    minedge = heappop(edgelist)
    if used[minedge[1]]:
      continue 
    v = minedge[1]
    used[v] = True 
    for e in G[v]:
      if not used[e[1]]:
        heappush(edgelist, e)
    res += minedge[0]
  return res

def main():
  global G, used
  N = int(input())
  xy = []
  for i in range(N):
    xy += [[i, *list(map(int, input().split()))]]
  G = [[] for _ in range(N)]
  used = [False for _ in range(N)]
  input_graph(N, xy)
  print(prim(N))

if __name__ == "__main__":
  main()
Problem p02760 (python)

Fixed submission:
A = []
for i in range(3):
  a = input().split()
  a = [int(num) for num in a]
  A.append(a)

N = int(input())
b = [int(input()) for i in range(N)]

for i in range(3):
  for j in range(3):
    if b.count(A[i][j]) != 0:
      A[i][j] = 0
    else:
      continue

def Agetraw(j):
    Ans = [int(A[i][j]) for i in range(3)]
    return(Ans)

if (sum(A[0])==0 or sum(A[1])==0 or sum(A[2])==0 
    or sum(Agetraw(0))==0 or sum(Agetraw(1))==0 or sum(Agetraw(2))==0 
    or A[0][0]+A[1][1]+A[2][2]==0 or A[0][2]+A[1][1]+A[2][0]==0):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
A = []
for i in range(3):
  a = input().split()
  a = [int(num) for num in a]
  A.append(a)

N = int(input())
b = [int(input()) for i in range(N)]

for i in range(3):
  for j in range(3):
    if b.count(A[i][j]) != 0:
      A[i][j] = 0
    else:
      continue

if A[1][1] == 0:
  if A[0][0]==A[2][2]==0 or A[0][2]==A[2][0]==0:
    print("Yes")
  else:
    print("No")
elif A[1][1] != 0:
  if sum(A[0])==0 or sum(A[2])==0 or sum(A[:][0])==0 or sum(A[:][2]==0):
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
A = []
for i in range(3):
  a = input().split()
  a = [int(num) for num in a]
  A.append(a)
print(A)

N = int(input())
b = [int(input()) for i in range(N)]
print(b)

for i in range(3):
  for j in range(3):
    if b.count(A[i][j]) != 0:
      A[i][j] = 0
    else:
      continue

if A[1][1] == 0:
  if A[0][0]==A[2][2]==0 or A[0][2]==A[2][0]==0:
    print("Yes")
  else:
    print("No")
elif A[1][1] != 0:
  if sum(A[0])==0 or sum(A[2])==0 or sum(A[:][0])==0 or sum(A[:][2]==0):
    print("Yes")
  else:
    print("No")
Problem p02848 (python)

Fixed submission:
N = int(input())
S = list(input())
alphabet = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
new_S = []
for i in range(len(S)):
  s = alphabet.index(S[i])+N
  if s >= 26 :
    s -= 26
  new_S.append(alphabet[s])
print("".join(new_S))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())
alphabet = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
new_S = []
for i in range(len(S)):
  s = alphabet.index(S[i])+N
  new_S.append(alphabet[s])
print("".join(new_S))
Problem p02922 (python)

Fixed submission:
x = input().split()
A, B = int(x[0]), int(x[1])
n = 1
t = 0
while n < B:
  n += A - 1
  t += 1
print(t)

Buggy submission (verdict: Runtime Error):
x = input().split()
A, B = x[0], x[1]
n = 1
t = 0
while n <= B:
  n += A - 1
  t += 1
print(t)
Problem p02957 (python)

Fixed submission:
x = input().split()
A, B = [int(num) for num in x]
K = (A+B)/2
if int(K) == K:
  print(int(K))
else:
  print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
x = input().split()
A, B = [int(num) for num in x]
K = (A+B)/2
if int(K) = K:
  print(K)
else:
  print("IMPOSSIBLE")
Problem p02981 (python)

Fixed submission:
l = input().split()
N, A, B = [int(i) for i in l]
train = N * A
m = min(train, B)
print(m)

Buggy submission (verdict: Runtime Error):
l = input().split()
N, A, B = [int(num) for i in l]
NA = N * A
print(min(NA,B))
Problem p03076 (python)

Fixed submission:
lst = [input() for i in range(5)]
d = [int(num) for num in lst]
lst_one = [int(list(i)[-1]) for i in lst]
if lst_one.count(0) == len(lst_one):
  print(sum(d))
else:
  if lst_one.count(0) == 0:
    idx = lst_one.index(min(lst_one))
  else:
    no_zero = [i for i in lst_one if i != 0]
    m = min(no_zero)
    idx = lst_one.index(m)

  x = d[idx]
  del d[idx]

  for i in range(len(d)):
    if d[i] % 10 != 0:
      d[i] = 10*(int((d[i]/10))+1)
    else:
      continue
  print(sum(d) + x)

Buggy submission (verdict: Runtime Error):
lst = [input() for i in range(5)]
d = [int(num) for num in lst]
lst_one = [int(list(i)[-1]) for i in lst]

if lst_one.count(0) == 0:
  idx = lst_one.index(min(lst_one))
else:
  no_zero = [i for i in lst_one if i != 0]
  m = min(no_zero)
  idx = lst_one.index(m)

x = d[idx]
del d[idx]

for i in range(len(d)):
  if d[i] % 10 != 0:
    d[i] = 10*(int((d[i]/10))+1)
  else:
    continue
print(sum(d) + x)

Buggy submission (verdict: Runtime Error):
d = [input() for i in range(5)]
p = [int(list(i)[-1]) for i in d]
if p.count(0) == 0:
  n = p.index(min(p))
else:
  q = sorted(p)
  while q.count(0) != 0:
    q.remove(0)
  m = q[0]
  n = p.index(m)
  
x = int(d[n])
del d[n]

for i in range(len(d)):
  if list(d[i])[-1] == "0":
    continue
  else:
    d[i] = int(d[i])
    d[i] = (int(d[i]/10)+1)*10
    
d = [int(num) for num in d]

print(sum(d)+x)
Problem p03086 (python)

Fixed submission:
S = list(input())
length = []
t = 0
for i in range(len(S)):
  if S[i] == "A" or S[i]=="C" or S[i]=="G" or S[i]=="T":
    t += 1
  else:
    length.append(t)
    t = 0
length.append(t)
print(max(length))

Buggy submission (verdict: Runtime Error):
S = list(input())
length = []
t = 0
for i in range(len(S)):
  if S[i]=="A" or S[i]=="C" or S[i]=="G" or S[i]=="T":
    t += 1
  else:
    length.append(t)
    t = 0
print(max(length))