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

Fixed submission:
n=int(input())
s=input()
e=s.count('E')
w=0
ans=e+w
p=0
for i in s:
  if p==1:
    w+=1
    p=0
  if i=='E':
    e-=1
  else:
    p=1
  ans=min(ans,e+w)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
line=str(input())
line=line.replace('E','0')
line=line.replace('W','1')
line=list(map(int,line))
v=0
for i in range(n-1):
  if line[i]==0 or line[i+1]==0:
    pass
  else:
    v=line[0:i].count(o)+line[i+1:n].count(1)
    break
print(v)

Buggy submission (verdict: Runtime Error):
n=int(input())
line=str(input())
line=line.replace('E','0')
line=line.replace('W','1')
line=list(map(int,line))
v=0
for i in range(n-1):
  if line[i]==0 or line[i+1]:
    pass
  else:
    v=line[0:i].count(o)+line[i+1:n].count(1)
    break
print(v)

Buggy submission (verdict: Runtime Error):
n=int(input())
line=list(str(input()))
line.replace('E',0)
line.replace('W',1)
def turn_e(x):
  count=0
  for i in range(x):
    if line[i]==1:
      count+=1
  return count
def turn_w(x):
  count=0
  for i in range(x+1,n):
    if line[i]==0:
      count+=1
  return count
v=n
for i in range(n):
  if (turn_e(i)+turn_w(i))<v:
    v=turn_e(i)+turn_w(i)
print(v)
Problem p03370 (python)

Fixed submission:
n,x=map(int,input().split())
m=[]
for i in range(n):
  k=int(input())
  m.append(k)
m.sort()
print((x-sum(m))//m[0] +n)

Buggy submission (verdict: Runtime Error):
n,x=map(int,input().split())
m=[]
for i in range(n):
  m.append(int(input())
m.sort()
print((x-sum(m))//m[0] +n)
Problem p03400 (python)

Fixed submission:
n=int(input())
d,x=map(int,input().split())
a=[]
for i in range(n):
  k=int(input())
  a.append(k)
ans=x
for i in a:
  ans+= (d-1)//i +1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
d,x=map(int,input().split())
a=[]
for i in range(n):
  k=int(input())
  a.append(k)
ans=x
for i in a:
  ans+= (d-1)//a +1
print(ans)
Problem p03401 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[0]*(n+1)
b[0]=abs(a[0])
b[-1]=abs(a[-1])
c=b[0]+b[-1]
for i in range(n-1):
  b[i+1]=abs(a[i+1]-a[i])
  c+=b[i+1]
for i in range(n):
  if i==0:
    if 0<=a[i]<=a[i+1] or a[i+1]<=a[i]<=0:
      print(c)
    else:
      print(c-b[i]-b[i+1]+abs(a[i+1]))
    continue
  if i==n-1:
    if a[i-1]<=a[i]<=0 or 0<=a[i]<=a[i-1]:
      print(c)
    else:
      print(c-b[i]-b[i+1]+abs(a[i-1]))
    continue
  if a[i-1]<=a[i]<=a[i+1] or a[i+1]<=a[i]<=a[i-1]:
    print(c)
  else:
    print(c-b[i]-b[i+1]+abs(a[i-1]-a[i+1]))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=[0]*(n)
b[0]=abs(a[0])
c=b[0]
for i in range(n-1):
  b[i+1]=abs(a[i+1]-a[i])
  c+=b[i+1]
for i in range(n):
  if i==0:
    if 0<=a[i]<=a[i+1]:
      print(c)
    else:
      print(c-b[i]+abs(a[i+1]))
  if a[i-1]<=a[i]<=a[i+1]:
    print(c)
  else:
    print(c-b[i]-b[i-1]+abs(a[i-1]-a[i+1]))
Problem p03408 (python)

Fixed submission:
n=int(input())
s=[]
for i in range(n):
  k=input()
  s.append(k)
m=int(input())
t=[]
for i in range(m):
  k=input()
  t.append(k)
check=[]
ans=[0]
for i in s:
  if i in check:
    continue
  ans.append(s.count(i)-t.count(i))
  check.append(i)
print(max(ans))

Buggy submission (verdict: Runtime Error):
n=int(input())
s=[]
for i in range(n):
  k=input()
  s.append(k)
m=int(input())
t=[]
for i in range(m):
  k=input()
  t.append(k)
check=[]
ans=[]
for i in s:
  if i in check:
    continue
  if s.count(i)>=t.count(i):
    ans.append(s.count(i)-t.count(i))
  check.append(i)
print(max(ans))
Problem p03424 (python)

Fixed submission:
n=int(input())
s=list(input())
if 'Y' in s:
  print("Four")
else:
  print("Three")

Buggy submission (verdict: Runtime Error):
n=int(input())
s=list(input())
if 'Y' in s:
  print("Four")
else:
  print(Three)
Problem p03435 (python)

Fixed submission:
import sys
c=[[int(i) for i in l.split()] for l in sys.stdin]
for i in range(2):
  stack=c[i][0]-c[i+1][0]
  for j in range(3):
    if stack!=c[i][j]-c[i+1][j]:
      print('No')
      exit()
for i in range(2):
  stack=c[0][i]-c[0][i+1]
  for j in range(3):
    if stack!=c[j][i]-c[j][i+1]:
      print('No')
      exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
import sys
c=[[int(i) for i in l.stlip()] for l in sys.stdin]
for i in range(2):
  stack=c[i][0]-c[i+1][0]
  for j in range(3):
    if stack!=c[i][j]-c[i+1][j]:
      print('No')
      exit()
for i in range(2):
  stack=c[0][i]-c[0][i+1]
  for j in range(3):
    if stack!=c[j][i]-c[j][i+1]:
      print('No')
      exit()
print('Yes')
Problem p03449 (python)

Fixed submission:
n=int(input())
line1=list(map(int,input().split()))
line2=list(map(int,input().split()))
line=[line1,line2]
point=0
place=0
def judge(i):
  status1=0
  status2=0
  possible=1
  for k in range(n-i-1):
    status1+=line[0][i+k+1]
    status2+=line[1][i+k]
    if status1>=status2:
      possible=0
      break
  return possible
for i in range(n):
  point+=line[place][i]
  if place==0 and judge(i)==1:
    place=1
    point+=line[place][i]
print(point)

Buggy submission (verdict: Runtime Error):
n=int(input())
line1=list(map(int,input().split()))
line2=list(map(int,input().split()))
line=[line1,line2]
point=0
place=0
def judge(i):
  status1=0
  status2=0
  possible=1
  for k in range(n-i-1):
    status1+=line[0][i+k+1]
    status2+=line[1][i+k]
    if status1>=status2:
      possible=0
      break
  return possible
for i in range(n):
  point+=line[place][i]
  if palce==0 and judge(i)==1:
    place=1
    point+=line[place][i]
print(point)

Buggy submission (verdict: Runtime Error):
n=int(input())
line1=list(map(int,input().split()))
line2=list(map(int,input().split()))
line=[line1,line2]
point=0
place=0
def judge(i):
  status1=0
  status2=0
  possible=1
  for k in range(n-i-1):
    status1+=line[0][i+k+1]
    status2+=line[1][i+k]
    if status1>=status2:
      possible=0
      break
  return possible
for i in range(n):
  point+=line[place][i]
  if judge(i)==1:
    place=1
    point+=[place][i]
print(point)
Problem p03456 (python)

Fixed submission:
square=[]
for i in range(400):
  square.append(i*i)
a,b=map(int,input().split())
p=a*(10**len(str(b)))+b
if p in square:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
square=[]
for i in range(400):
  square.append(i*i)
a,b=int(input().split())
p=a*(10**len(str(b)))+b
if p in square:
  print('Yes')
else:
  print('No')
Problem p03470 (python)

Fixed submission:
n=int(input())
mochi=[]
for i in range(n):
  k=int(input())
  mochi.append(k)
print(len(set(mochi)))

Buggy submission (verdict: Runtime Error):
n=input()
mochi=[]
for i in range(n):
  k=int(input())
  mochi.append(k)
print(len(list(set(mochi))))

Buggy submission (verdict: Runtime Error):
n=input()
mochi=[]
for i in range(n):
  k=int(input())
  mochi.append(k)
print(len(set(mochi)))
Problem p03486 (python)

Fixed submission:
s=input()
s_=sorted(s)
s=''.join(s_)
t=input()
t_=sorted(t)
t=''.join(t_)
t_=reversed(t)
t=''.join(t_)
if s<t:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s=input()
s_=sorted(s)
s=''.join(s_)
t=input()
t_=sorted(t)
t=''.joint(t_)
if s<t:
  print('Yes')
else:
  print('No')
Problem p03487 (python)

Fixed submission:
n=int(input())
stack=[0]*(n+1)
a=list(map(int,input().split()))
for i in a:
  if i<=n:
    stack[i]+=1
ans=0
for i in range(1,n+1):
  if stack[i]>=i:
    ans+=i
print(n-ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
stack=[0]*(n+1)
a=list(map(int,input().split()))
for i in a:
  stack[i]+=1
ans=0
for i in range(1,n+1):
  if stack[i]>=i:
    ans+=i
print(n-ans)
Problem p03495 (python)

Fixed submission:
n,k=map(int,input().split())
stack=[0]*(2*10**5+1)
a=list(map(int,input().split()))
num=len(set(a))
for i in a:
  stack[i]+=1
stack.sort()
def binarysearch():
  ng=-1
  ok=2*10**5+1
  while abs(ng-ok)>1:
    mid=(ng+ok)//2
    if stack[mid]==0:
      ng=mid
    else:
      ok=mid
  return ok
p=binarysearch()
ans=0
if num<=k:
  print(0)
  exit()
for i in range(num-k):
  ans+=stack[p+i]
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
stack=[0]*(2*10**5+1)
a=list(map(int,input().split()))
num=len(set(a))
for i in a:
  stack[a]+=1
stack.sort()
def binarysearch():
  ng=-1
  ok=2*10**5+1
  while abs(ng-ok)>1:
    mid=(ng+ok)//2
    if stack[mid]==0:
      ng=mid
    else:
      ok=mid
  return ok
p=binarysearch()
ans=0
if num<=k:
  print(0)
  exit()
for i in range(num-k):
  ans+=stack[p+i]
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
stack=[0]*(2*10**5+1)
a=list(map(int,input().split()))
num=len(set(a))
for i in a:
  stack[a]+=1
stack.sort()
def binarysearch():
  ng=-1
  ok=2*10**5+1
  while abs(ng-ok)>1:
    mid=(ng+ok)//2
    if stack[mid]==0:
      ng=mid
    else:
      ok=mid
  return ok
p=binarysearch()
ans=0
for i in range(num-k):
  ans+=stack[p+i]
print(ans)
Problem p03545 (python)

Fixed submission:
line=str(input())
line=list(line)
line=list(map(int,line))
a=line[0]
b=line[1]
c=line[2]
d=line[3]
o1='+'
o2='+'
o3='+'
count=0
for x in (a+b,a-b):
  for y in (c,-c):
    for z in (d,-d):
      if x+y+z==7 and count==0:
        if x==a-b:
          o1='-'
        if y==-c:
          o2='-'
        if z==-d:
          o3='-'
        count+=1
print("{}{}{}{}{}{}{}=7".format(a,o1,b,o2,c,o3,d))

Buggy submission (verdict: Runtime Error):
line=str(input())
line=list(line)
a=line[0]
b=line[1]
c=line[2]
d=line[3]
o1='+'
o2='+'
o3='+'
for x in (a+b,a-b):
  for y in (c,-c):
    for z in (d,-d):
      if x+y+z==7:
        if x==a-b:
          o1='-'
        if y==-c:
          o2='-'
        if z==-d:
          o3='-'
print("{}{}{}{}{}{}{}=7".format(a,o1,b,o2,c,o3,d))

Buggy submission (verdict: Runtime Error):
line=str(input())
line=list(line)
a,b,c,d=line
o1='+'
o2='+'
o3='+'
for x in (a+b,a-b):
  for y in (c,-c):
    for z in (d,-d):
      if x+y+z==7:
        if x==a-b:
          o1='-'
        if y==-c:
          o2='-'
        if z==-d:
          o3='-'
print("{}{}{}{}{}{}{}=7".format(a,o1,b,o2,c,o3,d))

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
o1='+'
o2='+'
o3='+'
for x in (a+b,a-b):
  for y in (c,-c):
    for z in (d,-d):
      if x+y+z==7:
        if x==a-b:
          o1='-'
        if y==-c:
          o2='-'
        if z==-d:
          o3='-'
print("{}{}{}{}{}{}{}=7".format(a,o1,b,o2,c,o3,d))

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
o1='+'
o2='+'
o3='+'
for x in (a+b,a-b):
  for y in (c,-c):
    for z in (d,-d):
      if x+y+z==7:
        if x==a-b:
          o1='-'
        if y==-c:
          o2='-'
        if z==-d:
          o3='-'
print("{}{}{}{}{}{}{}".format(a,o1,b,o2,c,o3,d))
Problem p03557 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
b=list(map(int,input().split()))
b.sort()
c=list(map(int,input().split()))
c.sort()
def binary_search1(x,sortedlist):
  left=-1
  right=len(sortedlist)
  while abs(right-left)>1:
    mid=(left+right)//2
    if sortedlist[mid]<=x:
      left=mid
    else:
      right=mid
  return right
def binary_search2(x,sortedlist):
  left=-1
  right=len(sortedlist)
  while abs(right-left)>1:
    mid=(left+right)//2
    if sortedlist[mid]>=x:
      right=mid
    else:
      left=mid
  return left
ans=0
for i in range(len(b)):
  ans+=(len(c)-binary_search1(b[i],c))*(binary_search2(b[i],a)+1)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.sort(list(set(a)))
b=list(map(int,input().split()))
b.sort(list(set(b)))
c=list(map(int,input().split()))
c.sort(list(set(c)))
def binary_search1(x,sortedlist):
  left=-1
  right=len(sortedlist)
  while abs(right-left)>1:
    mid=(left+right)//2
    if sortedlist[mid]<=x:
      left=mid
    else:
      right=mid
  return right
def binary_search2(x,sortedlist):
  left=-1
  right=len(sortedlist)
  while abs(right-left)>1:
    mid=(left+right)//2
    if sortedlist[mid]>=x:
      right=mid
    else:
      left=mid
  return left
ans=0
for i in range(len(b)):
  ans+=(len(c)-binary_search1(b[i],c))*(binary_search2(b[i],a)+1)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.sort(list(set(a)))
b=list(map(int,input().split()))
b.sort(list(set(b)))
c=list(map(int,input().split()))
c.sort(list(set(c)))
def binary_search1(x,sortedlist):
  left=-1
  right=len(sortedlist)
  while abs(right-left)>1:
    mid=(left+right)//2
    if sortedlist[mid]<=x:
      left=mid
    else:
      right=mid
  return right
def binary_search2(x,sortedlist):
  left=-1
  right=len(sortedlist)
  while abs(right-left)>1:
    mid=(left+right)//2
    if sortedlist[mid]>=x:
      right=mid
    else:
      left=mid
  return left
ans=0
for i in range(len(b)):
  ans+=binary_search1(b[i],c)*binary_search2(b[i],a)
print(ans)
Problem p03565 (python)

Fixed submission:
s=input()
t=input()
ans=[]
for i in range(0,len(s)-len(t)+1):
  m=[]
  flag=True
  for p in range(i):
    if s[p]=='?':
      m.append('a')
    else:
      m.append(s[p])
  for q in range(i,len(t)+i):
    if s[q]=='?' or s[q]==t[q-i]:
      m.append(t[q-i])
    else:
      flag=False
      break
  for r in range(len(t)+i,len(s)):
    if flag==False:
      break
    if s[r]=='?':
      m.append('a')
    else:
      m.append(s[r])
  if flag:
    ans.append("".join(m))
ans.sort()
if len(ans)>0:
  print(ans[0])
else:
  print('UNRESTORABLE')

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
ans=[]
for i in range(len(s)):
  s.insert(0,s.pop())
  s=''.join(s)
  m=[]
  flag=True
  for j in range(len(t)):
    if s[j]=='?' or t[j]==s[j]:
      m.append(t[j])
    else:
      flag=False
      break
  if flag:
    for j in range(len(t),len(s)):
      if s[j]=='?':
        m.append(a)
      else:
        m.append(s[j])
    ans.append(''.join(m))
ans.sort()
if len(ans)>0:
  print(ans[0])
else:
  print('UNRESTORABLE')

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
ans=[]
for i in range(len(s)):
  s.insert(0,s.pop())
  s=''.join(s)
  m=[]
  flag=True
  for j in range(len(t)):
    if s[j]=='?' or t[j]==s[j]:
      m.append(t[j])
    else:
      flag=False
      break
  if flag:
    for j in range(len(t),len(s)):
      if s[j]=='?':
        m.append(a)
      else:
        m.append(s[j])
    ans.append(''.join(m))
ans.sort()
print(ans[0])
Problem p03575 (python)

Fixed submission:
import sys
n,m=map(int,input().split())
vertex=[[int(i) for i in l.split()] for l in sys.stdin]
def find(x):
  if root[x]==x:
    return x
  root[x]=find(root[x])
  return root[x]
def check(x,y):
  return find(x)==find(y)
def union(x,y):
  x=find(x)
  y=find(y)
  if size[x]>=size[y]:
    root[y]=x
  else:
    root[x]=y
  if size[x]==size[y]:
    size[x]+=1
ans=0
for i in range(m):
  root=[i for i in range(n+1)]
  size=[0]*(n+1)
  for j in range(m):
    if j!=i:
      if check(vertex[j][0],vertex[j][1]):
        pass
      else:
        union(vertex[j][0],vertex[j][1])
  for j in range(1,n):
    if check(j,j+1)==True:
      pass
    else:
      ans+=1
      break
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
n,m=map(int,input().split())
vertex=[[int(i) for i in l.split()] for l in sys.stdin]
def generate(x):
  root=[i for i in range(1,x+1)]
  size=[0]*x
def find(x):
  if root[x]==x:
    return x
  return find(root[x])
def check(x,y):
  return find(x)==find(y)
def union(x,y):
  x=find(x)
  y=find(y)
  if size[x]>=size[y]:
    root[y]=x
  else:
    root[x]=y
  if size[x]==size[y]:
    size[x]+=1
ans=0
for i in range(m):
  generate(n)
  for j in range(m):
    if j!=i:
      if check(vertex[j][0],vertex[j][1]):
        pass
      else:
        union(vertex[j][0],vertex[j][1])
  for j in range(n-1):
    if check(j,j+1)==0:
      pass
    else:
      ans+=1
      break
print(ans)
Problem p03607 (python)

Fixed submission:
import sys
n=int(input())
a=[int(i) for i in sys.stdin]
a.sort()
stack=a[0]
num=1
ans=0
for i in range(1,n):
  if a[i]==stack:
    num+=1
  else:
    if num%2==1:
      ans+=1
    stack=a[i]
    num=1
if num%2==1:
  ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
n=int(input())
a=[[int(i) for i in l] for l in sys.stdin]
a.sort()
stack=a[0]
num=1
ans=0
for i in range(1,n):
  if a[i]==stack:
    num+=1
  else:
    if num%2==1:
      ans+=1
    stack=a[i]
    num=1
if num%2==1:
  ans+=1
print(ans)
Problem p03632 (python)

Fixed submission:
a,b,c,d=map(int,input().split())
Alice=range(a,b+1)
Bob=range(c,d+1)
Alice_Bob=set(Alice)&set(Bob)
if len(Alice_Bob)!=0:
  print(len(Alice_Bob)-1)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
Alice=range(a,b+1)
Bob=range(c,d+1)
Alice_Bob=set(Alice)+set(Bob)
print(len(Alice_Bob))
Problem p03633 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**8)
n=int(input())
t=[int(i) for i in sys.stdin]
if n==1:
  print(t[0])
  exit()
def gcd(x,y):
  if y==0:
    return x
  return gcd(y,x%y)
x=t[0]
for i in range(1,n):
  y=x*t[i]//gcd(x,t[i])
  x=y
print(y)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**9)
n=int(input())
t=[int(i) for i in sys.stdin]
def gcd(x,y):
  if y==0:
    return x
  return gcd(y,x%y)
x=t[0]
for i in range(1,n):
  y=x*t[i]//gcd(x,t[i])
  x=y
print(y)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**9)
n=int(input())
t=[int(i) for i in sys.stdin]
def gcd(x,y):
  if y==0:
    return x
  return gcd(y,x%y)
x=t[0]
for i in range(1,n):
  y=x*t[i]//gcd(x,t[i])
  x=y
print(y)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**18)
n=int(input())
t=[int(i) for i in sys.stdin]
def gcd(x,y):
  if y==0:
    return x
  return gcd(y,x%y)
x=t[0]
for i in range(1,n):
  y=x*t[i]//gcd(x,t[i])
  x=y
print(y)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000000)
n=int(input())
t=[int(i) for i in sys.stdin]
def gcd(x,y):
  if y==0:
    return x
  return gcd(y,x%y)
x=t[0]
for i in range(1,n):
  y=x*t[i]//gcd(x,t[i])
  x=y
print(y)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000000)
n=int(input())
t=[int(i) for i in sys.stdin]
def gcd(x,y):
  if y==0:
    return x
  return gcd(y,x%y)
x=t[0]
for i in range(1,n):
  y=x*t[i]//gcd(x,t[i])
  x=y
print(y)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(200000)
n=int(input())
t=[int(i) for i in sys.stdin]
def gcd(x,y):
  if y==0:
    return x
  return gcd(y,x%y)
x=t[0]
for i in range(1,n):
  y=x*t[i]//gcd(x,t[i])
  x=y
print(y)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)
n=int(input())
t=[int(i) for i in sys.stdin]
def gcd(x,y):
  if y==0:
    return x
  return gcd(y,x%y)
x=t[0]
for i in range(1,n):
  y=x*t[i]//gcd(x,t[i])
  x=y
print(y)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(5000)
n=int(input())
t=[int(i) for i in sys.stdin]
def gcd(x,y):
  if y==0:
    return x
  return gcd(y,x%y)
x=t[0]
for i in range(1,n):
  y=x*t[i]//gcd(x,t[i])
  x=y
print(y)

Buggy submission (verdict: Runtime Error):
import sys
n=int(input())
t=[int(i) for i in sys.stdin]
def gcd(x,y):
  if y==0:
    return x
  return gcd(y,x%y)
x=t[0]
for i in range(1,n):
  y=x*t[i]//gcd(x,t[i])
  x=y
print(y)
Problem p03637 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
not_two=0
yes_four=0
for i in a:
  if i%2!=0:
    not_two+=1
  if i%4==0:
    yes_four+=1
if yes_four-not_two>=0:
  print('Yes')
elif yes_four+not_two==n and yes_four-not_two==-1:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
not_two=0
yes_four=0
for i in a:
  if a%2!=0:
    not_two+=1
  if a%4==0:
    yes_four+=1
if yes_four-not_two>=1:
  print('Yes')
else:
  print('No')
Problem p03659 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[]
sum_=0
for i in a:
  sum_+=i
  b.append(sum_)
ans=10**18
for i in range(n-1):
  ans=min(ans,abs(b[-1]-b[i]*2))
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=[]
sum_=0
for i in a:
  sum_+=i
  b.append(sum_a)
ans=10**18
for i in range(n-1):
  ans=min(ans,abs(b[-1]-b[i]))
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=[]
sum_=0
for i in a:
  sum_a+=i
  b.append(sum_a)
ans=10**18
for i in range(n-1):
  ans=min(ans,abs(b[-1]-b[i]))
print(ans)
Problem p03673 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[]
c=[]
for i in range(n):
  if i%2!=n%2:
    b.append(a[i])
  else:
    c.append(a[i])
b.reverse()
b.extend(c)
print(' '.join(map(str,b)))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input()))
b=[]
c=[]
for i in range(n):
  if i%2==0:
    b.append(a[i])
  else:
    c.append(a[i])
b.reverse()
b.extend(c)
print(' '.join(map(str,b)))
Problem p03680 (python)

Fixed submission:
n=int(input())
lamp=[]
status=1
count=0
possible=0
for i in range(n):
  p=int(input())
  lamp.append(p)
while status!=2:
  if lamp[status-1]!=0:
    var=lamp[status-1]
    lamp[status-1]=0
    status=var
    count+=1
  else:
    possible+=1
    break
if possible==0:
  print(count)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
n=int(input())
lamp=[]
status=1
count=0
possible=1
for i in range(n):
  p=int(input())
  lamp.append(p)
while status!=2 or count==n:
  status=lamp[status]
  count+=1
  if count==n and status!=2:
    possible=0
if possible==1:
  print(count)
else:
  print(-1)
Problem p03681 (python)

Fixed submission:
import math
n,m=map(int,input().split())
if abs(n-m)>1:
  print(0)
  exit()
p=10**9+7
if n==m:
  print((2*((math.factorial(m))%p)*((math.factorial(n))%p))%p)
else:
  print((((math.factorial(m))%p)*((math.factorial(n))%p))%p)

Buggy submission (verdict: Runtime Error):
import math
n,m=map(int,input().split())
if abs(n-m)>1:
  print(0)
  exit()
p=10**9+7
print((2*((math.factorial(m))%)*((math.factorial(m))%))%p)
Problem p03712 (python)

Fixed submission:
h,w=map(int,input().split())
ans=[]
ans.append(['#']*(w+2))
for i in range(h):
  a=list(input().split())
  a.insert(0,'#')
  a.append('#')
  ans.append(a)
ans.append(['#']*(w+2))
for i in ans:
  print(''.join(i))

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
ans=[]
ans.append(['#']*(w+2))
for i in range(h):
  a=list(map(int,input().split()))
  a.insert(0,'#')
  a.append('#')
  ans.append(a)
ans.append(['#']*(w+2))
for i in ans:
  print(''.join(i))

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
ans=[]
ans.append(['#'*(w+2)])
for i in range(h):
  a=list(map(int,input().split()))
  a.insert(0,'#')
  a.append('#')
  ans.append(a)
ans.append(['#'*(w+2)])
for i in ans:
  print(''.join(i))

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
ans=[]
ans.append('#'*(w+2))
for i in range(h):
  a=list(map(int,input().split()))
  a.insert(0,'#')
  a.append('#')
  ans.append("#")
ans.append('#'*(w+2))
for i in ans:
  print(''.join(i))
Problem p03713 (python)

Fixed submission:
h,w=map(int,input().split())
if h%3==0 or w%3==0:
  print(0)
  exit()
if (w-w//3-1)%2==0 or h%2==0:
  x=h*(w//3 +1)-h*(w-w//3-1)//2
else:
  x=h*(w//3 +1)-(h*w-h*(w//3 +1)-min((w-w//3-1),h))//2
if (w-w//3)%2==0 or h%2==0:
  x2=h*(w-w//3)//2-h*(w//3)
else:
  x2=(h*w-h*(w//3)+min((w+w//3),h))//2-h*(w//3)
if (h-h//3-1)%2==0 or w%2==0:
  y=w*(h//3 +1)-w*(h-h//3-1)//2
else:
  y=w*(h//3 +1)-(h*w-w*(h//3 +1)-min((h-h//3-1),h))//2
if (h-h//3)%2==0 or w%2==0:
  y2=w*(h-h//3)//2-w*(h//3)
else:
  y2=(h*w-w*(h//3)+min((h-h//3),h))//2-w*(h//3)
print(min(x,y,x2,y2))

Buggy submission (verdict: Runtime Error):
h,w=map(int,input())
if h%3==0 or w%3==0:
  print(0)
if (w-w//3-1)%2==0 or h%2==0:
  x=h*(w//3 +1)-(h*w-h*(w//3 +1))//2
else:
  x=h*(w//3 +1)-(h*w-h*(w//3 +1)-min((w-w//3-1),h))//2
if (h-h//3-1)%2==0 or w%2==0:
  y=w*(h//3 +1)-(h*w-w*(h//3 +1))//2
else:
  y=w*(h//3 +1)-(h*w-w*(h//3 +1)-min((h-h//3-1),h))//2
print(min(x,y))