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

Fixed submission:
#!/usr/bin/env python3
# %%

import sys


def solve(N: int):
    return (N+1)//2/N


# %%

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
# (tips: You use the default template now. You can remove this line by using your custom template)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    print(solve(N))


if __name__ == '__main__':
    main()


# %%

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


def solve(A: int, B: int):
    while A % B:
        tmp = B
        B = A % B
        A = tmp
    if B == 1:
        print(1)
    else:
        ans = factorization(B)
        print(len(ans)+1)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)


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

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

if c - ( a - b) >= 0  :
    print( c - ( a - b))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
N = int(input())
cnt = 0
for i in range(1,N+1):
    if len(str(i)) % 2 != 0:
        cnt += 1
print (cnt)
Problem p02912 (python)

Fixed submission:
import heapq

N, M = map(int, input().split())
A = [-int(x) for x in input().split()]
heapq.heapify(A)
for i in range(M):
    x = heapq.heappop(A)
    x = int(x / 2)
    heapq.heappush(A, x)  # pop minimum
print(-sum(A))

Buggy submission (verdict: Runtime Error):
import bisect
import sys

inf = sys.maxsize
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()

for i in range(M):
    x = A.pop(N-1)
    if x == 0:
        break
    x = x // 2
    A.insert(bisect.bisect_left(A, x), x)
print(sum(A)
Problem p02990 (python)

Fixed submission:
import math

N, K = map(int, input().split())

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

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

for i in range(1, K+1):
  if N - K + 1 < i:
    print(0)
  else:
    print((combinations_count(N-K+1, i) * combinations_count(K-1, i-1)) % (10**9 + 7))

Buggy submission (verdict: Runtime Error):
import math

N, K = map(int, input().split())

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

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

for i in range(1, K+1):
  print((combinations_count(N-K+1, i) * combinations_count(K-1, i-1)) % (10**9 + 7))

Buggy submission (verdict: Runtime Error):
import math

N, K = map(int, input().split())

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

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

print(combinations_count(N-K+1, 1))
for i in range(2, K):
  print(combinations_count(N-K+1, 1) * permutations_count(N-K, i-1) % (10**9 + 7))
print(combinations_count(N-K+1, K) % (10**9 + 7))
Problem p02987 (python)

Fixed submission:
s = input()
ans = 'No'
a = list({x for x in s})
if len(a) == 2:

  if s.count(a[0]) == 2 and s.count(a[1]) == 2:
    ans = 'Yes'
    
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
ans = 'No'
a = {x for x in s}
if len(a) == 2:
  if a.count(a[0]) == 2 and a.count(a[1]) == 2:
    ans = 'Yes'
    
print(ans)
Problem p02948 (python)

Fixed submission:
from heapq import heappop, heappush

n,m=map(int,input().split())
a=[]
for i in range(n):
    heappush(a,list(map(int,input().split())))
heap=[]
s=0
for i in range(m):
    while 1:
        if len(a)==0:break
        else:
            if a[0][0]==i+1:heappush(heap,-heappop(a)[1])
            else:break
    if len(heap)>0:s+=-heappop(heap)
print(s)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
l=sorted([list(map(int,input().split())) for _ in [0]*n],key=lambda x:[x[0],-x[1]])+[[-1,-1]]
for i in range(n):l[i][0]-=1
w=[0]*(m+1)
i=0
while i<n:
    j=l[i][0]
    s=j
    while l[i][0]==j:
        while w[s]>=l[i][1]:s+=1
        if s<m:w[s]=l[i][1]
        i+=1
print(sum(w))
Problem p03634 (python)

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n=int(input())
l=[list(map(int,input().split())) for _ in [0]*(n-1)]
q,k=map(int,input().split())
L=[list(map(int,input().split())) for _ in [0]*q]

neighbor=[[] for _ in range(n+1)]
for i in range(n-1):
    neighbor[l[i][0]].append([l[i][1],l[i][2]])
    neighbor[l[i][1]].append([l[i][0],l[i][2]])

cost=[-1]*(n+1)
cost[k]=0
c=0

def sol(i,p,d):
    global cost
    cost[i]=d
    for x in neighbor[i]:
        if x[0]!=p:
            sol(x[0],i,d+x[1])
sol(k,-1,0)

for i in range(q):
    print(cost[L[i][0]]+cost[L[i][1]])

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**5)

n=int(input())
l=[list(map(int,input().split())) for _ in [0]*(n-1)]
q,k=map(int,input().split())
L=[list(map(int,input().split())) for _ in [0]*q]

neighbor=[[] for _ in range(n+1)]
for i in range(n-1):
    neighbor[l[i][0]].append([l[i][1],l[i][2]])
    neighbor[l[i][1]].append([l[i][0],l[i][2]])

cost=[-1]*(n+1)
cost[k]=0
c=0

def sol(i,p,d):
    global cost
    cost[i]=d
    for x in neighbor[i]:
        if x[0]!=p:
            sol(x[0],i,d+x[1])
sol(k,-1,0)

for i in range(q):
    print(cost[L[i][0]]+cost[L[i][1]])

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

n=int(input())
l=[list(map(int,input().split())) for _ in [0]*(n-1)]
q,k=map(int,input().split())
L=[list(map(int,input().split())) for _ in [0]*q]

neighbor=[[] for _ in range(n+1)]
for i in range(n-1):
    neighbor[l[i][0]].append([l[i][1],l[i][2]])
    neighbor[l[i][1]].append([l[i][0],l[i][2]])

cost=[-1]*(n+1)
cost[k]=0
c=0

def sol(i,p,d):
    global cost
    cost[i]=d
    for x in neighbor[i]:
        if x[0]!=p:
            sol(x[0],i,d+x[1])
sol(k,-1,0)

for i in range(q):
    print(cost[L[i][0]]+cost[L[i][1]])

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

n=int(input())
l=[list(map(int,input().split())) for _ in [0]*(n-1)]
q,k=map(int,input().split())
L=[list(map(int,input().split())) for _ in [0]*q]

neighbor=[[] for _ in range(n+1)]
for i in range(n-1):
    neighbor[l[i][0]].append([l[i][1],l[i][2]])
    neighbor[l[i][1]].append([l[i][0],l[i][2]])

cost=[-1]*(n+1)
cost[k]=0
c=0

def sol(i,p,d):
    cost[i]=d
    for x in neighbor[i]:
        if x[0]!=p:
            sol(x[0],i,d+x[1])
sol(k,-1,0)

for i in range(q):
    print(cost[L[i][0]]+cost[L[i][1]])
Problem p02847 (python)

Fixed submission:
k=["MON","TUE","WED","THU","FRI","SAT"]
s=input()
j="SUN"
if(s==j):
  print(7)
else:
  for a,i in enumerate (k):
    if(s==i):
      print(6-a)

Buggy submission (verdict: Runtime Error):
k=["MON","TUE","WED","THU","FRI","SAT"]
s=input()
j="SUN"
if(s==j):
  print(7)
else:
  for a,i in enumerate k:
    if(s==i):
      print(6-a)

Buggy submission (verdict: Runtime Error):
days=["MON","TUE","WED","THU","FRI","SAT","SUN"]
s=input()
for k,i in enumerate days:
  if(s=="SUN"):
    print(7)
  elif(s==i)
    print(6-k)
Problem p02847 (python)

Fixed submission:
s = input()
w = ['SUN','MON','TUE','WED','THU','FRI','SAT']
for i in range(len(w)):
    if s == w[i]:
        print (7 - i)

Buggy submission (verdict: Runtime Error):
s = input()
w = ['SUM','MON','TUE','WED','THU','FRI','SAT']
for i in range(len(S)):
    if s == w[i]:
        print 7 - i
Problem p02847 (python)

Fixed submission:
import sys

day = sys.stdin.read().strip()

days = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']

day_index = days.index(day)

print(7-day_index)

Buggy submission (verdict: Runtime Error):
import sys

day = sys.stdin().read().strip()

days = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']

day_index = days.index(day)

print(7-day_index)

Buggy submission (verdict: Runtime Error):
import sys

day = sys.stdin.read()

days = ['MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN']
day_index = days.index(day)

print(6 - day_index)
Problem p02912 (python)

Fixed submission:
import heapq

N = list(map(int, (input().split(' '))))
A = list(map(lambda x: x*(-1), map(int, (input().split(' ')))))

heapq.heapify(A)
for i in range(N[1]):
    heapq.heappush(A, int(heapq.heappop(A) / 2))

print(-sum(A))

Buggy submission (verdict: Runtime Error):
import heapq
 
def FUNCTION(A, M):
    heapq.heapify(A)
    for i in range(M):
        heapq.heappush(A, int(heapq.heappop(A) / 2))
        print (A)
    return -sum(A)

N = list(map(int, (input().split(' '))))
A = list(map(lambda x: x*(-1), map(int, (input().split(' ')))))
print(FUNCTION(A, N[1]))
Problem p02847 (python)

Fixed submission:
if __name__ == '__main__':
    S = input()
    d = {'SUN':7, "MON":6, "TUE":5, "WED":4, "THU":3, "FRI":2, "SAT":1}
    if d.get(S, False):
        print(d[S])
    else:
        res = -1
        for i in d.keys():
            if i in S or i.lower() in S:
                res = d[i]
                break
        print(res)

Buggy submission (verdict: Runtime Error):
from sys import stdin, stdout

if __name__ == '__main__':
  S = stdin.readlines().replace("\n","")
  d = {'SUN':7, "MON":6, "TUE":5, "WED":4, "THU":3, "FRI":2, "SAT":1}
  stdout.writelines("%d" % d[S])
Problem p02897 (python)

Fixed submission:
import math

N = int(input())

print( math.ceil(N/2)/N )

Buggy submission (verdict: Runtime Error):
N,K = map(int, input().split())
S = sorted( list(map(int, input().split())) )
count=0

for i in S:
  if(i>K):
    count += 1
print(count)
Problem p02847 (python)

Fixed submission:
S = input()

l = ["SUN","MON","TUE","WED","THU","FRI","SAT"]

print(7 - l.index(S))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000)

N = int(input())
G = [[] for i in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    a,b = a-1,b-1
    G[a].append([b, i])

ans = [None]*(N-1)
def rec(cur, color):
    cnt = 1
    for (to, j) in G[cur]:
        if cnt == color:
            cnt += 1
        ans[j] = cnt
        rec(to, cnt)
        cnt += 1

rec(0,0)
print(max(ans))
[print(a) for a in ans]
Problem p02847 (python)

Fixed submission:
s = input()
if s == "SUN":
  print(7)
if s == "MON":
  print(6)
if s == "TUE":
  print(5)
if s == "WED":
  print(4)
if s == "THU":
  print(3)
if s == "FRI":
  print(2)
if s == "SAT":
  print(1)

Buggy submission (verdict: Runtime Error):
s = input()
if s = "SUN":
  print(0)
if s = "MON":
  print(6)
if s = "TUE":
  print(5)
if s = "WED":
  print(4)
if s = "THU":
  print(3)
if s = "FRI":
  print(2)
if s = "SUT":
  print(1)
Problem p02989 (python)

Fixed submission:
n = int(input())
d = list(map(int,input().split()))
d.sort()
ans = 0
if n % 2 == 1:
  print(ans)
else:
  ans = d[(n // 2)] - d[(n // 2 - 1)]
  print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split()))
d.sort()
ans = 0
if n % 2 = 1:
  print(ans)
else:
  ans = d[(n - 1)/2 + 1] - d[(n - 1)/2]
  print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split()))
k = max(d)
i,j,ans,b,s = 0
while i <= k:
  while j <= n-1:
    if d[j] <= i:
      b += 1
    if d[j] > i:
      s += 1
  if b == s:
    ans += 1
  i += 1
print(ans)
Problem p03011 (python)

Fixed submission:
time = list(map(int, input().split()))
sum = time[0] + time[1]
if sum > time[1] + time[2]:
  sum = time[1] + time[2]
if sum > time[0] + time[2]:
  sum = time[0] + time[2]
print(sum)

Buggy submission (verdict: Runtime Error):
time = list(map(int, input(),split()))
sum = time[0] + time[1]
if sum > time[1] + time[2]:
  sum = time[1] + time[2]
if sum > time[0] + time[2]:
  sum = time[0] + time[2]
print(sum)

Buggy submission (verdict: Runtime Error):
time = list(map(int, input(),split()))
sum = time[0] + time[1]
if sum > time[1] + time[2]:
  sum = time[1] + time[2]
if sum > time[0] + time[2]:
  sum = time[0] + time[2]
print(sum)

Buggy submission (verdict: Runtime Error):
time = list(map(int, input(),sprit()))
sum = time[0] + time[1]
if sum > time[1] + time[2]:
  sum = time[1] + time[2]
if sum > time[0] + time[2]:
  sum = time[0] + time[2]
print(sum)
Problem p03073 (python)

Fixed submission:
s = input()
set = [0, 1]
diff = 0

for i in range(len(s)):
    set.reverse()
    if set[1] == int(s[i]):
        diff += 1

print(min([diff, len(s)-diff]))

Buggy submission (verdict: Runtime Error):
s = input()
set = [0, 1]
diff = 0

for i in range(len(s)):
    set.reverse()
    print(s)
    if set[1] == int(s[i]):
        diff += 1

print(min([diff, len(s)-diff]))
Problem p02847 (python)

Fixed submission:
wd = {
  "SUN":7,
  "MON":6,
  "TUE":5,
  "WED":4,
  "THU":3,
  "FRI":2,
  "SAT":1
  }
line = input()
 
print(wd[line])

Buggy submission (verdict: Runtime Error):
wd = {
  "SUN":7
  "MON":6
  "TUE":5
  "WED":4
  "THU":3
  "FRI":2
  "SAT":1
  }
line = input()
 
print(wd[line])
Problem p02847 (python)

Fixed submission:
s = input()
if s == "SUN":
    print(7)
elif s == "SAT":
    print(1)
elif s == "FRI":
    print(2)
elif s == "THU":
    print(3)
elif s == "WED":
    print(4)
elif s == "TUE":
    print(5)
elif s == "MON":
    print(6)

Buggy submission (verdict: Runtime Error):
s = input()
if s == "SUN":
    print(7)
elif s == "SAT":
    print(1)
elif s == "FRI":
    print(2)
elif s == "THU":
    print(3)
elif s == "WED":
    print(4)
elif s == "TUE":
    print(5)
elif s == "MON":
    print(6)
~
Problem p03426 (python)

Fixed submission:
# 解説読後
import sys
sys.setrecursionlimit(100000)
H,W,D=map(int,input().split())
A=[list(map(int,input().split())) for i in range(H)]
mapper={}
for i in range(H):
    for j in range(W):
        mapper[A[i][j]]=(i,j)

Q=int(input().strip())
dist=[0]*(H*W+1)
for i in range(1,H*W+1):
    if i<=D:
        dist[i] = 0
    else:
        pos1=mapper[i]
        pos2=mapper[i-D]
        dist[i]=dist[i-D]+abs(pos1[0]-pos2[0])+abs(pos1[1]-pos2[1])
for i in range(Q):
    cst=0
    l,r=map(int,input().split())
    print(dist[r]-dist[l])

Buggy submission (verdict: Runtime Error):
H,W,D=map(int,input().split())
A=[list(map(int,input().split())) for i in range(H)]
mapper={}
for i in range(H):
    for j in range(W):
        mapper[A[i][j]]=(i,j)

Q=int(input().strip())
L=[]
R=[]
dist={}
def search(l,r):
    if l==r:
        return 0
    if (l,r) in dist:
        return dist[l,r]
    else:
        if l+D==r:
            posl=mapper[l]
            posr=mapper[r]
            val= abs(posl[0]-posr[0])+abs(posl[1]-posr[1])
            dist[(l,l+D)]=val
            return val
        else:
            val=search(l,l+D)+search(l+D,r)
            dist[l,r]=val
            return val
for i in range(Q):
    cst=0
    l,r=map(int,input().split())
    print(search(l,r))
Problem p03805 (python)

Fixed submission:
from collections import defaultdict
import sys
sys.setrecursionlimit(10000)
N,M=list(map(int,input().split()))
links=defaultdict(list)
for i in range(M):
    a,b=list(map(int, input().split()))
    links[a].append(b)
    links[b].append(a)
ct=0
visited=[False]*N
def DFS(idx):
    global visited
    if all(visited):
        global ct
        ct+=1
        return
    for i in links[idx]:
        if visited[i-1]:
            continue
        visited[i-1]=True
        DFS(i)
        visited[i-1]=False
visited[0]=True
DFS(1)
print(ct)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)
N,M=list(map(int,input().split()))
graph=[[False]*N for i in range(N)]
for i in range(N):
    a,b=list(map(int, input().split()))
    graph[a-1][b-1]=True
    graph[b-1][a-1]=True
visited=[False]*N
def dfs(v,visited):
    if all(visited):
        return 1
    ret=0
    for i in range(N):
        if not graph[v][i]:
            continue
        if visited[i]:
            continue
        visited[i]=True
        ret+=dfs(i,visited)
        visited[i]=False
    return ret
visited[0]=True
print(dfs(0,visited))

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
import sys
sys.setrecursionlimit(10000)
N,M=list(map(int,input().split()))
links=defaultdict(list)
for i in range(N):
    a,b=list(map(int, input().split()))
    links[a].append(b)
    links[b].append(a)
ct=0
visited=[False]*N
def DFS(idx):
    global visited
    if all(visited):
        global ct
        ct+=1
        return
    for i in links[idx]:
        if visited[i-1]:
            continue
        visited[i-1]=True
        DFS(i)
        visited[i-1]=False
visited[0]=True
DFS(1)
print(ct)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
import sys
sys.setrecursionlimit(10000)
N,M=list(map(int,input().split()))
links=defaultdict(list)
for i in range(N):
    a,b=list(map(int, input().split()))
    links[a].append(b)
    links[b].append(a)
ct=0
def DFS(idx,visited):
    visited.add(idx)
    for i in links[idx]:
        if i in visited:
            continue
        visi=set(visited)
        DFS(i,visi)
        if len(visi)==N:
            global ct
            ct+=1
DFS(1,set())
print(ct)
Problem p03013 (python)

Fixed submission:
n = list(map(int, input().split()))
s = [int(input()) for i in range(n[1])]
s.append(n[0]+1)
memo = [0] * 100001
def stairs(x):
    memo[0] = 1
    memo[1] = 1
    for i in range(2, x+1):
        memo[i] = memo[i-2] + memo[i-1]

salst = [s[0]-1]
for i in range(n[1]):
    sa = (s[i+1]-1) - (s[i]+1)
    salst.append(sa)
    if sa < 0:
        break
if salst[-1] < 0:
    print(0)
else:
    ans = 1
    maxnum = max(salst)
    stairs(maxnum)
    for l in salst:
        ans *= memo[l]
    print(ans%1000000007)

Buggy submission (verdict: Runtime Error):
n = list(map(int, input().split()))
s = [int(input()) for i in range(n[1])]
s.append(n[0]+1)
memo = [0] * 100000
def stairs(x):
    memo[0] = 1
    memo[1] = 1
    for i in range(2, x+1):
        memo[i] = memo[i-2] + memo[i-1]

salst = [s[0]-1]
for i in range(n[1]):
    sa = (s[i+1]-1) - (s[i]+1)
    salst.append(sa)
    if sa < 0:
        break
if salst[-1] < 0:
    print(0)
else:
    ans = 1
    maxnum = max(salst)
    stairs(maxnum)
    for l in salst:
        ans *= memo[l]
    print(ans%1000000007)

Buggy submission (verdict: Runtime Error):
n = list(map(int, input().split()))
s = [int(input()) for i in range(n[1])]
s.append(n[0]+1)

def stairs(x):
    if x > 2:
        return stairs(x-1) + stairs(x-2)
    elif x == 2:
        return 2
    elif x == 1 or x == 0:
        return 1

salst = [s[0]-1]
for i in range(n[1]):
    sa = (s[i+1]-1) - (s[i]+1)
    salst.append(sa)
    if sa < 0:
        break
if salst[-1] < 0:
    print(0)
else:
    ans = 1
    for k in range(len(salst)):
        ans *= stairs(salst[k])

    print(ans%1000000007)

Buggy submission (verdict: Runtime Error):
n = list(map(int, input().split()))
s = [int(input()) for i in range(n[1])]
s.append(n[0]+1)

def stairs(x):
    if x > 2:
        return stairs(x-1) + stairs(x-2)
    elif x == 2:
        return 2
    elif x == 1 or x == 0:
        return 1

sa = [s[0]-1]
for i in range(n[1]):
    sa.append((s[i+1]-1) - (s[i]+1))
ans = 1
for k in range(len(sa)):
    ans *= stairs(sa[k])

print(ans%1000000007)
Problem p02847 (python)

Fixed submission:
S= input()
days = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
for i in range(7):
    if S==days[i]:
        a=7-i
print(a)

Buggy submission (verdict: Runtime Error):
S= input()
days = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
for i in days:
    if S==days[0]:
        print(0)
    elif S==days[i]:
        print(7-i)
Problem p02847 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
# リストの準備
daylist = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
# 文字列の入力
s = input()
# indexの検索
if s in daylist:
    a = daylist.index(s)
    print(7 - a)
else:
    print("{} is not day of week".format(s))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# リストの準備
list = [SUN,MON,TUE,WED,THU,FRI,SAT]
# 文字列の入力
s = input()
# indexの検索
a = list.index(s)
# 7-indexで出力
print(7 - b)
Problem p02880 (python)

Fixed submission:
n=int(input())
L=[]
for i in range(1,10):
    for j in range(1,10):
        L.append(i*j)

if n in L:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
L=[]
for i in [1,...,9]:
    for j in [1,...,9]:
        L.append(i*j)

if n in L:
    print("Yes")
else:
    print("No")
Problem p03207 (python)

Fixed submission:
n=int(input())
P=[int(input()) for i in range(n)]
sumOfP=int(sum(P)-max(P)/2)
print(sumOfP)

Buggy submission (verdict: Runtime Error):
n=int(input())
P=[int(input()) for i in range(n)]
sumOfP=sum(P)-P/2
print(sumOfP)
Problem p03631 (python)

Fixed submission:
N = input()
if N[0] == N[2]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
A,B,C,D = map(int,input().split())

if (B < C or D < A):
    print("0")
else:
    print(abs(max(A,C)-min(B,D)))
Problem p02847 (python)

Fixed submission:
s = input()
 
weeks = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
print(7 - weeks.index(s))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
abc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
w = ""
for x in S:
    if abc.index(x) + 1 + N > 26:
        w += abc[abc.index(x) + N - 26]
    else:
        w += abc[abc.index(x) + N]
print(w)
Problem p03013 (python)

Fixed submission:
n, m = map(int, input().split(' '))
a = set()
for i in range(m):
    a.add(int(input()))


s = [0] * (n + 1)
s[0] = 1
for i in range(n):
    j = i + 1
    while(j <= min(n, i + 2)):
        if j not in a:
            s[j] += s[i]
            s[j] = int(s[j] % 1000000007)
        j += 1

print(s[n])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split(' '))
a = []
for i in range(m):
    a.append(int(input()))

def t(current, n):
    if current == n:
        return 1
    if current in a:
        return 0
    p1, p2 = 0, 0
    if current + 1 not in a:
        p1 = t(current + 1, n)
    if current + 2 <= n and current + 2 not in a:
        p2 = t(current + 2, n)
    return p1 + p2

result = 1
a.append(n - 1)
for index in range(len(a)):
    if index == 0:
        a1 = 0
    else:
        a1 = a[index - 1] + 1
    a2 = a[index] + 1
    p_step1 = t(a1 + 1,  a2)
    p_step2 = t(a1 + 2,  a2)
    result = (result * (p_step1 + p_step2)) % 1000000007
 
print(result)
Problem p02859 (python)

Fixed submission:
print(int(input())**2)

Buggy submission (verdict: Runtime Error):
print(int(input)()**2)