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

Fixed submission:
n = int(input())
if n== 1:
  print(1)
  exit()
pos = []
diff = []
for _ in range(n):
  x,y = map(int,input().split())
  for px,py in pos:
    diff.append((x-px, y-py))
    diff.append((px-x, py-y))
  pos.append((x,y))
from collections import Counter
diff = Counter(diff).most_common()
x,y = diff[0][0]
count = diff[0][1]
if x== y == 0:
  x,y = diff[1][0]
  count = diff[1][1]
print(n-count)

Buggy submission (verdict: Runtime Error):
n = int(input())
pos = []
diff = []
for _ in range(n):
  x,y = map(int,input().split())
  for px,py in pos:
    diff.append((x-px, y-py))
    diff.append((px-x, py-y))
  pos.append((x,y))
from collections import Counter
diff = Counter(diff).most_common()
x,y = diff[0][0]
count = diff[0][1]
if x== y == 0:
  x,y = diff[1][0]
  count = diff[1][1]
print(n-count)
Problem p03031 (python)

Fixed submission:
n,m = map(int,input().split())
ss = []
for _ in range(m):
  s = list(map(int,input().split()))[1:]
  ss.append(s)
ps = list(map(int,input().split()))

def get_bit(i,n):
  res = []
  for _ in range(n):
    res.append(i%2)
    i = int(i/2)
  return res[::-1]

ans = 0
for i in range(2**n):
  flags = get_bit(i,n)
  for j in range(m):
    count = 0
    for k in ss[j]:
      count += flags[k-1]
    if count %2 == ps[j]:
      continue
    else:
      break
  else:
    ans += 1
print(ans)

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

def get_bit(i,n):
  res = []
  for i in range(n):
    res.append(i%2)
    i = int(i/2)
  return res[::-1]

ans = 0
for i in range(2**n):
  flags = get_bit(i,n)
  for j in range(m):
    count = 0
    for k in ss[j]:
      count += flags[k-1]
    if count %2 == ps[j]:
      continue
    else:
      break
  else:
    ans += 1
print(ans)
Problem p03037 (python)

Fixed submission:
n,m = map(int,input().split())
ans = [0 for _ in range(n+2)]
for i in range(m):
  l,r = map(int,input().split())
  ans[l] += 1
  ans[r+1] += -1
  
from itertools import accumulate
ans = list(accumulate(ans))
count = 0
for a in ans:
  if a == m:
    count +=1
print(count)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
ans = [0 for _ in range(n+1)]
for i in range(m):
  l,r = map(int,input().split())
  ans[l] += 1
  ans[r+1] += -1
  
from itertools import accumulate
ans = list(accumulate(ans))
count = 0
for a in ans:
  if a == n:
    count +=1
print(count)
Problem p03044 (python)

Fixed submission:
import sys
input = sys.stdin.readline
n = int(input())
d = {}
graph = {i:[] for i in range(n)}
for _ in range(n-1):
  u,v,w = map(int,input().split())
  d[(u-1,v-1)] = w
  graph[u-1].append(v-1)
  graph[v-1].append(u-1)
  
  
color = [-1 for i in range(n)] 
color[0] = 0
from collections import deque
queue =deque([0])

while queue:
  p = queue.popleft()
  color_p = color[p]
  for i in graph[p]:
    if color[i] != -1:
      continue
    else:
      if d[(min(i,p),max(i,p))] %2:
        color[i] = 1 - color_p
      else:
        color[i] = color_p
      queue.append(i)

for i in range(n):
  print(color[i])

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n = int(input())
d = {}
graph = {i:[] for i in range(n)}
for _ in range(n-1):
  u,v,w = map(int,input().split())
  d[(u-1,v-1)] = w
  graph[u-1].append(v-1)
  graph[v-1].append(u-1)
  
  
color = [-1 for i in range(n)] 
color[0] = 0
from itertools import deque
queue =deque([])

while queue:
  p = queue.popleft()
  color_p = color[p]
  for i in range(graph[p]):
    if color[i] != -1:
      continue
    else:
      if d[(min(i,p),max(i,p))] %2:
        color[i] = 1 - color_p
      else:
        color[i] = color_p
      queue.push(i)

for i in range(n):
  print(color[i])

Buggy submission (verdict: Runtime Error):
n = int(input())
graph = [[float('inf') for _ in range(n)] for _ in range(n)]
graph1 = {i:[] for i in range(n)}
for _ in range(n-1):
  u,v,w = map(int,input().slpit())
  graph[u-1][v-1] = w
  graph[v-1][u-1] = w
  graph1[u].append(v)
  graph1[v].append(u)
  
  
color = [-1 for i in range(n)] 
def dfs(i,j):#(child, parent)
  if color[i] != -1:
    return
  if graph[i][j] %2:
    color[i] = 1 -color[j]
  else:
    color[i] = color[j]
  for k in graph1[i]:
    if k ==j:
      continue
    dfs(k,i)
dsf(0,-1)

for i in range(n):
  print(color[i])
Problem p03062 (python)

Fixed submission:
n = int(input())
A = list(map(int,input().split()))
minus = 0
ans = 0
abs_min = float('inf')
for a in A:
  if a < 0:
    minus += 1
  ans += abs(a)
  abs_min = min(abs_min, abs(a))
if minus%2:
  ans -= abs_min*2

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int,input().split()))
minus = 0
ans = 0
abs_min = float('inf')
for a in A:
  if a < 0:
    minus += 1
  ans += abs(a)
  abs_min = min(abs_min, abs(a))
if mins%2:
  ans -= abs_min*2

print(ans)
Problem p03071 (python)

Fixed submission:
a,b  = map(int,input().split())
ans = 0
if a>=b:
  ans += a
  a -= 1
else:
  ans += b
  b-=1

if a>=b:
  ans += a
  a -= 1
else:
  ans += b
  b-=1
  
print(ans)

Buggy submission (verdict: Runtime Error):
a,b  = map(int,input().split())
ans = 0
if a=>b:
  ans += a
  a -= 1
else:
  ans += b
  b-=1

if a=>b:
  ans += a
  a -= 1
else:
  ans += b
  b-=1
  
print(ans)

Buggy submission (verdict: Runtime Error):
a,b  = map(int,input().split())
ans = 0
if a=>b:
  ans += a
  a -= 1
else:
  ans += b
  b-=1

if a=>b:
  ans += a
  a -= 1
else:
  ans += b
  b-=1
  
 print(ans)
Problem p03076 (python)

Fixed submission:
l = [int(input()) for i in range(5)]
rest = []
time = 0
for v in l:
  if v %10 == 0:
    time += v
  else:
    time += int(v/10)*10
    rest.append(v%10)
#print(rest)
if rest != []:
  time += ((len(rest)-1)*10)
  time += min(rest)
print(time)

Buggy submission (verdict: Runtime Error):
l = [int(input()) for i in range(5)]
time = 0
for v in l:
  if v %10 == 0:
    time += v
    l.remove(v)
if l != []:
  m = min(list(map(lambda x:x%10,l)))
  find_min = False
  for v in l:
    if v %10 == m and not find_min:
      time += v
    else:
      time += calc_time(v)
print(time)

def calc_time(t):
  return (int(t/10)+1 )*10

Buggy submission (verdict: Runtime Error):
l = [int(input()) for i in range(5)]
time = 0
for v in l:
  if v %10 == 0:
    time += v
    l.remove(v)
if l == []:
  print(time)
  return
m = min(list(map(lambda x:x%10,l)))
find_min = False
for v in l:
  if v %10 == m && not find_min:
    time += v
  else:
    time += calc_time(v)
print(time)

def calc_time(t):
  return (int(t/10)+1 )*10
Problem p03085 (python)

Fixed submission:
s = input()
dict = {'A':'T','T':'A','G':'C','C':'G'}
print(dict[s])

Buggy submission (verdict: Runtime Error):
s = input()
dict = {'A':'T','T':'A','G':'C','C':'G'}
print(dict(s))
Problem p03086 (python)

Fixed submission:
S = input()
atgc = ['A','T','G','C']
flag = True
count = 0
max = 0

for c in S:
  if (c in atgc):
    flag = True
    if not flag:
      count = 0
    count += 1
    if max < count:
      max = count
  else:
    flag = False
    count = 0
    
print(max)

Buggy submission (verdict: Runtime Error):
s = input()
SENT = ('A','T','G','C')

ans = 0
count = 0
for c in s:
  if c in SENT:
    count += 1
  else:
    ans = max(ans,conut)
    count = 0
else:
  ans = max(ans,count)
  
print(ans)
Problem p03087 (python)

Fixed submission:
n,q = map(int,input().split())
s= input()
ans = [int(s[i:i+2]=='AC') for i in range(n)]
ans = [0] + ans
from itertools import accumulate
ans = list(accumulate(ans))
for _ in range(q):
  l,r = map(int,input().split())
  print(ans[r-1]-ans[l-1])

Buggy submission (verdict: Runtime Error):
n,q = map(int,input().split())
s= input()
ans = [int(s[i:i+2]=='AC') for i in range(n)]
from itertools import accumulate
ans = list(accumulate(ans))
for _ in range(q):
  l,r = map(int,input().split())
  print(ans[r]-ans[l])
Problem p03101 (python)

Fixed submission:
H,W = map(int,input().split())
h,w = map(int,input().split())
print((H-h)*(W-w))

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split)
h,w = map(int,input().split)
print((H-h)*(W-w))

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split)
h,w = map(int,input().split)
print((a-h)*(b-w))

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split)
h,w = map(int,input().split)
print(a*b -a*w-b*h+h*w)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split)
print(a*b -a-b+1)
Problem p03102 (python)

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

import numpy as np
B = np.array(b)
A = np.array(a)
#C = np.ones([N,1])*c
res = np.dot(A,B.T) #+ C
#print(A)
#print(B)
#print(res)
print(np.sum(res > -c))

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

import numpy as np
B = np.array(b).T
A = np.array(a)
C = np.ones([N,1])*c
res = np.dot(A,B) + C
print(np.sum(res > 0))
Problem p03103 (python)

Fixed submission:
n,m = map(int,input().split())
drink=[]
for _ in range(n):
  a,b = map(int,input().split())
  drink.append((a,b))
drink.sort(reverse=1)

ans = 0
while m>0:
  a,b = drink.pop(-1)
  ans += a*min(m, b)
  m -= b
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
drink=[]
for _ in range(n):
  a,b = map(int,input().split())
  drink.append(a,b)
drink.sort(reverse=1)

ans = 0
while m<0:
  a,b = drink.pop(-1)
  ans += a*min(m, b)
  m -= b
print(ans)
Problem p03106 (python)

Fixed submission:
a,b,k = map(int,input().split())
import fractions
n = fractions.gcd(a,b)
divisor = []
for i in range(int(n/2)+1):
  if n % (i+1) == 0:
    divisor.append(i+1)
divisor.append(n)
print(divisor[-k])

Buggy submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
import math
n = math.gcd(a,b)
divisor = []
for i in range(n/2+1):
  if n % (i+1) == 0:
    divisor.append(i+1)
print(divisor[-k])
Problem p03151 (python)

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

C = [A[i] - B[i] for i in range(n)]
C.sort()

if sum(C)<0:
  print(-1)
  exit()
  
ans = 0

from collections import deque
C = deque(C)
c = 0
while C:
  nc = C.popleft()
  if nc >=0:
    break
  c+= nc
  ans += 1
  while c<0:
    c+=C.pop()
    ans += 1
print(ans)

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

C = [A[i] - B[i] for i in range(n)]
C.sort()

if sum(C)<0:
  print(-1)
  exit()
  
ans = 0

for collections import deque
C = deque(C)
c = 0
while 1:
  nc = C.popleft()
  if nc >=0:
    break
  c+= nc
  ans += 1
  while c<0:
    c+=C.popright()
    ans += 1
print(ans)
Problem p03220 (python)

Fixed submission:
n = int(input())
t,a = map(int,input().split())
H = list(map(int,input().split()))
ans = float('inf')
for h in H:
  if abs(a-(t-ans*0.006)) > abs(a-(t-h*0.006)):
    ans = h
print(H.index(ans)+1)

Buggy submission (verdict: Runtime Error):
n = int(input())
t,a = map(int,input().split())
H = list(map(int,input().split()))
ans = float('inf')
for h in H:
  if abs(t-ans*0.006) > abs(t-ans*0.006):
    ans = h
print(H.index(ans)+1)
Problem p03238 (python)

Fixed submission:
n = int(input())
if n == 1:
  print('Hello World')
else:
  print(sum([int(input()) for i in range(2)]))

Buggy submission (verdict: Runtime Error):
n = int(input())
def get_h(pos,cx,cy,H):
  r= H - abs(pos[0]-cx) - abs(pos[1]-cy)
  return r

points = []
for i in range(n):
  x,y,h = map(int,input().split())
  if h == 0:
    continue
  points.append([x,y,h])
  
ans = []
if ans == []:
  for i in range(101):
    for j in range(101):
      d = get_h(points[0],i,j,0)- get_h(points[1],i,j,0)
      if points[0][2]- points[1][2] == d:
        ans.append([i,j])
for k in range(len(points)):
  for l in range(k+1,len(points)):
    for elem in ans[:]:
      i = elem[0]
      j = elem[1]
      if points[k][2] - points[l][2] != abs(points[l][0]-i) + abs(points[l][1]-j)- abs(points[k][0]-i)-abs(points[k][1]-j):
        ans.remove(elem)
h = abs(points[0][0]-ans[0][0])+abs(points[0][1]-ans[0][1]) + points[0][2]
print('{} {} {}'.format(ans[0][0],ans[0][1],h))

Buggy submission (verdict: Runtime Error):
n = int(input())
if n == '1':
  print('Hello World')
else:
  print(map(+,map(int,input().split())))
Problem p03239 (python)

Fixed submission:
n,T = map(int,input().split())
cands = [tuple(map(int,input().split())) for _ in range(n)]
cands.sort()
for c,t in cands:
  if t<= T:
    print(c)
    break
else:
  print('TLE')

Buggy submission (verdict: Runtime Error):
n,t = map(int,input().split())
cands = [tuple(map(int,input().split())) for _ in range(n)]
cands.sort()
for c,t in cands:
  if t<= T:
    print(c)
    break
else:
  print('TLE')
Problem p03241 (python)

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

a = int(m /n)
for i in range(a,0,-1):
  if m % i == 0:
    print(i)
    break

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

a = int(m /n)

for i in range(min(a,m/2),0,-1):
  if m % i == 0:
    print(i)
    break
Problem p03260 (python)

Fixed submission:
a,b = map(int,input().split())
print('Yes') if a*b%2 ==1 else print('No')

Buggy submission (verdict: Runtime Error):
a,b = map(nit,input().split())
print('Yes') if a*b%2 ==1 else print('No')
Problem p03262 (python)

Fixed submission:
n,x = map(int,input().split())
xs = list(map(int,input().split()))
xs.append(x)
xs.sort()
n_xs = []
for i in range(1,n+1):
  n_xs.append(xs[i]-xs[i-1])
import fractions
ans = n_xs[0]
for i in range(1, n):
  ans = fractions.gcd(ans, n_xs[i])
print(ans)

Buggy submission (verdict: Runtime Error):
n,x = map(int,input().split())
xs = list(map(int,input().split()))
xs.append(x)
xs.sort()
n_xs = []
for i in range(1,n):
  n_xs.append(xs[i]-xs[i-1])
import fractions
ans = n_xs[0]
for i in range(1, n-1):
  ans = fractions.gcd(ans, n_xs[i])
print(ans)
Problem p03273 (python)

Fixed submission:
h,w = map(int,input().split())
maze = []
for _ in range(h):
  s = input()
  if s != '.'*w:
    maze.append(s)
h = len(maze)
skip = []
for j in range(w):
  for i in range(h):
    if maze[i][j] == '#':
      break
  else:
    skip.append(j)

for i in range(h):
  for j in range(w):
    if j not in skip:
      print(maze[i][j],end= '')
  print()

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
maze = []
for _ in range(h):
  s = input()
  if s != '.'*w:
    maze.append(s)
h = len(maze)
skip = []
for j in range(w):
  for i in raneg(h):
    if maze[i][j] == '#':
      break
  else:
    skip.append(j)

for i in range(h):
  for j in range(w):
    if j not in skip:
      print(maze[i][j],end= '')
  print()
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())

for c in s:
  if c == '1':
    k -= 1
    if k == 0:
      print(1)
      break
  else:
    print(c)
    break

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())
for int(c) in s:
  if c != 1:
    print(c)
    exit(0)
Problem p03292 (python)

Fixed submission:
As = sorted(list(map(int,input().split())))
print(abs(As[0]-As[1]) + abs(As[1] - As[2]))

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

def func(m,AS):
  ans = 0
  for a in AS:
    ans += (m % a)
  return ans
    
  
ans = 0
for i in range(2,10**5+1):
  a = func(i,AS)
  if a > ans:
    ans = a
print(ans)
Problem p03316 (python)

Fixed submission:
s = input()
n = int(s)
m = 0
for c in s:
  m += int(c)
print('Yes' if n%m==0 else 'No')

Buggy submission (verdict: Runtime Error):
s = input()
n = int(s)
m = 0
for c in range(s):
  m += int(c)
print('Yes' if n%m==0 else 'No')
Problem p03352 (python)

Fixed submission:
x = int(input())
if x==1:
  print(1)
  exit()
ans = 1
for i in range(x, 0, -1):
  m = i
  div = []
  for j in range(2,int(m**0.5)+2):
    if m%j==0:
      count = 0
      while m%j ==0:
        m //= j
        count += 1
      div.append(count)
  if m!= 1:
    div.append(1)
  count = div[0]
  for c in div:
    if c!= count or count ==1:
      break
  else:
    print(i)
    exit()
print(ans)

Buggy submission (verdict: Runtime Error):
x = int(input())
ans = 1
for i in range(x, 0, -1):
  m = i
  div = []
  for j in range(2,int(m**0.5)+2):
    if m%j==0:
      count = 0
      while m%j ==0:
        m //= j
        count += 1
      div.append(count)
  if m!= 1:
    div.append(1)
  count = div[0]
  for c in div:
    if c!= count or count ==1:
      break
  else:
    print(i)
    exit()
print(ans)

Buggy submission (verdict: Runtime Error):
x = int(input())
for i in range(x, 0, -1):
  ans = i
  div = []
  for j in range(2,(x**0.5)+1):
    count = 0
    if i%j ==0:
      while i%j==0:
        i //= j
        count += 1
      div.append(count)
  if len(div) == 1 and div[0] > 1:
    print(ans)
Problem p03356 (python)

Fixed submission:
n,m = map(int,input().split())
P = list(map(int,input().split()))
uf = {i:-1 for i in range(1,n+1)}

def get_p(i):
  while uf[i] != i:
    if uf[i] == -1:
      return i
    i = uf[i]
  return i

for _ in range(m):
  x,y = map(int,input().split())
  if x > y:
    x,y = y,x
  if uf[x]== uf[y] == -1:
    uf[x] = x
    uf[y] = x
  elif uf[x] != -1 and uf[y] != -1:
    p = get_p(x)
    uf[x] = p
    index = y
    while index != uf[index]:
      index = uf[y]
      uf[y] = p
      y = index
    else:
      uf[index] = p
  else:
    if uf[x] == -1:
      p = get_p(y)
    else:
      p = get_p(x)
    uf[x] = p
    uf[y] = p

ans = 0  
for i, p in enumerate(P):
  if get_p(i+1) == get_p(p):
    ans += 1
print(ans)

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

uf = {i+1:i+1 for i in range(1,n+1)}

def get_parent(i):
  lst = []
  while uf[i] != i:
    lst.append(i)
    i = uf[i]
  for l in lst[:-1]:
    uf[l] = i
  return i

def unite(uf,i,j):
  p = get_parent(i)
  uf[get_parent(j)] = p

def same(i,j):
  return get_parent(i) == get_parent(j)

for _ in range(m):
  x,y = map(int,input().split())
  unite(x,y)

ans = 0
for i in range(1,n+1):
  ans += int(same(P[i-1],uf[i]))
print(ans)
Problem p03360 (python)

Fixed submission:
A = list(map(int,input().split()))
A.sort()
k = int(input())
ans = sum(A[:2]) + A[2]*(2**k)
print(ans)

Buggy submission (verdict: Runtime Error):
A = list(map(int,input().split()))
A.sort()
k = int(input())
ans = sum(A[:2]) + A[3]*(2**k)
print(ans)

Buggy submission (verdict: Runtime Error):
A = list(map(int,input().split()))
A.sort()
k = int(input())
ans = sum(A[:2]) + A[3]*(2**k)
Problem p03361 (python)

Fixed submission:
H,W = map(int,input().split())
figure = [input() for _ in range(H)]
D = [(1,0), (-1, 0), (0,1), (0,-1)]

for h in range(H):
  for w in range(W):
    if figure[h][w] == '#':
      for dh,dw in D:
        nh, nw = h+dh, w+dw
        if not (0 <= nh <H and 0 <= nw < W):
          continue
        if figure[nh][nw] == '#':
          break
      else:
        print('No')
        exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
figure = [input() for _ in range(H)]
D = [(1,0), (-1, 0), (0,1), (0,-1)]

for h in range(H):
  for w in range(W):
    if figure[h][w] == '#':
      for dh,dw in D:
        nh, nw = h+dh, w+dw
        if not (0 <= nh <=H and 0 <= nw <= W):
          continue
        if figure[nh][nw] == '#':
          break
      else:
        print('No')
        exit()
print('Yes')
Problem p03385 (python)

Fixed submission:
s = input()
l = ['a','b','c']
for c in s:
  if c in l:
    l.remove(c)
print('Yes' if l ==[] else 'No')

Buggy submission (verdict: Runtime Error):
s = input(s)
l = ['a','b','c']
for c in s:
  l.remove(c)
print('Yes' if l ==[] else 'No')
Problem p03424 (python)

Fixed submission:
_ = input()
A = list(input().split())
if 'Y' in A:
  print('Four')
else:
  print('Three')

Buggy submission (verdict: Runtime Error):
_ = input()
A = list(map(int,input().split()))
if 'Y' in A:
  print('Four')
else:
  print('Three')
Problem p03434 (python)

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

points = [0,0]#alice,bob
i = 0
while AS:
  point = max(AS)
  points[i] += point
  AS.remove(point)
  i = 1-i
print(points[0]-points[1])

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

points = [0,0]#alice,bob
i = 0
while AS:
  point = max(AS)
  points[i] += point
  AS.remove(point)
  i = 1-i
print(point[0]-point[1])
Problem p03449 (python)

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

from itertools import accumulate

A = list(accumulate(A))
B = list(accumulate(B[::-1]))[::-1]



ans = 0
for i in range(n):
  ans = max(A[i]+B[i], ans)
print(ans)

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

from itertools import accumulate

A = list(accumulate(A))
B = list(accumulate(B[::-1]))[::-1]

ans = 0
for i in range(n):
  ans = max(A[i]+B[i])
print(ans)
Problem p03469 (python)

Fixed submission:
s= input()
if s[:4]=='2017':
  print('2018'+s[4:])
else:
  print(s)

Buggy submission (verdict: Runtime Error):
s=  input()
s[3] = '8'
print(s)
Problem p03502 (python)

Fixed submission:
n = input()
a = 0
for i in n:
  a += int(i)
print('Yes' if int(n) % a == 0 else 'No')

Buggy submission (verdict: Runtime Error):
n = input()
x = int(input())
fx = 0
for i in n:
  fx += int(i)
print('Yes' if x%fx ==0 else 'No')
Problem p03503 (python)

Fixed submission:
n = int(input())         
import numpy as np

open = np.array([list(map(int,input().split())) for i in range(n)])
p  = np.array([list(map(int,input().split())) for i in range(n)])

max_p = -999999999999
                     
for j in range(1,2**10):  
  store = [0,0,0,0,0,0,0,0,0,0] 
  flag = True          
  for k in range(10):  
    if j %2 ==1 : 
      store[k] = 1 
    j = int(j/2)                           
#store = np.array([1,0,1,0,0,0,0,0,0,0]) 
  days = [sum(i) for i in store * open] 
  score = 0                            
  for i in range(n):                   
          score += p[i][days[i]]
  if score > max_p: 
    max_p = score            
print(max_p)

Buggy submission (verdict: Runtime Error):
n = int(input())
F = []
for i in range(n):
  f = list(map(int,input().split()))
  shop = []
  for j in range(5):
    shop.append([f[2*j],f[2*j+1]])
  F.append(shop)
P = [list(map(int,input().split())) for _ in range(n)]

import numpy as np
ans = -float('inf')
for i in range(1,2**10):
  index =format(i,'b').zfill(10)
  open_j = [int(j) for j in index]
  open_j = np.array(open_j).reshape(5,2)
  score = 0
  for j in range(n):
    count = 0
    for k in range(5):
      for l in range(2):
        if F[j][k][l] and open_j[k][l]:
          count += 1
    score += P[j][count]
  ans = max(ans,score)
print(ans)
Problem p03504 (python)

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

def inc(n):
  return n+1
def dec(n):
  return n-1

history = {}
for i in range(N):
  s,t,c = map(int,input().split())
  s *= 2
  t *= 2
  #print(history)
  if (t-1) in history and c in history[t-1]:
    history[t-1].pop(c)
  else:
    if t in history:
      history[t][c] = dec
    else:history[t] = {c:dec}
  if (s) in history and c in history[s]:
    history[s].pop(c)
  else:
    #history[s-0.5][c] = inc
    if s-1 in history:
      history[s-1][c] = inc
    else:
      history[s-1] = {c:inc}
maximum = 0
counter = 0
for i in range(100000*2):
  if i in history:
    for func in history[i].values():
      counter = func(counter)
    if counter > maximum:
      maximum = counter
#print(history)
print(maximum)

Buggy submission (verdict: Runtime Error):
import collections
n,c  = map(int,input().split())                     
channels = [list(map(int,input().split())) for i in range(n)]
print(channels)
channel_set = [list(range(i[0],i[1]+1)) for i in channels]
channels = []                                                
for ch in channel_set:
    channels.extend(ch)                                   
print(channels)                                  
#map(int,input().split())                                           c = collections.Counter(channels)
print(c.most_common()[0][1])