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

Fixed submission:
import math

X = int(input())
x = int(round(math.sqrt(X), 0))
flag = 0

for i in range(100):
    for j in range(2, x):
        if X % j == 0:
            flag = 1
            break
    if flag == 0:
        break
    else:
        flag = 0
        X += 1
print(X)

Buggy submission (verdict: Runtime Error):
import math

X = int(input())
x = round(math.sqrt(X), 0)
flag = 0

for i in range(100):
    for j in range(2, x):
        if X % j == 0:
            flag = 1
            break
    if flag == 0:
        break
    else:
        flag = 0
        X += 1
print(X)

Buggy submission (verdict: Runtime Error):
import math

X = int(input())
x = round(math.sqrt(X), 0)
flag = 0

for i in range(100):
  for j in range(2, x):
    if X % j == 0:
      flag = 1
      break
  if flag == 0:
    break
  else:
    flag = 0
	X += 1

print(X)
Problem p02819 (python)

Fixed submission:
import math
def is_prime(n):
    for i in range(2, int(math.sqrt(n)) + 1):
        if n%i ==0:
            return False
    return True
 
target = int(input())
 
not_found_flg = True
if target == 2:
    print("2")
else:
    if target %2 == 0:
        target = target+1
    result = 0

    while not_found_flg:
        if (is_prime(target)):
            result = target
            break
        target = target+2
 
    print(result)

Buggy submission (verdict: Runtime Error):
import math
target = input()
def is_prime(n):
    for i in range(2, int(math.sqrt(n)) + 1):
        if n%i ==0:
            return False
    return True

not_found_flg = True
if target %2 == 0:
    target = target+1
result = 0
while not_found_flg:
    if (is_prime(target)):
        result = target
        break
    target = target+2

print(result)
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 = input().split()
if (a<=9 and b<=9):
  print(a*b)
else:
  print(-1)
Problem p02831 (python)

Fixed submission:
from fractions import gcd

def saisyou(x, y):
    ans =  (x * y) // gcd(x, y)
    print(ans)

A,B = map(int, input().split())
saisyou(A,B)

Buggy submission (verdict: Runtime Error):
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A,B = map(int, input().split())

print(lcm(A, B))
Problem p02847 (python)

Fixed submission:
S = input()

if S == 'SUN':
    print(7) 
elif S == 'MON':
    print(6) 
elif S == 'TUE':
    print(5) 
elif S == 'WED':
    print(4) 
elif S == 'THU':
    print(3) 
elif S == 'FRI':
    print(2) 
else:
    print(1)

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

def money(n):
    re = A*n + B*len(str(n))
    return re

tmp = 0
if X >= money(1000000000):
    print(1000000000)
elif X < money(1):
    print(0)
else:
    left = 0
    right = 10**9
    while 1:
        mid = (left + right) // 2
        if money(mid) == X or right - left <= 1:
            print(mid)
            break
        elif money(mid) < X:
            left = mid
        elif money(mid) > X:
            right = mid
Problem p02897 (python)

Fixed submission:
N = int(input())

count = 0
for i in range(1, N+1):
    if i % 2 == 1:
        count += 1

print(count/N)

Buggy submission (verdict: Runtime Error):
N = int(input())

count = 0
for i in range(1, N+1):
    if i % 2 == 1:
        count += 1

print(count/N)N = int(input())

count = 0
for i in range(1, N+1):
    if i % 2 == 1:
        count += 1

print(count/N)
Problem p02829 (python)

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

print(6 - (a+b))

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

print(6 - (a+b))
Problem p02915 (python)

Fixed submission:
n = int(input())

print(n**3)

Buggy submission (verdict: Runtime Error):
n = int(input())

print (n^3
Problem p02916 (python)

Fixed submission:
n = int(input())
a_array, b_array, c_array = [list(map(int, input().split())) for _ in range(3)]
c_array.append(0)

sum = 0

for m in a_array:
    sum += b_array[m-1]

for i in range(n-1):
    if (a_array[i] + 1 == a_array[i+1]):
        sum += c_array[a_array[i]-1]

print(sum)

Buggy submission (verdict: Runtime Error):
n = int(input())
a_array = list(map(int(), input().split()))
b_array = list(map(int(), input().split()))
c_array = list(map(int(), input().split()))

c_array.append(0)

sum = 0

for m in a_array:
    sum += b_array[m-1]

for i in range(n-1):
    if (a_array[i] + 1 == a_array[i+1]):
        sum += c_array[a_array[i]-1]

print(sum)
Problem p03011 (python)

Fixed submission:
x = input()
x2 = x.split(" ")

x2.sort()

print (int(x2[0]) + int(x2[1]))

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

n, m = list(map(int, input().split()))
b = [-1]
ans = 1

def dfs(top, bot, dp):
    if top == bot:
        return 1
    elif top < bot:
        return 0
    else:
        if (top,bot) in dp:
            return dp[(top,bot)]
        dp[(top,bot)] = dfs(top - 1, bot, dp) + dfs(top - 2, bot, dp)
    
for i in range(m):
    broken = int(input())
    b.append(broken)

b.append(n + 1)
##print (b)

dp = dict()

for i in range(len(b) - 1):
    if b[i + 1] == b[i] + 1:
        ans = 0
        break
    else:
##        print (b[i + 1] - 1, b[i] + 1)
        ans *= dfs(b[i + 1] - 1, b[i] + 1, dp)
        ans %= 1000000007

print (ans)

Buggy submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))
b = [-1]
ans = 1

def dfs(top, bot):
    if top == bot:
        return 1
    elif top < bot:
        return 0
    else:
        return dfs(top - 1, bot) + dfs(top - 2, bot)
    
for i in range(m):
    broken = int(input())
    b.append(broken)

b.append(n + 1)
##print (b)

for i in range(len(b) - 1):
    if b[i] + 1 in b:
        ans = 0
        break
    else:
##        print (b[i + 1] - 1, b[i] + 1)
        ans *= dfs(b[i + 1] - 1, b[i] + 1)
        ans %= 1000000007

print (ans)
Problem p02879 (python)

Fixed submission:
# coding: utf-8

a, b = map(int, input().split())
if not 0 <= a <= 9 or not 0 <= b <= 9:
  print("-1")
else:
  c = a * b
  print(c)

Buggy submission (verdict: Runtime Error):
# coding: utf-8

a, b = map(int, input().split())
if not 0 <= a <= 9 or not 0 <= b <= 9:
  print("-1")
  sys.exit()
  
c = a * b
print(c)
Problem p02912 (python)

Fixed submission:
# coding: utf-8
import heapq

n, m = map(int, input().split())
s = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(s)

for i in range(m):
  maxi = heapq.heappop(s)
  heapq.heappush(s, -(-maxi // 2))

print(-sum(s))

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import heepq

n, m = map(int, input().split())
s = list(map(lamda x: int(x)*(-1), input().split()))
heapq.heapify(s)

for i in range(m):
  maxi = heapq.heappop(s)
  heapq.heappush(s, maxi // 2)

print(-sum(s))
Problem p02897 (python)

Fixed submission:
N = int(input())
if N % 2 == 0:
       print(0.5)
else:
       print((N-int(N/2))/N)

Buggy submission (verdict: Runtime Error):
N = int(input())
print(int(N / 2 + 0.5) / N
Problem p02915 (python)

Fixed submission:
n=int(input())
print(n**3)

Buggy submission (verdict: Runtime Error):
n=input()
print(n**3)

Buggy submission (verdict: Runtime Error):
n=input()
print(n**3)
Problem p02916 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
s=0
for i in range(n):
  if i==0:
    s+=b[a[0]-1]
  elif a[i]==a[i-1]+1:
    s=s+b[a[i]-1]+c[a[i]-2]
  else:
    s=s+b[a[i]-1]
print(s)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
s=0
for i in range(n):
  if i==0:
    s+=b[a[0]]
  elif a[i]==a[i-1]+1:
    s=s+b[a[i]-1]+c[a[i]-2]
  else:
    s=s+b[a[i]]
print(s)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
s=0
for i in range(n):
  if i==0:
    s+=b[a[0]]
  elif a[i]==a[i-1]+1:
    s=s+b[a[i]]+c[a[i-1]]
  else:
    s=s+b[a[i]]
print(s)
Problem p02879 (python)

Fixed submission:
a, b = [int(i) for i in input().split()]
if a <= 9 and b <= 9:
    print(a*b)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(4100000)
import heapq
n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
f = [int(i) for i in input().split()]
a.sort()
f.sort(reverse=True)

if sum(a) <= k:
    print(0)
else:
    heap = []
    for i in range(n):
        heapq.heappush(heap, (-a[i]*f[i], a[i], f[i]))
    for i in range(k):
        cur,x,y = heapq.heappop(heap)
        x -= 1
        cur = x*y
        heapq.heappush(heap,(-cur,x,y))
    ans = -float('inf')
    for i in range(len(heap)):
        ans = max(-heap[i][0], ans)
    print(ans)
Problem p03329 (python)

Fixed submission:
n_max = 100000

bs = [(6 ** i, 6) for i in range (1, 10)]
bs.extend([(9 ** i, 9) for i in range (1, 10)])
bs = list(sorted(filter(lambda x: x[0] <= n_max, bs)))
bms = []
s = 5
for b, i in bs:
    s += b * (i - 1)
    bms.append((b, i, s))

#print(bs)
#print(bms, len(bms))

#m = 44852
m = int(input())

stack = [(m, 0, len(bms) - 1)]
#print("search start!")
result = 10000
while stack:
    m, n, bms_i = stack.pop()
    b, i, s = bms[bms_i]
    #print(m, n, bms_i, b, i, s)

    if n > result:
        #print("skip!", m, n, bms_i)
        continue
    if m > s:
        continue
    if bms_i < 0:
        if m <= 6 and m + n < result:
            result = m + n
        #    print('get result!', result)
        continue

    for j in range(i):
        next_m = m - b * j
        if next_m >= 0 and n + j < result:
            stack.append((next_m, n + j, bms_i - 1))

print(result)

Buggy submission (verdict: Runtime Error):
n_max = 100000

bs = [(6 ** i, 6) for i in range (1, 10)]
bs.extend([(9 ** i, 9) for i in range (1, 10)])
bs = list(sorted(filter(lambda x: x[0] <= n_max, bs)))
bms = []
s = 5
for b, i in bs:
    s += b * (i - 1)
    bms.append((b, i, s))

#print(bs)
#print(bms, len(bms))

#m = 44852
m = int(input())

stack = [(m, 0, len(bms) - 1)]
#print("search start!")
result = 10000
while stack:
    m, n, bms_i = stack.pop()
    steps += 1
    b, i, s = bms[bms_i]
    #print(m, n, bms_i, b, i, s)

    if n > result:
        #print("skip!", m, n, bms_i)
        continue
    if m > s:
        continue
    if bms_i < 0:
        if m <= 6 and m + n < result:
            result = m + n
        #    print('get result!', result)
        continue

    for j in range(i):
        next_m = m - b * j
        if next_m >= 0 and n + j < result:
            stack.append((next_m, n + j, bms_i - 1))

print(result)
Problem p03346 (python)

Fixed submission:
def main():
    n = int(input())
    l = [ int(input().rstrip()) for i in range(n)]

    s = {}
    for i in l:
        if i - 1 in s:
            s[i] = s[i - 1] + 1
            del s[i - 1]
        else:
            s[i] = 1
    print(n - max(s.values()))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from itertools import count
n = int(input())
l = [ int(input()) for i in range(n)]
ans = tuple(sorted(l))

checked = set()

s = [(l, 0)]
for loop_count in count():
    #print(s, checked)
    tl, ns = s.pop(0)
    #print(loop_count, ns, len(s), len(checked))
    if tuple(tl) in checked:
        continue
    if ans == tuple(tl):
        print(ns)
        break
    for i in range(n):
        n1 = list(tl)
        if i != n - 1 and i != 0 and n1[i] != n1[i-1] + 1:
            c = n1.pop(i)
            n1.append(c)
            if(tuple(n1) not in checked):
                s.append((n1, ns+1))
        n2 = list(tl)
        if i != 0 and i != n - 1 and n2[i] + 1 != n2[i+1]:
            c = n2.pop(i)
            n2.insert(0, c)
            if(tuple(n2) not in checked):
                s.append((n2, ns+1))
    checked.add(tuple(tl))
Problem p03053 (python)

Fixed submission:
from collections import deque

h, w = map(int, input().split())
p = [list(input()) for i in range(h)]

# メモ配列
INF = 10**7
# memo = [[INF]*w for i in range(h)]

# 探索用ベクトル
vx = (0, -1, 0, 1)
vy = (-1, 0, 1, 0)

# 幅探索用キューの準備
# 白マスをカウント
q = deque()
bcnt = 0
for i, vi in enumerate(p):
    for j, vj in enumerate(vi):
        if vj == '#':
            q.appendleft((j, i))
            bcnt+=1
            
qans = deque()
            
def bfs(q):
    for i in range(INF):
        # キューが空なら終了
        if len(q) == 0:
            return qans

        # キューから一つ取り出す
        x, y = map(int, q.pop())
#         print('xy', x, y)

        # 4方向のいずれかに白があれば、黒にする
        for j in range(4):
            nx, ny = x+vx[j], y+vy[j]

            # エリア外 or 黒色なら探索しない
            if nx < 0 or w <= nx or ny < 0 or h <= ny or p[ny][nx] == '#':
                continue

            p[ny][nx] = '#'
            qans.appendleft((nx, ny))

def printmap(a):
    for i in a:
        print(i)
        
# print(q)
# printmap(p)
for i in range(INF):
    qans = deque()
    q = bfs(q)
#     print(q)
#     printmap(p)
    # キューが空なら終了
    if len(q) == 0:
        ans = i
        break
    
print(ans)
# print(q)

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

h, w = map(int, input().split())
p = [list(input()) for i in range(h)]

# メモ配列
INF = 10**7
# memo = [[INF]*w for i in range(h)]

# 探索用ベクトル
vx = (0, -1, 0, 1)
vy = (-1, 0, 1, 0)

# 幅探索用キューの準備
# 白マスをカウント
q = deque()
bcnt = 0
for i, vi in enumerate(p):
    for j, vj in enumerate(vi):
        if vj == '#':
            q.appendleft((j, i))
            bcnt+=1
            
qans = deque()
            
def bfs(q):
    for i in range(INF):
        # キューが空なら終了
        if len(q) == 0:
            return qans

        # キューから一つ取り出す
        x, y = map(int, q.pop())
#         print('xy', x, y)

        # 4方向のいずれかに白があれば、黒にする
        for j in range(4):
            nx, ny = x+vx[j], y+vy[j]

            # エリア外 or 黒色なら探索しない
            if nx < 0 or w <= nx or ny < 0 or h <= ny or p[ny][nx] == '#':
                continue

            p[ny][nx] = '#'
            memo[ny][nx] = 1
            qans.appendleft((nx, ny))

def printmap(a):
    for i in a:
        print(i)
        
# print(q)
# printmap(p)
for i in range(INF):
    qans = deque()
    q = bfs(q)
#     print(q)
#     printmap(p)
    # キューが空なら終了
    if len(q) == 0:
        ans = i
        break
    
print(ans)
# print(q)
Problem p03073 (python)

Fixed submission:
s = str(input())

test0 = [x%2 for x in range(len(s))]
test1 = [x%2 for x in range(len(s) - 1)]
test1.insert(0, 1)

cnt0 = 0
cnt1 = 0

for i, v in enumerate(s):
    if int(v) != test0[i]:
        cnt0+=1
    if int(v) != test1[i]:
        cnt1+=1

print(min(cnt0, cnt1))

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

test0 = [x%2 for x in range(n)]
test1 = [x%2+1 for x in range(n)]

cnt0 = 0
cnt1 = 0

for i, v in enumerate(s):
    if int(v) != test0[i]:
        cnt0+=1
    if int(v) != test1[i]:
        cnt1+=1
        
print(min(cnt0, cnt1))
Problem p03107 (python)

Fixed submission:
s = input()
cnt = [s.count('0'), s.count('1')]

print(len(s) - (max(cnt) - min(cnt)))

Buggy submission (verdict: Runtime Error):
import copy

s = input()
l1 = len(s)

for i in range(n):
    if '01' in s:
        s = s.replace('01', '')
    elif '10' in s:
        s = s.replace('10', '')
    else:
        break
        
print(l1 - len(s))
Problem p03137 (python)

Fixed submission:
n,m = map(int, input().split())
X = list(map(int, input().split()))
X.sort()

length = X[m-1] - X[0]
L = []
for i in range(m-1):
	L.append(X[i+1] - X[i])
L.sort()

if n >= m:
	print(0)
else:
	print(length - sum(L[m-1-(n-1):m-1]))

Buggy submission (verdict: Runtime Error):
#間隔が大きいところを含まないように分割すればいいのでは？
import bisect
n,m = map(int, input().split())
X = list(map(int, input().split()))
X.sort()
ans = []
xmin = X.pop(0)
prev = xmin
for x in X:
	if len(ans) < n-1:
		bisect.insort(ans, abs(prev - x))
	elif ans[0] < abs(prev - x):
		ans[0] = abs(prev - x)
	prev = x
if n >= m:
	print(0)
else:
	print(X[m-2]-xmin - sum(ans))
Problem p02829 (python)

Fixed submission:
t = [int(input()) for i in range(2)] 
k = [1,2,3]
for i in k:
  if i in t:
    pass
  else:
    print(i)

Buggy submission (verdict: Runtime Error):
a = [int(i) for i in input().split()]
if a[0] > a[1]:
  pass
else:
  b = a[0]
  c = a[1]
  a[0] = c
  a[1] = b

b = a[0]
c = a[1]

import fractions

g = fractions.gcd(b,c)

print(int((b * c) / g))
Problem p02862 (python)

Fixed submission:
#coding: utf-8
import math
import heapq

MOD = 10**9+7

def combination(n, r):
    r = min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n+1-i) % MOD
        denom = denom * i % MOD
    return numer * pow(denom, MOD-2, MOD) % MOD


X,Y = map(int, input().split())

if (X+Y)%3!=0:
    print(0)
else:
    a = (2*X-Y)//3
    b = (2*Y-X)//3
    if a<0 or b<0:
        print(0)
    else:
        print(combination(a+b, a))

Buggy submission (verdict: Runtime Error):
#coding: utf-8
import math
import heapq

MOD = 10**9+7

def combination(n, r):
    r = min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n+1-i) % MOD
        denom = denom * i % MOD
    return numer * pow(denom, MOD-2, MOD) % MOD


X,Y = map(int, input().split())

if (X+Y)%3!=0:
    print(0)
else:
    a = (2*X-Y)/3
    b = (2*Y-X)/3
    if a<0 or b<0:
        print(0)
    else:
        print(combination(a+b, a))
Problem p02990 (python)

Fixed submission:
#coding: utf-8
import math
import heapq
import bisect
from scipy.misc import comb

MOD = 10**9+7

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

for i in range(1,K+1):
    ans = (comb(K-1,i-1,exact=True)%MOD)*(comb(N-K+1,i,exact=True)%MOD)%MOD
    print(ans)

Buggy submission (verdict: Runtime Error):
#coding: utf-8
import math
import heapq
import bisect
from scipy.special import comb

MOD = 10**9+7

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

for i in range(1,K+1):
    ans = (comb(K-1,i-1,exact=True)%MOD)*(comb(N-K+1,i,exact=True)%MOD)%MOD
    print(ans)
Problem p03013 (python)

Fixed submission:
#coding: utf-8
import math
import heapq
import bisect
#from scipy.misc import comb

MOD = 10**9+7

N,M = map(int, input().split())
A = []
for i in range(M):
    a = int(input())
    A.append(a)    

ans = [1,1]+[0]*(N-1)
for a in A:
    ans[a]=-1

for i in range(2,N+1):
    if ans[i]!=-1:
        if ans[i-2]!=-1:
            ans[i]=(ans[i]+ans[i-2])%MOD
        if ans[i-1]!=-1:
            ans[i]=(ans[i]+ans[i-1])%MOD

print(ans[N])

Buggy submission (verdict: Runtime Error):
#coding: utf-8
import math
import heapq
import bisect
#from scipy.misc import comb

MOD = 10**9+7

N = int(input())
X,Y = map(int, input().split())

# 複数個の数値を、intの配列として取得
L = list(map(int, input().split()))

# (x,y)みたいな構造体をN個まとめてリストにするとき
A = []
for i in range(N):
    a = tuple(map(int, input().split()))
    A.append(a)
Problem p03038 (python)

Fixed submission:
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
#from scipy.misc import comb

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

L = []
for i in range(M):
    l = list(map(int, input().split()))
    L.append(l)
L = sorted(L, key=lambda x:-x[1])

ans = 0
index = 0
for i in range(N):
    if index >= M:
        ans += A[i]
    else:
        if A[i] >= L[index][1]:
            ans += A[i]
        else:
            ans += L[index][1]
            L[index][0] -= 1
            if L[index][0] == 0:
                index += 1

print(ans)

Buggy submission (verdict: Runtime Error):
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
#from scipy.misc import comb

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

L = []
for i in range(M):
    l = list(map(int, input().split()))
    L.append(l)
L = sorted(L, key=lambda x:-x[1])

ans = 0
index = 0
for i in range(N):
    if L[index][0] == 0:
        index += 1

    if index >= M:
        ans += A[i]
    else:
        if A[i] >= L[index][1]:
            ans += A[i]
        else:
            ans += L[index][1]
            L[index][0] -= 1

print(ans)
Problem p03127 (python)

Fixed submission:
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
import fractions
#from scipy.misc import comb

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

ans = A[0]
for i in range(1,N):
    ans = fractions.gcd(ans, A[i])

print(ans)

Buggy submission (verdict: Runtime Error):
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
#from scipy.misc import comb

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

ans = A[0]
for i in range(1,N):
    ans = math.gcd(ans, A[i])

print(ans)

Buggy submission (verdict: Runtime Error):
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
#from scipy.misc import comb

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

ans = math.gcd(A[0],A[1])
for i in range(2,N+1):
    ans = math.gcd(ans, A[i])

print(ans)
Problem p02847 (python)

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



if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
ef main():
    dict = {"SUN": 7,
            "MON": 6,
            "TUE": 5,
            "WED": 4,
            "THU": 3,
            "FRI": 2,
            "SAT": 1,
            }
    day = input()
    ans = dict[day]
    print(ans)



if __name__ == "__main__":
    main()
Problem p03127 (python)

Fixed submission:
# import math
import fractions
from functools import reduce

def gcd_list(lst):
    # return reduce(math.gcd, lst)
    return reduce(fractions.gcd, lst)

N = int(input())
lst_monsters = map(int, input().split())
print(gcd_list(lst_monsters))

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

def gcd(a, b):
    if b==0:
        return a
    else:
        gcd(b, a%b)

ans = lst_a[0]
for a in lst_a:
    # 配列の最初からひとつずつ最大公約数を取っていけばよい。
    ans = gcd(ans, a)

print(ans)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd_list(lst):
    return reduce(math.gcd, lst)

N = int(input())
lst_monsters = map(int, input().split())
print(gcd_list(lst_monsters))

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

import math
from functools import reduce
# def gcd(*lst):
#     return reduce(math.gcd, lst)

def gcd_list(lst):
    return reduce(math.gcd, lst)

ans = gcd_list(lst_monsters)
print(ans)

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

import math
from functools import reduce

def gcd_list(lst):
    return reduce(math.gcd, lst)

ans = gcd_list(lst_monsters)
print(ans)
Problem p03208 (python)

Fixed submission:
# coding: utf-8
import itertools

N, K = map(int, input().split())
lst = sorted([int(input()) for _ in range(N)], reverse=True)

ans = 10000000000
for i in range(N-K+1):
    l = lst[i]-lst[i+K-1]
    if l < ans:
        ans = l
print(ans)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import itertools
import sys

N, K = map(int, input().split())
# lst = [int(input()) for _ in range(N)]
lst = [int(i) for i in sys.stdin]
# lst2 = list(itertools.combinations(lst, K))
# print(lst2)

lst3 = []
# for l in lst2:
for l in itertools.combinations(lst, K):
    print(l)
    diff = max(l)-min(l)
    lst3.append(diff)

print(min(lst3))
Problem p03986 (python)

Fixed submission:
# coding: utf-8
X = input()
tmp = " "
cnt = 0
for x in X:
    if x == "S":
        tmp += x
        cnt += 1
    elif x == "T" and tmp[-1]=="S":
            cnt -= 1
            tmp = tmp[0:len(tmp)-1]
    else:
        tmp += x
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
X = input()
cnt_S, cnt_T = 0, 0

for c in range(X):
    if c == "S":
        cnt_S += 1
    else:
        if cnt_S:
            cnt_S -= 1
        else:
            cnt_T += 1
print(cnt_S, cnt_T)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
n_S, n_T = 0, 0

if c in input():
    if c == "S":
        n_S += 1
    else:
        if n_S:
            n_S -= 1
        else:
            T += 1
print(n_S + n_T)