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

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

if a > b:
   c = c - (a - b)

if c >= 0:
    print(c)
else:
    print('0')

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

if a + b >= a - b and a + b >= a * b:
    print(a+b)
elif a-b >= a+b and a-b >= a*b:
    print(a-b)
else:
    print(a*b)
Problem p03041 (python)

Fixed submission:
N=list(map(int,input().split()))
S=list(input())
k=N[1]
S[k-1]=S[k-1].lower()
j = ' '
 
for x in S:
    j += x
print(j)

Buggy submission (verdict: Runtime Error):
N=list(map(int,input().split()))
S=list(input())
k=N[1]
S[k]=S[k].lower()
j = ','.join(S)
print(j)

Buggy submission (verdict: Runtime Error):
N=list(map(int,input().split()))
S=list(input())
k=N[1]
S[k]=S[k].lower()
print(S)
Problem p02546 (python)

Fixed submission:
s=input()
if s[len(s)-1]=="s":
    print(s+"es")
else:
    print(s+"s")

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

for i in range(n):
    d1,d2=map(int,input().split())
    if d1==d2:
        flag+=1
        if flag==3:
            ans=1
    else:
        flag=0
if ans!=1:
    print("No")
else:
    print("Yes")
Problem p02547 (python)

Fixed submission:
n=int(input())
flag=0
ans=0

for i in range(n):
    d1,d2=map(int,input().split())
    if d1==d2:
        flag+=1
        if flag==3:
            ans=1
    else:
        flag=0
if ans!=1:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
n=int(input())
flag=0
for i in range(n):
    d1,d2=map(int,input().split())
    if d1==d2:
        flag+=1
        if flag==3:
            ans=1
    else:
        flag=0
if ans!=1:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
n=int(input())
flag=0
for i in range(n):
    d1,d2=map(int,input().split())
    if d1==d2:
        flag+=1
        if flag==3:
            ans=1
    else:
        flag=0
if ans!=1:
    print("No")
else:
    print("Yes")
Problem p02725 (python)

Fixed submission:
K,N=map(int,input().split())
A=list(map(int,input().split()))
d=[]
for i in range(N-1):
    d.append(A[i+1]-A[i])
d.append(K-A[N-1]+A[0])
print(K-max(d))

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

Fixed submission:
import re
ptr=["A{3}|B{3}"]
str=input()

for valueptr in ptr:
    pattern=re.compile(valueptr)
    res=pattern.search(str)
    if res is None:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
N,P=map(int,input().split())
S=str(input())
S=S[::-1]
Si=[]
count=0
sum=0
if P==2:
    for i in range(N):
        if int(S[i])%2==0:
            count+=N-i
elif P==5:
    for i in range(N):
        if S[i]=="0" or S[i]=="5":
            count+=N-i
else:
    listS=[int(i) for i in S]
    mod=[(k*10**j)%P for j,k in enumerate(listS)]
    for m in mod:
        sum+=m
        Si.append(sum%P)
        
    for start in range(N):
        if Si[start]==0:
            count+=1            
        for end in range(start+1,N):
            if Si[start]==Si[end]:
                count+=1
print(count)
Problem p02757 (python)

Fixed submission:
n, p = map(int, input().split())
 
s = list(input())
ans = 0
if p == 2 or p == 5:
    for i in range(n):
        if int(s[i]) % p == 0:
            ans += i + 1
else:
    d = [0] * (n + 1)
    ten = 1
    for i in range(n - 1, -1, -1):
        a = int(s[i]) * ten % p
        ten *= 10
        ten %= p
        d[i - 1] = (d[i] + a) % p
    cnt = [0] * p
    for i in range(n, -1, -1):
        cnt[d[i]] += 1
    for  i in cnt:
        ans+=i*(i-1)/2

print(int(ans))

Buggy submission (verdict: Runtime Error):
n, p = map(int, input().split())
 
s = list(input())
ans = 0
sum=0
if p == 2 or p == 5:
    for i in range(n):
        if int(s[i]) % p == 0:
            ans += i + 1
else:
    d = [0] * (n + 1)
    ten = 1
    for i in range(n - 1, -1, -1):
        a = int(s[i]) * ten % p
        sum+=a
        ten *= 10
        ten %= p
        d[i]= sum % p
    cnt = [0] * p
    for i in range(n, -1, -1):
        cnt[d[i]] += 1
    for  i in cnt:
        ans+=i*(i-1)/2
print(d)
print(int(ans))

Buggy submission (verdict: Runtime Error):
n, p = map(int, input().split())
 
s = list(input())
ans = 0
if p == 2 or p == 5:
    for i in range(n):
        if int(s[i]) % p == 0:
            ans += i + 1
else:
    d = [0] * (n + 1)
    ten = 1
    for i in range(n - 1, -1, -1):
        a = int(s[i]) * ten % p
        sum+=a
        ten *= 10
        ten %= p
        d[i]= sum % p
    cnt = [0] * p
    for i in range(n, -1, -1):
        cnt[d[i]] += 1
    for  i in cnt:
        ans+=i*(i-1)/2
print(d)
print(int(ans))
Problem p02577 (python)

Fixed submission:
s=list(input())
ans=0
for i in range(len(s)):
  ans+=int(s[i])
  ans%=9
if ans==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s=list(input())
ans=0
for i in range(len(s)):
  ans+=s[i]
  ans%=9
if ans==0:
  print("Yes")
else:
  print("No")
Problem p02546 (python)

Fixed submission:
S = input()
if S[-1:] == "s":
  print(S+"es")
else:print(S+"s")

Buggy submission (verdict: Runtime Error):
N = int(input())
nums =[]
count = 0
switch = False
for i in range(N):
    nums.append([int(x) for x in input().split()])

for j in nums:
    if j[0] == j[1]:
        count += 1
    elif j[0] != j[1]:
        count = 0
    if count == 3:
        switch = True
if switch == True:
    print("Yes")
elif switch == False:
    print("No")

Buggy submission (verdict: Runtime Error):
S = input()
if S[-1:] = s:
  print(S+"es")
else:print(S+"s")
Problem p02547 (python)

Fixed submission:
N = int(input())
nums =[]
count = 0
switch = False
for i in range(N):
    nums.append([int(x) for x in input().split()])

for j in nums:
    if j[0] == j[1]:
        count += 1
    elif j[0] != j[1]:
        count = 0
    if count == 3:
        switch = True
if switch == True:
    print("Yes")
elif switch == False:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
nums =[]
count = 0
switch = False
for i in range(N):
    nums.append([int(x) for x in input().split()]

for j in nums:
    if j[0] == j[1]:
        count += 1
    elif j[0] != j[1]:
        count = 0
    if count == 3:
        switch = True
if switch == True:
    print("Yes")
elif switch == False:
    print("No")
Problem p02552 (python)

Fixed submission:
x = int(input())
if x == 1:
    print("0")
elif x == 0:
    print("1")

Buggy submission (verdict: Runtime Error):
a,b,c,d = [int(x) for x in input().split()]

nums = [a*c,a*d,b*c,b*d]
print(max(nums))
Problem p02880 (python)

Fixed submission:
num = int(input())
if num in [i*j for i in range(1,10) for j in range(1,10)]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c,x = [int(input()) for _ in range(4)]
print(sum(500*i+100*j+50*k==x for i in range(a+1)for j in range(b+1)for k in range(c+1)))
Problem p02570 (python)

Fixed submission:
def dts():
	return list(map(int,input().split()))

d,t,s=dts()

if d>t*s:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
d,t,s=list(int,input().split())

if d/t<=s:
    print("yes")
else:
    print("No")

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

if d/t<=s:
    print("yes")
else:
    print("No")
Problem p02547 (python)

Fixed submission:
n=int(input())

count=0
c_list=[1]

for i in range(n):
    d1, d2=map(int, input().split())
    if d1==d2:
        count+=1
        c_list.append(count)
        #print(c_list)
    else:
        count=0
        
if max(c_list)>=3:
    print("Yes")
else:
    print("No")

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

count=0
c_list=[]
for i in range(n):
    d1, d2=map(int, input().split())
    if d1==d2:
        count+=1
        c_list.append(count)
    else:
        count=0
        
if max(c_list)>=3:
    print("Yes")
else:
    print("No")
Problem p02682 (python)

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

if k<=a:
    print(k)
elif a<k<=(a+b):
    print(a)
else:
    print(a+(k-a-b)*(-1))

Buggy submission (verdict: Runtime Error):
a,b,c,k=map(int, input().split())
all_list=[1]*a+[0]*b+[-1]*c
#print(all_list)
print(sum(all_list[:k]))
Problem p02754 (python)

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

if a==0:
    print(0)
    
elif b==0:
    print(n)
    
else:
    
    quo=n//(a+b)
    
    #商
    if n%(a+b)==0:
        rem=0
    elif  1<=n%(a+b)<=a:
        rem=n%(a+b)
    else:
        rem=a
        
    print(quo*a+rem)

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

num=n//(a+b)+1

line=("b"*a+"r"*b)*num

print(line[:n].count("b"))
Problem p02597 (python)

Fixed submission:
n = int(input())
s = input()
a = 0
b = 0
for c in s:
    if c == "R": a += 1
ans = max(a,b)
for i in range(n):
    if s[i] == "R": a -= 1
    else: b += 1
    ans = min(ans, max(a, b))
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
C = input()
c_R = 0
c_W = 0
for c in C:
    if c == "R": c_R += 1
    else: c_W += 1
ans = min(c_R, c_W)


if C[0] + C[1] == "WR":
    C[2:].find("WR") != -1:
    C = list(C)
    C[0] = "R"
    C[C[2:].find("WR") + 1] = "W"
    C = "".join(C)
    
ind1 = C.find("RWR")
if ind1 != -1:
    ind2 = C[ind1 + 2:].find("WR")
else:
    ind2 = -1


while ((ind1 != -1) & (ind2 != -1)):
    C = list(C)
    C[ind1 + 1] = "R"
    C[ind2 + 1] = "W"
    C = "".join(C)

    ind1 = C.find("RWR")
    if ind1 != -1:
        ind2 = C[ind1 + 2:].find("WR")
    else:
        ind2 = -1


    


c_R = 0
c_W = 0
for c in C:
    if c == "R": c_R += 1
    else: c_W += 1
ans = min(ans,c_R, c_W)
Problem p02623 (python)

Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

sum_a = [0]
sum_b = [0]
ans = 0
for i in range(1,len(A)+1):
    sum_a.append(sum_a[i - 1] + A[i - 1])
for i in range(1,len(B)+1):
    sum_b.append(sum_b[i - 1] + B[i - 1])


j = len(sum_b)-1
for i in range(len(sum_a)):
    if sum_a[i] > K: break
    while (sum_b[j] + sum_a[i] > K):
        j -= 1
    ans = max(ans, i + j)

    
print(ans)

Buggy submission (verdict: Runtime Error):
#from collections import deque
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
A = A[::-1]
B = list(map(int, input().split()))

book = A + B
sum_a = sum(A)
sum_b = sum(B)

l = 0
r = len(A)
time = sum_a
ans = 0
#print(book)
while ((r < len(book))|(l <= len(A))):
    if time + book[r] <= K:
        time += book[r]
        ans = max(ans,len(book[l:r])+1)
        r += 1
    elif r == l:
        r += 1
        l += 1
    else:
        time -= book[l]
        l += 1

    #print(l, r)
    #print(ans)
    #print()

book = B[::-1]+A[::-1]

l = 0
r = len(B)
time = sum_b

while ((r < len(book))|(l <= len(B))):
    if time + book[r] <= K:
        time += book[r]
        ans = max(ans,len(book[l:r])+1)
        r += 1
    elif r == l:
        r += 1
        l += 1
    else:
        time -= book[l]
        l += 1
    


print(ans)
Problem p02624 (python)

Fixed submission:
n = int(input())

L = [0] * (n + 1)

for i in range(1, n + 1):
    for j in range(1, (n // i)+1):
        L[i * j] += 1

i = 0
ans = 0
for i in range(len(L)):
    ans += i *L[i]

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
cnt_tb = [0]*n
for i in range(1, n + 1):
    j = 1
    tmp = i*j
    while (tmp <= n):
        cnt_tb[tmp] += 1
        j += 1
        tmp = i*j
ans = 0
for i, cnt in enumerate(cnt_tb):
    ans += (i + 1) * cnt
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
cnt_tb = [0]*n
for i in range(1, n + 1):
    j = 1
    tmp = i*j
    while (tmp <= n):
        cnt_tb[tmp] += 1
        j += 1
ans = 0
for i, cnt in enumerate(cnt_tb):
    ans += (i + 1) * cnt
print(ans)
Problem p02695 (python)

Fixed submission:
import itertools
N, M, Q = map(int, input().split())
vec = [list(map(int, input().split())) for i in range(Q)]
A = itertools.combinations_with_replacement(range(1,M+1), N)
ans = 0

for a in A:
    tmp = 0
    for v in vec:
        if (a[v[1]-1] - a[v[0]-1]) == v[2]:
            tmp += v[3]
    if ans < tmp:
        ans = tmp
        
print(ans)

Buggy submission (verdict: Runtime Error):
N, M, Q = map(int, input().split())
vec = [list(map(int, input().split())) for i in range(Q)]
A = itertools.combinations_with_replacement(range(1,M+1), N)
ans = 0

for a in A:
    tmp = 0
    for v in vec:
        if (a[v[1]-1] - a[v[0]-1]) == v[2]:
            tmp += v[3]
    if ans < tmp:
        ans = tmp
        
print(ans)

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


A_list = []
N=2
for i in range(10**(N-1),10**N):
    #A = [int(x) for x in list(str(i))]
    #A_replace = [int(str(a).replace('0', '10')) for a in A]
    #if A_replace == sorted(A_replace):
    A_list.append(sorted(str(i)))
abcd_list = []
for q in range(Q):
    abcd_list.append(list(map(int, input().split())))

for A in A_list:
    tokuten = 0
    for q in range(Q):
        if (A[abcd_list[q][1]-1] - A[abcd_list[q][0]-1] == abcd_list[q][2]):
            tokuten += abcd_list[q][3]

    if tokuten > max_n:
        max_n = tokuten

print(max_n)

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


A_list = []
N=2
for i in range(10**(N-1),10**N):
    #A = [int(x) for x in list(str(i))]
    #A_replace = [int(str(a).replace('0', '10')) for a in A]
    #if A_replace == sorted(A_replace):
    A_list.append(sorted(i))
abcd_list = []
for q in range(Q):
    abcd_list.append(list(map(int, input().split())))

for A in A_list:
    tokuten = 0
    for q in range(Q):
        if (A[abcd_list[q][1]-1] - A[abcd_list[q][0]-1] == abcd_list[q][2]):
            tokuten += abcd_list[q][3]

    if tokuten > max_n:
        max_n = tokuten

print(max_n)
Problem p02753 (python)

Fixed submission:
s=set(input())
if len(s)==2:print('Yes')
else:print('No')

Buggy submission (verdict: Runtime Error):
s=set(input().split(''))
if len(s)==2:print('Yes')
else:print('No')
Problem p02773 (python)

Fixed submission:
from collections import Counter
N = int(input())
L = [input() for _ in range(N)]
#for n in range(N):
    #S = input()
    #L.append(S)
Dic = Counter(L)
max_value = max(Dic.values())
max_k_list = [i for i, j in Dic.items() if j == max_value]
max_k_list = sorted(max_k_list)
for t in max_k_list:
    print(t)

Buggy submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
L = [input() for _ in range(N)]
#for n in range(N):
    #S = input()
    #L.append(S)
Dic = Counter(L)

max_k_list = [i for i, j in Dic.items() if j == max(Dic.values())]
max_k_list = max_k_list.sort()
for t in max_k_list:
    print(t)

Buggy submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
#L = []
L = [input() for _ in range(N)]
#for n in range(N):
    #S = input()
    #L.append(S)
Dic = Counter(L)
max_k_list = [kv[0] for kv in Dic.items() if kv[1] == max(Dic.values())]
max_k_list = max_k_list.sort()
for t in max_k_list:
    print(t)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = []
Dic = {}
for n in range(N):
    S = input()
    L.append(S)
Unique = list(set(L))

for i in Unique:
    Dic[i]=0

for j in range(len(L)):
    Dic[j] = Dic[j] + 1
    
max_k_list = [kv[0] for kv in Dic.items() if kv[1] == max(Dic.values())]
max_k_list = sorted(max_k_list)
for t in max_k_list:
    print(t)
Problem p02819 (python)

Fixed submission:
def factorization(n):# 計算量O(√N)
    arr = {}
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr[i] = cnt

    if temp!=1:
        arr[temp]=1

    if arr==[]:
        arr[n] = 1

    return arr



x = int(input())
while(True):
    p = factorization(x)
    if (len(p)==1) & (x in p):
        break
    else:
        x += 1

print(x)

Buggy submission (verdict: Runtime Error):
import sys
sys.path.append('../../')
from librarys import prime_factorization

x = int(input())

while(True):
    p = prime_factorization.factorization(x)
    if len(p)==1:
        break
    else:
        x += 1

print(x)
Problem p02831 (python)

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

print(int(a*b / fractions.gcd(a,b)))

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

print(int(a*b / math.gcd(a,b)))
Problem p02570 (python)

Fixed submission:
d,t,s=input().split()
d=int(d)
t=int(t)
s=int(s)
d1=s*t
if d<=d1:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
d,t,s=intput().split()
d=int(d)
t=int(t)
s=int(s)
d1=s*t
if d<=d1:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
d,t,s=intput().split()
d=int(d)
t=int(t)
s=int(s)
d1=s*t
if d<=d1:
  print("Yes")
else:
  print("No)

Buggy submission (verdict: Runtime Error):
d,t,s=intput().split()
d1=s*t
if d<=d1:
  print("Yes")
else:
  print("No)
Problem p02546 (python)

Fixed submission:
s =str(input())
if s[-1] == "s":
    print(s + "es")
else:
    print(s + "s")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = []
for i in range(n):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        a.append(True)
    else:
        a.append(False)
a.append(False)
a.append(False)
for i in a:
    if i == True:
        if a[a.index(i)+1] and a[a.index(i)+2]:
            print("Yes")
            exit()
print("No")
Problem p02578 (python)

Fixed submission:
n = input()
a = list(map(int, input().split()))
max = 0
step = 0            
for i in a:
	if max > i:
		step += max - i
	else:
		max = i

print(step)

Buggy submission (verdict: Runtime Error):
n = input()
a = list(map(int, input().split()))
min = a[1]
ans = 0            
for i in a:
	if min > i:
		ans += (min - i)
	else:
		min = i

print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
a = list(map(int, input().split()))
min = a[1]
ans = 0            
for i in a:
	if min > i:
		ans += min - i
	else:
		min = i

print(ans)
Problem p02597 (python)

Fixed submission:
n = int(input())
c = input()
count = 0

i, j = 0, n - 1
if c.count('W') == 0:
    count=0
elif c.count('R') == 0:
    count = 0
else:
    white_cnt = []
    red_cnt = []
    for i in range(n):
        if c[i] == 'W':
            white_cnt.append(i)
        else:
            red_cnt.append(i)
    while 1:
        white_num = white_cnt.pop(0)
        red_num = red_cnt.pop()
        if white_num < red_num:
            count += 1
        if len(white_cnt) == 0:
            break
        if len(red_cnt) == 0:
            break
print(count)

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

i, j = 0, n - 1
if c.count('W') == 0 | c.count('R') == 0:
    count = 0
else:
    white_cnt = []
    red_cnt = []
    for i in range(n):
        if c[i] == 'W':
            white_cnt.append(i)
        else:
            red_cnt.append(i)
while 1:
    white_num = white_cnt.pop(0)
    red_num = red_cnt.pop()
    if white_num < red_num:
        count += 1
    if len(white_cnt) == 0:
        break
    if len(red_cnt) == 0:
        break
print(count)
Problem p02711 (python)

Fixed submission:
n=input()
cnt=0
for i in n:
  if i == '7':
    cnt=1
    break
if cnt==0:
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
n=input()
cnt=0
for i in n:
  if i = '7':
    cnt=1
    break
if cnt==0:
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
n=input()
cnt=0
for i in n:
  if i = "7":
    cnt=1
    break
if cnt==0:
  print("No")
else:
  print("Yes")
Problem p02712 (python)

Fixed submission:
n=int(input())
cnt=0
for i in range(n+1):
  if i%3!=0:
    if i%5!=0:
      cnt=cnt+i
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(intput())
cnt=0
for i in range(n+1):
  if i%3!=0:
    if i%5!=0:
      cnt=cnt+i
print(cnt)
Problem p03011 (python)

Fixed submission:
p,q,r=map(int,input().split())
print(p+q+r-max(p,q,r))

Buggy submission (verdict: Runtime Error):
# スペース区切りの整数の入力
p,q,r=map(int, input().split())

# 出力
Print(p+q+r-max(p, q, r))

Buggy submission (verdict: Runtime Error):
# スペース区切りの整数の入力
p,q,r = map(int, input().split(' '))

# 出力
Print(p+q+r-max(p, q, r))

Buggy submission (verdict: Runtime Error):
# スペース区切りの整数の入力
p,q,r = map(int, input().split())

# 出力
Print(p+q+r-max(p, q, r))

Buggy submission (verdict: Runtime Error):

p,q,r = map(int, raw_input().split())


Print(p+q+r-max(p, q, r))

Buggy submission (verdict: Runtime Error):
# スペース区切りの整数の入力
p,q,r = map(int, raw_input().split())

# 出力
Print(p+q+r-max(p, q, r))

Buggy submission (verdict: Runtime Error):
# スペース区切りの整数の入力
p, q, r = map(int, raw_input().split())

# 出力
Print(p+q+r-max(p, q, r))

Buggy submission (verdict: Runtime Error):
# スペース区切りの整数の入力
p, q, r = map(int, raw_input().split())

n=max(p, q, r)

# 出力
Print(p+q+r-n)

Buggy submission (verdict: Runtime Error):
# スペース区切りの整数の入力
p, q, r = map(int, raw_input().split())

n=max(p, q, r)

# 出力
Print str(p+q+r-n)
Problem p02557 (python)

Fixed submission:
from collections import defaultdict
def solve(N,A,B):
    d1=defaultdict(int)
    d2=defaultdict(int)
    for i in range(N):
        d1[A[i]]+=1
        d2[B[i]]+=1
    for i in d1:
        if d1[i]+d2[i]>N:
            return "No",[]
    else:
        return "Yes",B[::-1]
    
if __name__ == "__main__":
    N=int(input())
    A=[int(i) for i in input().split()][:N]
    B=[int(i) for i in input().split()][:N]
    a,b=solve(N,A,B)
    print(a)
    if b!=[]:
        #print(a)
        k,z=0,N-1
        for i in range(N):
            if A[i]==b[i] and b[i]!=b[k]:
                b[i],b[k]=b[k],b[i]
                k+=1
            elif A[i]==b[i] and b[i]==b[k]:
                b[i],b[z]=b[z],b[i]
                z-=1
        z,k=0,N-1
        for i in range(N):
            if A[i]==b[i] and b[i]!=b[k]:
                b[i],b[k]=b[k],b[i]
                k-=1
            elif A[i]==b[i] and b[i]==b[k]:
                b[i],b[z]=b[z],b[i]
                z+=1
        print(*b)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
def solve(N,A,B):
    d1=defaultdict(int)
    d2=defaultdict(int)
    for i in range(N):
        d1[A[i]]+=1
        d2[B[i]]+=1
    for i in d1:
        if d1[i]+d2[i]>N:
            return "No",[]
    else:
        return "Yes",B[::-1]
    
if __name__ == "__main__":
    N=int(input())
    A=[int(i) for i in input().split()][:N]
    B=[int(i) for i in input().split()][:N]
    a,b=solve(N,A,B)
    print(a)
    if b!=[]:
        #print(a)
        k,z=0,N-1
        for i in range(N):
            if A[i]==b[i] and b[i]!=A[k]:
                b[i],b[k]=b[k],b[i]
                k+=1
            elif A[i]==b[i] and b[i]==A[k]:
                b[i],b[z]=b[z],b[i]
                z-=1
        for i in range(N):
            if A[i]==b[i]:
                for j in range(N):
                    if A[j]!=b[i] and b[j]!=b[i]:
                        raise ArithmeticError
                        b[i],b[j]=b[j],b[i]
        print(*b)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
N=int(input())
A=[int(i) for i in input().split()][:N]
B=[int(i) for i in input().split()][:N]
arr=[0]*N
d=defaultdict(int)
for i in range(N):
  if A[i]==B[i]:
    d[B[i]]+=1
l=list(d.keys())
x=l.pop()
i=0
while i<N:
  if A[i]!=B[i]:
    #d[B[i]]-=1
    arr[i]=B[i]
    i+=1
  else:
    if d[x]!=0:
      if x!=A[i]:
        arr[i]=x
        d[x]-=1
        i+=1
      else:
        if len(l)>0:
          temp=x
          x=l.pop()
          l.append(temp)
        else:
          print("No")
          break
    else:
      if len(l)>0:
        x=l.pop()
      else:
        print("No")
        break
else:
  print("Yes")
  print(*arr)
#print(arr)