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

Fixed submission:
class UnionFind:
    #par[x]でxの親のID，xが根ならその木のサイズに―をつけたもの
    def __init__(self, n):
        #全て根として初期化
        self.par = [-1] * n
    
    #xの根を返す
    def root(self, x):
        #xが根なら終了
        if self.par[x] < 0:
            return x
        #そうでないならxの親について調べる
        self.par[x] = self.root(self.par[x])    #xの根が親になるように更新
        return self.par[x]

    #xとyを結合
    def union(self, x, y):
        x = self.root(x)
        y = self.root(y)
        #xとyが同じ根を持つ(＝同じ木に属する)なら終了
        if x == y:
            return
        #サイズの大きい木に小さい木を結合
        if self.par[x] > self.par[y]:   #xが大きくなるよう交換
            x, y = y, x
        self.par[x] += self.par[y]
        self.par[y] = x
    
    #xのサイズを返す
    def size(self, x):
        return -1 * self.par[self.root(x)]


#main
n, m = map(int, input().split())
uf = UnionFind(n)
#Union-FInd木を作る
for _ in range(m):
    a, b = map(int, input().split())
    uf.union(a-1, b-1)      #1からではなく0からに
#サイズが最大のものを探す
ans = 0
for i in range(n):
    ans = max(ans, uf.size(i))
print(ans)

Buggy submission (verdict: Runtime Error):
n, m =map(int,input().split())
l = [{int(x) for x in input().split()}]
ans = 0
for _ in range(m-1):
    a = {int(x) for x in input().split()}
    for j, s in enumerate(l):
        if s & a:
            l[j] |= a
            ans = max(ans, len(l[j]))
            if ans >= n:
                print(ans)
                exit()
            break
    else:
        l.append(a)
print(ans)

Buggy submission (verdict: Runtime Error):
n, m =map(int,input().split())
l = [{int(x) for x in input().split()}]
ans = 0
for _ in range(m-1):
    a = {int(x) for x in input().split()}
    for j, s in enumerate(l):
        if s & a:
            l[j] |= a
            break
    else:
        l.append(a)
for s in l:
    ans = max(ans, len(s))
print(ans)
Problem p02612 (python)

Fixed submission:
n = int(input())
for i in range(1000,10001,1000):
    if(i>=n):
        print(i-n)
        break

Buggy submission (verdict: Runtime Error):
n = int(input())
if(n%1000 == 0):
	print('0')
else:
	n_str = str(n)
    g = n_str[0]
    print((n+1)*1000-n)
Problem p02613 (python)

Fixed submission:
import sys
input = sys.stdin.readline

cases = int(input())
account = {'AC': 0, 'WA' : 0, 'TLE':0, 'RE':0}

while cases > 0:
  account[input().split()[0]] += 1
  cases -= 1
  
print('AC x '+ str(account['AC']))
print('WA x '+ str(account['WA']))
print('TLE x '+ str(account['TLE']))
print('RE x '+ str(account['RE']))

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

account = {'AC': 0, 'WA' : 0, 'TLE':0, 'RE':0}

while --cases > 0:
  ++account[input()]
  
print('AC x '+ account['AC'])
print('WA x '+ account['WA'])
print('TLE x '+ account['TLE'])
print('RE x '+ account['RE'])

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

account = {'AC': 0, 'WA' : 0, 'TLE':0, 'RE':0}

while cases > 0:
  account[input()]++
  cases--
  
print('AC x '+ account['AC'])
print('WA x '+ account['WA'])
print('TLE x '+ account['TLE'])
print('RE x '+ account['RE'])

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

account = {'AC': 0, 'WA' : 0, 'TLE':0, 'RE':0}

while cases-- > 0:
  account[input()]++
  
print('AC x '+ account['AC'])
print('WA x '+ account['WA'])
print('TLE x '+ account['TLE'])
print('RE x '+ account['RE'])
Problem p02909 (python)

Fixed submission:
s=input()
if s=="Sunny":print("Cloudy")
elif s=="Cloudy":print("Rainy")
else:print("Sunny")

Buggy submission (verdict: Runtime Error):
s=input()
if s=="Sunny":print("Cloudy")
elif s=="Cloudy":print("Rainy")
else print("Sunny")
Problem p03423 (python)

Fixed submission:
print(int(input())//3)

Buggy submission (verdict: Runtime Error):
print((int)input()/3)
Problem p02657 (python)

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

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

ans = 1
for a in A:
    ans *= a
    if ans == 0:
        break
    elif ans > 10**18:
        ans = -1
        break

print(ans)
Problem p02755 (python)

Fixed submission:
import math

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

pricemax_A = math.floor((A+1)/0.08)
pricemin_A = math.ceil(A/0.08)

pricemax_B = math.floor((B+1)/0.1)
pricemin_B = math.ceil(B/0.1)

if pricemin_A >= pricemin_B and pricemin_A < pricemax_B:
    print(pricemin_A)
elif pricemin_A <= pricemin_B and pricemax_A > pricemin_B:
    print(pricemin_B)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
import math

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

pricemax_A = math.floor((A+1)/0.08)
pricemin_A = math.floor(A/0.08)

pricemax_B = math.floor((B+1)/0.1)
pricemin_B = math.floor(B/0.1)

if pricemin_A >= pricemax_B or pricemax_A =< pricemin_B:
    print(-1)
elif pricemin_A >= pricemin_B:
    print(pricemin_A)
elif pricemin_A < pricemin_B:
    print(pricemin_B)

Buggy submission (verdict: Runtime Error):
import math

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

pricemax_A = math.floor((A+1)/0.08)
pricemin_A = math.floor(A/0.08)

pricemax_B = math.floor((B+1)/0.1)
pricemin_B = math.floor(B/0.1)

if A > B or A < 0 or B < 0 or A > 100 or B > 100:
    return (-1)

if pricemin_A >= pricemin_B and pricemin_A < pricemax_B:
    print(pricemin_A)
elif pricemin_A <= pricemin_B and pricemax_A > pricemin_B:
    print(pricemin_B)
else:
    print(-1)
Problem p02761 (python)

Fixed submission:
import math
 
N, M = map(int,input().split())
 
if M == 0:
    if N == 1:
        print(0)
    else:
        print(10**(N-1))
else:
    s = list()
    c = list()
 
    for i in range(M):
        s_val, c_val = map(int, input().split())
        s.append(s_val)
        c.append(c_val)
 
    ans = 1000
    for i in range(int(10**(N)-1), int(10**(N-1)-1),-1):
        keta=list()
        for j in range(N):
            keta.append((math.floor(i/(10**j))%10))
        counter = 0
        
        for k in range(M):
 
            if keta[N-s[k]] == c[k]:
                counter += 1
            if counter == M:
                ans = i
 
    if N == 1 and M == 1 and c[0] == 0:
        print(0)
 
    elif ans == 1000:
        print(-1)
    else:
        print(ans)

Buggy submission (verdict: Runtime Error):
import math

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

if M == 0:
    if N == 1:
        print(0)
    else:
        print(10**(N-1))
else:
    s = list()
    c = list()

    for i in range(M):
        s_val, c_val = map(int, input().split())
        s.append(s_val)
        c.append(c_val)

    ans = 1000
    for i in range(int(10**(N)-1), int(10**(N-1)-1),-1):
        keta=list()
        for j in range(N):
            keta.append((math.floor(i/(10**j))%10))
        counter = 0
        print(i)
        for k in range(M):

            if keta[N-s[k]] == c[k]:
                counter += 1
            if counter == M:
                ans = i

    elif ans == 1000:
        print(-1)
    else:
        print(ans)
Problem p02801 (python)

Fixed submission:
C = input()

alp = 'abcdefghijklmnopqrstuvwxyz'

print(alp[alp.find(C)+1])

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

dic = {'a':1,'b':2,'c':3,'d':4,'e':5,'f':6,'g':7,'h':8,'i':9,'j':10,'k':11,'l':12,'m':13,'n':14,'o':15,'p':16,'q':17,'r':18,'s':19,'t':20,'u':21,'v':22,'w':23,'x':24,'y':25,'z':26}

keys = list(dic.keys())

for i in range(26):
    if keys[i]==C:
        print(keys[i+1])
        break

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

dic = {'a':1,'b':2,'c':3,'d':4,'e':5,'f':6,'g':7,'h':8,'i':9,'j':10,'k':11,'l':12,'m':13,'n':14,'o':15,'p':16,'q':17,'r':18,'s':19,'t':20,'u':21,'v':22,'w':23,'x':24,'y':25,'z':26}

keys = list(dic.keys())

for i in range(26):
    if keys[i]==C:
        print(keys[i+1])
Problem p02848 (python)

Fixed submission:
N = int(input())
S = input()
alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

new_S = list()
for word in S:
    num = alpha.index(word)+N
    if num > 25:
        num -= 26
    new_S.append(alpha[num])
print(''.join(new_S))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

new_S = list()
for word in S:
    num = alpha.index(word)+N
    if num > 25:
        num -= 25
    new_S.append(alpha[num])
print(''.join(new_S))
Problem p02717 (python)

Fixed submission:
X, Y, Z = map(int, input().split())
print(Z, X, Y)

Buggy submission (verdict: Runtime Error):
X, Y, Z = input()
print(Z, X, Y)
Problem p02817 (python)

Fixed submission:
N=input().split(" ");print(N[1]+N[0])

Buggy submission (verdict: Runtime Error):

A,B,K = [int(i) for i in input().split(" ")]

def check(A,B,K):
    if 0 < K < A:
        A-=K
        K = 0
    else:
        result = K-A
        A = 0
        K = result
    if 0 < B:
        if K < B:
            B-=K
        else:
            B = 0
    return "{0} {1}".format(A,B)

print(check(A,B,K))

Buggy submission (verdict: Runtime Error):

A,B,K = [int(i) for i in input().split(" ")]

def check(A,B,K):
    if A > K:
        A=-K
    else:
        result = K-A
        A = 0
        K = result
    B-=K
    return "{0} {1}".format(A,B)

print(check(A,B,K))
Problem p02818 (python)

Fixed submission:

A,B,K = [int(i) for i in input().split(" ")]

def check(A,B,K):
    if A > 0:
        if A > K:
            A-=K
            K = 0
        else:
            result = K-A
            A = 0
            K = result
    if B > 0:
        if B > K:
            B-=K
        else:
            B = 0
    return "{0} {1}".format(A,B)

print(check(A,B,K))

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

def check(A,B,K):
    if A > 0:
        if K-A >= 0:
            K = K-A
            A = 0
        else:
            A = A-K
            return (A,B)
    
    if B > 0:
        if B-K >= 0:
            return (A,B-K)
        else:
            return (A,0)

ans = check(A,B,K)
print(ans[0],ans[1])

Buggy submission (verdict: Runtime Error):
A,B,K = [int(i) for i in input().split(" ")]

def check(A,B,K):
    if A > 0:
        if K-A >= 0:
            K = K-A
            A = 0
        else:
            A = A-K
            return (A,B)
    
    if B > 0:
        if B-K >= 0:
            return (A,B-K)
        else:
            return (A,0)

ans = check(A,B,K)
print(ans[0],ans[1])
Problem p02887 (python)

Fixed submission:
N = int(input());S = list(input());print(len([(x,i) for i,x in enumerate(S) if i != N-1 if x != S[i+1]])+1)

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

@tail_recursive
def fun(list,c=0):
    if len(list) == 1:
        return c+1
    if list[0] == list[1]:
        return fun(list[1:],c)
    else:
        return fun(list[1:],c+1)

print(fun(S))

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

def fun(list,c=0):
    if len(list) == 1:
        return c+1
    if list[0] == list[1]:
        return fun(list[1:],c)
    else:
        return fun(list[1:],c+1)

print(fun(S))
Problem p02922 (python)

Fixed submission:
A,B = [int(i) for i in input().split(" ")]

for i in range(B):
    if (i*A)-(i-1) >= B:
        print(i)
        break

Buggy submission (verdict: Runtime Error):
A,B=list(map(int,input().split(" ")));print([i for i in range(B) if A*i>= B][0])
Problem p02995 (python)

Fixed submission:
import fractions
#解説見ました。
def lcm(x,y):
    return (x * y) // fractions.gcd(x,y)
def wei(n,x,y):
    return n-(n//x + n//y - n//lcm(x,y))

A,B,C,D = [int(i) for i in input().split(" ")]
print(wei(B,C,D) - wei(A-1,C,D))

Buggy submission (verdict: Runtime Error):
import math 

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

A,B,C,D = [int(i) for i in input().split(" ")]
AB = B-A
BC = AB//C
BD = AB//D
CD = lcm(C,D)
BCD = AB//CD
union = BC+BD-BCD
print(AB - union)
Problem p03284 (python)

Fixed submission:
nk = list(map(int,input().split(" ")))
l = [(nk[0] + i) // nk[1] for i in range(nk[1])]
print(max(l) - min(l))

Buggy submission (verdict: Runtime Error):
nk = map(int,input().split(" "))
print(nk[0] % nk[1])
Problem p03399 (python)

Fixed submission:
A = [int(input()) for i in range(2)]
B = [int(input()) for i in range(2)]
print(min(A) + min(B))

Buggy submission (verdict: Runtime Error):
A,B = list(map(int,input().split(" ")))
c = 0
for i in range(1,A+1):
    for j in range(1,B+1):
        print(i,j)
        if i == j:
            c+=1
print(c)
Problem p03719 (python)

Fixed submission:
A, B, C = map(int,input().split())
if (C>=A) and (C<=B):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
if C >= A:
    if C <= B:
        print('Yes')
    else:
        print('No')
else:
    print('No')
Problem p02576 (python)

Fixed submission:
import math
N, X, T = map(int, input().split())

print(T * math.ceil(N / X))

Buggy submission (verdict: Runtime Error):
import math
N, X, T = map(int(input().split()))

print(T * math.ceil(N / X))

Buggy submission (verdict: Runtime Error):
import math
N, X, T = int(input())

print(T * math.ceil(N / X))
Problem p02675 (python)

Fixed submission:
str = input()

if str[-1] == '2' or str[-1] == '4' or str[-1] == '5' or str[-1] == '7' or str[-1] == '9':
    print('hon')
elif str[-1] == '3':
    print('bon')
else:
    print('pon')

Buggy submission (verdict: Runtime Error):
import math
a, b, h, m = map(int, input().split())

theta = h * 30 - m * 5.5
result = a ** 2 + b ** 2 - 2 * a * b * math.cos(math.radians(theta))
print(result ** (1 / 2))
Problem p02706 (python)

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

if n >= sum(A):
    print(n - sum(A))
else:
    print('-1')

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
print(max(n - sum(list(map(int, input().split())))), -1)
Problem p03059 (python)

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

count = T // A
bsc = B * count

print(bsc)

Buggy submission (verdict: Runtime Error):
A = int(input(A))
B = int(input(B))
T = int(input(T))

count = (T + 0.5) // A
biscuit = B * count
print(biscuit)

Buggy submission (verdict: Runtime Error):
A = int(A)
B = int(B)
T = int(T)

count = (T + 0.5) // A
biscuit = B * count
print(biscuit)

Buggy submission (verdict: Runtime Error):
count = (T + 0.5) // A
biscuit = B * count
print(biscuit)
Problem p03060 (python)

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

worth = 0

for i in range(N):
    if V[i] > C[i]:
        worth += V[i] - C[i]
    else:
        pass

print(worth)

Buggy submission (verdict: Runtime Error):
jewel = 0

for i in range(1, 21):
  if V(i) > C(i):
    jewel += V(i) - C(i)
  else:
    pass

print(jewel)
Problem p03469 (python)

Fixed submission:
a = input()
b = '2018' + a[4:]
print(b)

Buggy submission (verdict: Runtime Error):
a = input()
a[:4] = '2018'
print(a)
Problem p03470 (python)

Fixed submission:
n = int(input())
a = []
for i in range(n):
  x = int(input())
  a.append(x)

print(len(set(a)))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = []
for i in range(n):
  x = int(input())
  a.append(x)
print(len(set(a))
Problem p03477 (python)

Fixed submission:
a,b,c,d = map(int, input().split())
print("Left" if a + b > c + d else ("Right" if a + b < c + d else "Balanced"))

Buggy submission (verdict: Runtime Error):
n,a,b = map(int, input().split())
def f(x):
  ret = 0
  while(x > 0):
    ret += x % 10
    x //= 10
  return ret
nums = filter(lambda x: f(x) >= a and f(x) <= b, range(1, n + 1))
print(sum(nums))
Problem p03478 (python)

Fixed submission:
n,a,b = map(int, input().split())
def f(x):
  ret = 0
  while(x > 0):
    ret += x % 10
    x //= 10
  return ret
nums = filter(lambda x: f(x) >= a and f(x) <= b, range(1, n + 1))
print(sum(nums))

Buggy submission (verdict: Runtime Error):
n,a,b = map(int, input().split())
def f(x):
  ret = 0
  while(x > 0):
    ret += x % 10
    x //= 10
nums = filter(lambda x: f(x) >= a && f(x) <= b, range(1, n + 1))
print(sum(nums))
Problem p02576 (python)

Fixed submission:
import math
n, x, t = map(int, input().split(" "))

out = int(math.ceil(n/x)) * t if x != 0 else 0
print(out)

Buggy submission (verdict: Runtime Error):
n, x, t = map(int, input().split(" "))

out = int(math.ceil(n/x)) * t
print(out)
Problem p02613 (python)

Fixed submission:
n = int(input())
S = []
for i in range(n):
    S.append(input())
cnt_ac = 0
cnt_tle = 0
cnt_wa = 0
cnt_re = 0


for i in range(n):
    if S[i] == "AC":
        cnt_ac += 1
    elif S[i] == "TLE":
        cnt_tle += 1
    elif S[i] == "WA":
        cnt_wa += 1
    elif S[i] == "RE":
        cnt_re += 1

print("AC x " + str(cnt_ac))
print("WA x " + str(cnt_wa))
print("TLE x " + str(cnt_tle))
print("RE x " + str(cnt_re))

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

cnt_ac = 0
cnt_tle = 0
cnt_wa = 0
cnt_re = 0

for i in range(n):
    if input() == "AC":
        cnt_ac += 1
    elif input() == "TLE":
        cnt_tle += 1
    elif input() == "WA":
        cnt_wa += 1
    elif input() == "RE":
        cnt_re += 1

print("AC ×　" + cnt_ac)
print("WA ×　" + cnt_wa)
print("TLE ×　" + cnt_tle)
print("RE ×　" + cnt_re)
Problem p02658 (python)

Fixed submission:
def main():
    n = int(input())
    A = [int(x) for x in input().split()]
    if 0 in A:
        print(0)
        return

    mul = 1
    for a in A:
        mul *= a

        if mul > 1e18:
            print(-1)
            return

    print(mul)


main()

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


prod = 1
for a in A:
  if a == 0:
    prod = 0
  prod *= a
  if prod > 1000000000000000000:
  prod = -1

print(prod)
Problem p02718 (python)

Fixed submission:
n, m = map(int, input().split())
A = list(map(int, input().split()))
sorted_A = list(reversed(sorted(A)))
print("No" if sorted_A[m-1] < sum(A)/(4*m) else "Yes")

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
A = list(map(int, input().split()))
sorted_A = list(reversed(sorted(A)))
print("No" if sorted_A[m] < sum(A)/(4*m) else "Yes")
Problem p02983 (python)

Fixed submission:
L, R = list(map(int, input().split(' ')))
#print(L, R)
 
min = 2019
for i in range(L, R):
    for j in range(i + 1, R + 1):
        mod_ij = (i * j) % 2019
        if min > mod_ij:
            min = mod_ij
            if min == 0:
                break
    if min == 0:
        break
print(min)

Buggy submission (verdict: Runtime Error):
[l,r] = [int(i) for i in input().split()]

ans = []

if l > 2019 and r > 2019:
	l %= 2019
	r %= 2019
	
elif l <= 2019 and r > 2019:
	r %= 2019
	s = l
	l = r
	r = s
	
if l == r:
	l %= 2019
	r %= 2019
	print(l*r%2019)
	
else:	
	for i in range(l,r):
		for j in range(i+1,r+1):
			rem = i*j%2019
			ans.append(rem)

	print(min(ans))

Buggy submission (verdict: Runtime Error):
[l,r] = [int(i) for i in input().split()]

ans = []

if l > 2019:
	l %= 2019
	
if r > 2019:
	r %= 2019
	
for i in range(l,r):
	for j in range(i+1,r+1):
		rem = i*j%2019
		ans.append(rem)

print(min(ans))

Buggy submission (verdict: Runtime Error):
[l,r] = [int(i) for i in input().split()]

ans = []

if l > 2019:
	l %= 2019
	
if r > 2019:
	r %= 2019
	
if l+1 == r:
	print(l*r%2019)

else:
	for i in range(l,r):
		for j in range(i+1,r+1):
			rem = i*j%2019
			ans.append(rem)

	print(min(ans))
Problem p03161 (python)

Fixed submission:
n, k = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]


def frog(n, k, h):
    d = [float('inf')] * n
    d[0] = 0

    for i in range(1, n):
        d[i] = min(
            d[j] + abs(h[i] - h[j]) for j in range(max(i - k, 0), i)
        )
    return d[n - 1]


print(frog(n, k, h))

Buggy submission (verdict: Runtime Error):
[N,K] = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
	
dp = []

dp[0] = 0
for i in range(1,N):
	d[i] = min(d[j] + abs(h[i] - h[j]) for j in range(max(i-K,0),i))
	
print(dp[-1])
Problem p02848 (python)

Fixed submission:
n = int(input())
s = input()
list = []

for i in s:
    if ord(i)+n > 90:
        list.append(chr(ord(i)+n-26))
    else:
        list.append(chr(ord(i)+n))
        
ans = "".join(list)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
list = []

for i in s:
    if ord(i)+N > 90:
        list.append(chr(ord(i)+N-26))
    else:
        list.append(chr(ord(i)+N))
        
ans = "".join(list)
print(ans)
Problem p02886 (python)

Fixed submission:
n = int(input())
lst = list(map(int,input().split()))
ans = 0
for i in range(n):
    for j in range(i+1,n):
        ans = ans + lst[i]*lst[j]

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
lst = map(int,input().split())
ans = 0
for i in range(n):
    for j in range(1,n):
        ans = ans + lst[i]*lst[j]

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
lst = map(int,input().split())
ans = 0
for i in range(n):
    for j in range(1,n):
        ans += lst[i]*lst[j]

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
lst = map(int,input().split())
ans = 0
for i in range(n):
    for j in range(1,n):
        ans += ans + lst[i]*lst[j]

print(ans)
Problem p02910 (python)

Fixed submission:
s = input()

if "L" in s[::2] or "R" in s[1::2]:
    print("No")
else:
    print("Yes")

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

if s[::2] in "L" or s[1::2] in "R":
    print("No")
else:
    print("Yes")
Problem p02969 (python)

Fixed submission:
r = int(input())
print(3*r**2)

Buggy submission (verdict: Runtime Error):
import math

n,d = map(int,input().split())

k = n/(d*2+1)
print(math.ceil(k))
Problem p03339 (python)

Fixed submission:
n = int(input())
s = input()
s_min = s[1:].count("E")
s_now = s[1:].count("E")

for i in range(1,n):
    if s[i-1] == "E" and s[i] == "E":
        s_now -= 1
    if s[i-1] == "W" and s[i] == "W":
        s_now += 1
    s_min = min(s_min, s_now)
print(s_min)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
ans = 300000
lst = []
for i in range(n):
    tmp = s[:i].count("W") + s[i+1:].count("E")
    ans = min(ans,tmp)
    
print(min(ans))

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

lst = []
for i in range(n):
    total = s[:i].count("W") + s[i+1:].count("E")
    lst = lst + [total]
    
print(min(total))
Problem p03449 (python)

Fixed submission:
n = int(input())
lst =[list(map(int,input().split())) for i in range(2)]

ans = []
for i in range(n):
    if i != n-1:
        ans = ans + [sum(lst[0][:i+1]) + sum(lst[1][i:])]
    else:
        ans = ans + [sum(lst[0][:]) + lst[1][-1]]
print(max(ans))

Buggy submission (verdict: Runtime Error):
from itertools import accumulate

n = int(input())
lst =[list(map(int,input().split())) for i in range(n)]

lst_p = [lst[0][0]]
for i in range(n):
    a = sum(lst[0][i+1:]) + lst[1][-1]
    b = sum(lst[1][i:])
    if a > b:
        lst_p =  lst_p + [lst[0][i+1]]
        if i == n-1:
            lst_p = lst_p + [lst[1][-1]] 
    else:
        lst_p = lst_p + lst[1][i:]
        break
print(list(accumulate(lst_p))[-1])
Problem p03545 (python)

Fixed submission:
lst = list(map(str, input()))
n = len(lst) - 1
op_lst = ["+", "-"]
for i in range(2**n):
    op = ["-"] * 3
    for j in range(n):
        if ((i >> j) & 1):
            op[n-j-1] = op_lst[0]
    formula = ""
    for num,opp in zip(lst, op + [""]):
        formula += (num + opp)
    if eval(formula) == 7:
        print(formula + "=7")
        break

Buggy submission (verdict: Runtime Error):
lst = list(map(int, input()))
n = len(lst) - 1
op_lst = ["+", "-"]
for i in range(2**n):
    op = ["-"] * 3
    for j in range(n):
        if ((i >> j) & 1):
            op[n-j-1] = op_lst[0]
    formula = ""
    for num,opp in zip(lst, op + [""]):
        formula += (num + opp)
    if eval(formula) == 7:
        print(formula + "=7")
        break

Buggy submission (verdict: Runtime Error):
lst = list(map(int, input()))
n = len(lst) - 1
op_lst = ["+", "-"]
for i in range(2**n):
    op = ["-"] * 3
    for j in range(n):
        if ((i >> j) & 1):
            op[n-j-1] = op_lst[0]
    formula = ""
    for num,opp in zip(lst, op + [""]):
        formula += [num + opp]
    if eval(formula) == 7:
        print(formula + "=7")
        break