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

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
list=[]
for i in range(n):
  list.append([i+1,l[i]])
list.sort(key=lambda x:x[1])
ans=[]
for aa in list:
  ans.append(aa[0])
print(*ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
list=[]
for i in range(n):
  list.append([i+1,list[i]])
list.sort(key=lambda x:x[1])
ans=[]
for aa in list:
  ans.append(aa[0])
print(*ans)
Problem p02910 (python)

Fixed submission:
s=input()
n=len(s)
list1=['R','U','D']
list2=['L','U','D']
listg=[]
listk=[]
for i in range(n):
  if i%2!=0:
    listg.append(i)
  else:
    listk.append(i)
list3=[]
for g in listg:
  if s[g] in list2:
    list3.append(g)
list4=[]
for k in listk:
  if s[k] in list1:
    list4.append(k)
if len(list3)==len(listg) and len(list4)==len(listk):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
k=['R','U','D']
g=['L','U','D']
for i in n:
  if (i+1)%2!=0 and s[i] not in k:
    print('No')
    exit()
  elif (i+1)%2==0 and s[i] not in g:
    print('No')
    exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
list1=['R','U','D']
list2=['L','U','D']
listg=[]
listk=[]
for i in range(n):
  if i%2!=0:
    listg.append(i)
  else:
    listk.append(i)
list3=[]
for g in listg:
  if s[g] in list2:
    list3.append(g)
list4=[]
for k in listk:
  if s[k] in list1:
    list4.append(k)
if len(list3)==len(listg) and len(list4)=len(listk):
  print('Yes')
else:
  print('No')
Problem p02911 (python)

Fixed submission:
n,k,q=map(int,input().split())
l=[int(input()) for i in range(q)]
p=[k]*n
for ll in l:
  p[ll-1]+=1
for pp in p:
  pp-=q
  if pp>0:
    print('Yes')
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
n,k,q=map(int,input().split())
l=[int(input()) for i in range(q)]
p=[0]*
for ll in l:
  p[ll-1]
Problem p02922 (python)

Fixed submission:
a,b=map(int,input().split())
n=0
while n*a-n+1<b:
  n+=1
print(n)

Buggy submission (verdict: Runtime Error):
import math
a,b=map(int,input().split())
print(math.ceil((b-1)/(a-1))
Problem p02934 (python)

Fixed submission:
n=int(input())
lista=list(map(int,input().split()))
count=0
for a in lista:
  count+=1/a
print(1/count)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
sum=0
for ll in list:
  sum+=1/ll
print(1/sum)

Buggy submission (verdict: Runtime Error):
n=int(input())
lista=list(map(int,input().split()))
count=0
for a in lista:
  count+=1/a
print(i/count)
Problem p02936 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**7)
n,q=map(int,input().split())
root=[[] for _ in range(n)]
f=lambda x:int(x)-1
 
for i in range(n-1):
  a,b=map(f,input().split())
  root[a].append(b)
  root[b].append(a)
 
score=[0]*n
for j in range(q):
  p,x=map(int,input().split())
  score[p-1]+=x
 
visit = [False]*n
def dfs(now):
  visit[now] = True
  for go in root[now]:
    if visit[go]:
      continue
    score[go] += score[now]
    dfs(go)

dfs(0)
print(*score)

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
root=[[] for _ in range(n)]
f=lambda x:int(x)-1
 
for i in range(n-1):
  a,b=map(f,input().split())
  root[a].append(b)
  root[b].append(a)
 
score=[0]*n
for j in range(q):
  p,x=map(int,input().split())
  score[p-1]+=x
 
visit = [False]*n
def dfs(now):
  visit[now] = True
  for go in root[now]:
    if visit[go]:
      continue
    score[go] += score[now]
    dfs(go)

dfs(0)
print(*score)

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
l=[[] for _ in range(n)]
f=lambda x:int(x)-1
 
for i in range(n-1):
  a,b=map(f,input().split())
  l[a].append(b)
  l[b].append(a)
 
score=[0]*n
for j in range(q):
  p,x=map(int,input().split())
  score[p-1]+=x
 
visit = [False]*N
def dfs(n):
  visit[n] = True
  for go in root[n]:
    if visit[go]:
      continue
    ans[go] += ans[n]
    dfs(go)

dfs(0)
print(*score)

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
l=[[] for _ in range(n)]
f=lambda x:int(x)-1
 
for i in range(n-1):
  a,b=map(f,input().split())
  l[a].append(b)
  l[b].append(a)
 
score=[0]*n
for j in range(q):
  p,x=map(int,input().split())
  score[p-1]+=x
 
visit=set()
def dfs(now):
  visit.add(now)
  for t in l[now]:
    if t not in visit:
      visit.add(t)
      score[t]+=score[now]
      dfs(t)
dfs(0)
print(*score)

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
l=[[] for _ in range(n)]
f=lambda x:int(x)-1

for i in range(n-1):
  a,b=map(f,input().split())
  l[a].append(b)
  l[b].append(a)

score[0]*n
for j in range(q):
  p,x=map(int,input().split())
  score[p-1]+=x

visit=set()
def dfs(now):
  visit.add(now)
  for t in l[now]:
    if t not in visit:
      visit.add(t)
      score[t]+=score[now]
      dfs()
dfs(0)
print(*score)
Problem p02946 (python)

Fixed submission:
k,x=map(int,input().split())
list=[]
for i in range(k):
  list.append(x+i)
  list.append(x-i)
list.remove(x)
list.sort()
print(*list)

Buggy submission (verdict: Runtime Error):
k,x=map(int,input().split())
l=list(range(x-k+1,x+k))
  print(*l)

Buggy submission (verdict: Runtime Error):
k,x=map(int,input().split())
list=[]
for i in range(k):
  list.append(x+i)
  list.append(x-i)
list.remove(x)
list.sort()
print(*list sep='')

Buggy submission (verdict: Runtime Error):
k,x=map(int,input().split())
list=[]
for i in range(k):
  list.append(k+i)
  list.append(k-i)
list.remove(0)
list.sort()
print(*list sep='')
Problem p02947 (python)

Fixed submission:
from collections import Counter
n=int(input())
l=[''.join(sorted(input())) for _ in range(n)]
ans=0
for i in Counter(l).values():
  ans+=i*(i-1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(inout())
l=[''.join(sorted(input())) for _ in range(n)]
ans=0
for i in Counter(l).value():
  ans+=i*(i-1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools
import collections
n=int(input())
l=[input() for i in range(n)]
ans=0
for k in itertools.combinations:
  c1=collections.Counter(k[0])
  c2=collections.Counter(k[1])
  if c1.most_common()==c2.most_common():
    ans+=1
print(ans)
Problem p02952 (python)

Fixed submission:
n=int(input())
ans=0
for i in range(1,n+1):
  if len(str(i))%2!=0:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
num=math.log(n,10)
if 0<=num<1:
  print(n)
elif 1<=num<2:
  print(9)
elif 2<=num<3:
  print(n-90)
elif 3<=num<4:
  print(909)
elif 4<=num<5:
  print(n-9090)
else:
  print(90909)

Buggy submission (verdict: Runtime Error):
n=int(input())
num=math.log(n,10)
if 0<=num<1:
  print(n)
elif 1<=num<2:
  print(n-90)
elif 2<=num<3:
  print(909)
elif 3<=num<4:
  print(909)
elif 4<=num<5:
  print(n-9090)
else:
  print(90909)
Problem p02958 (python)

Fixed submission:
n=int(input())
p=list(map(int,input().split()))
t=list(range(1,n+1))
cnt=0
for i in range(n):
  if p[i]!=t[i]:
    cnt+=1
print('YES' if 0<=cnt<=2 else 'NO')

Buggy submission (verdict: Runtime Error):
n=int(input())
p=list(map(in,input().split()))
t=list(range(1,n+1))
cnt=0
for pp in p:
  for tt in t:
    if pp!=tt:
      cnt+=1
print('Yes' if 0<=cnt<=2 else 'No')

Buggy submission (verdict: Runtime Error):
n=int(input())
listp=list(map(int,input().split()))
for i in range(1,n):
  for j in range(2,n+1):
    a=listp[i-1]
    b=listp[j-1]
    listp[i-1]=b
    listp[j-1]=a
    for y in range(n):
      if listp[y]==y+1:
        print('Yes')
        exit()
for x in range(n):
  if listp[x]==x+1
    print('Yes')
    exit()
print('No')
Problem p02982 (python)

Fixed submission:
n,d=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
cnt=0
for i in range(n-1):
  for j in range(i+1,n):
    sum=0
    for dd in range(d):
      sum+=(l[i][dd]-l[j][dd])**2
    if sum**0.5==int(sum**0.5):
      cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n,d=map(int,input().split())
lists=[list(map(int,input().split())) for x in range(n)]
answer=0
for i in range(1,n):
  for j in range(i+1,n+1):
    count=o
    for y in range(d):
      count+=(lists[j-1][y]-lists[i-1][y])**2
    t=count**(1/2)
    if t.is_integer():
      answer+=1
print(answer)

Buggy submission (verdict: Runtime Error):
n,d=map(int,input().split())
lists=[list(map(int,input().split())) for x in range(n)]
answer=0
for i in range(1,n):
  for j in range(i+1,n+1):
    count=o
    for y in range(d):
      count+=(lists[j-1][y]-lists[i-1][y])**2
    t=count**(1/2)
    if t.is_integer():
        answer+=1
print(answer)

Buggy submission (verdict: Runtime Error):
n,d=map(int,input().split())
lists=[list(map(int,input().split())) for x in range(n)]
answer=0
for i in range(1,n):
  for j in range(i+1,n+1):
    for y in range(d):
      count=0
      count+=(lists[j-1][y]-lists[i-1][y])**2
      n=count**(1/2)
      if n.is_integer():
        answer+=1
print(answer)

Buggy submission (verdict: Runtime Error):
n,d=map(int,input().split())
lists=[list(map(int,input().split())) for x in range(n)]
answer=0
for i in range(1,n):
  for j in range(2,n+1):
    for y in range(d):
      count=0
      count+=(lists[j-1][y]-lists[i-1][y])**2
      n=count**(1/2)
      if n.is_integer():
        answer+=1
print(answer)

Buggy submission (verdict: Runtime Error):
n,d=map(int,input().split())
lists=[list(map(int,input().split())) for x in range(n)]
answer=0
for i in range(1,n):
  for j in range(2,n+1):
    for y in range(d):
      count=0
      count+=(lists[j-1][y]-lists[i-1][y])**2
      if is_integer(count**(1/2)):
        answer+=1
print(answer)
Problem p02994 (python)

Fixed submission:
n,l=map(int,input().split())
s=0
list=[]
for i in range(1,n+1):
  s+=i
  list.append(abs(l+i-1))
sum=n*(l-1)+s
m=list.index(min(list))
print(sum-l-m)

Buggy submission (verdict: Runtime Error):
n,l=map(int,input().split())
ls=[]
for i in range(1,n+1):
  ls.append(abs(l-1+i))
mi=l.index(min(ls))
print(n*(l-1)+sum(range(1,n+1))-l-mi)

Buggy submission (verdict: Runtime Error):
l=[]
for i in range(1,n+1):
  l.append(abs(l-1+i))
mi=l.index(min(l))
print(n*(l-1)+sum(range(1,n+1))-l-mi)

Buggy submission (verdict: Runtime Error):
l=[]
for i in range(1,n+1):
  l.append(abs(l-1+i))
mi=l.index(min(l))
print(n*(l-1)+sum(range(1,n+1)-l-mi)

Buggy submission (verdict: Runtime Error):
n,l=map(int,input().split())
s=0
list=[]
for i in range(1,n+1):
  s+=i
  list.append(abs(l+i-1)
sum=n*(l-i)+s
if l-1<-n:
  print(sum+min(list))
else:
  print(sum-min(list))
Problem p02995 (python)

Fixed submission:
import math
a,b,c,d=map(int,input().split())
x=b//c-(a-1)//c
y=b//d-(a-1)//d
g=math.gcd(c,d)
l=c*d//g
z=b//l-(a-1)//l
print(b-a+1-x-y+z)

Buggy submission (verdict: Runtime Error):
l=[]
for i in range(1,n+1):
  l.append(abs(l-1+i))
mi=l.index(min(l))
print(n*(l-1)+sum(range(1,n+1))-l-mi)
Problem p03030 (python)

Fixed submission:
n=int(input())
lists=[]
for x in range(n):
  a,b=input().split()
  lists.append([a,int(b),x+1])
lists.sort(key=lambda t:t[1],reverse=True)
lists.sort(key=lambda t:t[0])
for x in range(n):
  print(lists[x][2])

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[]
for i in range(n):
  s,p=map(int,input().split())
  l.append([i+1,s,p])
l.sort(key=lambda x:x[2],reverse=True)
l.sort(key=lambda x:x[1])
for ll in l:
  print(ll[0])

Buggy submission (verdict: Runtime Error):
n=int(input())
for x in range(n):
  a,b=input().split()
  lists.append([a,int(b),x+1])
lists.sort(key=lambda t:t[1],reverse=True)
lists.sort(key=lambda t:t[0])
for x in range(n):
  print(lists[x][2])

Buggy submission (verdict: Runtime Error):
n=int(input())
lists=[list(input().split()) for x in range(n)]
for x in range(n):
  a,b=input().split()
  lists.append([a,int(b),x+1])
lists.sort(key=lambda t:t[1],reverse=True)
lists.sort(key=lambda t:t[0])
for x in range(n):
  print(lists[x][2])

Buggy submission (verdict: Runtime Error):
n=int(input())
lists=[list(input().split()) for x in range(n)]
for y in range(n):
  lists[y].append(y+1)
lists.sort(key=lambda t:t[1] reverse=True)
lists.sort(key=lambda t:t[0])
for z in range(n):
  print(lists[z][2])

Buggy submission (verdict: Runtime Error):
n=int(input())
lists=[list(input().split()) for x in range(n)]
for x in range(n):
  lists[x].append(x+1)
lists.sort(key=lambda t:t[1] reverse=True)
lists.sort(key=lambda t:t[0])
for x in range(n):
  print(lists[x][2])

Buggy submission (verdict: Runtime Error):
n=int(input())
lists=[list(input().split()) for x in range(n)]
for x in range(n):
  lists[x].append(x+1)
lists.sort(key=lambda x:x[1] reverse=True)
lists.sort(key=lambda x:x[0])
for x in range(n):
  print(lists[x][2])
Problem p03031 (python)

Fixed submission:
import itertools
n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
p=list(map(int,input().split()))
sss=0
for c in itertools.product([0,1],repeat=n):
  ans=0
  for i in range(m):
    cnt=0
    for j in range(l[i][0]):
      if c[l[i][j+1]-1]==1:
        cnt+=1
    if cnt%2==p[i]:
      ans+=1
  if ans==m:
    sss+=1
print(sss)

Buggy submission (verdict: Runtime Error):
import itertools
n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
p=list(map(int,input().split()))
sss=0
for c in itertools.product([0,1],n):
  for i in range(m):
    cnt=0
    for j in range(l[i][0]):
      if c[l[i][j+1]-1]==1:
        cnt+=1
    if cnt%2==p[i]:
      ans+=1
  if ans==m:
    sss+=1
print(sss)
Problem p03037 (python)

Fixed submission:
n,m=map(int,input().split())
l,r=map(int,input().split())
for i in range(m-1):
  x,y=map(int,input().split())
  l=max(l,x)
  r=min(r,y)
print(r-l+1 if l<=r else(0))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
lr=[list(map(int,input().split())) for i in range(m)]
l=[0]*n
for l,r in lr:
  for t in range(l,r+1):
    l[t-1]+=1
ans=0
for ll in l:
  if ll==m:
    ans+==1
print(ans)
Problem p03076 (python)

Fixed submission:
import math
list=[int(input()) for x in range(5)]
list.sort(key=lambda x:x%10)
count=0
for l in list:
  if l%10==0:
    count+=1
if count==5:
  print(sum(list))
else:
  a=list[count]
  del list[count]
  ans=[]
  for t in list:
    ans.append(math.ceil(t/10)*10)
  print(sum(ans)+a)

Buggy submission (verdict: Runtime Error):
import math
l=[int(input()) for i in range(5)]
t=[]
for ll in l:
  t.append(math.ceil(t//10))
lis=[]
for i in range(5):
  lis.append(t[i]*10-l[i])
m=max(lis)
sum=0
for i in range(5):
  sum+=t[i]*10
print(sum-m)

Buggy submission (verdict: Runtime Error):
import math
list=[int(input()) for x in range(5)]
list.sort(key=lambda x:x%10)
count=0
for l in list:
  if l%10==0:
    count+=1
if count==0:
  print(sum(list))
else:
  a=list[count]
  del list[count]
  ans=[]
  for t in list:
    ans.append(math.ceil(t/10)*10)
  print(sum(ans)+a)

Buggy submission (verdict: Runtime Error):
import math
list=[int(input()) for x in range(5)]
list.sort(key=lambda x:x%10)
count=0
for l in list:
  if l%10==0:
    count+=1
a=list[count]
del list[count]
ans=[]
for t in list:
  ans.append(math.ceil(t/10)*10)
print(sum(ans)+a)
Problem p03086 (python)

Fixed submission:
s=input()
n=len(s)
list=['A','C','G','T']
ans=[]
for i in range(n):
  k=0
  while i+k<=n-1:
    if all(a in list for a in s[i:i+k+1]):
      ans.append(k+1)
    k+=1
if len(ans)==0:
  print(0)
else:
  print(max(ans))

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
list=['A','C','G','T']
ans=[]
for i in range(n):
  k=0
  while i+k<=n-1:
    if all(a in list for a in s[i:i+k+1]):
      ans.append(k+1)
    k+=1
print(max(ans))
Problem p03087 (python)

Fixed submission:
n,q=map(int,input().split())
s=input()
list=[0]
for i in range(n-1):
  if s[i]=='A' and s[i+1]=='C':
    list.append(list[i]+1)
  else:
    list.append(list[i])
for j in range(q):
  l,r=map(int,input().split())
  print(list[r-1]-list[l-1])

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=input()
list=[0]
for i in range(n-1):
  if s[i]=='A' and s[i+1]=='C':
    list.append(list[i]+1)
  else:
    list.append(list[i])
for j in range(q):
  l,r=map(int,input().split())
  print(list[r]-list[l-1])

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=input()
list=[0]
for i in range(n-1):
  if s[i]=='A' and s[i+1]=='C':
    list.append(list[i]+1)
  else:
    list.append(list[i])
for j in range(q):
  l,r=map(int,input().split())
  print(list[r]-list[l-1])

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=input()
list=[0]
for i in range(n-1):
  if s[i]=='A' and s[i+1]=='C':
    list.append(list[i]+1)
  else:
    list.append(list[i])
for j in range(q):
  l,r=map(int,input().split())
  print(list[r]-list[l-1])

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=input()
list=[0]
for i in range(n-1):
  if s[i]=='A' and s[i+1]=='C':
    list.append(s[i]+1)
  else:
    list.append(s[i])
for j in range(q):
  l,r=map(int,input().split())
  print(list[r]-list[l-1])
Problem p03102 (python)

Fixed submission:
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
lista=[list(map(int,input().split())) for x in range(n)]
ans=0
for i in range(1,n+1):
  sum=0
  for j in range(1,m+1):
    sum+=lista[i-1][j-1]*b[j-1]
  if sum+c>0:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
lista=[list(map(int,input().split())) for x in range(n)]
ans=0
for i in range(1,n+1):
  sum=0
  for j in range(1,m+1):
    sum+=lista[j-1][j-1]*b[j-1]
  if sum+c>0:
    ans+=1
print(ans)
Problem p03111 (python)

Fixed submission:
import itertools
n,A,B,C=map(int,input().split())
l=[int(input()) for i in range(n)]
ll=[]
for p in itertools.product(['A','B','C','Z'],repeat=n):
  ans=0
  a=0
  b=0
  c=0
  numa=0
  numb=0
  numc=0
  for i in range(n):
    if p[i]=='A':
      a+=l[i]
      numa+=1
    elif p[i]=='B':
      b+=l[i]
      numb+=1
    elif p[i]=='C':
      c+=l[i]
      numc+=1
  ans+=(abs(a-A)+abs(B-b)+abs(C-c)+(numa+numb+numc-3)*10)
  if all(nn!=0 for nn in [numa,numb,numc]):
    ll.append(ans)
print(min(ll))

Buggy submission (verdict: Runtime Error):
import itertools
n,a,b,c=map(int,input().split())
l=[int(input()) for i in range(n)]
ans=100000
for p in itertools.product(['A','B','C','Z'],repeat=n):
  if list(p).count('A')>=1 and list(p).count('B')>=1 and list(p).count('C')>=1:
    for i in range(n):
      la=0
      lb=0
      lc=0
      if p[i]=='A':
        la+=p[i]
      elif p[i]=='B':
        lb+=p[i]
      elif p[i]=='C':
        lc+=p[i]
      ans=min(ans,abs(la-a)+abs(lb-b)+abs(lc-c))
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools
A,B,C,n=map(int,input(),split())
l=[int(input()) for i in range(n)]
ll=[]
for p in itertools.product(['A','B','C','Z'].repeat=n):
  ans=0
  a=0
  b=0
  c=0
  for i in range(n):
    if p[i]=='A':
      a+=l[i]
    elif p[i]=='B':
      b+=l[i]
    elif p[i]=='C':
      c+=l[i]
  ans+=(abs(a-A)+abs(B-b)+abs(C-c))
  ll.append(ans)
print(min(ans))
Problem p03126 (python)

Fixed submission:
n,m=map(int,input().split())
lists=[list(map(int,input().split())) for x in range(n)]
ans=[0]*m
for x in range(n):
  k=lists[x][0]
  for t in range(k):
    ans[lists[x][t+1]-1]+=1
count=0
for y in range(m):
  if ans[y]==n:
    count+=1
print(count)

Buggy submission (verdict: Runtime Error):
n,m=map(int,,input().split())
ans=[0]*m
l=[list(map(int,input().split())) for i in range(n)]
for i in range(n):
  k=l[i][0]
  for j in (1,k+1):
    ans[l[i][j]-1]+=1
cnt=0
for aa in ans:
  if aa==n:
    cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
lists=[list(map(int,input().split())) for x in range(n)]
ans=[0]*m
for x in range(n):
  k=lists[x][0]
  for t in range(k):
    ans[lists[x][t+1]-1]+=1
count=0
for y in range(m):
  if ans[x]==n:
    count+=1
print(count)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
lists=[list(map(int,input().split())) for x in range(n)]
ans=[0]*m
for x in range(n):
  k=lists[x][0]
  for t in range(k):
    ans[lists[x][t+1]-1]+=1
count=0
for x in range(n):
  if ans[x]==n:
    count+=1
print(count)
Problem p03136 (python)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
m=max(l)
l.remove(m)
print('Yes' if m<sum(l) else 'No')

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
m=max(list)
list.remove(m)
print('Yes' if m<sum(list) else 'No')
Problem p03146 (python)

Fixed submission:
s=int(input())
list=[s]
num=2
while num<=1000000:
  if list[num-2]%2==0:
    list.append(list[num-2]/2)
  else:
    list.append(list[num-2]*3+1)
  if list[num-1] in list[:num-1]:
    break
  num+=1
print(num)

Buggy submission (verdict: Runtime Error):
int(input())
list=[s]
num=2
while num<=1000000:
  if num%2==0:
    list.append(list[num-2]/2)
  else:
    list.append(list[num-2]*3+1)
  if list[num-1] in list[:num-1]:
    print(num)
    break
  num+=1

Buggy submission (verdict: Runtime Error):
int(input())
list=[s]
num=2
while num<=1000000:
  if num%2==0:
    list.append(list[num-2]/2)
  else:
    list.append(list[num-2]*3+1)
  if list[num-1] in list[:num-1]:
    break
  num+=1
print(num)
Problem p03147 (python)

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
sum=h[0]
for i in range(n-1):
  if h[i+1]>h[i]:
    sum+=h[i+1]-h[i]
print(sum)

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
h=np.array(h)
ans=0
while True:
  if all(hhh==0 for hhh in h):
    print(ans)
    exit()
  for i in range(n):
    k=n-i
    cnt=0
  for j in range(1,k):
    if all(hh!=0 for hh in h[i:i+j+1]):
      cnt+=1
  h[i:i+cnt+1]=-1
  ans+=1
Problem p03160 (python)

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
dp=[0]*n
dp[0]=0
dp[1]=abs(h[1]-h[0])
for i in range(n-2):
  dp[i+2]=min(dp[i]+abs(h[i+2]-h[i]),dp[i+1]+abs(h[i+2]-h[i+1]))
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
dp=[0]*n
dp[0]=0
dp[1]=abs(h[1]-h[0])
for i in range(n-2):
  dp(i+2)=min(dp[i]+abs(h[i+2]-h[i]),dp[i+1]+abs(h[i+2]-h[i]))
print(dp[n-1])
Problem p03161 (python)

Fixed submission:
n,k=map(int,input().split())
h=list(map(int,input().split()))
m=max(h)*(n-1)
dp=[m]*n
dp[0]=0
for i in range(n):
  if i+1+k<=n:
    r=k
  else:
    r=n-i-1
  for kk in range(1,r+1):
    dp[i+kk]=min(dp[i+kk],dp[i]+abs(h[i+kk]-h[i]))
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
import numpy as np
n,k=map(int,input().split())
h=np.array(list(map(int,input().split())))
dp=np.array([10**10]*(n+k))
dp[0]= 0
for i in range(n):
    dp[i+1:i+k+1]=np.minimum(dp[i+1:i+k+1],np.abs(h[i+1:i+k+1]-h[i])+dp[i])
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
import numpy as np
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=np.full(n+k,10**10,dtype=np.int64)
dp[0]=0
for i in range(1,n):
  dp[i:i+k+1]=np.minimum(dp[i:i+k+1],dp[i]+np.abs(h[i:i+k+1]-h[i]))
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
h=list(map(int,input().split()))
m=max(h)*(n-1)
dp=[m]*n
dp[0]=0
for i in range(n):
  if i+k<=n:
    r=k
  else:
    r=n-i
  for kk in range(1,r+1):
    dp[i+kk]=min(dp[i+kk],dp[i]+h[i+kk]-h[i])
print(dp[n-1])
Problem p03162 (python)

Fixed submission:
n=int(input())
abc=[list(map(int,input().split())) for i in range(n)]
dp=[[0,0,0] for _ in range(n+1)]
for i in range(n):
  for a in range(3):
    for b in range(3):
      if a!=b:
        dp[i+1][a]=max(dp[i][b]+abc[i][a],dp[i+1][a])
print(max(dp[n]))

Buggy submission (verdict: Runtime Error):
n=int(input())
import copy
l=[list(map(int,input().split())) for i in range(n)]
q=copy.copy(l)
dp=[0]*(n+1)
dp[0]=0
dp[1]=max(l[0])
for i in range(1,n-1):
  if l[i+1].index(max(l[i+1]))==l[i].index(max(l[i]):
    qq=q[i+1].sort()                                      
    dp[i+1]=max(dp[i-1]+max(l[i+1]),dp[i]+qq[1])
print(n)