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

Fixed submission:
from sys import stdin
import math
import itertools


def makeIntMatrix(lines):
    intMatrix = []
    for a in makeStringMatrix(lines):
        intMatrix.append([int(b) for b in a])
    return intMatrix
 
 
def makeStringMatrix(lines):
    stringMatrix = [line.split() for line in lines]
    return stringMatrix
 
 
def makeInt(line):
    return int(line.rstrip())
 
 
def makeMultiInteger(line):
    return [int(x) for x in line.rstrip().split()]


def solve(input_string):
    N, M = makeMultiInteger(input_string[0])
    S = makeIntMatrix(input_string[1:])
    c = 0
    ra = range(1, N+1)
        
    min_range = ra
    min_l = ra[0]
    min_r = ra[-1]
    for s in S:
        l = s[0]
        r = s[1]
        if l > min_range[0]:
            min_l = l
        if r < min_range[-1]:
            min_r = r
        min_range = range(min_l, min_r+1)
        if len(min_range) == 0:
            return 0
    #if ra[-1] >= min_range[-1]:
    return len(min_range)
    #else:
    #    return len(ra)



def main():
    input_lines = stdin.readlines()
    answer = solve(input_lines)
    print(answer)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from sys import stdin
import math
import itertools


def makeIntMatrix(lines):
    intMatrix = []
    for a in makeStringMatrix(lines):
        intMatrix.append([int(b) for b in a])
    return intMatrix
 
 
def makeStringMatrix(lines):
    stringMatrix = [line.split() for line in lines]
    return stringMatrix
 
 
def makeInt(line):
    return int(line.rstrip())
 
 
def makeMultiInteger(line):
    return [int(x) for x in line.rstrip().split()]


def solve(input_string):
    N, M = makeMultiInteger(input_string[0])
    S = makeIntMatrix(input_string[1:])
    c = 0
    ra = range(1, N+1)
        
    min_range = ra
    for s in S:
        l = s[0]
        r = s[1]
        if l >= min_range[0]:
            min_l = l
        if r <= min_range[-1]:
            min_r = r
        min_range = range(min_l, min_r+1)
    #print(min_range)
    if ra[-1] > min_range[-1]:
        return len(min_range)
    else:
        return len(ra)



def main():
    input_lines = stdin.readlines()
    answer = solve(input_lines)
    print(answer)


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

Fixed submission:
from sys import stdin


def b(input_string):
    a, b, k = [int(x) for x in input_string.split()]
    mod_0_numbers = []
    if a >= b:
        for i in range(1, a+1):
            if a % i == 0:
                if b % i == 0:
                    mod_0_numbers.append(i)
    else:
        for i in range(1, b+1):
            if b % i == 0:
                if a % i == 0:
                    mod_0_numbers.append(i)
    return mod_0_numbers[-k]


def main():
    input_line = stdin.readline().rstrip()
    answer = b(input_line)
    print(answer)


if __name__ == '__main__':
    main()

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


def b(input_string):
    a, b, k = [int(x) for x in input_string.split()]
    mod_0_numbers = []
    if a >= b:
        for i in range(1, a):
            if a % i == 0:
                if b % i == 0:
                    mod_0_numbers.append(i)
    else:
        for i in range(1, b):
            if b % i == 0:
                if a % i == 0:
                    mod_0_numbers.append(i)
    return mod_0_numbers[-k]


def main():
    input_line = stdin.readline().rstrip()
    answer = b(input_line)
    print(answer)


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

Fixed submission:
N = input()
string_list = input().rstrip().split()
l = [int(x) for x in string_list]
_max = 0
_min = l[0]
for t in l:
  if _max < t:
    _max = t
  if _min > t:
    _min = t  
print(_max - _min)

Buggy submission (verdict: Runtime Error):
N = input()
string_list = input().rstrip().split()
l = [int(x) for x in string_list]
_max = 0
_min = l[0]
for t in l:
  if _max < t:
    _max = t
  if _min > t:
    _min = t  
return _max - _min

Buggy submission (verdict: Runtime Error):
N = input()
l = [int(x) for x in input().rstrip().split()]
_max = 0
_min = l[0]
for t in l:
  if _max < t:
    _max = t
  if _min > t:
    _min = t  
return _max - _min

Buggy submission (verdict: Runtime Error):
N = input()
l = [int(input()) for i in range(N)]
_max = 0
_min = l[0]
for t in l:
  if _max < t:
    _max = t
  if _min > t:
    _min = t  
return _max - _min
Problem p03141 (python)

Fixed submission:
N = int(input())
l = []
sumB = 0
for i in range(N):
    tmp = list(map(int, input().split()))
    l.append(tmp[0] + tmp[1])
    sumB += tmp[1]
l.sort(reverse=True)
A = 0
for i in range(N):
    if i % 2 ==0:
        A += l[i]
print(A - sumB)

Buggy submission (verdict: Runtime Error):
N = int(input())
l = []
sumB = 0
for i in range(N):
    tmp = map(int, input().split())
    l.append(tmp[0] + tmp[1])
    sumB += tmp[1]
l.sort(reverse=True)
A = 0
for i in range(0, N, 2):
        A += l[i]
print(A - sumB)
Problem p03993 (python)

Fixed submission:
N = int(input())
A = [0] + list(map(int, input().split()))
res = 0
for i in range(1, N):
    if i == A[A[i]]:
        res += 1
        A[A[i]] = 0
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
res = 0
for i in range(N):
    if i + 1 == A[A[A[i]-1]]:
        res += 1 
print(res)
Problem p03047 (python)

Fixed submission:
nk = input()

n = int(nk.split(' ')[0])
k = int(nk.split(' ')[1])

answer = n - k + 1
print(answer)

Buggy submission (verdict: Runtime Error):
nk = input()

n = nk.split(' ')[0]
k = nk.split(' ')[1]

answer = n - k + 1
print(answer)
Problem p03238 (python)

Fixed submission:
n = int(input())
if n == 1:
    print("Hello World")
else:
    a = int(input())
    b = int(input())
    print(a + b)

Buggy submission (verdict: Runtime Error):
n = int(input())
xyhs = []
for _ in range(n):
    xyhs.append(tuple(map(int, input().split())))

xyhs = sorted(xyhs, key=lambda v: v[2], reverse=True)

anss = []
for y in range(101):
    for x in range(101):
        x0, y0, h0 = xyhs[0]
        ht = h0 + abs(x0 - x) + abs(y0 - y)

        flag = True
        for xyh in xyhs[1:]:
            xi, yi, hi = xyh
            his = max(ht - abs(xi - x) - abs(yi - y), 0)
            if his != hi:
                flag = False
                break

        if flag:
            anss.append((x, y, ht))

print(anss[0][0], anss[0][1], anss[0][2])
Problem p03240 (python)

Fixed submission:
n = int(input())
xyhs = []
for _ in range(n):
    xyhs.append(tuple(map(int, input().split())))

xyhs = sorted(xyhs, key=lambda v: v[2], reverse=True)

anss = []
for y in range(101):
    for x in range(101):
        x0, y0, h0 = xyhs[0]
        ht = h0 + abs(x0 - x) + abs(y0 - y)

        flag = True
        for xyh in xyhs[1:]:
            xi, yi, hi = xyh
            his = max(ht - abs(xi - x) - abs(yi - y), 0)
            if his != hi:
                flag = False
                break

        if flag:
            anss.append((x, y, ht))

print(anss[0][0], anss[0][1], anss[0][2])

Buggy submission (verdict: Runtime Error):
n = int(input())
xyhs = []
for _ in range(n):
    xyhs.append(tuple(map(int, input().split())))

xyhs = sorted(xyhs, key=lambda v: v[2], reverse=True)

anss = []
for y in range(101):
    for x in range(101):
        x0, y0, h0 = xyhs[0]
        ht = h0 + abs(x0 - x) + abs(y0 - y)

        flag = True
        for xyh in xyhs[1:]:
            xi, yi, hi = xyh
            his = ht - abs(xi - x) - abs(yi - y)
            if his != hi:
                flag = False
                break

        if flag:
            anss.append((x, y, ht))

print(anss[0][0], anss[0][1], anss[0][2])

Buggy submission (verdict: Runtime Error):
n = int(input())
xyhs = []
for _ in range(n):
    xyhs.append(tuple(map(int, input().split())))

xyhs = sorted(xyhs, key=lambda v: v[2], reverse=True)

anss = []
for y in range(101):
    for x in range(101):
        x0, y0, h0 = xyhs[0]
        ht0 = h0 + abs(x0 - x) + abs(y0 - y)

        flag = True
        for xyh in xyhs[1:]:
            xi, yi, hi = xyh
            hti = hi + abs(xi - x) + abs(yi - y)
            if hti != ht0:
                flag = False
                break

        if flag:
            anss.append((x, y, ht0))

print(anss[0][0], anss[0][1], anss[0][2])
Problem p03262 (python)

Fixed submission:
def gcd(l):
    if len(l) == 1:
        return l[0]

    v = gcd2(l[0], l[1])
    for i in range(2, n):
        v = gcd2(v, l[i])

    return v


def gcd2(a, b):
    if b == 0:
        return a

    return gcd2(b, a % b)


n, s = map(int, input().split())
x = list(map(int, input().split()))

x = [abs(xi - s) for xi in x]
print(gcd(x))

Buggy submission (verdict: Runtime Error):
def gcd(l):
    if len(l) == 1:
        return l[0]

    return gcd([gcd2(l[0], l[1])] + l[2:])


def gcd2(a, b):
    if b == 0:
        return a

    return gcd2(b, a % b)


n, s = map(int, input().split())
x = list(map(int, input().split()))

x = [abs(xi - s) for xi in x]
print(gcd(x))
Problem p03404 (python)

Fixed submission:
a, b = map(int, input().split())
f = [['#' for _ in range(100)] for _ in range(50)] + \
    [['.' for _ in range(100)] for _ in range(50)]

for i in range(a-1):
    h = (i // 50) * 2
    w = (i % 50) * 2
    f[h][w] = '.'

for i in range(b-1):
    h = -((i // 50) * 2 + 1)
    w = (i % 50) * 2
    f[h][w] = '#'

print(100, 100)
for line in f:
    print(''.join(line))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
N = 20
f = [['#'] * N if i < (N/2) else ['.'] * N for i in range(N)]

for i in range(a-1):
    h = 2 * ((2 * i) // N)
    w = (2 * i) % N
    f[h][w] = '.'

for i in range(b-1):
    h = (N//2 + 1) + 2 * (2 * i // N)
    w = 2 * i % N
    f[h][w] = '#'


print(N, N)
for line in f:
    print(''.join(line))
Problem p03071 (python)

Fixed submission:
a, b = [int(x) for x in input().split()]

c = max([a, b])

if c == a:
    d = max([a - 1, b])
else:
    d = max([a, b - 1])

result = c + d
print(result)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = [int(a) for a in input().split()]

result = 0
for i in range(n):
    if all([h[j] <= h[i] for j in range(i)]):
        result += 1

print(result)
Problem p03087 (python)

Fixed submission:
N, Q = map(int, input().split())
S = str(input())
wa=[0]*N
p=0
for j in range(1,N):
    if S[j-1]=="A" and S[j]=="C":
        p+=1
        wa[j]=p
    else:
        wa[j]=wa[j-1]
for i in range(Q):
    k =input().split()
    l=int(k[0])
    r=int(k[1])
    print(wa[r-1]-wa[l-1])

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
S = str(input())
len=len(S)
for i in range(Q):
    l, r = map(int, input().split())
    slice = S[l-1:r]
    po=slice.replace("AC","")
    le=len(po)
    print((len-(r-l+1)+le)//2)
Problem p03387 (python)

Fixed submission:
x=list(map(int,input().split()))
y=sorted(x)
if (y[0]+y[1])%2==0:
  print(int((2*y[2]-y[1]-y[0])/2))
else :
  print(int((2*y[2]-y[1]-y[0]+3)/2))

Buggy submission (verdict: Runtime Error):
x=int(input())
y=sorted(x)
if (y[0]+y[1])%2==0:
  print((2*y[2]-y[1]-y[0])/2)
else :
  print((2*y[2]-y[1]-y[0]+3)/2)
Problem p03417 (python)

Fixed submission:
M, N = map(int, input().split())
if M==1 and N==1:
    print(1)
elif M > 2 and N > 2:
    print((M - 2) * (N - 2))
elif M==1 or N==1:
    print(N * M - 2)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
M, N = map(int, input().split())
if M > 2 and N > 2:
    print(M - 2) * (N - 2)
elif M==1 or N==1:
    print(N * M - 2)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
M, N = map(int, input().split())
if M >= 2 and N >= 2:
    print(M - 2) * (N - 2)
elif M==1 or N==1:
    print(N * M - 2)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
M,N = map(int, input().split())
if M>=2 and N>=2 : 
    print(M-2)*(N-2)
else:
    print(N*M-2)
Problem p03633 (python)

Fixed submission:
# coding: UTF-8
from fractions import gcd
N=int(input())
a=int(input())
for i in range(N-1):
    b=int(input())
    a=a*b//gcd(a, b)
print(int(a))

Buggy submission (verdict: Runtime Error):
# coding: UTF-8
import math
N=int(input())
a=int(input())
for i in range(N-1):
    b=int(input())
    a=a*b//math.gcd(a, b)
print(int(a))

Buggy submission (verdict: Runtime Error):
# coding: UTF-8
import math
N=int(input())
a=int(input())
for i in range(N-1):
    b=int(input())
    c=math.gcd(a, b)
    a=a*b/c
print(int(a))
Problem p03095 (python)

Fixed submission:
N = int(input())
S = str(input())
dic = {'a':0,'b':0,'c':0,'d':0,'e':0,'f':0,'g':0,'h':0,'i':0,'j':0,'k':0,'l':0,'m':0,'n':0,'o':0,'p':0,'q':0,'r':0,'s':0,'t':0,'u':0,'v':0,'w':0,'x':0,'y':0,'z':0}

ans = 1

for i in range(N):
	dic[S[i]] += 1

for key in list(dic.keys()):
	ans *= (dic[key]+1)

print(str((ans-1)%(10**9+7)))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = str(input())
dic = {'a':0,'b':0,'c':0,'d':0,'e':0,'f':0,'g':0,'h':0,'i':0,'j':0,'k':0,'l':0,'m':0,'n':0,'o':0,'p':0,'q':0,'r':0,'s':0,'t':0,'u':0,'v':0,'w':0,'x':0,'y':0,'z':0}

ans = 1

for i in range(N):
	dic[S[i]] += 1

for key in list(dic.keys()):
	ans *= (dic[key]+1)

print(str((ans-1)%(10**9+7))
Problem p03160 (python)

Fixed submission:
N=int(input())
H=list(map(int,input().split(' ')))
dp=[]

for k in range(N):
	if k==0:
		dp.append(0)
	elif k==1:
		dp.append(abs(H[1]-H[0]))
	else:
		dp.append(min(dp[k-2]+abs(H[k]-H[k-2]), dp[k-1]+abs(H[k]-H[k-1])))
		
print(dp[N-1])

Buggy submission (verdict: Runtime Error):
N=int(input())
H=list(map(int,input().split(' ')))
dp=[]

for i in range(N):
	if i==0:
		dp.append(0)
	elif k==1:
		dp.append(abs(H[1]-H[0]))
	else:
		return min(dp[k-2]+abs(H[k]-H[k-2]), dp[k-1]+abs(H[k]-H[k-1]))
		
print(dp[N-1])

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

def dp(k):
	if k==0:
		return 0
	elif k==1:
		return abs(H[1]-H[0])
	else:
		return min(dp(k-2)+abs(H[k]-H[k-2]), dp(k-1)+abs(H[k]-H[k-1]))
		
print(dp(N-1))
Problem p03161 (python)

Fixed submission:
N, K=map(int,input().split(' '))
H=list(map(int,input().split(' ')))
dp=[]

for i in range(N):
	if i==0:
		dp.append(0)
	elif i==1:
		dp.append(abs(H[1]-H[0]))
	else:
		d = min([ dp[i-j]+abs(H[i]-H[i-j]) for j in range(1,K+1) if i-j>=0])
		dp.append(d)
		
print(dp[N-1])

Buggy submission (verdict: Runtime Error):
import numpy as np
N, K=map(int,input().split(' '))
H=np.array(list(map(int,input().split(' '))))
dp=np.zeros(N)

for i in range(N):
	if i==0:
		continue
	elif i==1:
      	#0->1に移動するコストは1通り
		dp[i]=(np.abs(H[1]-H[0]))
	else:
      	#i>=2のときはiに移動するコストは
        #dp[i-j]+abs(H[i-j]-H[i]) (j=1,...,min(K,i)) の最小値]
        dp[i] = np.min(dp[min(0,i-K):i] + np.abs(H[min(0,i-K):i] - H[i]))
		
print(dp[N-1])

Buggy submission (verdict: Runtime Error):
import numpy as np
N, K=map(int,input().split(' '))
H=np.array(list(map(int,input().split(' '))))
dp=np.zeros(N)

for i in range(N):
	if i==0:
		continue
	elif i==1:
		dp[i]=(np.abs(H[1]-H[0]))
	else:
		d = np.min(np.array([ dp[i-j]+abs(H[i]-H[i-j]) for j in range(1,K+1) if i-j>=0]))
		dp.append(d)
		
print(dp[N-1])
Problem p03163 (python)

Fixed submission:
N,Wmax=map(int,input().split(' '))
W=[]
V=[]
for _ in range(N):
	w,v = map(int,input().split(' '))
	W.append(w)
	V.append(v)

#dp[i][j]=i番目の品物までだけを選び重量制限をjとしたときの価値の最大値
dp = []
dp.append([0]*min(W[0],Wmax+1)+ [V[0]]*max(0, Wmax+1-W[0]))


for i in range(1,N):
	#今回の重量制限をwとする
	#今回は荷物を積む場合: dp[i][w] = dp[i-1][w-w[i]]+v[i] 
	#今回は荷物を積まない場合: dp[i][w] = dp[i-1][w]
	#よってこの2つのうち大きいほうをdp[i][w]に採用する
	dpi = []
	for j in range(Wmax+1):
		if j<W[i]:
			dpi.append(dp[i-1][j])
		else:
			dpi.append(max(dp[i-1][j], dp[i-1][j-W[i]]+V[i]))
	dp.append(dpi)
print(dp[N-1][Wmax])

Buggy submission (verdict: Runtime Error):
N,Wmax=map(int,input().split(' '))
info=[ list(map(int,input().split(' '))) for i in range(N) ]
W = info[:][0]
V = info[:][1]

#dp[i][j]=i番目の品物までだけを選び重量制限をjとしたときの価値の最大値
dp = []

for i in range(N):
	if i==0:
		#重量制限がW[0]以上なら荷物を積むのが最善
		dp.append([ V[0] if W[0]<=w else 0 for w in range(Wmax+1) ])	
	else:
		#今回の重量制限をwとする
		#今回は荷物を積む場合: dp[i][w] = dp[i-1][w-w[i]]+v[i] 
		#今回は荷物を積まない場合: dp[i][w] = dp[i-1][w]
		#よってこの2つのうち大きいほうをdp[i][w]に採用する
		for w in range(Wmax+1):
			val1 = dp[i-1][w-w[i]]+v[i] 
			val2 = dp[i][w] = dp[i-1][w]
			dp.append(max(val1,val2))
print(dp[N-1][Wmax])

Buggy submission (verdict: Runtime Error):
N,Wmax=map(int,input().split(' '))
info=[ list(map(int,input().split(' '))) for i in range(N) ]
W = info[:][0]
V = info[:][1]

#dp[i][j]=i番目の品物までだけを選び重量制限をjとしたときの価値の最大値
dp = []

for i in range(N):
	if i==0:
		#重量制限がW[0]以上なら荷物を積むのが最善
		dp.append([ V[0] if W[0]<=w else 0 for w in range(Wmax+1) ])	
	else:
		#今回の重量制限をwとする
		#今回は荷物を積む場合: dp[i][w] = dp[i-1][j-w[i]]+v[i] 
		#今回は荷物を積まない場合: dp[i][w] = dp[i-1][w]
		#よってこの2つのうち大きいほうをdp[i][w]に採用する
		for w in range(Wmax+1):
			val1 = dp[i-1][j-w[i]]+v[i] 
			val2 = dp[i][w] = dp[i-1][w]
			dp.append(max(val1,val2))
print(dp[N-1][Wmax])
Problem p03231 (python)

Fixed submission:
def gcd(a,b):
	x,y = min(a,b), max(a,b)
	while x*y>0:
		x,y = min(x,y), max(x,y)
		x,y = y-x,x
	return y

N,M=map(int,input().split())
S=input()
T=input()
g=gcd(N,M)
p,q=M//g,N//g
print((N//g)*M) if S[0::q]==T[0::p] else print('-1')

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
	x,y = min(a,b), max(a,b)
	while x*y>0:
		x,y = y-x,x
	return y

N,M=map(int,input().split())
S=input()
T=input()
g=gcd(N,M)
p,q=M//g,N//g
print((N//g)*M) if S[0::q]==T[0::p] else print('-1')

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
	x,y = min(a,b), max(a,b)
	while x*y>0:
		x,y = y-x,x
	return y

N,M=map(int,input().split())
S=input()
T=input()
g=gcd(N,M)
p,q=M//g,N//g
print(N*M//g) if S[0::q]==T[0::p] else print('-1')

Buggy submission (verdict: Runtime Error):
def lcm(a,b):
	x,y = min(a,b), max(a,b)
	while x*y>0:
		x,y = y-x,x
	return int(a*b/y)

N,M=map(int,input().split())
S=input()
T=input()
l=lcm(N,M)
p,q=l//N,l//M
print(l) if S[0::q]==T[0::p] else print('-1')
Problem p03239 (python)

Fixed submission:
N,T=map(int,input().split(' '))
costs = []
for i in range(N):
  c,t = map(int,input().split(' '))
  if t<=T:
    costs.append(c)
if costs == []:
  print('TLE')
else:
  print(min(costs))

Buggy submission (verdict: Runtime Error):
N,T=map(int,input().split(' '))
costs = []
for i in range(N):
  c,t = map(int,input().split(' '))
  if t<=T:
    costs.append(c)
print(min(costs))
Problem p03282 (python)

Fixed submission:
S=input()
K=int(input())
notoneposition=[S.find(str(i)) for i in range(2,10) if S.find(str(i))!=-1]
if notoneposition==[]:
	print(1)
else:
	notonehead=min(notoneposition)
	notone=S[notonehead]
	print(1) if K-1<notonehead else print(str(notone))

Buggy submission (verdict: Runtime Error):
S=input()
K=int(input())
notonehead=min([S.find(str(i)) for i in range(2,10) if S.find(str(i))!=-1])
notone=S[notonehead]
print(1) if K-1<notonehead else print(str(notone))

Buggy submission (verdict: Runtime Error):
S=input()
K=int(input())
notonehead=min([S.find(str(i)) for i in range(2,10) if S.find(str(i))!=-1])
notone=S[notonehead]
print(1) if K-1<notonehead else print(str(notone))
Problem p03302 (python)

Fixed submission:
a,b=map(int,input().split(' '))
print('+') if a+b==15 else print('*') if a*b==15 else print('x')

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split(' '))
print('+') if a+b==15 else print('*') else a*b==15 else print('x')
Problem p03319 (python)

Fixed submission:
N,K=map(int,input().split(' '))
A=list(map(int,input().split(' ')))
count=0
sum=0
while sum<N:
	if count==0:
		sum+=K
	else:
		sum+=(K-1)
	count+=1
print(count)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split(' '))
A=list(map(int,input.split(' ')))
count=0
sum=0
while sum<N:
	if count==0:
		sum+=K
	else:
		sum+=(K-1)
	count+=1
print(count)
Problem p03359 (python)

Fixed submission:
a,b=map(int,input().split(' '))
print(a) if b>=a else print(a-1)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input())
print(a) if b>=a else print(a-1)
Problem p03455 (python)

Fixed submission:
a,b=map(int,input().split(' '))
print(['Even','Odd'][a*b%2])

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split(' '))
print(['Even','Odd'][A*B%2])
Problem p03478 (python)

Fixed submission:
N,A,B=map(int,input().split(' '))
ans=0
for i in range(N):
  if A<=sum([int(s) for s in list(str(i+1))])<=B:
    ans+=(i+1)
print(ans)

Buggy submission (verdict: Runtime Error):
100 4 16
Problem p03547 (python)

Fixed submission:
i,j=['ABCDEF'.find(x) for x in input().split(' ')]
print('<') if i<j else print('>') if i>j else print('=')

Buggy submission (verdict: Runtime Error):
i,j=['ABCDEF',find(X) for x in input().split(' ')]
print('<') if i<j else print('>') if i>j else print('=')
Problem p03573 (python)

Fixed submission:
n = list(map(int,input().split(' ')))
print(str(max([i if n.count(i)==1 else -10000 for i in list(dict.fromkeys(n))])))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split(' '))
R=[list(map(int,input().split(' '))) for i in range(M)]
Mat=[[0]*N]*N
for r in R:
	Mat[r[0]-1][r[1]-1]=1
	Mat[r[1]-1][r[0]-1]=1

stack=[1]
island=[]

ans=0
Matmini=[]

def dfs():
	global stack
	global island
	global Matmini
	if stack==[]:
		return None
	if len(set(island))==N:
		#全頂点が網羅できていたらそこで終了
		return None
	else:
		#たどれるノードがあるかどうかを確認
		for i in range(1,N+1):
			#iが未訪問のときのみ処理続行
			if i not in stack:
				#実際に辺が存在するか
				if Matmini[stack[0]-1][i-1]==1:
					stack = [i] + stack
					dfs()
		#これ以上先に進めなくなったら島の構成要素を更新
		island += stack
		stack.pop(0)

for r in R:
	#Rからi番目の辺だけ除去したもの
	Matmini = Mat
	Matmini[r[0]-1][r[1]-1]=0
	Matmini[r[1]-1][r[0]-1]=0
	stack = [1]
	island = []
	dfs()
	if len(set(island))!=N:
		ans += 1
		
print(ans)

Buggy submission (verdict: Runtime Error):
n = list(map(int,input().split(' ')))
ans = i if n.count(i)==1 for i in list(dict.fromkeys(n))
print(str(ans))

Buggy submission (verdict: Runtime Error):
n = list(map(int,input().split(' ')))
ans = i if i.count(dict.fromkeys(n))==1 for i in n
print(str(ans))
Problem p03623 (python)

Fixed submission:
x,a,b=map(int,input().split(' '))
print('A') if abs(x-a)<abs(x-b) else print('B')

Buggy submission (verdict: Runtime Error):
x,a,b=map(int,input(' '))
print('A') if abs(x-a)<abs(x-b) else print('B')
Problem p03633 (python)

Fixed submission:
import fractions
def lcm(a,b):
  return a*b//fractions.gcd(a,b)
N=int(input())
T=[int(input()) for i in range(N)]
ans=1
for i in range(N):
  ans=lcm(ans,T[i])
print(ans)

Buggy submission (verdict: Runtime Error):
import fractions
def lcm(a,b):
  return int(a*b/fractions.gcd(a,b))
N=int(input())
T=[int(input()) for i in range(N)]
ans=1
for i in range(N):
  ans=lcm(ans,T[i])
print(ans)
Problem p03635 (python)

Fixed submission:
n,m=map(int,input().split(' '))
print(str((n-1)*(m-1)))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split(' '))
print(sum((n-1)*(m-1)))
Problem p03711 (python)

Fixed submission:
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
ans=''
x,y=map(int,input().split(' '))
if x==y: ans='Yes'
else:
    for c in [a,b]:
        if (x in c)*(y in c):
            ans='Yes'
            break
if ans=='': ans='No'
print(ans)

Buggy submission (verdict: Runtime Error):
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
ans=''
x,y=map(int,input().split(' '))
if x==y: ans='Yes'
else:
    for c in [a,b]:
        ans='Yes' if x in c and y in c
if ans=='': ans='No'
print(ans)

Buggy submission (verdict: Runtime Error):
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
ans=''
x,y=map(int,input().split(' '))
ans='Yes' if x==y
for c in (a,b):
    ans='Yes' if x in c and y in c
if ans=='': ans='No'
print(ans)

Buggy submission (verdict: Runtime Error):
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
ans=''
x,y=map(int,input().split(' '))
ans='Yes' if x==y
for c in (a,b):
    ans='Yes' if x in c and y in c
ans='No' if ans==''
print(ans)
Problem p03733 (python)

Fixed submission:
N,T=map(int,input().split(' '))
times=list(map(int,input().split(' ')))
print(sum([min(T, times[i+1]-times[i]) for i in range(N-1)])+T)

Buggy submission (verdict: Runtime Error):
N,T=map(int,input().split(' '))
times=[int(input()) for i in range(N)]
print(sum([min(T, times[i+1]-times[i] for i in range(N-1))])+times[-1])