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

Fixed submission:
import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
l = [a, b, c, d, e]
ans = 9
n = 0
j = 0
for i in [i % 10 for i in l]:
    if i != 0 and i < ans:
        ans = i
        n = j
    j += 1
m = l.pop(n)
r = 0
for i in l:
    r += math.ceil(i / 10) * 10
print(r + m)

Buggy submission (verdict: Runtime Error):
n, h, w = [int(i) for i in input().split()]
print(sum(h <= a and w <= b for a, b in ([int(i) for i in input().split()] for _ in range(n))))

Buggy submission (verdict: Runtime Error):
n, h, w = [int(i) for i in input().split()]
print(sum(h <= a and w <= b for a, b in ([int(i) for i in input().split()] for _ in range(n))))

Buggy submission (verdict: Runtime Error):
n, h, w = [int(i) for i in input().split()]
r = [h <= a and w <= b for a, b in ([int(i) for i in input().split()] for _ in range(n))]
print(sum(r))

Buggy submission (verdict: Runtime Error):
from math import ceil
a = [int(input()) for _ in range(5)]
b = [ceil(i / 10) * 10 for i in a]
print(min([sum([a[i]] + [b[j] for j in range if i != j]) for i in range(5)]))

Buggy submission (verdict: Runtime Error):
from functools import reduce
l = [int(input()) for _ in range(5)]
r = [i % 10 for i in l if i % 10 != 0]
l = [i if i % 10 == 0 else i // 10 * 10 + 10 for i in l]
print(reduce(lambda a, b: a + b, l) + (min(r) - 10 if r else 0)

Buggy submission (verdict: Runtime Error):
from functools import reduce
l = [int(input()) for _ in range(5)]
r = [i % 10 for i in l if i % 10 != 0]
l = [i // 10 * 10 + 10 for i in l]
print(reduce(lambda a, b: a + b, l) + min(r if r else 0) - 10)

Buggy submission (verdict: Runtime Error):
from functools import reduce
l = [int(input()) for _ in range(5)]
r = min([i % 10 for i in l if i % 10 != 0])
l = [i if i % 10 == 0 else i // 10 * 10 + 10 for i in l]
print(reduce(lambda a, b: a + b, l) + r - 10)

Buggy submission (verdict: Runtime Error):
from functools import reduce
l = [int(input()) for _ in range(5)]
r = min([i % 10 for i in l if i % 10 != 0])
l = [i // 10 * 10 + 10 for i in l]
print(reduce(lambda a, b: a + b, l) + r - 10)

Buggy submission (verdict: Runtime Error):
from functools import reduce
l = [int(input()) for _ in range(5)]
a = min([i % 10 for i in l if i % 10 != 0])
l = [i if i % 10 != 0 else i + 10 for i in l ]
ceil = lambda n: n // 10 * 10
print(reduce(lambda a, b: ceil(a) + ceil(b), l) + a)

Buggy submission (verdict: Runtime Error):
import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
l = [a, b, c, d, e]
ans = 9
n = 9
j = 0
for i in [i % 10 for i in l]:
    if i != 0 and i < ans:
        ans = i
        n = j
    j += 1
m = l.pop(n)
r = 0
for i in l:
    r += math.ceil(i / 10) * 10
print(r + m)

Buggy submission (verdict: Runtime Error):
import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
l = [a, b, c, d, e]
ans = 9
n = 9
j = 0
for i in [i % 10 for i in l]:
    if i != 0 and i < ans:
        ans = i
        n = j
    j += 1
m = l.pop(n)
r = 0
for i in l:
    r += math.ceil(i / 10) * 10
print(r + m)
Problem p03086 (python)

Fixed submission:
s = list(input())
n = len(s)
ans = 0
li = []
for i in range(n):
    if s[i] in list('ACGT'):
        ans += 1
    else:
        li.append(ans)
        ans = 0
li.append(ans)
print(max(li))

Buggy submission (verdict: Runtime Error):
s = input()
ans = 0
l = []
for i in range(len(s)):
    if s[i] in list('ACGT'):
        ans += 1
    else:
        l.append(ans)
        ans = 0
l.append(ans)
print(max(li))
Problem p03220 (python)

Fixed submission:
N = int(input())
T, A = map(int, input().split())
HS = list(map(int, input().split()))
 
result = 1
min_dif = 10000
for i in range(N):
  dif = abs(A - (T - HS[i] * 0.0060))
  if dif < min_dif:
    min_dif = dif
    result = i + 1
print(result)

Buggy submission (verdict: Runtime Error):
N = int(input())
T, A = map(int, input())
HS = list(map(int, input().split()))

result = 0
min_dif = 10000
for i in range(N):
  dif = abs(A, T - HS[i] * 0.0060 )
  if dif < min_dif:
    min_dif = dif
    result = i
print(result)
Problem p03308 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
 
# print(max(A) - min(A))

min = A[0]
max = A[0]
for i in range(N):
  if A[i] > max:
    max = A[i]
  if A[i] < min:
    min = A[i]
print(max - min)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(intm input().split()))

print(max(A) - min(A))
Problem p03469 (python)

Fixed submission:
S = input()
print("2018" + S[4:])

Buggy submission (verdict: Runtime Error):
S = input()
S[0:4] = "2018"
print(S)
Problem p03502 (python)

Fixed submission:
N = int(input())
 
sum = 0
tmp = N
while tmp > 0:
  sum += tmp % 10
  tmp //= 10
if N % sum == 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
 
sum = 0
tmp = N
while tmp > 0:
  sum += tmp % 10
  tmp =// 10
if N % sum == 0:
  print("Yes")
else:
  print("No")
Problem p03636 (python)

Fixed submission:
s = input()
print(s[0] + str(len(s[1:len(s) - 1])) +  s[len(s) - 1])

Buggy submission (verdict: Runtime Error):
s = input()
print(s[0] + len(s[1:len(s) - 1]) + s[len(s) - 1]
Problem p03264 (python)

Fixed submission:
n=int(input())
if n % 2==0:
	print((n//2)**2)
else:
	m=(n+1)//2
	print(m*(n-m))

Buggy submission (verdict: Runtime Error):
x_1,y_1,x_2,y_2=tuple(map(int,input().split()))

be=[x_2-x_1,y_2-y_1]
za3=[x_2+(-1)*be[1],y_2+be[0]]
za4=[x_1+(-1)*be[1],y_1+be[0]]

print(za3[0],za3[1],za4[0],za4[1])
Problem p03599 (python)

Fixed submission:
a, b, c, d, e, f = [int(x) for x in input().strip().split()]
a *= 100
b *= 100

water_cands = set()
t = 0
while t <= f:
    water_cands.add(t)
    u = t + b
    while u <= f:
        water_cands.add(u)
        u += b
    t += a

rat, wat, sug = 0.0, a, 0
for w in water_cands:
    if w == 0:
        continue
    suger_limit = min(f - w, w // 100 * e)
    suger_max = 0
    t = 0
    while t <= suger_limit:
        if suger_max < t:
            suger_max = t
        u = t + d
        while u <= suger_limit:
            if suger_max < u:
                suger_max = u
            u += d
        t += c
    if suger_max / (suger_max + w) > rat:
        rat = suger_max / (suger_max + w)
        wat = w
        sug = suger_max

print(wat + sug, sug)

Buggy submission (verdict: Runtime Error):
a, b, c, d, e, f = [int(x) for x in input().strip().split()]
a *= 100
b *= 100
if f < a + c:
    print("0 0")
    raise SystemExit

water_cands = set()
t = 0
while t <= f:
    water_cands.add(t)
    u = t + b
    while u <= f:
        water_cands.add(u)
        u += b
    t += a

rat, wat, sug = 0.0, 0, 0
for w in water_cands:
    suger_limit = min(f - w, w // 100 * e)
    suger_max = 0
    t = 0
    while t <= suger_limit:
        if suger_max < t:
            suger_max = t
        u = t + d
        while u <= suger_limit:
            if suger_max < u:
                suger_max = u
            u += d
        t += c
    if suger_max / (suger_max + w) > rat:
        rat = suger_max / (suger_max + w)
        wat = w
        sug = suger_max

print(wat + sug, sug)
Problem p03605 (python)

Fixed submission:
if [1 for c in input() if c == '9']:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
    if [1 for c in input() if c == '9']:
        print('Yes')
    else:
        print('No')
Problem p03146 (python)

Fixed submission:
def func(x):
  if(x % 2 == 0):
    return x / 2
  else:
    return 3 * x + 1

s = int(input())
if((s == 1) or (s == 2)):
  print(4)
  exit()
  
cnt = 1
while(s != 1):
  s = func(s)
  cnt += 1
print(cnt + 1)

Buggy submission (verdict: Runtime Error):
def func(x):
  if(x % 2 == 0):
    return x / 2
  else:
    return 3 * x + 1

s = int(input())
if(s == 1 || s == 2):
  print(4)
  exit()
  
cnt = 1
while(s != 1):
  s = func(s)
  cnt += 1
print(cnt + 1)
Problem p03233 (python)

Fixed submission:
'''
辺のコストをmin(Ax, By)とする代わりに、
辺のコストをAxもしくはByの好きな方にしてよいとしたときの最小値を求める

各頂点vについて、
１．Av, Bvともに選ばれる
２．Avのみ選ばれる
３．Bvのみ選ばれる
４．Av, Bvとも選ばれない

すべてタイプ2のときはsum(A), すべてタイプ3のときはsum(B)
それ以外は、タイプ1 = タイプ4 
2...2 4141..4 3...3 1
と構成すればよい
A, Bを合併したリストから小さい順にN個取る
この時に、最初のN個に同じ頂点由来のAv, Bvが両方含まれていたら上のように構成してしまえばよい
明らかにこれが最小値
含まれていないときは, 最初のn項についてそれぞれ取り除いたときにどうなるかを考える
Aw/Bwを取り除いたとすると, N+1番目の項がBw/AwでなければN+1番目の項を追加
Bw/Awの時はN+2番目の項を追加
（最初のN項が頂点について被りがないという条件から、これにより必ずあるvについてAv, Bv両方が含まれることになる
'''

n = int(input())
x = []
for i in range(n):
    ai, bi = map(int, input().split())
    x += [[i, ai, 0], [i, bi, 1]]
s1 = sum([x[2 * i][1] for i in range(n)])
s2 = sum([x[2 * i + 1][1] for i in range(n)])


x.sort(key = lambda x: x[1])
s3 = sum([x[i][1] for i in range(n)])
if len(set([x[i][0] for i in range(n)])) != n:
    print(min(s1, s2, s3))
else:
    if x[n - 1][0] == x[n][0]:
        s4 = min(s3 - x[n - 1][1] + x[n + 1][1], s3 - x[n - 2][1] + x[n][1])
    else:
        s4 = s3 - x[n - 1][1] + x[n][1]
    print(min(s1, s2, s4))

Buggy submission (verdict: Runtime Error):
'''
辺のコストをmin(Ax, By)とする代わりに、
辺のコストをAxもしくはByの好きな方にしてよいとしたときの最小値を求める

各頂点vについて、
１．Av, Bvともに選ばれる
２．Avのみ選ばれる
３．Bvのみ選ばれる
４．Av, Bvとも選ばれない

すべてタイプ2のときはsum(A), すべてタイプ3のときはsum(B)
それ以外は、タイプ1 = タイプ4 
2...2 4141..4 3...3 1
と構成すればよい
A, Bを合併したリストから小さい順にN個取る
この時に、最初のN個に同じ頂点由来のAv, Bvが両方含まれていたら上のように構成してしまえばよい
明らかにこれが最小値
含まれていないときは, 最初のn項についてそれぞれ取り除いたときにどうなるかを考える
Aw/Bwを取り除いたとすると, N+1番目の項がBw/AwでなければN+1番目の項を追加
Bw/Awの時はN+2番目の項を追加
（最初のN項が頂点について被りがないという条件から、これにより必ずあるvについてAv, Bv両方が含まれることになる
'''

n = int(input())
x = []
for i in range(n):
    ai, bi = map(int, input().split())
    x += [[i, ai, 0], [i, bi, 1]]
s1 = sum([x[2 * i][1] for i in range(n)])
s2 = sum([x[2 + i + 1][1] for i in range(n)])


x.sort(key = lambda x: x[1])
s3 = sum([x[i][1] for i in range(n)])
if len(set([x[i][0] for i in range(n)])) != n:
    print(min(s1, s2, s3))
else:
    if x[n - 1][0] == x[n][0]:
        s4 = min(s3 - x[n - 1][1] + x[n + 1][1], s3 - x[n - 2][1] + x[n][1])
    else:
        s4 = s3 - x[n - 1][1] + x[n][1]
    print(min(s1, s2, s4))

Buggy submission (verdict: Runtime Error):
'''
辺のコストをmin(Ax, By)とする代わりに、
辺のコストをAxもしくはByの好きな方にしてよいとしたときの最小値を求める

各頂点vについて、
１．Av, Bvともに選ばれる
２．Avのみ選ばれる
３．Bvのみ選ばれる
４．Av, Bvとも選ばれない

すべてタイプ2のときはsum(A), すべてタイプ3のときはsum(B)
それ以外は、タイプ1 = タイプ4 
2...2 4141..4 3...3 1
と構成すればよい
A, Bを合併したリストから小さい順にN個取る
この時に、最初のN個に同じ頂点由来のAv, Bvが両方含まれていたら上のように構成してしまえばよい
明らかにこれが最小値
含まれていないときは, 最初のn項についてそれぞれ取り除いたときにどうなるかを考える
Aw/Bwを取り除いたとすると, N+1番目の項がBw/AwでなければN+1番目の項を追加
Bw/Awの時はN+2番目の項を追加
（最初のN項が頂点について被りがないという条件から、これにより必ずあるvについてAv, Bv両方が含まれることになる
'''

n = int(input())
x = []
for i in range(n):
    ai, bi = map(int, input().split())
    x += [[i, ai, 0], [i, bi, 1]]
s1 = sum([x[2 * i][1] for i in range(n)])
s2 = sum([x[2 + i + 1][1] for i in range(n)])


x.sort(key = lambda x: x[1])
s3 = sum([x[i][1] for i in range(n)])
if len(set([x[i][0] for i in range(n)])) != n:
    print(min(s1, s2, s3))
else:
    if x[n - 1][0] == x[n][0]:
        s4 = min(s3 - x[n - 1][1] + x[n + 1][1], s3 - x[n - 2][1] + x[n][1])
    else:
        s4 = s3 - x[n - 1][1] + x[n][1]
    print(min(s1, s2, s4))
Problem p03256 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

N, M = map(int, input().split())
s = input()
G = [[] for _ in range(2 * N)]
for _ in range(M):
    a, b = map(lambda x: int(x) - 1, input().split())
    if s[a] == s[b]:
        G[a].append(b + N)
        G[b].append(a + N)
    else:
        G[a + N].append(b)
        G[b + N].append(a)

status = [0] * (2 * N) #0 = 未訪問　1 = 訪問中 2 = 訪問済
def dfs(v):
    if status[v] == 1:
        print('Yes')
        exit()
    elif status[v] == 0:
        status[v] = 1
        for u in G[v]:
            dfs(u)
        status[v] = 2

for v in range(2 * N):
    dfs(v)
print('No')

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000).
def have_loop(G, V):
    #Gに閉路があるかを判定 Gは隣接グラフによる表現. 0-based Vは頂点数
    status = [0] * V #0 = 未訪問　1 = 訪問中 2 = 訪問済
    def visit(n):
        if status[n] == 1:
            print('Yes')
            exit()
        elif status[n] == 0:
            status[n] = 1
            for v in G[n]:
                visit(v)
            status[n] = 2
        return None
    for v in range(V):
        visit(v)
    print('No')
    return None


N, M = map(int, input().split())
s = input()
G = [[] for _ in range(2 * N)]
for _ in range(M):
    a, b = map(lambda x: int(x) - 1, input().split())
    if s[a] == s[b]:
        G[a].append(b + N)
        G[b].append(a + N)
    else:
        G[a + N].append(b)
        G[b + N].append(a)

have_loop(G, 2 * N)

Buggy submission (verdict: Runtime Error):
def have_loop(G, V):
    #Gに閉路があるかを判定 Gは隣接グラフによる表現. 0-based Vは頂点数
    status = [0] * V #0 = 未訪問　1 = 訪問中 2 = 訪問済
    def visit(n):
        if status[n] == 1:
            print('Yes')
            exit()
        elif status[n] == 0:
            status[n] = 1
            for v in G[n]:
                visit(v)
            status[n] = 2
        return None
    for v in range(V):
        visit(v)
    print('No')
    return None


N, M = map(int, input().split())
s = input()
G = [[] for _ in range(2 * N)]
for _ in range(M):
    a, b = map(lambda x: int(x) - 1, input().split())
    if s[a] == s[b]:
        G[a].append(b + N)
        G[b].append(a + N)
    else:
        G[a + N].append(b)
        G[b + N].append(a)

have_loop(G, 2 * N)
Problem p03262 (python)

Fixed submission:
def gcd(x, y):
    if y > x:
        return gcd(y, x)
    elif x == 0:
        return 0
    else:
        z = x % y
        if z == 0:
            return y
        else:
            return gcd(y, z)

N, X = map(int, input().split())
city = [X] + list(map(int, input().split()))
city_diff = [abs(city[i + 1] - city[i]) for i in range(N)]
ans = city_diff[0]
for i in range(1, N, 1):
    ans = gcd(ans, city_diff[i])
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np

N, X = map(int, input().split())
city = [X] + list(map(int, input().split()))
city_diff = np.array([abs(city[i + 1] - city[i]) for i in range(N)])
ans = np.gcd.reduce(city_diff)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
import sys
sys.setrecursionlimit(100000) 
N, X = map(int, input().split())
city = [X] + list(map(int, input().split()))
city_diff = [abs(city[i + 1] - city[i]) for i in range(N)]
ans = city_diff[0]
for i in range(1, N, 1):
    ans = math.gcd(ans, city_diff[i])
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N, X = map(int, input().split())
city = [X] + list(map(int, input().split()))
city_diff = [abs(city[i + 1] - city[i]) for i in range(N)]
import math
ans = city_diff[0]
for i in range(1, N, 1):
    ans = math.gcd(ans, city_diff[i])
print(ans)
Problem p03280 (python)

Fixed submission:
A, B = map(int, input().split())
print((A - 1) * (B - 1))

Buggy submission (verdict: Runtime Error):
import bisect

N, M, Q = map(int, input().split())
trains = [list(map(int, input().split())) for i in range(M)]
queries = [list(map(int, input().split())) for i in range(Q)]
trains.sort(key = lambda x: x[1])
L = [train[0] for train in trains]
R = [train[1] for train in trains]

dp = [[0] * N for i in range(N)]
for i in range(N):
    for j in range(i, N):
        right = bisect.bisect_right(R, j + 1)
        A = sorted(L[:right])
        left = bisect.bisect_left(A, i + 1)
        dp[i][j] = right - left

for q in range(Q):
    pi, qi = queries[q]
    print(dp[pi - 1][qi - 1])
Problem p03362 (python)

Fixed submission:
def prime_list(n):
    '''
    n以下の素数のリストを返す
    '''
    A = list(range(2, n + 1, 1))
    prime = []
    p_max = A.pop(0)    
    while A[-1] >= p_max ** 2:
        for n in A:
            if n % p_max == 0:
                A.remove(n)
        prime.append(p_max)
        p_max = A.pop(0)
    prime.append(p_max)
    prime += A
    return prime

N = int(input())
ans = ['2']
for prime in prime_list(1362):
    if len(ans) < N:
        if prime % 5 == 1:
            ans.append(str(prime))

print(' '.join(ans))

Buggy submission (verdict: Runtime Error):
def prime_list(n):
    '''
    n以下の素数のリストを返す
    '''
    A = list(range(2, n + 1, 1))
    prime = []
    p_max = A.pop(0)    
    while A[-1] >= p_max ** 2:
        for n in A:
            if n % p_max == 0:
                A.remove(n)
        prime.append(p_max)
        p_max = A.pop(0)
    prime.append(p_max)
    prime += A
    return prime

N = int(input())
ans = [2]
for prime in prime_list(1362):
    if len(ans) < N:
        if prime % 5 == 1:
            ans.append(prime)

print(' '.join(ans))
Problem p03402 (python)

Fixed submission:
B, A = map(int, input().split())

h, w = 100, 100
grid = [['.'] * 100 for _ in range(50)] + [['#'] * 100 for _ in range(50)]

for i in range(A - 1):
    A1, A2 = divmod(i, 50)
    grid[2 * A1][2 * A2] = '#'

for j in range(B - 1):
    B1, B2 = divmod(j, 50)
    grid[2 * B1 + 51][2 * B2] = '.'

print(h, w)
for i in range(100):
    print(''.join(grid[i]))

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

h, w = 100, 100
grid = [['.'] * 100 for _ in range(50)]+ [['#'] * 100 for _ in range(50)]

for i in range(A - 1):
    A1, A2 = divmod(i, 50)
    grid[2 * A1][2 * A2] = '#'

for j in range(B - 1):
    B1, B2 = divmod(i, 50)
    grid[2 * B1 + 51][2 * B2] = '.'

print(h,w)
for i in range(100):
    print(grid[i])
Problem p03476 (python)

Fixed submission:
def sieve(n):
    '''

    :param n:
    :return: n以下の素数のリストを返す
    '''
    prime = []
    is_prime = [True] * (n + 1) #is_prime[i] = Trueならiは素数
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, n+1):
        if is_prime[i]:
            prime.append(i)
            for j in range(2 * i, n + 1, i):
                is_prime[j] = False
    return is_prime

import bisect
Q = int(input())
queries = [list(map(int, input().split())) for _ in range(Q)]
primehantei = sieve(10 ** 5)
like2017 = []
for i in range(10 ** 5):
    if primehantei[i] == True and primehantei[ (i + 1) // 2] == True:
        like2017.append(i)

for i in range(Q):
    li, ri = queries[i]
    print(bisect.bisect_right(like2017, ri) - bisect.bisect_right(like2017, li - 1))

Buggy submission (verdict: Runtime Error):
import bisect
def prime_list(n):
    '''
    n未満の素数のリストを返す
    '''
    num = list(range(2, n))
    prime = []
    while num[0] ** 2 < n:
        p = num.pop(0)
        for j in range(2 * p, n, p):
            if j in num:
                num.remove(j)
        prime.append(p)
    prime += num
    return prime

Q = int(input())
queries = [list(map(int, input().split())) for _ in range(Q)]
primes = prime_list(10 ** 5)
prime_2017like = []
for prime in primes:]
    if (prime + 1) // 2 in primes:
        prime_2017like.append(prime)
for i in range(Q):
    li, ri = queries[i]
    print(bisect.bisect_right(prime_2017like, ri) - bisect.bisect_right(prime_2017like, li - 1))
Problem p03579 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

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

G = [[] for i in range(N)]
for _ in range(M):
    Ai, Bi = map(int, input().split())
    G[Ai - 1].append(Bi - 1)
    G[Bi - 1].append(Ai - 1)

color = [0] * N
def dfs(v, c):
    '''
    頂点vをcで塗る　そこから深さ優先探索で交互に塗っていく
    '''
    color[v] = c
    for i in G[v]:
        if color[i] == c:
            return False
        if color[i] == 0 and not(dfs(i, -c)):
            return False
    return True

if dfs(0, 1):
    print(color.count(1) * color.count(-1) - M)
else:
    print(N * (N - 1) // 2 - M)

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

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

G = [[] for i in range(N)]
for _ in range(M):
    Ai, Bi = map(int, input().split())
    G[Ai - 1].append(Bi - 1)
    G[Bi - 1].append(Ai - 1)

color = [0] * N
def dfs(v, c):
    '''
    頂点vをcで塗る　そこから深さ優先探索で交互に塗っていく
    '''
    color[v] = c
    for i in G[v]:
        if color[i] == c:
            return False
        if color[i] == 0 and not(dfs(i, -c)):
            return False
    return True

if dfs(0, 1):
    print(color.count(1) * color.count(-1) - M)
else:
    print(N * (N - 1) // 2 - M)

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

G = [[] for i in range(N)]
for _ in range(M):
    Ai, Bi = map(int, input().split())
    G[Ai - 1].append(Bi - 1)
    G[Bi - 1].append(Ai - 1)

color = [0] * N
def dfs(v, c):
    '''
    頂点vをcで塗る　そこから深さ優先探索で交互に塗っていく
    '''
    color[v] = c
    for i in G[v]:
        if color[i] == c:
            return False
        if color[i] == 0 and not(dfs(i, -c)):
            return False
    return True

if dfs(0, 1):
    print(color.count(1) * color.count(-1) - M)
else:
    print(N * (N - 1) // 2 - M)
Problem p03206 (python)

Fixed submission:
#coding:utf-8
d=int(input())
if d==25:
	print("Christmas")
elif d==24:
	print("Christmas Eve")
elif d==23:
	print("Christmas Eve Eve")
elif d==22:
	print("Christmas Eve Eve Eve")
else:
	print("")

Buggy submission (verdict: Runtime Error):
#coding:utf-8
n,k=map(int, input().split())
h=[int(input()) for i in range(n)]
h.sort()
print(min(h[i+k-1] - h[i] for i in range(n-k+1)))

Buggy submission (verdict: Runtime Error):
#coding:utf-8
n,k=map(int,input().split())
h=[int(input()) for i in range(n)]
h.sort()
print(min(h[i+k-1]-h[i] for i in range(n-k+1)))

Buggy submission (verdict: Runtime Error):
#coding:utf-8
n,k=map(int(input().split()))
h=[int(input()) for i in range(n)]
h.sort()
print(min(h[i+k-1]-h[i] for i in range(n-k+1)))
Problem p03796 (python)

Fixed submission:
s=int(input())
ans=1
for i in range(1,s+1):
  ans=ans%(10**9+7)*i
  
  
print(ans%(10**9+7))

Buggy submission (verdict: Runtime Error):
s=int(input())
ans=1
for i in range(1,n+1):
  ans=ans%(10**9+7)*i
  
  
print(ans%(10**9+7))

Buggy submission (verdict: Runtime Error):
s=int(input())
ans=1
for i in range(1,n+1):
  ans=ans%(10**9+7)*n
  
  
print(ans%(10**9+7))

Buggy submission (verdict: Runtime Error):
s=int(input())
ans=1
for i in range(1,n+1):
  ans=ans%(10**9+7)*n
  
  
print(ans%(10**9+7))

Buggy submission (verdict: Runtime Error):
s=int(input())
ans=1
for i in range(1,n+1):
  ans=ans%(10**9+7)*n
  
  
print(ans%1000000007)

Buggy submission (verdict: Runtime Error):
s=int(input())
ans=1
for i in range(1,n+1):
  ans=ans%(10**9+7)*n
  
  
print(ans%10000000007)

Buggy submission (verdict: Runtime Error):
#include<bits/stdc++.h>
using namespace std;

int main(){
  long long int n,i,ans=1;
  cin>>n;
  
  for(i=1;i<=n;i++)
  ans=(ans*i)%(10000000007);
  
cout<<ans<<endl;

Buggy submission (verdict: Runtime Error):
s=int(input())
ans=1
for i in range(1,n+1):
  ans*=i
  
print(ans)
Problem p03455 (python)

Fixed submission:
def matmul(a,b):
  c = a*b
  return c

a,b=map(int, input().split())
c = matmul(a,b)
if c%2==0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
import sys

def matmul(a,b):
  mul = a * b
  return mul

if __name__=="__main__":
  li = []
  for i in sys.argv:
    li.append(i)
  a = li[0]
  b = li[1]
  c = matmul(a,b)
  if c%2:
    print("Even")
  else:
    print("Odd")
Problem p03050 (python)

Fixed submission:
a = int(input())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors


test_list = make_divisors(a)
test_list_modify = [i-1 for i in test_list if i > 2 and a//(i-1) == a%(i-1)]
print(sum(test_list_modify))

Buggy submission (verdict: Runtime Error):
import sympy

a = int(input())

test_list = sympy.divisors(a)
test_list_modify = [i-1 for i in test_list if i > 2 and a//(i-1) == a%(i-1)]
print(sum(test_list_modify))

Buggy submission (verdict: Runtime Error):
import sympy

a = int(input())

test_list = sympy.divisors(a)
test_list_modify = [i-1 for i in test_list if i > 2]
print(test_list_modify)
print(sum(test_list_modify))

Buggy submission (verdict: Runtime Error):
import sympy

a = int(input())

test_list = sympy.divisors(a)
test_list_modify = [i-1 for i in test_list if i > 2 or i!=8]
print(sum(test_list_modify))