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

Fixed submission:
s=input()
t=input()
u='UNRESTORABLE'
a=[]
if len(s)>=len(t):
  for i in range(len(s)-len(t)+1):
    f=0
    for j in range(i,i+len(t)):
      if s[j]!='?' and s[j]!=t[j-i]:
        f=1
    if f==0:
      m=s[:i]+t+s[i+len(t):]
      m=m.replace('?','a',50)
      a.append(m)
if len(a)==0:
  print(u)
else:
  a.sort()
  print(a[0])

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
u='UNRESTORABLE'
a=[]
if len(s)>=len(t):
  for i in range(len(s)-len(t)+1):
    f=0
    for j in range(i,i+len(t)):
      if s[j]!='?' and s[j]!=t[j-i]:
        f=1
    if f==0:
      for j in range(i,i+len(t)):
        if s[j]=='?':
          m=s[:j]+t[j-i]+s[j+1:]
      m=m.replace('?','a')
      a.append(m)
if len(a)==0:
  print(u)
else:
  a.sort()
  print(a[0])

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
u=['UNRESTORABLE']
if len(s)>=len(t):
  for i in range(len(s)-len(t)+1):
    f=0
    for j in range(i,i+len(t)):
      if s[j]!='?' and s[j]!=t[j-i]:
        f=1
    if f==0:
      for j in range(i,i+len(t)):
        if s[j]=='?':
          m=s[:j]+t[j-i]+s[j+1:]
      m=m.replace('?','a')
      u.append(m)
u.sort()
print(u[0])

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
u=['UNRESTORABLE']
if len(s)>=len(t):
  for i in range(len(s)-len(t)+1):
    f=0
    for j in range(i,i+len(t)):
      if s[j]!='?' and s[j]!=t[j-i]:
        f=1
    if f==0:
      for j in range(i,i+len(t)):
        if s[j]=='?':
          m=s[:j]+t[j-i]+s[j+1:]
      m=m.replace('?','a')
      a.append(m)
u.sort()
print(u[0])
Problem p03583 (python)

Fixed submission:
n=int(input())
for i in range(1,3501):
  for j in range(1,3501):
    if 4*i*j-n*i-n*j>0:
      if (n*i*j)%(4*i*j-n*i-n*j)==0:
        print(i,j,(n*i*j)//(4*i*j-n*i-n*j))
        exit()

Buggy submission (verdict: Runtime Error):
n=int(input())
for i in range(1,3501):
  for j in range(1,3501):
    if (n*i*j)%(4*i*j-n*i-n*j)==0:
      print(i,j,(n*i*j)//(4*i*j-n*i-n*j))
      exit()
Problem p03592 (python)

Fixed submission:
n,m,k=map(int,input().split())
x='No'
for i in range(m+1):
  t=n*i
  if t==k:
    x='Yes'
    break
  for j in range(n):
    t+=m-2*i
    if t==k:
      x='Yes'
      break
print(x)

Buggy submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
x='No'
for i in range(m+1)
  t=n*i
  if t==k:
    x='Yes'
    break
  for j in range(n):
    t+=m-2*i
    if t==k:
      x='Yes'
      break
print(x)
Problem p03611 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
d=[0]*(max(a)+3)
for i in a:
  d[i]+=1
  d[i+1]+=1
  d[i+2]+=1
print(max(d))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
d=[0]*(max(a)+2)
for i in a:
  d[i]+=1
  d[i+1]+=1
  d[i+2]+=1
print(max(d))
Problem p03633 (python)

Fixed submission:
from fractions import gcd as g
def l(a,b):
  x=a*b//g(a,b)
  return x
n=int(input())
m=int(input())
for _ in range(n-1):
  t=int(input())
  m=l(m,t)
print(m)

Buggy submission (verdict: Runtime Error):
from fractions import gcd as g
def l(a,b):
  x=a*b/g(a,b)
  return int(x)
n=int(input())
if n==1:
  print(int(input()))
else:
  for _ in range(n):
    t=int(input())
    m=l(t,m)
  print(m)

Buggy submission (verdict: Runtime Error):
from fractions import gcd as g
def l(a,b):
  x=a*b/g(a,b)
  return int(x)
n=int(input())
t=[0]*n
for _ in range(n):
  t[_]=int(input())
if n==1:
  print(t[0])
else:
  m=l(t[0],t[1])
  for i in range(1,n):
    m=l(t[i],m)
  print(m)

Buggy submission (verdict: Runtime Error):
from fractions import gcd as g
def l(a,b):
  x=a*b/g(a,b)
  return int(x)
n=int(input())
t=[0]*n
for _ in range(n):
  t[_]=int(input())
m=l(t[0],t[1])
for i in range(1,n):
  m=l(t[i],m)
print(m)
Problem p03645 (python)

Fixed submission:
n,m=map(int,input().split())
c=[]
d=[]
for _ in range(m):
  a,b=map(int,input().split())
  if a==1:
    c.append(b)
  elif b==n:
    d.append(a)
if len(set(c)&set(d))!=0:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
c=[]
d=[]
for _ in range(m):
  a,b=map(int,input().split())
  if a==1:
    c.append(b)
  elif b==n:
    d.append(a)
if len(c&d)!=0:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')
Problem p03651 (python)

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
from fractions import gcd
from functools import reduce
def g(l):
  return reduce(gcd,l)
if max(a)<k:
  print('IMPOSSIBLE')
else:
  z=g(a)
  if k in a or k%z==0:
    print('POSSIBLE')
  else:
    print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
from fractions import gcd
from functools import reduce
def g(l):
return reduce(gcd,l)
if max(a)<k:
  print('IMPOSSIBLE')
else:
  z=g(a)
  if k%z==0:
    print('POSSIBLE')
  else:
    print('IMPOSSIBLE')
Problem p03673 (python)

Fixed submission:
n=int(input())
a=list(input().split())
b=[]
if len(a)%2==0:
  for i in range(n-1,0,-2):
    b.append(a[i])
  for i in range(0,n-1,2):
    b.append(a[i])
else:
  for i in range(n-1,-1,-2):
    b.append(a[i])
  for i in range(1,n-1,2):
    b.append(a[i])
print(' '.join(b))

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

Fixed submission:
n=int(input())
a=[int(input()) for i in range(n)]
c,s=1,a[0]
while s!=2 and c<n:
  c+=1
  s=a[s-1]
print(c if c<n else -1)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[0]*n
for _ in range(n):
  a[_]=int(input())
c=0
p=a[0]
while True:
  p=a[p-1]
  c+=1
  if p=2:
    break
  if p=1:
    c=-1
    break
print(c)
Problem p03730 (python)

Fixed submission:
import fractions as f
a,b,c=map(int,input().split())
print('YES' if c%(f.gcd(a,b))==0 else 'NO')

Buggy submission (verdict: Runtime Error):
import math
a,b,c=map(int,input().split())
print('YES' if c%(math.gcd(a,b))==0 else 'NO')

Buggy submission (verdict: Runtime Error):
import math
a,b,c=map(int,input().split())
print('YES' if c%math.gcd(a,b)==0 else 'NO')
Problem p03761 (python)

Fixed submission:
n=int(input())
a=input()
if n!=1:
  b=input()
  m=[]
  if len(a)>len(b):
    a,b=b,a
  b=list(b)
  for i in a:
    for j in range(len(b)):
      if i==b[j]:
        m.append(i)
        b[j]=''
        break
  for _ in range(n-2):
    s=list(input())
    l=[]
    for i in m:
      for j in range(len(s)):
        if i==s[j]:
          l.append(i)
          s[j]=''
          break
    m=l
  print(''.join(sorted(m)))  
else:
  print(''.join(sorted(a)))

Buggy submission (verdict: Runtime Error):
n=int(input())
if n!=1:
  a=input()
  b=input()
  m=[]
  for i in a:
    for j in b:
      if i==j:
        m.append(i)
        break
  for _ in range(n-2):
    s=input()
    l=[]
    for i in m:
      for j in s:
        if i==j:
          l.append(i)
          break
    m=l
  print(''.join(sorted(m)))  
else:
  print(a)

Buggy submission (verdict: Runtime Error):
n=int(input())
if n!=1:
  a=input()
  b=input()
  m=[]
  for i in a:
    for j in b:
      if i==j:
        m.append(i)
  for _ in range(n-2):
    s=input()
    l=[]
    for i in s:
      for j in m:
        if i==j:
          l.append(i)
    m=l
  print(''.join(sorted(m)))  
else:
  print(a)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=input()
b=input()
m=[]
for i in a:
  for j in b:
    if i==j:
      m.append(i)
for _ in range(n-2):
  s=input()
  l=[]
  for i in s:
    for j in m:
      if i==j:
        l.append(i)
  m=l
print(''.join(sorted(m)))
Problem p03779 (python)

Fixed submission:
x=int(input())
n=0
for i in range(1,x+1):
  n+=i
  if n>=x:
    break
print(i)

Buggy submission (verdict: Runtime Error):
x=int(input())
n=0
for i in range(1,x):
  n+=i
  if n>=x:
    break
print(i)
Problem p03807 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
s=0
for i in range(n):
  if a[i]%2==1:
    s+=1
print('YES' if s%2==0 else 'NO')

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
s=0
for i in range(n):
  s+=1 if a[i]%2==1
print('YES' if s%2==0 else 'NO')
Problem p03814 (python)

Fixed submission:
s=input()
l=len(s)
x=0
y=0
for i in range(l):
  if s[i]=='A':
    x=i
    break
for j in range(l-1,0,-1):
  if s[j]=='Z':
    y=j
    break
print(y-x+1)

Buggy submission (verdict: Runtime Error):
s=input()
l=len(s)
x,y=0
for i in range(l):
  if s[i]=='A':
    x=i
    break
for j in range(l-1,0,-1):
  if s[j]=='Z':
    y=j
    break
print(y-x+1)
Problem p03846 (python)

Fixed submission:
n=int(input())
if n==1:
  if int(input())==0:
    print(n)
  else:
    print(0)
  exit()
a=list(map(int,input().split()))
m=10**9+7
x=[]
if n%2==1:
  x.append(0)
for i in range(n%2+1,n,2):
  x.append(i)
  x.append(i)
if sorted(a)==x:
  print((2**(n//2))%m)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
n=int(input())
if n==1:
  if int(input())==0:
    print(n)
  else:
    print(0)
  exit
a=list(map(int,input().split()))
m=10**9+7
x=[]
if n%2==1:
  x.append(0)
for i in range(n%2+1,n,2):
  x.append(i)
  x.append(i)
if sorted(a)==x:
  print((2**(n//2))%m)
else:
  print(0)
Problem p03937 (python)

Fixed submission:
h,w=map(int,input().split())
a=[list(input()+'.') for _ in range(h)]
d=['.']*(w+1)
a.append(d)
x=1
i=0;j=0
a[0][0]='.'
while i!=h-1 or j!=w-1:
  if a[i+1][j]=='#':
    if a[i][j+1]=='#':
      x=0
      break
    else:
      i=i+1
      a[i][j]='.'
  else:
    if a[i][j+1]=='.':
      x=0
      break
    else:
      j=j+1
      a[i][j]='.'
if x==1:
  for k in range(h):
    if '#' in a[k]:
      x=0
      break
print('Possible' if x==1 else 'Impossible')

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
a=[list(input())+'.' for _ in range(h)]
d='.'*(w+1)
a.append(d)
x=1
i=0;j=0
while i!=h-1 or j!=w-1:
  if a[i+1][j]=='#':
    if a[i][j+1]=='#':
      x=0
      break
    else:
      i=i+1
      a[i][j]='.'
  else:
    if a[i][j+1]=='.':
      x=0
      break
    else:
      j=j+1
      a[i][j]='.'
if x==1:
  if '#' in a:
    x=0
print('Possible' if x==1 else 'Impossible')

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
d='.'*(w+2)
a=[d]
for _ in range(h):
  s='.'+input()+'.'
  a.append(s)
a.append(d)
x='Possible'
a[h][w+1]='#'
for i in range(1,w+1):
  for j in range(1,h+1):
    if a[j][i]=='#':
      if a[j][i+1]==a[j+1][i]:
        x='Impossible'
        break
print(x)
Problem p03944 (python)

Fixed submission:
w,h,n=map(int,input().split())
o=[0,0]
c=[w,h]
for _ in range(n):
  x,y,a=map(int,input().split())
  if a==1:
    o[0]=x if o[0]<x else o[0]
  elif a==2:
    c[0]=x if c[0]>x else c[0]
  elif a==3:
    o[1]=y if o[1]<y else o[1]
  else:
    c[1]=y if c[1]>y else c[1]
if o[0]<c[0] and o[1]<c[1]:
  print((c[0]-o[0])*(c[1]-o[1]))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
w,h,n=map(int,input().split())
o=[0,0]
c=[w,h]
for _ in range(n):
  x,y,a=map(int,input().split())
  if a==1:
    o[0]=x if o[0]<x
  elif a==2:
    c[0]=x if c[0]>x
  elif a==3:
    o[1]=y if o[1]<y
  else:
    c[1]=y if c[1]>y
if o[0]<c[0] and o[1]<c[1]:
  print((c[0]-o[0])*(c[1]-o[1]))
else:
  print(0)
Problem p03951 (python)

Fixed submission:
n=int(input())
s=input()
t=input()
l=2*n
for i in range(n):
  if s[i:]==t[:n-i]:
    l=n+i
    break
print(min(n*2,l))

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
t=input()
for i in range(n):
  if s[i:]==t[:n-i]:
    l=n+i
    break
print(min(n*2,l))
Problem p03957 (python)

Fixed submission:
s=input()
l=len(s)
x='No'
f=0
for i in range(l):
  if s[i]=='C':
    f=1
  if s[i]=='F' and f==1:
    x='Yes'
    break
print(x)

Buggy submission (verdict: Runtime Error):
s=input()
l=len(s)
x='No'
f=0
for i in range(l):
  if s[i]=='C':
    f=1
  if s[i]=='F' and f=1:
    x='Yes'
    break
print(x)
Problem p03958 (python)

Fixed submission:
k,t=map(int,input().split())
print(max(0,2*max(list(map(int,input().split())))-k-1))

Buggy submission (verdict: Runtime Error):
k,t=map(int,input().split())
l=[0]*t
a=list(map(int,input().split()))
for i in a:
  l[i-1]+=1
print(max(0,max(l)-(k+1)//2))
Problem p03998 (python)

Fixed submission:
a=input()
b=input()
c=input()
def s(x):
  if len(x)==1:
    return ''
  else:
    return x[1:]
def g(x):
  global a
  global b
  global c
  if x=='a':
    if len(a)==0:
      y='A'
    else:
      y=a[0]
      a=s(a)
  elif x=='b':
    if len(b)==0:
      y='B'
    else:
      y=b[0]
      b=s(b)
  else:
    if len(c)==0:
      y='C'
    else:
      y=c[0]
      c=s(c)
  return y
t=g(a[0])
while t!='A' and t!='B' and t!='C':
  t=g(t)
print(t)

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
c=input()
def g(x):
  if x=='a':
    if len(a)==0:
      y='A'
    else:
      y=a[0]
      a[0]=''
  elif x=='b':
    if len(b)==0:
      y='B'
    else:
      y=b[0]
      b[0]=''
  else:
    if len(c)==0:
      y='C'
    else:
      y=c[0]
      c[0]=''
  return y
t=g(a[0])
while t!='A' and t!='B' and t!='C':
  t=g(t)
print(t)

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
c=input()
def g(x):
  if x=='a':
    if len(a)==0:
      y='A'
    else:
      y=a[0]
      a=a[1:]
  elif x=='b':
    if len(b)==0:
      y='B'
    else:
      y=b[0]
      b=b[1:]
  else:
    if len(c)==0:
      y='C'
    else:
      y=c[0]
      c=c[1:]
  return y
t=g(a[0])
while t!='A' and t!='B' and t!='C':
  t=g(t)
print(t)
Problem p04045 (python)

Fixed submission:
n,k=map(int,input().split())
d=list(input().split())
x=list(range(1,100000)[::-1])
for i in d:
  a=[]
  for j in x:
    if i not in str(j):
      a.append(j)
  x=a
import bisect as bi
x=x[::-1]
print(x[bi.bisect_left(x,n)])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
d=list(input().split())
x=list(range(1,10000)[::-1])
for i in d:
  a=[]
  for j in x:
    if i not in str(j):
      a.append(j)
  x=a
import bisect as bi
x=x[::-1]
print(x[bi.bisect_left(x,n)])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
d=list(input().split())
x=list(range(1,10000)[::-1])
for i in d:
  a=[]
  for j in x:
    if i not in str(j):
      a.append(j)
  x=a
import bisect as bi
print(x[bi.bisect_left(x,n)])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
d=list(input().split())
x=range(1,10000)[::-1]
for i in d:
  for j in x:
    if i in str(j):
      x.remove(j)
import bisect as bi
print(x[bi.bisect_left(x,n)])
Problem p04046 (python)

Fixed submission:
n=200000
mod=10**9+7
def pf(x,y,p):
  if y==0: return 1
  if y%2==0:
    d=pf(x,y//2,p)
    return d*d%p
  if y%2==1:
    return (x*pf(x,y-1,p))%p
facl=[1]
for i in range(1,n+2):
  facl.append(facl[i-1]*i%mod)
invl=[1]*(n+2)
for i in range(1,n+2):
  invl[i]=pf(facl[i],mod-2,mod)
def comb(x,k):
  if x<0 or k<0 or x<k: return 0
  if x==0 or k==0: return 1
  return (facl[x]*invl[k]*invl[x-k])%mod
h,w,a,b=map(int,input().split())
if h-a<w-b:
  h,w=w,h
  a,b=b,a
t=0
for i in range(w-b):
  t+=comb(h-a+b-1,b+i)*comb(w-b+a-1,a+i)
print(t%mod)

Buggy submission (verdict: Runtime Error):
n=200000
def pf(x,y,p):
  if y==0: return 1
  if y%2==0:
    d=pf(x,y//2,p)
    return d*d%p
  if y%2==1:
    return (x*pf(x,y-1,p))%p
facl=[1]
for i in range(1,n+2):
  facl.append(facl[i-1]*i%mod)
invl=[1]*(n+2)
for i in range(1,n+2):
  invl[i]=pf(facl[i],mod-2,mod)
def comb(x,k):
  if x<0 or k<0 or x<k: return 0
  if x==0 or k==0: return 1
  return (facl[x]*invl[k]*invl[x-k])%mod
h,w,a,b=map(int,input().split())
mod=10**9+7
if h-a<w-b:
  h,w=w,h
  a,b=b,a
t=0
for i in range(w-b):
  t+=comb(h-a+b-1,b+i)*comb(w-b+a-1,a+i)
print(t%mod)

Buggy submission (verdict: Runtime Error):
def comb(n,k,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=factorial(k)%p
  c=factorial(n-k)%p
  return (a*power_func(b,p-2,p)*power_func(c,p-2,p))%p
def power_func(a,b,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
h,w,a,b=map(int,input().split())
mod=10**9+7
if h-a<w-b:
  h,w=w,h
  a,b=b,a
t=0
for i in range(w-b):
  t+=comb((h-a-i)*(w-b+1+i),w-b+1+i)*comb((w-b-i)*(a+1+i),a+1+i)
print(t%mod)
Problem p03160 (python)

Fixed submission:
import sys

N_MAX = 100010

sys.setrecursionlimit(500000)

dp = [-1]*N_MAX
vec = [0]*N_MAX

def frog(n):
  if dp[n] != -1:
    return dp[n]
  else:
    dp[n] = min(frog(n-1) + abs(vec[n] - vec[n-1]) , frog(n-2) + abs(vec[n] - vec[n-2]))
    return dp[n]
  
N = int(input())
ln = list(map(int, input().split()))

for i in range(N):
  vec[i] = ln[i]

dp[0] = 0
dp[1] = abs(vec[0] - vec[1])

print(frog(N-1))

Buggy submission (verdict: Runtime Error):
import sys

N_MAX = 100010

sys.setrecursionlimit(100000)

dp = [-1]*N_MAX
vec = [0]*N_MAX

def frog(n):
  if dp[n] != -1:
    return dp[n]
  else:
    dp[n] = min(frog(n-1) + abs(vec[n] - vec[n-1]) , frog(n-2) + abs(vec[n] - vec[n-2]))
    return dp[n]
  
N = int(input())
ln = list(map(int, input().split()))

for i in range(N):
  vec[i] = ln[i]

dp[0] = 0
dp[1] = abs(vec[0] - vec[1])

print(frog(N-1))

Buggy submission (verdict: Runtime Error):
import sys

N_MAX = 100010

dp = [-1]*N_MAX
vec = [0]*N_MAX

def frog(n):
  if dp[n] != -1:
    return dp[n]
  else:
    dp[n] = min(frog(n-1) + abs(vec[n] - vec[n-1]) , frog(n-2) + abs(vec[n] - vec[n-2]))
    return dp[n]
  
N = int(input())
ln = list(map(int, input().split()))

for i in range(N):
  vec[i] = ln[i]

dp[0] = 0
dp[1] = abs(vec[0] - vec[1])

print(frog(N-1))
Problem p02582 (python)

Fixed submission:
S = input()
c = 0
ans = 0
for i in range(3):
  if S[i] == 'R':
    c+=1
  else:
    ans = max(c,ans)
    c = 0
ans = max(c,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
c = 0
ans = 0
for i in range(3):
  if S[i] == 'R':
    c++
  else:
    ans = max(c,ans)
print(ans)
Problem p02612 (python)

Fixed submission:
print((1000-(int(input())%1000))%1000)

Buggy submission (verdict: Runtime Error):
print((1000-(int(input)%1000))%1000)

Buggy submission (verdict: Runtime Error):
print((1000-int(input)%1000)%1000)
Problem p02613 (python)

Fixed submission:
a = [input() for _ in range(int(input()))]
print("AC x {}".format(a.count("AC")))
print("WA x {}".format(a.count("WA")))
print("TLE x {}".format(a.count("TLE")))
print("RE x {}".format(a.count("RE")))

Buggy submission (verdict: Runtime Error):
a = [input() for _ in range(int(input()))]
print("AC x {0}".format(a.count("AC"))
print("WA x {0}".format(a.count("WA"))
print("TLE x {0}".format(a.count("TLE"))      
print("RE x {0}".format(a.count("RE"))

Buggy submission (verdict: Runtime Error):
a = [input() for _ in range(int(input())]
print("AC x {0}".format(a.count("AC"))
print("WA x {0}".format(a.count("WA"))
print("TLE x {0}".format(a.count("TLE"))      
print("RE x {0}".format(a.count("RE"))
Problem p02664 (python)

Fixed submission:
s = input().replace("?", "D")
print(s)

Buggy submission (verdict: Runtime Error):
s = input()
ans = ""
for c in s:
  if c == '?':
    ans.append('d')
  else:
    ans.append(c)
print(ans)
Problem p02732 (python)

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

B = [0]*(N+1)
for l in range(N):
    B[A[l]] += 1
ans = 0
for i in range(N+1):
    ans += int(B[i] * (B[i]-1) / 2)
for k in range(N):
        print(ans - B[A[k]] + 1)

Buggy submission (verdict: Runtime Error):
import copy

N = int(input())
A = list(map(int, input().split()))

for i in range(N):
    k=i+1
    B = copy.copy(A)
    B.pop(i)
    C = [0]*(N-1)
    for l in range(N-1):
        C[B[l]] += 1
    temp = 0
    for m in range(N-1):
        temp += int(C[m]*(C[m]-1)/2)
    print(temp)
Problem p02583 (python)

Fixed submission:
import itertools

n = int(input())
arr = list(map(int, input().split()))
arr.sort()
count = 0
for i in itertools.combinations(arr, 3):
    if i[0] + i[1] > i[2] and i[0] + i[2] > i[1] and i[2] + i[1] > i[0] and i[0] != i[1] != i[2]:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
import itertools
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
count = 0
for i in itertools.combinations(arr, 3):
  if i[0]+i[1] > i[3] and i[0]+i[3] > i[1] and i[3]+i[1] > i[0]:
    count += 1
print(count)
Problem p02993 (python)

Fixed submission:
arr = list(input())
for k in range(len(arr) - 1):
  if arr[k] == arr[k+1]:
    print("Bad")
    exit()
print("Good")

Buggy submission (verdict: Runtime Error):
arr = list(map(int, input().split()))
for k in range(len(arr)):
  if arr[k] == arr[k+1]:
    print("Bad")
    exit()
print("Good")
Problem p03523 (python)

Fixed submission:
import re
print("YES" if re.match(r"^A?KIHA?BA?RA?$", input()) else "NO")

Buggy submission (verdict: Runtime Error):
s = list(input())
z = s.copy()
arr = []
result = []
req = list("AKIHABARA")
if s == []:
    print("NO")
    exit()
while s.count("A") >= 1:
    result.append(s.index("A"))
    s.remove("A")
m = "".join(z)
k = z.index("K")
for d in range(len(result)-1):
    if result[d] - result[d+1] == 0:
        print("NO")
        exit()
    else:
        arr.append("T")
if s == ['K', 'I', 'H', 'B', 'R'] and s.count("A") <= 4 and "KIH" in m:
    if "T" in arr or arr == [] or len(result) == 1:
        print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
s = list(input())
z = s.copy()
arr = []
result = []
req = list("AKIHABARA")
while s.count("A") >= 1:
    result.append(s.index("A"))
    s.remove("A")
m = "".join(z)
k = z.index("K")
for d in range(len(result)-1):
    if result[d] - result[d+1] == 0:
        print("NO")
        exit()
    else:
        arr.append("T")
if s == ['K', 'I', 'H', 'B', 'R'] and s.count("A") <= 4 and "KIH" in m:
    if "T" in arr or arr == [] or len(result) == 1:
        print("YES")
else:
    print("NO")
Problem p02783 (python)

Fixed submission:
H,A = map(int,input().split())

if H % A != 0:
  print(H//A + 1)
  
elif H % A == 0:
  print(H//A)

Buggy submission (verdict: Runtime Error):
H, A = mat(int, input().split())

if H % A == 0:
  print(H / A)
  
elif H % A != 0:
  print(H / A +1)
Problem p02784 (python)

Fixed submission:
H, N = map(int, input().split())
 
List = list(map(int, input().split()))
 
total = 0
for l in range(len(List)):
  total += List[l]
  
if H > total:
  print('No')
  
elif H <= total:
  print('Yes')

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

List = []
for _ in N:
  List.append(int(input()))

total = 0
for l in len(List):
  total += List[l]
  
if H > total:
  print('No')
  
elif H <= total:
  print('Yes')

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

List = map(int, input().split())

total = 0
for l in len(List):
  total += List[l]
  
if H > total:
  print('No')
  
elif H <= total:
  print('Yes')