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

Fixed submission:

import sys
from heapq import heapify,heappop,heappush
from collections import defaultdict
read=sys.stdin.read
readline=sys.stdin.readline

def main():
    n=int(readline())
    a,b,c=(list(map(int,lst.split())) for lst in read().splitlines())
    a.sort()
    b.sort()
    c=[-x for x in c]
    c.sort()

    def bise(x,lst):
        left=0
        right=len(lst)
        while right-left>0:
            mid=(right+left)//2
            if lst[mid]>=x:
                right=mid
            else:
                left=mid+1
        return left
    print(sum(bise(x,a)*bise(-x,c) for x in b))

if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
from bisect import bisect_right
read=sys.stdin.read
readline=sys.stdin.readline

def main():
    n=int(readline())
    a,b,c=(list(map(int,lst.split())) for lst in read().splitlines())
    a.sort()
    b.sort()
    c=[-x for x in c]
    c.sort()
    print(sum(bisect_right(x,a)*bisect_right(-x,c) for x in b))

if __name__=='__main__':
    main()
Problem p03563 (python)

Fixed submission:
r=int(input())
g=int(input())
print(2*g-r)

Buggy submission (verdict: Runtime Error):
r,g=map(int,input().split())
print(2*g-r)
Problem p03576 (python)

Fixed submission:
from collections import defaultdict
def main():
  n,k=map(int,input().split())
  xy=[list(map(int,input().split())) for _ in range(n)]
  x=[p[0] for p in xy]
  y=[p[1] for p in xy]
  x.sort()
  y.sort()
  
  s1=[[0]*n for _ in range(n)]
  s2=[[0]*n for _ in range(n)]
  s3=[[0]*n for _ in range(n)]
  s4=[[0]*n for _ in range(n)]
  for i in range(n):
    for j in range(n):
        for p in xy:
            if p[0]<=x[i] and p[1]<=y[j]:
              s1[i][j]+=1
              s2[i][j]+=(p[0]<x[i])
              s3[i][j]+=(p[1]<y[j])
              s4[i][j]+=(p[0]<x[i])*(p[1]<y[j])
  ans=float('inf')
  for s in range(n):
    for t in range(s+1,n):
      for u in range(n):
        for v in range(u+1,n):
          if s1[t][v]-s3[t][u]-s2[s][v]+s4[s][u]>=k:
            ans=min(ans,(x[t]-x[s])*(y[v]-y[u]))
  print(ans)

if __name__=='__main__':
  main()

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
n,k=map(int,input().split())
xy=[list(map(int,input().split())) for _ in range(n)]
xwl=dict((c[0],i) for i,c in enumerate(xy))
ywl=dict((c[1],i) for i,c in enumerate(xy))
x=list(xwl.keys())
y=list(ywl.keys())
x.sort()
y.sort()

xdict=dict()
ydict=dict()
xdict[x[0]]=[1<<xwl[x[0]],0]
ydict[y[0]]=[1<<ywl[y[0]],0]
size=lambda x:sum(x>>i&1 for i in range(n))
minus=lambda x,y:(x|y)^y
for i in range(1,n):
  xdict[x[i]]=[xdict[x[i-1]][0]|(1<<xwl[x[i]]), xdict[x[i-1]][1]|(1<<xwl[x[i-1]])]
  ydict[y[i]]=[ydict[y[i-1]][0]|(1<<ywl[y[i]]), ydict[y[i-1]][1]|(1<<ywl[y[i-1]])]

cand=[min(ans,(x[t]-x[s])*(y[v]-y[u])) for s in range(n) for t in range(n) \
 for u in range(n) for v in range(n) \
 if size(minus(xdict[x[t]][0],xdict[x[s]][1])&\
                minus(ydict[y[v]][0],ydict[y[u]][1]))>=k and s<t and u<v]

print(min(cand))
Problem p03590 (python)

Fixed submission:
import sys
readline=sys.stdin.readline
read=sys.stdin.read

def main():
    n,k=map(int,readline().split())
    ab=[list(map(int,l.split())) for l in read().splitlines()]
    
    ek=0
    while k>>ek:
        ek+=1

    cand=[]
    for i in range(ek):
        if k>>i&1:
            m=(k>>(i+1))<<(i+1)|((1<<i)-1)
            cand.append(sum([e[1] for e in ab if e[0]|m==m]))
    cand.append(sum([e[1] for e in ab if e[0]|k==k]))
    print(max(cand))

if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
readline=sys.stdin.readline
read=sys.stdin.read

def main():
    n,k=map(int,readline().split())
    ab=[list(map(int,l.split())) for l in read().splitlines()]
    
    ek=0
    while k>>ek:
        ek+=1
    ans=0
    for i in range(ek):
        if k>>i&1:
            m=(k>>(i+1))<<(i+1)|((1<<i)-1)
            ans=max(ans,sum([e[1] for e in ab if e[0]|m==m]))
    ans=max(ans,sum([e[1] for e in ab if e[0]|k==k]))
    print(max(cand))

if __name__=='__main__':
    main()
Problem p03597 (python)

Fixed submission:
import sys
read=sys.stdin.read

n,a=map(int,read().splitlines())

print(n**2-a)

Buggy submission (verdict: Runtime Error):
import sys
read=sys.stdin.read

n,a=map(int,read().spliitlines())

print(n**2-a)
Problem p03599 (python)

Fixed submission:
import sys
read=sys.stdin.read
readline=sys.stdin.readline

a,b,c,d,e,f=map(int,readline().split())

def searints(m,n,l):#m<=n
  mask=(1<<l+1)-1
  s=sum([1<<n*i for i in range(1,l//n+1)])&mask
  for i in range(1,l//m+1):
    s=(s+1<<m*i|s) &mask
  return [x for x in range(0,l+1) if ((s+1)>>x)&1==1]

w=searints(100*a,100*b,f)
s=searints(c,d,f)
candidates=[(100*y/(x+y),x+y,y) for x in w for y in s if e*x>=100*y and x*y>0 and x+y<=f]
if candidates:
  print(*max(candidates)[1:])
else:
  print(100*a,0)

Buggy submission (verdict: Runtime Error):
import sys
read=sys.stdin.read
readline=sys.stdin.readline

a,b,c,d,e,f=map(int,readline().split())

def searints(m,n,l):#m<=n
  mask=(1<<l+1)-1
  s=sum([1<<n*i for i in range(1,l//n+1)])&mask
  for i in range(1,l//m+1):
    s=(s+1<<m*i|s) &mask
  return [x for x in range(0,l+1) if ((s+1)>>x)&1==1]

w=searints(100*a,100*b,f)
s=searints(c,d,f)
candidates=[(100*y/(x+y),x+y,y) for x in w for y in s if e*x>=100*y and x*y>0 and x+y<=f]
print(*max(candidates)[1:])
Problem p03605 (python)

Fixed submission:
N=int(input())
print(['No','Yes'][9 in [N%10, (N-N%10)//10]])

Buggy submission (verdict: Runtime Error):
N=int(input())
print(['No','Yes'][9 in [N%10, (N-N%10)//10]]
Problem p03606 (python)

Fixed submission:
N=int(input())
lr=[list(map(int,input().split())) for _ in range(N)]
print(sum([e[1]-e[0]+1 for e in lr]))

Buggy submission (verdict: Runtime Error):
N=int(input())
lr=[list(map(int,input())) for _ in range(N)]
print(sum([e[1]-e[0]+1 for e in lr]))

Buggy submission (verdict: Runtime Error):
N=int(input())
lr=[list(map(int,input())) for _ in range(N)]
print(sum([e[1]-e[0]+1 for e in lr])
Problem p03607 (python)

Fixed submission:
import sys
from collections import Counter
read=sys.stdin.read

n,*a=map(int,read().split())
x=Counter(a)
print(sum(list(map(lambda n:n%2, list(x.values())))))

Buggy submission (verdict: Runtime Error):
import sys
readline=sys.stdin.readline

n=int(readline().strip())
a=[int(readline().strip()) for _  in range(n)]
l=[0]*(max(a)+1)
for x in a:
  l[x]^=1
print(sum(l))

Buggy submission (verdict: Runtime Error):
import sys
read=sys.stdin.read

n,*a=map(int,read().split())
l=[0]*(max(a)+1)
for x in a:
  l[x]^=1
print(sum(l))

Buggy submission (verdict: Runtime Error):
import sys
read=sys.stdin.read

n,*a=map(int,read().split())
l=[0]*max(a)
for i in a:
  l[a]^=1
print(sum(l))
Problem p03624 (python)

Fixed submission:
import sys
from string import ascii_lowercase as alphabets
from collections import defaultdict

readline=sys.stdin.readline

s=readline().strip()
d=defaultdict(int)
for x in s:
  d[x]=1
for a in alphabets:
  if d[a]==0:
    print(a)
    sys.exit()
print('None')

Buggy submission (verdict: Runtime Error):
import sys
from string import ascii_lowercase as aplhabets
from collections import defaultdict

readline=sys.stdin.readline

s=readline().split()
d=defautdict(int)
for x in s:
  d[x]=1
for a in alphabets:
  if d[a]==0:
    print(a)
    sys.exit()
print('None')

Buggy submission (verdict: Runtime Error):
import sys
from string import ascii_lowercase as aplhabets
from collections import defaultdict

readline=sys.stdin.readline

s=readline().split()
d=defautdict(int)
for x in s:
  d[x]=1
for a in alphabets:
  if d[a]=0:
    print(a)
    sys.exit()
print('None')
Problem p03625 (python)

Fixed submission:
import sys

n,*a=map(int,sys.stdin.read().split())

a.sort(reverse=True)
c=0
f=0
ans=[]
for i in range(n-1):
  if a[i]==a[i+1]:
    c+=1
    f+=1
    ans.append(a[i])
  else:
    f=0
  if (c>1 and f==1) or (c>2 and f==3):
    print(ans[0]*ans[-1])
    sys.exit()
print(0)

Buggy submission (verdict: Runtime Error):
import sys

n,*a=map(int,sys.stdin.read())

a.sort(reverse=True)
c=0
f=0
ans=[]
for i in range(n-1):
  if a[i]==a[i+1]:
    c+=1
    f+=1
    ans.append(a[i])
  else:
    f=0
  if (c==2 and f==1) or (c==3 and f==2):
    print(ans[0]*ans[1])
    sys.exit()
print(0)
Problem p03660 (python)

Fixed submission:
import sys
from collections import defaultdict
from collections import deque

n=int(input())
edges=[tuple(map(int,input().split())) for _ in range(n-1)]
d=defaultdict(list)
for e in edges:
  d[e[0]].append(e[1])
  d[e[1]].append(e[0])
fnc=[-1]*(n+1)
snk=[-1]*(n+1)
fnc[1]=0
snk[n]=0
cv=deque([1])
nv=deque([1])
c=-1
while nv:
  c+=1
  cv.extend(nv)
  nv.clear()
  for e in cv:
    fnc[e]=c
    for x in d[e]:
      if fnc[x]<0:
        nv.append(x)
  cv.clear()
cv.append(n)
nv=deque([1])
c=-1
while nv:
  c+=1
  cv.extend(nv)
  nv.clear()
  for e in cv:
    snk[e]=c
    for x in d[e]:
      if snk[x]<0:
        nv.append(x)
  cv.clear()

j=sum([(fnc[i]<=snk[i])-(fnc[i]>snk[i]) for i in range(1,n+1)])
if j>0:
  print('Fennec')
else:
  print('Snuke')

Buggy submission (verdict: Runtime Error):
from collections import deque, defaultdict

def main():
  n=int(input())
  edges=[tuple(map(int,input().split())) for _ in range(n-1)]
  d=defaultdict(list)
  for e in edges:
    d[e[0]].append(e[1])
    d[e[1]].append(e[0])
  def dist(m):
    dl=[-1]*(n+1)
    cv=deque([m])
    nv=deque([1])
    while nv:
      c+=1
      cv.extend(nv)
      nv.clear()
      for e in cv:
        dl[e]=c
        for x in d[e]:
          if dl[x]<0:
            nv.append(x)
      cv.clear()
    return dl[1:]
  fnc=dist(1)
  snk=dist(n)
  j=sum([(fnc[i]<=snk[i])-(fnc[i]>snk[i]) for i in range(n)])
  if j>0:
    print('Fennec')
  else:
    print('Snuke')

if __name__=='__main__':
    main()
Problem p03672 (python)

Fixed submission:
s=input()
n=len(s)//2
 
for i in range(1,n):
  if s[:n-i]==s[n-i:2*n-2*i]:
    print(2*n-2*i)
    break

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)//2

for x in range(1,n):
  if s[:n-i]==s[n-i:2*n-2*i]:
    print(2*n-2*i)
    break
Problem p03681 (python)

Fixed submission:
def main():
  p=10**9+7
  def modpfac(n):
    ret=1
    for i in range(1,n+1):
      ret=ret*i % p
    return ret
  n,m=map(int,input().split())
  if abs(m-n)>1:
    return print(0)
  elif abs(m-n)==1:
    return print(modpfac(n)*modpfac(m)%p)
  else:
    return print(2*modpfac(n)*modpfac(m)%p)
 
main()

Buggy submission (verdict: Runtime Error):

def main():
  p=10**9+7
  def modpfac(n):
    ret=1
    for i in range(1,n+1):
      ret*=i % p
    return ret
  n,m=map(int,input().split())
  if abs(m-n)>1:
    return print(0)
  elif abs(m-n)=1:
    return print(modpfac(n)*modpfac(m)%p)
  else:
    return print(2*modpfac(n)*modpfac(m)%p)

main()
Problem p03694 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
print(max(a)-min(a))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for _ in range(n)]
print(max(a)-min(a))
Problem p03711 (python)

Fixed submission:
x,y=map(int,input().split())
s0=1<<(x-1)|1<<(y-1)
s1=sum(list(map(lambda x:1<<(x-1),[1,3,5,7,8,10,12])))&s0
s2=sum(list(map(lambda x:1<<(x-1),[4,6,9,11])))&s0
s3=sum(list(map(lambda x:1<<(x-1),[2])))&s0

if s1==s0 or s2==s0 or s3==s0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
s0=1<<(x-1)|1<<(y-1)
s1=sum(list(map(lambda x:1<<(x-1),[1,3,5,7,8,10,12])))&s0
s2=sum(list(map(lambda x:1<<(x-1),[4,6,9,11])))&s0
s3==sum(list(map(lambda x:1<<(x-1),[2])))&s0

if s1==s0 or s2==s0 or s3==s0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
s0=1<<(x-1)|1<<(y-1)
s1=sum(map(lambda x:1<<(x-1),[1,3,5,7,8,10,12]))&s0
s2=sum(map(lambda x:1<<(x-1),[4,6,9,11]))&s0
s3==sum(map(lambda x:1<<(x-1),[2]))&s0

if s1==s0 or s2==s0 or s3==s0:
  print('Yes')
else:
  print('No')
Problem p03720 (python)

Fixed submission:
from collections import defaultdict

n,m=map(int,input().split())
r=[list(map(int,input().split())) for _ in range(m)]
d=defaultdict(int)
for x in r:
  d[x[0]]+=1
  d[x[1]]+=1

for i in range(1,n+1):
  print(d[i])

Buggy submission (verdict: Runtime Error):
from collections import defaultdict

n,m=map(int,input().split())
r=[list(map(int,input().split())) for _ in range(n)]
d=defaultdict(int)
for x in r:
  d[x[0]]+=1
  d[x[1]]+=1

for i in range(1,n+1):
  print(d[i])
Problem p03721 (python)

Fixed submission:
import sys
rl=sys.stdin.readline

def main():
    n,k=map(int,rl().strip().split())
    ints=[list(map(int,rl().strip().split())) for _ in range(n)]
    ints.sort(key=lambda e:e[0])
    s=0
    for e in ints:
        s+=e[1]
        if s>=k:
            print(e[0])
            break

if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
from sys
rl=sys.stdin.readline

def main():
    n,k=map(int,rl.strip().split())
    ints=[list(map(int,rl.strip().split())) for _ in range(n)]
    ints.sort(key=lambda e:e[0])
    s=0
    for e in ints:
        s+=e[1]
        if s<=k:
            print(e[0])
            break

if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
from collections import deque
n,k=map(int,input().split())
ints=[list(map(int,input().split())) for _ in range(n)]
d=deque()
for x in ints:
  d.extend([x[0]]*x[1])
ans=list(d).sort()
print(ans[k-1])
Problem p03722 (python)

Fixed submission:
import sys
rl=sys.stdin.readline

def main():
    n,m=map(int,rl().strip().split())
    eaw=[list(map(int,rl().strip().split())) for _ in range(m)]
    d=dict(((x[0]-1,x[1]-1),-x[2]) for x in eaw)
    inf=10**14
    mdl=[inf]*n
    mdl[0]=0
    def blrelax(dl,k):
        for _ in range(k):
            for e in iter(d):
                if dl[e[0]]+d[e]<dl[e[1]]:
                    dl[e[1]]=dl[e[0]]+d[e]
    blrelax(mdl,n-1)
    a1=mdl[n-1]
    blrelax(mdl,n)
    a2=mdl[n-1]
    if a1>a2:
        print('inf')
    else:
        print(-a1)
    
if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
from collections import defaultdict
rl=sys.stdin.readline


def main():
    n,m=map(int,rl().strip().split())
    ewdata=[list(map(int,rl().strip().split())) for _ in range(m)]
    ew=dict(((x[0],x[1]),x[2]) for x in ewdata)
    ed=defaultdict(list)
    deg=defaultdict(int)
    memo=defaultdict(int)
    for x in ew:
        ed[x[0]].append(x[1])
        deg[x[0]]+=1
    prev=0
    curr=1
    scores=[0]*(n+2)
    cps=[0]*(n+1)
    maxscore=-10**14
    stack=[]
    c=1
    while memo[1]<deg[1]:
        if cps[curr]==0:
            cps[curr]=c
        else:
            if scores[c]-scores[cps[curr]]>0:
                maxscore='inf'
                break
            else:
                memo[prev]+=1
                curr=prev 
                prev=stack.pop()
                c-=1
                continue
        if curr==n:
            maxscore=max(scores[c],maxscore)
        if memo[curr]<deg[curr]:
            c+=1
            stack.append(prev)
            prev=curr
            curr=ed[curr][memo[curr]]
            scores[c]+=scores[c-1]+ew[(prev,curr)]
        else:
            scores[c]=0
            memo[curr]=0
            memo[prev]+=1
            cps[curr]=0
            cps[prev]=0
            curr=prev
            prev=stack.pop()
            c-=1
        # print(c,cps,stack)
        # print(c,cps,scores)
        # print(list(memo.items()),stack)
    # print(deg)
    print(maxscore)

if __name__=='__main__':
    main()
Problem p03738 (python)

Fixed submission:
a=int(input())
b=int(input())

if a>b:
  print('GREATER')
elif a==b:
  print('EQUAL')
else:
  print('LESS')

Buggy submission (verdict: Runtime Error):
a=int(input().split())
b=int(input().split())

if a>b:
  print('GREATER')
elif a==b:
  print('EQUAL')
else:
  print('LESS')
Problem p03760 (python)

Fixed submission:
from collections import deque
 
O=input()
E=input()
 
o=deque(O)
e=deque(E)
 
s=''
while True:
  if not e  and not o:
    break
  if o:
    s+=o.popleft()
  if e:
    s+=e.popleft()
    
  
print(s)

Buggy submission (verdict: Runtime Error):
from itertools import zip_longest

o=input()
e=input()

print(''.join([x+y for x,y in zip_longetst(o,e,fillvalue='')]))

Buggy submission (verdict: Runtime Error):
from collections import deque

O=input()
E=input()

o=deque(O)
e=deque(E)

s=''
While True:
  if not e a and not o:
    break
  elif o:
    s+=o.pop()
  elif e:
    s+=e.pop()
    
  
print(s)

Buggy submission (verdict: Runtime Error):
from collections import deque

O=input()
E=input()

o=deque(O)
e=deque(E)

s=''
While True:
  if not e a and not o:
    break
  elif o:
    s+=o.pop()
  elif e:
    s+=e.pop()
Problem p03773 (python)

Fixed submission:
a,b=map(int,input().split())
 
print((a+b)%24)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input())

print((a+b)%24)
Problem p03777 (python)

Fixed submission:
a,b =input().split()

d={'H':0, 'D':1}
print(['H','D'][d[a]^d[b]])

Buggy submission (verdict: Runtime Error):
a,b =input().split()

d={'H':0, 'D':1}
print(['H','D'][d[a]^d[b]]
Problem p03798 (python)

Fixed submission:
import sys
from collections import deque

dic={'o':lambda s:1-(s[1]^s[0]), 'x':lambda s:s[1]^s[0]}
def mknseq(ox,ld):
    for x in ld:
        x.append(dic[ox]([x[-2],x[-1]]))
def main():
    N=int(sys.stdin.readline().strip())
    s=list(sys.stdin.readline().strip())
    ans=[deque([x,y]) for x in range(2) for y in range(2)]
    for x in range(N):
        mknseq(s[x],ans)
    ans=[list(x) for x in ans]
    # print(ans)
    for x in ans:
        if x[:2]==x[-2:]:
            return print(''.join([['W','S'][i] for i in x[1:-1]]))
    print(-1)

if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
from collections import deque

dic={'o':lambda s:1-(s[1]^s[0]), 'x':lambda s:s[1]^s[0]}
def mknseq(ox,ld):
    for x in ld:
        x.append(dic[ox]((x[-2],x[-1])))
def main():
    N=int(sys.stdin.readline().strip())
    s=list(sys.stdin.readline().strip())
    ans=[deque([x,y]) for x in range(2) for y in range(2)]
    for x in range(N):
        mknseq(s[x],ans)
    # print(ans)
    for x in ans:
        if x[:2]==x[-2:]:
            return print(''.join([['W','S'][i] for i in x])[1:-1])
    print(-1)

if __name__=='__main__':
    main()
Problem p03814 (python)

Fixed submission:
from collections import deque
s=input()

ds=deque(s)
flag=True

while ds[0]!='A' or ds[-1]!='Z':
  if ds[0]!='A':
    ds.popleft()
  if ds[-1]!='Z':
    ds.pop()
print(len(ds))

Buggy submission (verdict: Runtime Error):
s=input()
 
ds=list(s)
 
 
c1=0
while ds[c1]!='A'
  c1+=1
 
c2=-1
while ds[c2]!='Z':
  c2-=1
 
print(len(s[c1:c2]))

Buggy submission (verdict: Runtime Error):
s=input()
 
ds=list(s)
 
 
c1=0
while ds[c1]!='A'
  c1+=1
 
c2=-1
while ds[c2]!='Z':
  c2-=1
 
print(s[c1:c2])
 
s=input()

ds=list(s)


c1=0
while ds[c1]!='A'
  c1+=1

c2=-1
while ds[c2]!='Z':
  c2-=1

print(len(s[c1:c2]))

Buggy submission (verdict: Runtime Error):

s=input()

ds=list(s)


c1=0
while ds[c1]!='A'
  c1+=1

c2=-1
while ds[c2]!='Z':
  c2-=1

print(s[c1:c2])
Problem p03815 (python)

Fixed submission:
x=int(input())
 
p=x//11
q=x%11
q2=q-6
 
if q==0:
  print(2*p)
elif q2<=0:
  print(2*p+1)
else:
  print(2*p+2)

Buggy submission (verdict: Runtime Error):
x=int(input())
 
p=x//11
q=x%11
q2=q-6
 
if q==0
  print(2*p)
elif q2<0:
  print(2*p+1)
else:
  print(2*p+2)
Problem p03836 (python)

Fixed submission:
sx, sy, tx, ty=map(int,input().split())

dx=tx-sx
dy=ty-sy
d={0:'R', 1:'U', 2:'L', 3:'D'}
dirc=[dx,dy,dx,dy]

def path(sign,x,y,z,w):
  return d[sign+1]*abs(z-x) + d[sign+2]*abs(y-w)

s=''
s+='R'
s+=path(-1, sx+1, sy, tx, ty-1)
s+='UU'
s+=path(1, tx,ty+1,sx-1,sy)
s+='RD'
s+=path(-1, sx,sy-1,tx+1,ty)
s+='LL'
s+=path(1, tx-1,ty,sx,sy+1)
s+='D'
print(s)

Buggy submission (verdict: Runtime Error):
d={0:'R', 1:'U', 2:'L', 3:'D'}
dirc=[dx,dy,dx,dy]

def path(sign,x,y,z,w):
  return d[sign+1]*abs(z-x) + d[sign+2]*abs(y-w)

s=''
s+='R'
s+=path(-1, sx+1, sy, tx, ty-1)
s+='UU'
s+=path(1, tx,ty+1,sx-1,sy)
s+='RU'
s+=path(-1, sx,sy-1,tx+1,ty)
s+='LL'
s+=path(1, tx-1,ty,sx,sy+1)
s+='U'
print(s)

Buggy submission (verdict: Runtime Error):
sx, sy, tx, ty=map(int,inpu().split())

dx=tx-sx
dy=ty-sy
d={0:'R', 1:'U', 2:'L', 3:'D'}
dirc=[dx,dy,dx,dy]

s=''
for j in range(4):
  s+=d[j]*(dirc[j]+i)
s+='D'
for j in range(2):
  s+=d[j]*(dirc[j]+1)
s+='L'
s+='U'
for j in range(2):
  s+=d[j+2]*(dirc[j+2]+1)
s+='R'
print(s)

Buggy submission (verdict: Runtime Error):
sx, sy, tx, ty=map(int,inpu().split())

dx=tx-sx
dy=ty-sy
d={0:'R', 1:'U', 2:'L', 3:'D'}
dirc=[dx,dy,dx,dy]

s=''
for j in range(4)"
  s+=d[j]*(dirc[j]+i)
s+='D'
for j in range(2):
  s+=d[j]*(dirc[j]+1)
s+='L'
s+='U'
for j in range(2):
  s+=d[j+2]*(dirc[j+2]+1)
s+='R'
print(s)
Problem p03844 (python)

Fixed submission:
def main(a,op,b):
  if op=='+':
    return int(a)+int(b)
  elif op=='-':
    return int(a)-int(b)
 
  
if __name__=='__main__':
  a,op,b=input().split()
  print(main(a,op,b))

Buggy submission (verdict: Runtime Error):
def main(a,op,b):
  if op=='+':
    return int(a)+int(b)
  elif op=='-':
    return int(a)-int(b)

  
if __init__=='__main__':
  a,op,b=input().split()
  print(main(a,op,b))
Problem p03846 (python)

Fixed submission:
import sys
from collections import deque
p=10**9+7

def main(n,a):
  h=n//2
  g=n%2
  a.sort()
  c=[2*(x//2)+g+1 for x in range(n-g)]
  if g==1:
    c.insert(0,0)
  if a!=c:
      return 0
  return 2**(h%(p-1)) % p

if __name__=='__main__':
  n=int(input())
  a=list(map(int,sys.stdin.readline().strip().split()))
  print(main(n,a))

Buggy submission (verdict: Runtime Error):
import sys
from collections import deque
p=10**9+7

def main(n,a):
  h=n//2
  g=n%2
  a.sort()
  c=[2*(x//2)+g+1 for x in range(n-g)]
  if g==1:
    c.insert(0,0)
  if a!=c:
      return 0
  return 2**(h%(p-1))

if __name__='__main__':
  n=int(input())
  a=list(map(int,sys.stdin.readline().strip().split()))
  print(main(n,a))

Buggy submission (verdict: Runtime Error):
import sys
from collections import deque
p=10**9+7

def main(n,a):
  h=n//2
  g=n%2
  if g==1:
    if a.count(0)!=1:
      del a[a.index(0)]
  b=[0]*(n-g)
  d=deque(a)
  while d:
    x=d.pop()
    b[x-1-g]=x
    b[x-g]=x
  c=[2*(x//2)+g+1 for x in range(n-g)]
  if g==1:
    c.insert(0,0)
  if b!=c:
      return 0
  return 2**(h%(p-1))
n=int(input())
a=list(map(int,sys.stdin.readline().strip().split()))

print(main(n,a))

Buggy submission (verdict: Runtime Error):
import sys
p=10**9+7

def main(n,a):
  h=n//2
  g=n%2
  tp=2**h
  if g==1:
    if a.count(0)!=1:
      return 0
    else:
      del a[a.index(0)]
  c=sum([2**((x-1)//2) % tp for x in a])
  if c ^ 2*(tp-1):
      return 0
  return 2**(h%(p-1))
n=int(input())
a=list(map(int,sys.stdin.readline().strip().split()))

print(main(n,a))
Problem p03847 (python)

Fixed submission:
import sys

p=10**9+7
dthbit=lambda d,n: (n>>d)&1

def main(n):
    dp=[[0 for _ in range(3)] for _ in range(64)]
    dp[63][0]=1
    for d in range(62,-1,-1):
        b=dthbit(d,n)
        s=dp[d+1][:]
        dp[d][0]=dp[d+1][0]+(1^b)*dp[d+1][1] % p
        dp[d][1]=b*dp[d+1][0]+dp[d+1][1] % p
        dp[d][2]=(1+b)*dp[d+1][1]+3*dp[d+1][2] % p
    return sum(dp[0][:]) % p

n=int(input())
print(main(n))

Buggy submission (verdict: Runtime Error):
import sys

p=10**9+7
dthbit=lambda d,n: (n>>d)&1

def main(n):
    dp=[[0 for _ in range(3)] for _ in range(64)]
    dp[63][0]=1
    for d in range(62,-1,-1):
        b=dthbit(d,n)
        s=dp[d+1][:]
        dp[d][0]=dp[d+1][0]+(1^b)*dp[d+1][1] % p
        dp[d][1]=b*dp[d+1][0]+dp[d+1][1] % p
        dp[d][2]=(1+b)*dp[d+1][1]+3*dp[d+1][2] % p
    return sum(dp[0][:] % p)

n=int(input())
print(main(n))
Problem p03852 (python)

Fixed submission:
s = input()
 
vowels=['a','i','u','e','o']
 
if s[0] in vowels:
  print('vowel')
else:
  print('consonant')

Buggy submission (verdict: Runtime Error):
s = input()

vowels=['a','i','u','e','o']

if s[0]\invowels:
  print('vowel')
else:
  print('consonant')