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

Fixed submission:
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 1 ;count = 0 ;pro = 1
def gcd(a, b):
    while(b != 0):
        a, b = b, a % b
    return a
    
def lcm(m,n):
    return (m*n)//gcd(m,n)

n = int(input())
def make_key0(a,b):
  if a == 0 and b != 0:
    return(0,1)
  elif a != 0 and b == 0:
    return(1,0)
  if (a < 0 and b > 0) or (a > 0 and b < 0):hugou = 1
  else: hugou = -1
  a = abs(a)
  b = abs(b)
  G = gcd(a,b)
  return (hugou*(abs(a)//G),abs(b)//G)

C0 = collections.Counter()

for i in range(n):
  a,b = map(int,input().split())
  if (a,b) == (0,0) :count += 1
  else:
    a0,b0 = make_key0(a,b)
    C0[(a0,b0)] += 1

S = set()
for key,val in C0.items():
  a0,b0 = key
  S.add((a0,b0))
  a1,b1 = make_key0(b0,a0)
  if (a1,b1) in S:continue
  ans *= pow(2,val,mod) + pow(2,C0[(a1,b1)],mod) -1
  ans %= mod
ans += count 
print((ans-1)%mod)

Buggy submission (verdict: Runtime Error):
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 1 ;count = 0 ;pro = 1
def gcd(a, b):
    while(b != 0):
        a, b = b, a % b
    return a
    
def lcm(m,n):
    return (m*n)//gcd(m,n)

n = int(input())
def make_key0(a,b):
  if (a < 0 and b > 0) or (a > 0 and b < 0):hugou = 1
  else: hugou = -1
  a = abs(a)
  b = abs(b)
  G = gcd(a,b)
  return (hugou*(abs(a)//G),abs(b)//G)

def make_key1(a,b):
  if (a < 0 and b > 0) or (a > 0 and b < 0):hugou = -1
  else: hugou = 1
  a = abs(a)
  b = abs(b)
  G = gcd(a,b)
  return (hugou*(abs(b)//G),abs(a)//G)

C0 = collections.Counter()
C1 = collections.Counter()

for i in range(n):
  a,b = map(int,input().split())
  a0,b0 = make_key0(a,b)
  a1,b1 = make_key1(a,b)
  C0[(a0,b0)] += 1
  # C1[(a1,b1)] += 1
  # print(a0,b0,a1,b1)

S = set()
for key,val in C0.items():
  a0,b0 = key
  S.add((a0,b0))
  a1,b1 = make_key0(b0,a0)
  if (a1,b1) in S:continue
  # print((a0,b0))
  # print((a1,b1))
  # print((pow(2,val,mod) , pow(2,C0[(a1,b1)],mod)))
  # print((-1 if C0[(a1,b1)] else 0),C0[(a1,b1)])
  ans *= pow(2,val,mod) + pow(2,C0[(a1,b1)],mod) -1
  ans %= mod
print((ans-1)%mod)

# for key,val in C0.items():
#   print(key,val)

# for key,val in C1.items():
#   print(key,val)
Problem p02834 (python)

Fixed submission:
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
minans = inf ;ans = 0 ;count = 0 ;pro = 1
sys.setrecursionlimit(10**7)

n,u,v=map(int,input().split())
u-=1;v-=1
G=[[] for i in range(n)]
for i in range(n-1):
    a,b=map(int,input().split())
    a-=1;b-=1
    G[a].append(b)
    G[b].append(a)
D=[-1]*n
maxD=[-1]*n

def make_tree_dfs(n,d):
    D[n]=d
    tmp=0
    f=True
    for gi in G[n]:
        if D[gi]==-1:
            f=False
            tmp=max(tmp,make_tree_dfs(gi,d+1))
    if f: tmp=d
    maxD[n]=tmp
    return tmp

make_tree_dfs(v,0)
sdis=D[u]

def good_dfs(v,d,sdis):
    f=True
    for gi in G[v]:
        if D[gi]==d-1 and d-1>sdis-(d-1):
            return good_dfs(gi,d-1,sdis)
    return (maxD[v],d)

gd,orid=good_dfs(u,D[u],sdis)
k=orid-(sdis-orid)
print(gd-orid+(sdis-orid)+k-1)
# print(D)
# print(maxD)
# print(sdis,orid,gd,k)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n,U,V = map(int,input().split())
U-=1;V-=1
G = [[] for i in range(n)]
for i in range(n-1):
  a,b = map(int,input().split())
  a-=1;b-=1
  G[a].append(b)
  G[b].append(a)
Aokidis = [0]*n
Takahashidis = [0]*n
def dfs(node,dis,TorA,pre):
  if TorA == "Takahashi":Takahashidis[node] = dis
  else:Aokidis[node] = dis
  for vi in G[node]:
    if vi == pre:continue
    dfs(vi,dis+1,TorA,node)
dfs(U,0,"Takahashi",-1)
dfs(V,0,"",-1)
for i in range(n):
  if Takahashidis[i] <= Aokidis[i]:
    ans = max(ans,Aokidis[i]-1)
print(ans)
Problem p02873 (python)

Fixed submission:
#!/usr/bin/env python3
import sys
input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)
inf = float('inf')
mod = 10**9+7

S=input()
S=">"+S
n=len(S)
data=[0]*n
start=0
minv=0
for i in range(1,n):
    if S[i]=='<':
        data[i]=data[i-1]+1
    if S[i]=='>':
        if S[i-1]=='<':
            # print(minv)
            for k in range(start+1,i):
                data[k]-=minv
            data[start]=max(data[start],data[start+1]+1)
            # print(data,i,minv)
            data[i]=0
            minv=0
            start=i-1
        else:
            data[i]=data[i-1]-1
            minv=min(minv,data[i])
# print(data)
# print(minv,start)
for i in range(start+1,n):
    data[i]-=minv
data[start]=max(data[start],data[start+1]+1)
if S[1]=='<':
    data[0]=0
print(sum(data))
# print(data)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)
inf = float('inf')
mod = 10**9+7

s=int(input())
n=len(s)+1
ans=[0]*n
for i in range(n-1):
    if s[i]=='<':
        ans[i+1]=max(ans[i+1],ans[i]+1)
for i in range(n-2,-1,-1):
    if s[i]=='>':
        ans[i]=max(ans[i+1]-1,ans[i])
print(sum(ans))

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)
inf = float('inf')
mod = 10**9+7

s=int(input())
n=len(s)+1
ans=[0]*n
for i in range(n-1):
    if s[i]=='<':
        ans[i+1]=max(ans[i+1],ans[i]+1)
for i in range(n-2,-1,-1):
    if s[i]=='>':
        ans[i]=max(ans[i+1]-1),ans[i]
print(sum(ans))
Problem p02925 (python)

Fixed submission:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n=int(input())
    M=[None]*n
    for i in range(n):
        M[i]=list(map(lambda x:int(x)-1,input().split()))[::-1]

    # i が誰かしらと対戦できるか
    def check(i):
        if(not M[i]): # 既に試合を終えている
            return False
        j=M[i][-1]
        if(not M[j]): # これは起こり得ない
            return False
        return i==M[j][-1]

    # 初日に対戦できる人をピックアップ
    # 重複が起こるが、後で unique を取る
    Q=[]
    for i in range(n):
        if(check(i)):
            j=M[i][-1]
            if(i>j): i,j=j,i # i<j
            Q.append((i,j))

    # 処理を行なっていく
    day=0
    nQ=[] # 次の試合相手
    while(Q):
        # Q には重複があるので unique
        Q=list(set(Q))
        # 先に全ての試合を終わらせる必要がある
        for i,j in Q:
            M[i].pop(); M[j].pop()
        # 試合を終えた人は次の試合を行える可能性がある
        for i,j in Q:
            if(check(i)):
                k=M[i][-1]
                nQ.append((min(i,k),max(i,k)))
            if(check(j)):
                k=M[j][-1]
                nQ.append((min(j,k),max(j,k)))
        Q,nQ=nQ,[]
        day+=1

    print(day if(all(M[i]==[] for i in range(n))) else "-1")
resolve()

Buggy submission (verdict: Runtime Error):
from collections import deque
import sys
input = lambda: sys.stdin.readline()[:-1]
n=int(input())
data=[deque(map(int,input().split())) for i in range(n)]
last=n*(n-1)
count=0
while last:
	flag=1
	count+=1
	taisenzumi=[0]*n
	for i in range(n):
		if data[i]:
			if data[aite-1][0]==i+1:
				if taisenzumi[i]:continue
				if taisenzumi[aite-1]:continue				
				aite=data[i][0]
				data[i].popleft()
				data[aite-1].popleft()
				taisenzumi[aite-1]=1
				taisenzumi[i]=1
				last-=2
				flag=0
			else:continue
	if flag:
		break
else:
	print(count)
	exit()
print(-1)
Problem p02933 (python)

Fixed submission:
a =int(input())
s=input()
if a>=3200:
	print(s)
else:
	print('red')

Buggy submission (verdict: Runtime Error):
import sys
from collections import Counter
from collections import defaultdict
sys.setrecursionlimit(10**8)
input = lambda: sys.stdin.readline()[:-1]
cnt=Counter()
data=defaultdict(set)
visited=Counter()
n,q=map(int,input().split())
ab=[tuple(map(int,input().split())) for i in range(n-1)]
px=[tuple(map(int,input().split())) for i in range(q)]
ab.sort(key=lambda tup:(tup[0],tup[1]))
for i in ab:
	data[i[0]].add(i[1])
	data[i[1]].add(i[0])
for j in px:
	cnt[j[0]]+=j[1]

def plus(now,value):
	for i in data[now]:
		if not visited[i]:
			cnt[i]+=value
			visited[i]=1
			print(cnt)	
			plus(i,cnt[i])
		
		
cnt[1]+=0
visited[1]=1
plus(1,cnt[1])
print(cnt)

ans=list(cnt.items())
ans.sort(key=lambda tup:tup[0])
ans =[str(i[1]) for i in ans]
print(' '.join(ans))
Problem p02948 (python)

Fixed submission:
import heapq
n,m = map(int,input().split())
AB =[tuple(map(int,input().split())) for i in range(n)]
ans,memo=0,0
hq=[]
AB.sort(key=lambda tup:tup[0])
for day in range(m):
	for i in range(memo,n):
		if AB[i][0]<=(day+1):
			heapq.heappush(hq,-AB[i][1])
			memo+=1
		else:
			break
	if len(hq):	
		ans += -heapq.heappop(hq)
print(ans)

Buggy submission (verdict: Runtime Error):
import heapq
n,m = map(int,input().split())
AB =[tuple(map(int,input().split())) for i in range(n)]
ans,memo=0,0
hq=[]
AB.sort(key=lambda tup:tup[0])
for day in range(m):
	for i in range(memo,n):
		if AB[i][0]<=(day+1):
			heapq.push(hq,AB[i][1])
			memo+=1
		else:
			break
	if len(hq):	
		ans += -heapq.heappop(hq)
print(ans)

Buggy submission (verdict: Runtime Error):
import heapq
n,m = map(int,input().split())
AB =[tuple(map(int,input().split())) for i in range(n)]
ans,memo=0,0
hq=[]
AB.sort(key=lambda tup:tup[0])
for day in range(m):
	for i in range(memo,n):
		if AB[i][0]<=(day+1):
			heapq.push(hq,AB[i][1])
			memo+=1
		else:
			break
	ans += -heapq.heappop(hq)
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
data = [tuple(map(int,input().split())) for i in range(n)]
data.sort(key = lambda tup:tup[0])
salary =[]
ans=0
prev=0
memo=0
for day in range(m):
	for i in range(memo,n):
		if data[memo][0]<=(day+1):
			salary.append(data[memo][1])
			memo+=1
		else:
			break

	# ans+=salary.pop(max)

	ans+=max(salary ,default=0)
	if max(salary ,default=0) !=0:
		del salary[salary.index(max(salary))]
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
data = [tuple(map(int,input().split())) for i in range(n)]
data.sort(key = lambda tup:tup[0])
salary =[]
ans=0
prev=0
memo=0
for day in range(m):
	for i in range(memo,n):
		if data[memo][0]<=(day+1):
			salary.append(data[memo][1])
			memo+=1
		else:
			break
	ans+=max(salary ,default=0)
	if max(salary ,default=0) !=0:
		salary[salary.index(max(salary))]=0
print(ans)
Problem p02987 (python)

Fixed submission:
S=input()
s=list(S)
if s[0]==s[1] and s[2]==s[3] and s[0]!=s[2]:
	print("Yes")
elif s[0]==s[2] and s[1]==s[3] and s[0]!=s[1]:
	print("Yes")
elif s[0]==s[3] and s[1]==s[2] and s[0]!=s[1]:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
S=input()
s=list(S)
if s[1]==s[2] and s[3]==s[4] and s[2]!=s[3]:
	print("Yes")
elif s[1]==s[3] and s[2]==s[4] and s[1]!=s[3]:
	print("Yes")
elif s[1]==s[4] and s[2]==s[3] and s[1]!=s[2]:
	print("Yes")
else:
	print("No")
Problem p02990 (python)

Fixed submission:
#!/usr/bin/env python3
import sys
from operator import mul
from functools import reduce
import math
mod=10**9+7

# def combinations_count(n, r):
#     r = min(r, n - r)
#     numer = reduce(mul, range(n, n - r, -1), 1)
#     denom = reduce(mul, range(1, r + 1), 1)
#     return numer // denom

def combinations_count(n, r):
    return (math.factorial(n) // (math.factorial(n - r) * math.factorial(r)))%mod



input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)

n,k=map(int,input().split())
l=n-k
for i in range(1,k+1):
    if l+1<i or k<i:
        ans=0
    else:
        ans=(combinations_count(l+1,i)*combinations_count(k-1,i-1))%mod
    print(ans)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
from operator import mul
from functools import reduce
import math
mod=10**9+7

# def combinations_count(n, r):
#     r = min(r, n - r)
#     numer = reduce(mul, range(n, n - r, -1), 1)
#     denom = reduce(mul, range(1, r + 1), 1)
#     return numer // denom

def combinations_count(n, r):
    return (math.factorial(n) // (math.factorial(n - r) * math.factorial(r)))%mod



input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)

n,k=map(int,input().split())
l=n-k
for i in range(1,k+1):
    ans=(combinations_count(l+1,i)*combinations_count(k-1,i-1))%mod
    print(ans)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
from operator import mul
from functools import reduce
import math
mod=10**9+7

# def combinations_count(n, r):
#     r = min(r, n - r)
#     numer = reduce(mul, range(n, n - r, -1), 1)
#     denom = reduce(mul, range(1, r + 1), 1)
#     return numer // denom

def combinations_count(n, r):
    return (math.factorial(n) // (math.factorial(n - r) * math.factorial(r)))%mod



input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)

n,k=map(int,input().split())
l=n-k
for i in range(1,k+1):
    ans=(combinations_count(l+1,i))*(combinations_count(k-1,i-1))%mod
    print(ans)
Problem p03242 (python)

Fixed submission:
#!/usr/bin/env python3
n=input()
l=['1','9']
for i in n:
    print(l[l.index(i)-1], end = '')
print()

Buggy submission (verdict: Runtime Error):
n=input()
l=[1,9]
for i in n:
    print(l[l.index(i)-1],end='')
print()
    n=input()
l=['1','9']
for i in n:
    print(l[l.index(i)-1], end = '')
print()

Buggy submission (verdict: Runtime Error):
n=input()
l=[1,9]
for i in n:
    print(l[l.index(i)-1],end='')
print()
Problem p03253 (python)

Fixed submission:
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n,m = map(int,input().split())
class InverseTable:
    __slots__ = ['In', 'fac', 'Ifac']

    def __init__(self, mod, maxnum):
        self.In = [0, 1]; self.fac = [1, 1]; self.Ifac = [1, 1]
        for i in range( 2, maxnum + 1 ):
            self.In.append( ( -self.In[mod % i] * (mod//i) ) % mod )
            self.fac.append( ( self.fac[-1] * i ) % mod )
            self.Ifac.append( (self.Ifac[-1] * self.In[-1]) % mod )
        
    def cmb(self, n, r):
        if ( r<0 or r>n ): return 0
        r = min(r, n-r)
        return self.fac[n] * self.Ifac[r] * self.Ifac[n-r] % mod
    
    def per(self, n, r):
        if ( r<0 or r>n ): return 0
        return self.fac[n] * self.Ifac[n-r] % mod

invt = InverseTable(mod, 10**6)
# maxnum=10**6だとテーブル生成に200ms程かかるので（Pythonだと1000msほど）
# 最大生成領域は問題ごとに要検討

def prime_factor(n):
    ass = []
    for i in range(2,int(n**0.5)+1):
        count=0
        while n % i==0:
            count+=1
            n = n//i
        if count!=0:
            ass.append((i,count))
    if n != 1:
        ass.append((n,1))
    return ass


ass = prime_factor(m)
ans = 1
for i, amount in ass:
  ans = ans * invt.cmb(amount+n-1,amount) % mod
print(ans)
# print(ass)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n,m = map(int,input().split())

def prime_factor(n):
    ass = []
    for i in range(2,int(n**0.5)+1):
        count=0
        while n % i==0:
            count+=1
            n = n//i
        if count!=0:
            ass.append((i,count))
    if n != 1:
        ass.append((n,1))
    return ass


ass = prime_factor(m)
ans = 1
for i, amount in ass:
  ans = ans * len(itertools.combinations_with_replacement(range(n-1),amount)) % mod
print(ans)
# print(ass)
Problem p03774 (python)

Fixed submission:
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf')
ans = 0 ;count = 0 ;pro = 1

n,m=map(int,input().split())
ab=[tuple(map(int,input().split())) for i in range(n)]
cd=[tuple(map(int,input().split())) for i in range(m)]
for a,b in ab:
    tmp=inf
    candi=0
    for j in range(m):
        c=cd[j][0]
        d=cd[j][1]
        k=abs(a-c)+abs(b-d)
        if tmp>k:
            tmp=k
            candi=j
    print(candi+1)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf')
ans = 0 ;count = 0 ;pro = 1

n,m=map(int,input().split())
ab=[tuple(map(int,input().split())) for i in range(n)]
cd=[tuple(map(int,input().split())) for i in range(m)]
for a,b in ab:
    tmp=inf
    candi=0
    for j in range(n):
        c=cd[j][0]
        d=cd[j][1]
        k=abs(a-c)+abs(b-d)
        if tmp>k:
            tmp=k
            candi=j
    print(candi+1)
Problem p02570 (python)

Fixed submission:
D,T,S = map(int,input().split())

if(D/S <= T):
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
D = input()
T = input()
S = input()

if(D/S <= T):
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
D = input()
T = input()
S = input()

if(D/S <= T) print("Yes")
else print("No")
Problem p02879 (python)

Fixed submission:
a,b=map(int, input().split())
if (a<=9 and b<=9):
  print(a*b)
else:
  print("-1")

Buggy submission (verdict: Runtime Error):
a,b=map(int, input().split())
if (a<=9 && b<=9):
  print(a*b)
else:
  print("-1")

Buggy submission (verdict: Runtime Error):
a,b=map(int, input())
if (a<=9 & b<=9):
  print(a*b)
else:
  print("-1")
Problem p02879 (python)

Fixed submission:
a,b=map(int,input().split())
if 1<=a<=9 and 1<=b<=9:
    print(a*b)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input())
if 1<=a<=9 and 1<=b<=9:
    print(a*b)
else:
    print(-1)
Problem p02948 (python)

Fixed submission:
from heapq import heappush,heappop

n,m=[int(x) for x in input().rstrip().split()]
ab=[[] for i in range(10**5)]

for i in range(n):
  a,b=[int(x) for x in input().rstrip().split()]
  ab[a-1].append(-b)

ans=0
time=0
l=[]
for i in range(m):
  for b in ab[i]:
    heappush(l,b)
  if l:
    ans-=heappop(l)

print(ans)

Buggy submission (verdict: Runtime Error):
from heapq import heappush,heappop

n,m=[int(x) for x in input().rstrip().split()]
ab=[[] for i in range(10**5)]

for i in range(n):
  a,b=[int(x) for x in input().rstrip().split()]
  if a<=m:
    ab[m-a].append(-b)

ans=0
time=0
l=[]
for i in range(m,-1,-1):
  for b in ab[i]:
    heappush(l,b)

  if l:
    ans-=heappop(l)

print(ans)

Buggy submission (verdict: Runtime Error):
from heapq import heappush,heappop

n,m=[int(x) for x in input().rstrip().split()]
ab=[[] for i in range(10**5)]

for i in range(n):
  a,b=[int(x) for x in input().rstrip().split()]
  ab[m-a].append(-b)


ans=0
time=0
l=[]
for i in range(m,-1,-1):
  for b in ab[i]:
    heappush(l,b)

  if l:
    ans-=heappop(l)

print(ans)
Problem p03013 (python)

Fixed submission:
n,m=[int(x) for x in input().rstrip().split()]
a=[int(input()) for i in range(m)]
oks=[True for i in range(n+1)]

mod=10**9+7
dp=[0 for i in range(n+1)]
for i in a:
  oks[i]=False

if oks[1]==True:
  dp[1]=1
dp[0]=1
for i in range(2,n+1):
  if oks[i]==True:
    dp[i]=dp[i-2]+dp[i-1]
print(dp[n]%mod)

Buggy submission (verdict: Runtime Error):
n,m=[int(x) for x in input().rstrip().split()]
a=[int(input()) for i in range(m)]
oks=[True for i in range(n+1)]

mod=10**9+7
dp=[0 for i in range(n+1)]
for i in a:
  oks[i]=False

if oks[1]==True:
  dp[1]=1
if oks[2]==True:
  dp[2]=dp[1]+1

for i in range(3,n+1):
  if oks[i]==True:
    dp[i]=dp[i-2]+dp[i-1]
print(dp[n]%mod)
Problem p02912 (python)

Fixed submission:
import heapq
n, m = map(int, input().split())
a = list(map(lambda x: int(x) * (-1), input().split()))
heapq.heapify(a)
for _ in range(m):
    tmp_min = heapq.heappop(a)
    heapq.heappush(a, (-1)*(-tmp_min//2))
print(-sum(a))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = list(map(lambda x: int(x) * (-1), input().split()))
heapq.heapify(a)
for _ in range(m):
    tmp_min = heapq.heappop(a)
    heapq.heappush(a, (-1)*(-tmp_min//2))
print(-sum(a))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
sum = 0
a = np.array(list(map(int, input().split())))
for i in range(m):
    np.sort(a)[::-1]
    a[0] /= 2
b = np.array([abc // 1 for abc in a])
print(sum)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
sum = 0
a = np.array(list(map(int, input().split())))
for i in range(m):
    np.sort(a)
    a[0] /= 2
b = np.array([abc // 1 for abc in a])
print(sum)

Buggy submission (verdict: Runtime Error):
import numpy as np
n, m = map(int, input().split())
a = np.array(list(map(int, input().split())))
for i in range(m):
    a[a.argmax()] /= 2
b = np.array([abc // 1 for abc in a])
print(b.sum(b))
Problem p02935 (python)

Fixed submission:
a = int(input())
b = list(map(int, input().split()))
while (len(b) > 1):
    b = sorted(b)
    x = b.pop(0)
    y = b.pop(0)
    b.append((x+y)/2)
print(b[0])

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

while (len(b) > 1):
	b = sorted(b)
    x = b.pop(0)
    y = b.pop(0)
    b.append((x+y)/2)
print(b[0])
pass
Problem p03207 (python)

Fixed submission:
n = int(input())
l = [int(input()) for i in range(n)]
l = sorted(l)
print(sum(l) - l[-1]//2)

Buggy submission (verdict: Runtime Error):
n = int(input())
    l = [int(input()) for i in range(n)]
    l = sorted(l)
    print(sum(l) - l[-1]//2)
Problem p03775 (python)

Fixed submission:
import math
n = int(input())
l = []
for i in range(1, int(math.sqrt(n)//1)+1):
    if n % i == 0:
        l.append(int(n / i))
print(len(str(l[-1])))

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
l = []
for i in range(1, int(math.sqrt(n)//1)):
    if n % i == 0:
        l.append(int(n / i))
print(len(str(l[-1])))

Buggy submission (verdict: Runtime Error):
n = int(input())
l = []
for i in range(1, int(math.sqrt(n)//1)):
    if n % i == 0:
        l.append(int(n / i))
print(len(str(l[-1])))
Problem p03803 (python)

Fixed submission:
a,b = map(int,input().split())
if a == 1:
  a += 20
if b == 1:
  b += 20
if a == b:
  print('Draw')
elif a > b:
  print('Alice')
else:
  print('Bob')

Buggy submission (verdict: Runtime Error):
import itertools
n, m = map(int, input().split())
l = [list(map(int, input().split())) for i in range(m)]
r = [[] for i in range(n + 1)]
ans = 0
for i in range(m):
    r[l[i][0]].append(l[i][1])
    r[l[i][1]].append(l[i][0])
p = []
for i in range(n):
    p.append(i + 1)
p = list(itertools.permutations(p))
for i in range(len(p)):
    check = True
    t = list(p[i])
    if t[0] != 1:
        check = False
    for j in range(len(t)-1):
        if not t[j + 1] in r[t[j]]:
            check = False
    if check:
        ans += 1
print(ans)
Problem p03805 (python)

Fixed submission:
import itertools
n, m = map(int, input().split())
l = [list(map(int, input().split())) for i in range(m)]
r = [[] for i in range(n + 1)]
ans = 0
for i in range(m):
    r[l[i][0]].append(l[i][1])
    r[l[i][1]].append(l[i][0])
p = []
for i in range(n):
    p.append(i + 1)
p = list(itertools.permutations(p))
for i in range(len(p)):
    check = True
    t = list(p[i])
    if t[0] != 1:
        check = False
    for j in range(len(t)-1):
        if not t[j + 1] in r[t[j]]:
            check = False
    if check:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
l = [list(map(int, input().split())) for i in range(m)]
r = [[] for i in range(n + 1)]
ans = 0
for i in range(m):
    r[l[i][0]].append(l[i][1])
    r[l[i][1]].append(l[i][0])
p = []
for i in range(n):
    p.append(i + 1)
p = list(itertools.permutations(p))
for i in range(len(p)):
    check = True
    t = list(p[i])
    if t[0] != 1:
        check = False
    for j in range(len(t)-1):
        if not t[j + 1] in r[t[j]]:
            check = False
    if check:
        ans += 1
print(ans)