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

Fixed submission:
line = raw_input()
N, X = [int(s) for s in line.split(' ')]
line = raw_input()
xs = [int(s) for s in line.split(' ')]
xs.append(X)
#xs = [x - X for x in xs]
xs.sort()
X = 0
if len(xs) == 1:
    print abs(xs[0])
else:
    sub = [abs(a - b) for a, b in zip(xs[1:], xs)]
    sub.sort()
    ret = sub[0]
    for s in sub[1:]:
        mod = 1
        ss = ret
        while mod > 0:
            mod = s % ss
            s = ss
            ss = mod
        ret = s
    print ret

Buggy submission (verdict: Runtime Error):
line = raw_input()
N, X = [int(s) for s in line.split(' ')]
line = raw_input()
xs = [int(s) for s in line.split(' ')]

xs = [x - X for x in xs]
X = 0
if len(xs) == 1:
    print abs(xs[0])
else:
    sub = [a - b for a, b in zip(xs[1:], xs)]
    abs_sub = [abs(s) for s in sub]
    max_s = max(abs_sub)
    min_s = min(abs_sub)
    ret = 1
    for i in range(2, min_s + 1):
        if max_s % i == 0 and min_s % i == 0: 
            ret = i
    print ret
Problem p03274 (python)

Fixed submission:
line = raw_input()
N, K = [int(s) for s in line.split(' ')]
line = raw_input()
Xs = [int(s) for s in line.split(' ')]

ret = []
for i in range(0, len(Xs) - K + 1):
    p = Xs[i + K - 1]
    m = Xs[i]
    if p * m == 0:
        ret.append(abs(p) * abs(m))
        continue
    if p * m > 0:
        ret.append(max(abs(p), abs(m)))
        continue
    ret.append(abs(p) * 2 + abs(m))
    ret.append(abs(p) + abs(m) * 2)

print min(ret)

Buggy submission (verdict: Runtime Error):
line = raw_input()
N, K = [int(s) for s in line.split(' ')]
line = raw_input()
Xs = [int(s) for s in line.split(' ')]
pXs = [x for x in Xs if x > 0]
mXs = [x * -1 for x in Xs if x < 0 ]
mXs.reverse()
count = 0
time = 0
ret = []
if 0 in Xs:
    time = 0
    count = 1
    if K == 1:
        ret.append(0)
if len(pXs) > K - count:
    ret.append(pXs[K-count - 1])
if len(mXs) > K - count:
    ret.append(mXs[K-count - 1])
for n in range(0, len(pXs)):
    m = (K - count) - (n + 1) - 1
    print n, m
    if m >= len(mXs) or m < 0:
        continue
    ret.append(pXs[n] * 2 + mXs[m])
    ret.append(pXs[n] + mXs[m] * 2)
# print pXs
# print mXs
# print ret
print min(ret)
Problem p03493 (python)

Fixed submission:
def count(lst, x):
   ctr = 0
   for i in lst:
      if i == x:
         ctr += 1
   return ctr

s = [x for x in input()]
print(count(s, "1"))

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

def countTwoInFactor(n):
   def countTwoInFactori(n, acc):
      return countTwoInFactori(n / 2, acc + 1) if n % 2 == 0 else acc
   return countTwoInFactori(n, 0)

arr2 = [countTwoInFactor(x) for x in arr]
arr2.sort()
print(arr2[0])

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
arr = [int(x) for x in input().split()]

isAllEven = len([x for x in arr if x % 2 == 0]) == n

if not isAllEven:
   print(0)
   exit()

arr.sort()
print(math.log2(arr[0]))

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
arr = [int(x) for x in input().split()]

count = 0
max_even = 0
for x in arr:
   if x % == 2 and x > max_even:
      max_even = x 

print(math.log2(max_even))
Problem p03494 (python)

Fixed submission:
n = int(input())
arr = [int(x) for x in input().split()]

def countTwoInFactor(n):
   def countTwoInFactori(n, acc):
      return countTwoInFactori(n / 2, acc + 1) if n % 2 == 0 else acc
   return countTwoInFactori(n, 0)

arr2 = [countTwoInFactor(x) for x in arr]
arr2.sort()
print(arr2[0])

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
arr = [int(x) for x in input().split()]

count = 0
max_even = 0
for x in arr:
   if x % == 2 and x > max_even:
      max_even = x 

print(math.log2(max_even))
Problem p03105 (python)

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

if( (b / a) >= c):
  print(c)
else:
  print(str(int(b/a)))

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

l = []

greatest = a

if(b > a):
  greatest = b
  
for i in range(1, greatest):
  if(a % i == 0 and b % i == 0):
    l.append(i)

if(len(l) == 0):
  if(a == b):
    l.append(1)
    
print(str(l[len(l) - int(k)]))
Problem p03109 (python)

Fixed submission:
import re

date_s = input()

date_l = int(date_s.replace("/", ""))

if(date_l <= 20190430):
  print("Heisei")
else:
  print("TBD")

Buggy submission (verdict: Runtime Error):
import re

date_s = input()

date_l = date_s.replace("/", "")

if(date_l <= 20190430):
  print "Heisei"
else:
  print "TBD"

Buggy submission (verdict: Runtime Error):
import re

date_s = input()

date_l = re.replace("/", "")

if(date_l <= 20190430):
  print "Heisei"
else:
  print "TBD"
Problem p02983 (python)

Fixed submission:
l,r=map(int,input().split())
a=[]

if r-l > 3000:
    print(0)
else:
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            a.append((i*j)%2019)
    print(min(a))

Buggy submission (verdict: Runtime Error):
l,r=map(int,input().split())
a=[]

if r-l > 3000:
    print(0)
else:
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            a.append((i*j)%2019)

print(min(a))

Buggy submission (verdict: Runtime Error):
l,r=map(int,input().split())
a=[]

if r-l > 2019:
    print(0)
else:
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            a.append((i*j)%2019)

print(min(a))
Problem p03636 (python)

Fixed submission:
a,*b,c=input()
print(a+str(len(b))+c)

Buggy submission (verdict: Runtime Error):
a,*b,c=input()
print(a+len(b)+c)
Problem p03760 (python)

Fixed submission:
o=list(input())
e=list(input())+[""]
for x,y in zip(o,e):print(x+y,end="")

Buggy submission (verdict: Runtime Error):
o=list(input())
e=list(input())+[""]
for x,y in zip(x,y):print(x,y,end="")

Buggy submission (verdict: Runtime Error):
o=list(input())
e=list(input())
for x,y in zip(x,y):print(x,y,end="")
Problem p03126 (python)

Fixed submission:
import sys
 
lines = sys.stdin.read().rstrip().split("\n")
n, m = [int(x) for x in lines[0].split(" ")]
 
result = set(lines[1].split(" ")[1:])
 
if len(lines) == 2:
  print(len(result))
else:
  for x in lines[2:]:
    result = result & set(x.split(" ")[1:])
  print(len(result))

Buggy submission (verdict: Runtime Error):
import sys

lines = sys.stdin.read().rstrip().split("\n")
n, m = [int(x) for x in lines[0].split(" ")]

result = set(lines[1].split(" ")[1:])

if len(lines) == 2:
  print(len(result))
else:
  for x in range lines[2:]:
    result = result & set(x.split(" ")[1:])
  print(len(result))
Problem p04029 (python)

Fixed submission:
# coding: utf-8

n = int(input())
print(n * (n + 1) // 2)

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

n = int(input())
return n * (n + 1) // 2
Problem p04011 (python)

Fixed submission:
N,K,X,Y= [int(input()) for i in range (4)]
if N > K:
    yen1 = K * X
    yen2 = (N - K) * Y
    print(yen1 + yen2)
else:
    print(N * X)

Buggy submission (verdict: Runtime Error):
N,K,X,Y= map(int, input().split())
yen1 = K * X
yen2 = (N - K) * Y
print(yen1 + yen2)
Problem p04043 (python)

Fixed submission:
x = list(map(int, input().split()))
x.sort()
print('YES' if x == [5,5,7] else 'NO')

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = set(input().split())
while True:
    L = list(str(N))
    for i in L:
        if i in S:
            break
    else:
        break
    N += 1
print(N)
Problem p02778 (python)

Fixed submission:
S = input()

tmp = ""

for i in range(len(S)):
  tmp += "x"

print(tmp)

Buggy submission (verdict: Runtime Error):
S = input()
out = ""

for i in range(S.len()):
  out += "x"

print(out)
Problem p03059 (python)

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

N = 1
for i in range(100):
    if N * A > T + 0.5:
        N -= 1
        break

    N += 1

ret = N * B
print(ret)

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

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

"""
任意の2組みの数字の符号を変えることができる
したがって負の数が偶数個の場合全てを正にして総和をとれば良い
負の数が奇数個の場合絶対値の最小のもののみ負にして総和をとればよい
0が存在する場合はすべて正にできる
"""

A_abs = np.abs(A)

if 0 in A:
    print(np.sum(A_abs))

else:
    num = 0
    for i in range(N):
        if A[i] < 0:
            num += 1

    if num % 2 == 0:
        print(np.sum(A_abs))
    else:
        print(np.sum(A_abs) - 2 * min(A_abs))
Problem p03062 (python)

Fixed submission:
import numpy as np

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

"""
任意の2組みの数字の符号を変えることができる
したがって負の数が偶数個の場合全てを正にして総和をとれば良い
負の数が奇数個の場合絶対値の最小のもののみ負にして総和をとればよい
0が存在する場合はすべて正にできる
"""

A_abs = np.abs(A)

if 0 in A:
    print(np.sum(A_abs))

else:
    num = 0
    for i in range(N):
        if A[i] < 0:
            num += 1

    if num % 2 == 0:
        print(np.sum(A_abs))
    else:
        print(np.sum(A_abs) - 2 * min(A_abs))

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

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

"""
任意の2組みの数字の符号を変えることができる
したがって負の数が偶数個の場合全てを正にして総和をとれば良い
負の数が奇数個の場合絶対値の最小のもののみ負にして総和をとればよい
0が存在する場合はすべて正にできる
"""

A_abs = np.abs(A)

if 0 in A:
    print(np.sum(A_abs))

else:
    num = 0
    for i in range(N):
        if A[i] < 0:
            num += 1

    if num % 2 == 0:
        print(np.sum(A_abs))
    else:
        print(np.sum(A_abs) - 2 * min(A_abs))
Problem p03109 (python)

Fixed submission:
S = input()
S_split = S.split("/")
(year, month, day) = (int(S_split[i]) for i in range(3))

if month > 4:
    print("TBD")

else:
    print("Heisei")

Buggy submission (verdict: Runtime Error):
# N A B C
# l1
# l2
# ...

(N, A, B, C) = (int(input().split()[i]) for i in range(4))
L = []
for i in range(N):
    l = int(input())
    L.append(l)
# N = 5
# A = 100
# B = 90
# C = 80
# L = [98, 40, 30, 21, 80]

def recur_function(a, b, c, n):
    if n == N:
        return abs(a - A) + abs(b - B) + abs(c - C) if min(a, b, c) > 0 else 10**9
    ret0 = recur_function(a + L[n], b, c, n + 1) + 10 if a > 0 else recur_function(a + L[n], b, c, n + 1)
    ret1 = recur_function(a, b + L[n], c, n + 1) + 10 if b > 0 else recur_function(a, b + L[n], c, n + 1)
    ret2 = recur_function(a, b, c + L[n], n + 1) + 10 if c > 0 else recur_function(a, b, c + L[n], n + 1)
    ret3 = recur_function(a, b, c, n + 1)
    return min(ret0, ret1, ret2, ret3)

print(recur_function(0, 0, 0, 0))

Buggy submission (verdict: Runtime Error):
N = int(input())
X = []
U = []
for i in range(N):
    I = input().split()
    (x, u) = (int(I[0]), I[1])
    X.append(x)
    U.append(u)

otoshidama = 0.0

for i in range(N):
    if U[i] == "JPY":
        otoshidama += X[i]
    elif U[i] == "BTC":
        otoshidama += X[i] * 380000.0

print(otoshidama)

Buggy submission (verdict: Runtime Error):
N = int(input())
X = []
U = []
for i in range(N):
    I = input().split()
    (x, u) = (int(I[0]), I[1])
    X[i] = x
    U[i] = u

otoshidama = 0.0

for i in range(N):
    if U[i] == "JPY":
        otoshidama += X[i]
    elif U[i] == "BTC":
        otoshidama += X[i] * 380000.0

print(otoshidama)

Buggy submission (verdict: Runtime Error):
N = int(input())
X = []
U = []
for i in range(N):
    (x, u) = int(input().split())
    X[i] = x
    U[i] = u

otoshidama = 0.0

for i in range(N):
    if U[i] == "JPY":
        otoshidama += X[i]
    elif U[i] == "BTC":
        otoshidama += X[i] * 380000.0

print(otoshidama)
Problem p03110 (python)

Fixed submission:
N = int(input())
X = []
U = []
for i in range(N):
    I = input().split()
    (x, u) = (float(I[0]), I[1])
    X.append(x)
    U.append(u)

otoshidama = 0.0

for i in range(N):
    if U[i] == "JPY":
        otoshidama += X[i]
    elif U[i] == "BTC":
        otoshidama += X[i] * 380000.0

print(otoshidama)

Buggy submission (verdict: Runtime Error):
N = input()
X = []
U = []
for i in range(N):
    (x, u) = int(input().split())
    X[i] = x
    U[i] = u

otoshidama = 0.0

for i in range(N):
    if U[i] == "JPY":
        otoshidama += X[i]
    elif U[i] == "BTC":
        otoshidama += X[i] * 380000.0

print(otoshidama)
Problem p03111 (python)

Fixed submission:
# N A B C
# l1
# l2
# ...

tmp = input().split()
(N, A, B, C) = (int(tmp[i]) for i in range(4))
L = []
for i in range(N):
    l = int(input())
    L.append(l)
# N = 5
# A = 100
# B = 90
# C = 80
# L = [98, 40, 30, 21, 80]

def recur_function(a, b, c, n):
    if n == N:
        return abs(a - A) + abs(b - B) + abs(c - C) if min(a, b, c) > 0 else 10**9
    ret0 = recur_function(a + L[n], b, c, n + 1) + 10 if a > 0 else recur_function(a + L[n], b, c, n + 1)
    ret1 = recur_function(a, b + L[n], c, n + 1) + 10 if b > 0 else recur_function(a, b + L[n], c, n + 1)
    ret2 = recur_function(a, b, c + L[n], n + 1) + 10 if c > 0 else recur_function(a, b, c + L[n], n + 1)
    ret3 = recur_function(a, b, c, n + 1)
    return min(ret0, ret1, ret2, ret3)

print(recur_function(0, 0, 0, 0))

Buggy submission (verdict: Runtime Error):
# N A B C
# l1
# l2
# ...

(N, A, B, C) = int(input().split())
L = []
for i in range(N):
    l = int(input())
    L.append(l)
# N = 5
# A = 100
# B = 90
# C = 80
# L = [98, 40, 30, 21, 80]

def recur_function(a, b, c, n):
    if n == N:
        return abs(a - A) + abs(b - B) + abs(c - C) if min(a, b, c) > 0 else 10**9
    ret0 = recur_function(a + L[n], b, c, n + 1) + 10 if a > 0 else recur_function(a + L[n], b, c, n + 1)
    ret1 = recur_function(a, b + L[n], c, n + 1) + 10 if b > 0 else recur_function(a, b + L[n], c, n + 1)
    ret2 = recur_function(a, b, c + L[n], n + 1) + 10 if c > 0 else recur_function(a, b, c + L[n], n + 1)
    ret3 = recur_function(a, b, c, n + 1)
    return min(ret0, ret1, ret2, ret3)

print(recur_function(0, 0, 0, 0))
Problem p02910 (python)

Fixed submission:
input_tap = input()
flag = 'No'
input_tap1 = input_tap[0::2]
input_tap2 = input_tap[1::2]

if 'L' in input_tap1:
    flag = 'No'
elif 'R' in input_tap2:
    flag = 'No'
else:
    flag = 'Yes'
print(flag)

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

for i in range(0,len(input_tap),2):
    if input_tap[i] == 'R' or input_tap[i] == 'U' or input_tap[i] == 'D':
        flag = 'Yes'
    elif input_tap[i+1] == 'R' or input_tap[i+1] == 'U' or input_tap[i+1] == 'D':
        flag = 'Yes'
    else:
        flag = 'No'
print(flag)
Problem p02801 (python)

Fixed submission:
n = input()
if n == "a":
    print("b")
if n == "b":
    print("c")
if n == "c":
    print("d")
if n == "d":
    print("e")
if n == "e":
    print("f")
if n == "f":
    print("g")
if n == "g":
    print("h")
if n =="h":
    print("i")
if n == "i":
    print("j")
if n == "j":
    print("k")
if n == "k":
    print("l")
if n == "l":
    print("m")
if n == "m":
    print("n")
if n == "n":
    print("o")
if n == "o":
    print("p")
if n == "p":
    print("q")
if n == "q":
    print("r")
if n == "r":
    print("s")
if n == "s":
    print("t")
if n == "t":
    print("u")
if n == "u":
    print("v")
if n == "v":
    print("w")
if n == "w":
    print("x")
if n == "x":
    print("y")
if n == "y":
    print("z")
if n == "z":
    print("a")

Buggy submission (verdict: Runtime Error):
n = input()
if n == "a":
    print("b")
if n == "b":
    print("c")
if n == "c":
    print("d")
if n == "d":
    print("e")
if n == "e:"
    print("f")
if n == "f":
    print("g")
if n == "g":
    print("h")
if n =="h":
    print("i")
if n == "i":
    print("j")
if n == "j":
    print("k")
if n == "k":
    print("l")
if n == "l":
    print("m")
if n == "m":
    print("n")
if n == "n":
    print("o")
if n == "o":
    print("p")
if n == "p":
    print("q")
if n == "q":
    print("r")
if n == "r":
    print("s")
if n == "s":
    print("t")
if n == "t":
    print("u")
if n == "u":
    print("v")
if n == "v":
    print("w")
if n == "w":
    print("x")
if n == "x":
    print("y")
if n == "y":
    print("z")
if n == "z":
    print("a")
Problem p02802 (python)

Fixed submission:
n = input()
m = n.split()
P = [int(i) for i in m]
if P[1] == 0:
    for i in range(P[1]): #因数注意！
        n = input()    
    print("0 0")
else:
    
    AC = [0] * P[0]
    WA = [0] * P[0]

    for i in range(P[1]): #因数注意！
        n = input()    
        m = n.split()
        p = [i for i in m] #1列の数列をリスト化
        if p[1] == "AC":
            AC[int(p[0])-1] = 1
        else:
            if AC[int(p[0])-1] == 0:
                WA[int(p[0])-1] = WA[int(p[0])-1] +1
            else:
                pass
    A1 = 0
    A2 = 0
    for i in range(P[0]):
        if AC[i] == 1:
            A1 = A1+1
            A2 = A2 + WA[i]
    print(str(A1)+" "+str(A2))

Buggy submission (verdict: Runtime Error):
n = input()
m = n.split()
P = [int(i) for i in m]
if P[1] == 0:
    for i in range(P[1]): #因数注意！
        n = input()    
    print("0 0")
else:
    
    AC = [0] * P[0]
    WA = [0] * P[0]

    for i in range(P[1]): #因数注意！
        n = input()    
        m = n.split()
        p = [i for i in m] #1列の数列をリスト化
        if p[1] == "AC":
            AC[int(p[0])-1] = 1
        else:
            if AC[int(p[0])-1] == 0:
                WA[int(p[0])-1] = WA[int(p[0])-1] +1
            else:
                pass
A1 = 0
A2 = 0
for i in range(P[0]):
    if AC[i] == 1:
        A1 = A1+1
        A2 = A2 + WA[i]
print(str(A1)+" "+str(A2))
Problem p02817 (python)

Fixed submission:
n = input()    
m = n.split()
p = [i for i in m]
a = p[1]+p[0]
print(a)

Buggy submission (verdict: Runtime Error):
n = input()
m = input()
a = m+n
print(a)
Problem p03471 (python)

Fixed submission:
n,y= map(int,input().split())

ans=(-1,-1,-1)
m=range(n+1)
for a in m:
	for b in m:
		c=n-a-b
		total = 10000*a + 5000*b + 1000*c
		if (c>=0) & (total==y):
			ans=(a,b,c)
			break
		else:
			continue
		break

print("%d %d %d"%ans)

Buggy submission (verdict: Runtime Error):
import numpy
n,y= map(int,input().split())

c=list(range(n+1))
lenC=len(c)
v1=numpy.repeat(c, lenC*lenC)
v2=numpy.repeat(lenC*c, lenC)
v3=numpy.repeat(lenC*lenC*c,1)
v = numpy.array([v1,v2,v3]).reshape(3,len(v1))

comb=v[:,sum(v)==n]
m=numpy.matrix([10000, 5000, 1000])
s = m*comb

if y in s:
	ans=comb[:,numpy.array(s).flatten()==y][:,0]
	print("%d %d %d"%(ans[0],ans[1],ans[2]))
else:
	print("%d %d %d"%(-1,-1,-1))

Buggy submission (verdict: Runtime Error):
import numpy
n,y= map(int,input().split())

c=list(range(n+1))
lenC=len(c)
v1=numpy.repeat(c, lenC*lenC)
v2=numpy.repeat(lenC*c, lenC)
v3=numpy.repeat(lenC*lenC*c,1)
v = numpy.array([v1,v2,v3]).reshape(3,len(v1))

comb=v[:,sum(v)==n]
m=numpy.matrix([10000, 5000, 1000])
s = m*comb

if y in s:
	ans=comb[:,numpy.array(s).flatten()==y][:,0]
	print("%d %d %d"%(ans[0],ans[1],ans[2]))
else:
	print("%d %d %d"%(-1,-1,-1))
Problem p03493 (python)

Fixed submission:
s=list(input())

s1=int(s[0])
s2=int(s[1])
s3=int(s[2])
print(s1+s2+s3)

Buggy submission (verdict: Runtime Error):
N=int(input())
li= list(map(int,input().split())) 	
Ans=27
ans=0

for i in range(N):
	if li[i]%2==1:
		Ans=0
		break
	else:
		n=li[i]
		ans=0
		while n%2==0:
			n=n/2
			ans= ans+1
		if Ans>ans:
			Ans =ans

print(Ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
li= list(map(int,input().split())) 	
ans=1
minNum=10**9

for i in range(N):
	if li[i]%2==1:
		ans=0
		break
	elif li[i] < minNum:
		minNum = li[i]
		
if not ans==0:
	n=minNum
	ans=0	
	while n%2==0:
		n=n/2
		ans= ans+1

print(ans)
Problem p03030 (python)

Fixed submission:
N = int(input())
SP = [list(input().split()) for i in range(N)]

for row in SP:
    row[1] = int(row[1])

hoge = sorted(SP, key = lambda x:x[1], reverse = True)
SPsort = sorted(hoge, key = lambda x:x[0])

for i in range(N):
    print(SP.index(SPsort[i]) + 1)

Buggy submission (verdict: Runtime Error):
N = int(input())
SP = [list(input().split()) for i in range(N)]

hoge = sorted(SP, key = lambda x:x[1], reverse = True)
SPsort = sorted(hoge, key = lambda x:x[0]

for i in range(N):
    print(SP.index(SPsort[i]) + 1)

Buggy submission (verdict: Runtime Error):
N = int(input())
SP = [list(input().split()) for i in range(N)]

SPsort = sorted(SP, key = lambda x:x[0])

for i in range(N):
    print(SP.index(SPsort[i])) + 1
Problem p02945 (python)

Fixed submission:
num = input().split(" ")
a = int(num[0])
b = int(num[1])
print(max(a+b, a-b, a*b))

Buggy submission (verdict: Runtime Error):
num = input().split(" ")
a = int(num[0])
b = int(num[1])
return max(a+b, a-b, a*b)
Problem p04012 (python)

Fixed submission:
w= input()
w_set =set(w)

for i in w_set:
    if w.count(i)%2==1:
        print("No")
        exit()
print("Yes")

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

s=input()
s=Couter(s)

for i in s.values():
    if i%2!=0:
        print("No")
        break
else:
    print("Yes")
Problem p02898 (python)

Fixed submission:
N, K = map(int, input().split())
h_list = [int(i) for i in input().split()]

count = 0
for i in h_list:
    if i >= K:
        count += 1
    else:
        pass

print(count)

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

ans_list = []
for i in range(1, N + 1):
    ans_list.append(A_list.index(i) + 1)
    
print(' '.join([str(n) for n in ans_list]))
Problem p02910 (python)

Fixed submission:
S = input()

length = len(S)
evenN = []
oddN = []
for i in range(length):
    if (i + 1) % 2 == 0:
        if S[i] == 'R':
            evenN.append(False)
        else:
            evenN.append(True)
    if (i + 1) % 2 == 1:
        if S[i] == 'L':
            oddN.append(False)
        else:
            oddN.append(True)


if all(oddN) is True and all(evenN) is True:
    print('Yes')
else:
    print('No')

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

length = len(S)
for i in range(length):
    if (i + 1) % 2 == 0:
        global evenN
        if S[i] == 'R':
            evenN = False
        else:
            evenN = True
    if (i + 1) % 2 == 1:
        global oddN
        if S[i] == 'L':
            oddN = False
        else:
            oddN = True


if oddN is True and evenN is True:
    print('Yes')
else:
    print('No')

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

l = len(S)
for i in range(l):
    if (i + 1) % 2 == 0:
        if S[i] == 'R':
            even = False
        else:
            even = True
    if (i + 1) % 2 == 1:
        if S[i] == 'L':
            odd = False
        else:
            odd = True


if odd == True and even == True:
    print('Yes')
else:
    print('No')
Problem p02923 (python)

Fixed submission:
N = int(input())
h_list = list(map(int, input().split()))

count_list = []
if len(h_list) == 1:
    count_list.append(0)
else:
    count = 0
    for i in range(N-1):
        if h_list[i] >= h_list[i+1]:
            count += 1
            count_list.append(count)
        else:
            count = 0
            count_list.append(0)
    
print(max(count_list))

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

count_list = []
count = 0
for i in range(N-1):
    if h_list[i] >= h_list[i+1]:
        count += 1
        count_list.append(count)
    else:
        count = 0
        count_list.append(0)
    
print(max(count_list))
Problem p02995 (python)

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

def multiple(X, Y, Z):
    # 天井関数math.ceilが誤差でおかしくなってるから組み込み関数を使う
    if X % Z != 0:
        min_z = X // Z + 1
    else:
        min_z = X / Z
    max_z = Y // Z
    num_z = max_z - min_z + 1
    return int(num_z)

def gcd(X, Y):
    while Y!= 0:
        X, Y = Y, X % Y
    return X

if C == 1 or D == 1:
    print(0)
else:
    num_c = multiple(A, B, C)
    num_d = multiple(A, B, D)
    lcm = int((C * D) / gcd(C, D)) 
    num_lcm = multiple(A, B, lcm)
    print(B - A + 1 - num_c - num_d + num_lcm)

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

def multiple(X, Y, Z):
    min_z = math.ceil(X / Z)
    max_z = math.floor(Y / Z) 
    z_num = max_z - min_z + 1
    return z_num

num_c = multiple(A, B, C)
num_d = multiple(A, B, D)

lem = int((C * D) / math.gcd(C, D)) 
num_lem = multiple(A, B, lem)

print(B - A + 1 - num_c - num_d + num_lem)