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

Fixed submission:
h,w = map(int,input().split())
s = [list(input()) for _ in range(h)]
visited = [[False]*w for _ in range(h)]
flag = True
for y in range(h):
    for x in range(w):
        if s[y][x]=='#':
            flag = False
            for dy,dx in ((1,0),(0,1),(-1,0),(0,-1)):
                ny,nx = y+dy,x+dx
                if 0<=ny<h and 0<=nx<w and s[ny][nx]=='#':
                    flag = True
                    break
        
        if not flag:
            break
    if not flag:
        break


if flag:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
s = [list(input()) for _ in range(h)]
visited = [[False]*w for _ in range(h)]
for y in range(h):
    for x in range(w):
        if s[y][x]=="#" and not visited[y][x]:
            visited[y][x]= True
            flag =False
            for dy,dx in ((1,0),(-1,0),(0,1),(0,-1)):
                ny,nx = y+dy,x+dx
                if 0<=ny<h and 0<=nx<w and s[ny][nx]=='#':
                    visited[ny][nx] = True
                    flag = True
                    
            if flag ==False:
                print('No')
                break
    if not flag:
        break
    

if flag:
    print('Yes')
Problem p03425 (python)

Fixed submission:
N = int(input())
s = [input() for _ in range(N)]
count = [0]*5
for i in s:
    if i[0]=="M":
        count[0] += 1
    elif i[0]=="A":
        count[1] += 1
    elif i[0]=="R":
        count[2] += 1
    elif i[0]=="C":
        count[3] += 1
    elif i[0]=="H":
        count[4] += 1
ans = 1
i = 0
h = len(count)
while i < h:
    if count[i]==0:
        count.pop(i)
        h -= 1
        i = 0
    else:
        i += 1

if len(count)<3:
    ans = 0
elif len(count)==3:
    ans = 1
    for i in count:
        ans *=  i
else:
    ans = 0
    for bit in range(1<<len(count)):
        a = []
        b = 1
        for i in range(len(count)):
            mask = 1<<i
            if mask&bit:
                a.append(count[i])
                b *= count[i] 
        if len(a)==3:
            ans +=b
    
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
s = [input() for _ in range(N)]
count = [0]*5
for i in s:
    if i[0]=="M":
        count[0] += 1
    elif i[0]=="A":
        count[1] += 1
    elif i[0]=="R":
        count[2] += 1
    elif i[0]=="C":
        count[3] += 1
    elif i[0]=="H":
        count[4] += 1
ans = 1
i = 0;h = len(s)
while i < h:
    if count[i]==0:
        count.pop(i)
        h -= 1
        i = 0
    else:
        i += 1

if len(count)==0:
    ans = 0
elif len(count)<=3:
    ans = 1
    for i in count:
        ans *=  i
else:
    ans = 0
    for bit in range(1<<len(count)):
        a = []
        b = 1
        for i in range(len(count)):
            mask = 1<<i
            if mask&bit:
                a.append(count[i])
                b *= count[i] 
        if len(a)==3:
            ans +=b
    
print(ans)

Buggy submission (verdict: Runtime Error):
from math import factorial
N = int(input())
s = [input() for _ in range(N)]
count = [0]*5
for i in s:
    if i[0]=="M":
        count[0] += 1
    elif i[0]=="A":
        count[1] += 1
    elif i[0]=="R":
        count[2] += 1
    elif i[0]=="C":
        count[3] += 1
    elif i[0]=="H":
        count[4] += 1
ans = 1
i = 0;h = len(s)
while i < h:
    if count[i]==0:
        count.pop(i)
        h -= 1
    else:
        i += 1

if len(count)==0:
    ans = 0
elif len(count)<=3:
    ans = 1
    for i in count:
        ans *=  i
else:
    ans = 0
    for bit in range(1<<len(count)):
        a = []
        b = 1
        for i in range(len(count)):
            mask = 1<<i
            if mask&bit:
                a.append(count[i])
                b *= count[i] 
        if len(a)==3:
            ans +=b
    
print(ans)
Problem p03493 (python)

Fixed submission:
a = input()
count = 0
for i  in range(len(a)):
    if a[i]=='1':
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = [int(i) for i in input().split()]

c = list(set(a))

count = 0
if len(c) <= k:
    print(0)
else:
    while len(c) > k:
        minv = 10**3
        for i in c:
            o = a.count(i)
            if minv > o:
                minv = o
                atai = i
        c.remove(atai)
        count += minv
 
    print(count)
Problem p03524 (python)

Fixed submission:
from collections import Counter
s = input()
n = len(s)
count = dict(Counter(s))
flag = False

if n ==1:
    flag = True
elif n <= 3:
    if max(count.values())!=2:
        flag = True
elif n==4:
    if max(count.values())<=2:
        flag = True
else:
    if "a" in count:
        if "b" in count:
            if "c" in count:
                if count["a"]==count["b"] or count["b"]==count["c"] or count["c"]==count["a"]:
                    dev = max(count.values())-min(count.values())
                    if dev <= 1:
                        flag = True
            
            
print('YES' if flag==True else 'NO')

Buggy submission (verdict: Runtime Error):
from collections import Counter
s = input()
n = len(s)
count = dict(Counter(s))
flag = False

if n ==1:
    flag = True
elif n <= 3:
    if max(count.values())!=2:
        flag = True
elif n==4:
    if max(count.values())<=2:
        flag = True
else:
    if count["a"]==count["b"] or count["b"]==count["c"] or count["c"]==count["a"]:
        if max(count.values())-min(count.values()) <= 1:
            flag = True
            
            
print('YES' if flag==True else 'NO')

Buggy submission (verdict: Runtime Error):
from collections import Counter
s = input()
n = len(s)
count = dict(Counter(s))
flag = False

if n ==1:
    flag = True
elif n <= 3:
    if max(count.values())!=2:
        flag = True
elif n==4:
    if max(count.values())<=2:
        flag = True
else:
    if count["a"]==count["b"] or count["b"]==count["c"] or count["c"]==count["a"]:
        if abs(max(count.values())-min(count.values()))==1:
            flag = True
            
            
print('YES' if flag==True else 'NO')
Problem p03545 (python)

Fixed submission:
a = list(input())
a = [int(i) for i in a]
for bit in range(1<<3):
    ans = a[0]
    ans1 = []
    for i in  range(3):
        mask = 1<<i
        if mask&bit:
            ans = (ans+a[i+1])
            ans1.append('+')
        else:
            ans = (ans-a[i+1])
            ans1.append('-')
    
    if ans==7:
        ans2 = ans1
ans3 = []
for i in range(3):
    ans3.append(str(a[i]))
    ans3.append(ans2[i])
ans3.append(str(a[3]))
ans3.append('=7')
ans4 =''.join(ans3)
print(ans4)

Buggy submission (verdict: Runtime Error):
a = list(input())
a = [int(i) for i in a]
for bit in range(1<<3):
    ans = a[0]
    ans1 = []
    for i in  range(3):
        mask = 1<<i
        if mask&bit:
            ans = (ans+a[i+1])
            ans1.append('+')
        else:
            ans += (ans-a[i+1])
            ans1.append('-')
    
    if ans==7:
        ans2 = ans1
ans3 = []
for i in range(3):
    ans3.append(str(a[i]))
    ans3.append(ans2[i])
ans3.append(str(a[3]))
ans3.append('=7')
ans4 =''.join(ans3)
print(ans4)
Problem p03612 (python)

Fixed submission:
N = int(input())
p = [int(i) for i in input().split()]
count = 0
i = 0
while i < N:
    if p[i]-1==i:
        if i+1 != N:
            if p[i+1]-1==i+1:
                i += 1
                count += 1
            else:
                count += 1
        else:
            count += 1
    i += 1

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
p = [int(i) for i in input().split()]
count = 0
i = 0
while i < N:
    if p[i]-1==i:
        if p[i+1]-1==i+1:
            i += 1
            count += 1
        else:
            count += 1
    i += 1

print(count)
Problem p03699 (python)

Fixed submission:
N = int(input())
s = []
for _ in range(N):
    inp = int(input())
    s.append(inp)
s = sorted(s)
sm = sum(s)
if sm%10!=0:
    ans = sm
else:
    for i in s:
        if i%10!=0:
            sm-=i
            break
    ans = sm
    if sm==sum(s):
        ans = 0
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
s = []
ans = []
for _ in range(N):
    inp = int(input())
    s.append(inp)
mx = 0
for bit in range(1<<N):
    sums = 0
    for i in range(N):
        mask = 1<<i
        if mask&bit:
            sums += s[i]
        
    if mx < sums:
        if sums%10!=0:
            mx = sums

print(answer)
Problem p03761 (python)

Fixed submission:
from collections import Counter
n = int(input())
s = [dict(Counter(list(input()))) for _ in range(n)]
st = []
kouho = s[0]
moji = sorted(kouho)
for i in moji: #１つめの辞書から１つ１つ取り出す
    mn = kouho[i]
    for j in s: #すべての辞書において確認
        if i in j: #もし辞書に入っているのであれば取る値の小さいほうをmnに格納
            mn = min(mn,j[i])
        else:
            mn = 0
    st.append(i*mn)

print(''.join(st))

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
s = list(input())
ans1 = dict(Counter(s))
for i in range(n-1):
    ans = {}
    s = list(input())
    ans2 = dict(Counter(s))
    for j in ans2:
        if j in ans1:
            ans[j] = min(ans1[j],ans2[j])
st = []
sorted(ans)
for i,j in zip(ans,ans.values()):
    st.append(i*j)
print(''.join(st))
Problem p03817 (python)

Fixed submission:
x = int(input())
ans = x // 11 * 2
if x % 11 >= 7:
    ans += 2
elif x % 11 == 0:
    pass
else:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
x = int(input())
if x%11 > 6:
    ans = x//11 *2 +2
elif x %11==0:
    1+1
else:
    ans = x//11 *2 +1
print(ans)

Buggy submission (verdict: Runtime Error):
x = int(input())
if x%11 > 6:
    ans = x//11 *2 +2
elif x %11==0:
    pass
else:
    ans = x//11 *2 +1
print(ans)
Problem p03838 (python)

Fixed submission:
x,y = map(int,input().split())
ans = 10**10
if x<=y: ans = min(ans,y-x)
if -x<=y: ans = min(ans,1+y-(-x))
if x<=-y: ans = min(ans,-y-x+1)
if -x<=-y: ans = min(ans,-y-(-x)+2)
print(ans)

Buggy submission (verdict: Runtime Error):
x,y = map(int,input().split())
mn = 10**10
if x<=y: ans = min(ans,y-x)
if -x<=y: ans = min(ans,1+y-(-x))
if x<=-y: ans = min(ans,-y-x+1)
if -x<=-y: ans = min(ans,-y-(-x)+1)
print(ans)
Problem p02713 (python)

Fixed submission:
k=int(input())

from math import gcd
 
res=0
 
for n in range(1,k+1):
    for i in range(1,k+1):
        for j in range(1,k+1):

            res+=gcd(gcd(n,i),j)

print(res)

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

from math import gcd
 
res=0
 
for n in range(1,k+1):
    for i in range(1,k+1):
        for j in range(1,k+1):

            res+=math.gcd(math.gcd(n,i),j)

print(res)

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

import math
 
res=0
 
for n in range(1,k+1):
    for i in range(1,k+1):
        for j in range(1,k+1):

            res+=math.gcd(gcd(n,i),j)

print(res)
Problem p02767 (python)

Fixed submission:

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

a = []
for pp in range(1,101):
    sum = 0
    for xx in x:
        sum += abs((xx-pp) ** 2)
    a.append(sum)

print(min(a))

Buggy submission (verdict: Runtime Error):

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

a = []
for pp in 100:
    sum = 0
    for xx in x:
        sum += abs((xx-pp) ** 2)
    a.append(sum)

print(min(a))
Problem p02817 (python)

Fixed submission:
s = input().split()
print(s[1] + s[0])

Buggy submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
 
for a,b in range(k):
	if a >=  1:
            a -= 1
  
	elif a < 1 and b >= 1:
            b -= 1
	else:
            break
        
print (a,b,end=" ")

Buggy submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
 
for a,b in range(k):
	if a >=  1:
        a -= 1
  
	elif a < 1 and b >= 1:
        b -= 1
	else:
        break
        
print (a,b,end=" ")

Buggy submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
 
for a,b in range(k):
	if a >=  1:
      a -= 1
  
	elif a < 1 and b >= 1:
      b -= 1
	else:
      break
        
print (a,b,end=" ")

Buggy submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
 
for a,b in range(k):
	if a >=  1:
    	a -= 1
  
	elif a < 1 and b >= 1:
		b -= 1
	else:
      	break
        
print (a,b,end=" ")

Buggy submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
 
for a,b in range(k):
	if a >=  1:
    	a -= 1
  
	elif a < 1 and b >= 1:
		b -= 1
	else:
      	break
        
print (a,b,end=" ")

Buggy submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
 
for a,b in range(k):
	if a >=  1:
    	a -= 1
  
	elif a < 1 and b >= 1:
		b -= 1
        
print (a,b)
Problem p02885 (python)

Fixed submission:
A, B = list(map(int, input().split())) 
if 2*B >= A:
  print(0)
else:
  print(A-(2*B))

Buggy submission (verdict: Runtime Error):
A, B = int(input())
if 2*B >= A:
  print(0)
else:
  print(A-(2*B))

Buggy submission (verdict: Runtime Error):
A, B = int(input().split())
if 2*B >= A:
  print(0)
else:
  print(A-(2*B))
Problem p02945 (python)

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

c=[a+b, a-b, a*b]
print (max(c))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())

count = [a+b, a-b, a*b]
print (max(count))
Problem p03455 (python)

Fixed submission:
#2つの正整数a, bの積の偶奇判定
a,b = map(int,input().split())

if (a*b) % 2 == 0:
    print ("Even")
else:
    print ("Odd")

Buggy submission (verdict: Runtime Error):
#2つの正整数a, bの積の偶奇判定
a,b = map(int,input().split())

if (a*b) % 2 == 0:
    print (Even)
else:
    print(Odd)

Buggy submission (verdict: Runtime Error):
#2つの正整数a, bの積の偶奇判定
a,b = map(int,input().split()))

c = a*b
if c % 2 == 0:
    print (Even)
else:
    print(Odd)

Buggy submission (verdict: Runtime Error):
#2つの正整数a, bの積の偶奇判定
a,b = list(map(int,input().split()))

c = a*b
if c % 2 == 0:
    print (Even)
else:
    print(Odd)

Buggy submission (verdict: Runtime Error):
#2つの正整数a, bの積の偶奇判定
a = list(map(int,input().split()))

c = a*b
if c % 2 == 0:
    print (Even)
else:
    print(Odd)
Problem p03457 (python)

Fixed submission:

N = int(input())

for i in range(N):
    t_i, x_i, y_i = map(int, input().split()) 

    if (x_i+y_i)> t_i:
        print("No")
        exit()
    elif (x_i+y_i) %2 != t_i%2 :
        print("No")
        exit()

print("Yes")

Buggy submission (verdict: Runtime Error):

N = int(input())

t_prev, x_prev, y_prev=0

for i in range(N):
    t_i, x_i, y_i = map(int, input().split()) 

    if (x_i+y_i)> t_i:
        print("No")
        exit()
    elif (x_i+y_i) %2 != t_i%2 :
        print("No")
        exit()
    #1個前のループと比較
    elif x_i-x_prev > t_i-t_prev or y_i-y_prev>t_i-t_prev:
        print('No')
        exit()

    t_prev=t_i
    x_prev=x_i
    y_prev=y_i

print("Yes")
Problem p03471 (python)

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

for a in range(0, n+1):
    for b in range(0, n-a+1):
        c = n-(a+b)
        if (10000*a + 5000*b + 1000*c) == y:
            print(a, b, c)
            exit()

print(-1, -1, -1)

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

for a in range(0, n+1):
    for b in range(0, n-a+1):
        c = n-(a+b)+1
        if (10000*a + 5000*b + 1000*c) == y:
            print(a, b, c)
            break()

print(-1, -1, -1)

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

for a in range(0, n+1):
    for b in range(0, n-a+1):
        c = n-(a+b)+1
        if (10000*a + 5000*b + 1000*c) == y:
                print(a, b, c)
                break()

print(-1, -1, -1)
Problem p03493 (python)

Fixed submission:
#1,2,3の番号がついた3マスに，それぞれ"0"か"1"がある．"1"のマスはいくつあるか

s = input()
a = [int(c) for c in s]
print (a[0]+a[1]+a[2])

Buggy submission (verdict: Runtime Error):
#1,2,3の番号がついた3マスに，それぞれ"0"か"1"がある．"1"のマスはいくつあるか

s = input()
a = [int(c) for c in s]
print (a[1]+a[2]+a[3])

Buggy submission (verdict: Runtime Error):
#1,2,3の番号がついた3マスに，それぞれ"0"か"1"がある．"1"のマスはいくつあるか

res = sum(list(map(int(s))))
print (res)

Buggy submission (verdict: Runtime Error):
#1,2,3の番号がついた3マスに，それぞれ"0"か"1"がある．"1"のマスはいくつあるか

s1,s2,s3 = map(int,input().split())

res = (s1 + s2 + s3)
print (res)

Buggy submission (verdict: Runtime Error):
#1,2,3の番号がついた3マスに，それぞれ"0"か"1"がある．"1"のマスはいくつあるか

s1,s2,s3 = a = map(int,input().split())

res = (s1+s2+s3)
print (res)
Problem p03854 (python)

Fixed submission:
s = input()
a = 0
t = ("")

while a < len(s):
    if s[a+0:a+5] == ("dream") and s[a+5+0:a+5+2] != ("er"):
        a += 5

    elif s[a+0:a+5] == ("dream") and s[a+5+0:a+5+2] == ("er"):
        if s[a+7+0:a+7+3] != ("ase"):
            a += 7

        elif s[a+7+0:a+7+3] == ("ase") and s[a+10+0:a+10+1] != ("r"):
            a += 10

        elif s[a+7+0:a+7+3] == ("ase") and s[a+10+0:a+10+1] == ("r"):
            a += 11

    elif s[a+0:a+5] == ("erase") and s[a+5+0:a+5+1] != ("r"):
        a += 5

    elif s[a+0:a+5] == ("erase") and s[a+5+0:a+5+1] == ("r"):
        a += 6

    else:
        break

if a == len(s):
    print("YES")
else:
    print("NO")

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

rtn="dream"and "dreamer" and "eraser" and "erase" in s #""内は探したい文字列，戻り値はtrue/false

    if (rtn) == True:
        print(YES)
    else:
        print(NO)
Problem p02761 (python)

Fixed submission:
n,m =map(int,input().split())
l= [11]*n
for _ in range(m):
    s,c=map(int,input().split())
    if l[s-1] != str(c) and l[s-1] != 11:
        print(-1)
        exit()
    else:
        l[s-1] = str(c)
for index,i in enumerate(l):
    if i == 11:
        if n>1 and (index==0):
            l[index] = '1'
        else:
            l[index] = '0'
if n>=2:
    if l[0] == '0' or l[0]==l[1]=='0':
        print(-1)
        exit()
print(''.join(l))

Buggy submission (verdict: Runtime Error):
n,m =map(int,input().split())
if n <m:
    print(-1)
else:
    l= [11]*m
    for _ in range(m):
        s,c=map(int,input().split())
        if l[s-1] != str(c) and l[s-1] != 11:
            print(-1)
            exit(0)
        else:
            l[s-1] = str(c)
    for index,i in enumerate(l):
        if i == 11:
            l[index] = '0'
    if n>=2:
        if l[0] == '0' or l[0]==l[1]=='0':
            print(-1)
            exit(0)
    print(''.join(l))
Problem p03067 (python)

Fixed submission:
a,b,c=map(int,input().split())
print('Yes' if a<c<b or a>c>b else 'No')

Buggy submission (verdict: Runtime Error):
input()
S=input()
k=int(input())
for s in S:print(s if s == S[k-1] else '*',sep='')

Buggy submission (verdict: Runtime Error):
input()
S=input()
k=int(input())
for s in S:print(s if s == S[k-1] else '*',end='')

Buggy submission (verdict: Runtime Error):
input()
S=input()
k=int(input())
for s in S:print(s if s == s[k+1] else '*',end='')
Problem p03068 (python)

Fixed submission:
n=int(input())
s=input()
k=int(input())
a=''
for i in range(n):
    if s[i] != s[k-1]:
        a+='*'
    else:
        a+=s[i]
print(a)

Buggy submission (verdict: Runtime Error):
input()
S=input()
k=int(input())
for s in S:print(s if s == S[k+1] else '*',end='')

Buggy submission (verdict: Runtime Error):
input()
s=input()
k=int(input())
for i in s:print(s if s[i] == s[k+1] else '*',end='')
Problem p03125 (python)

Fixed submission:
a,b=map(int,input().split())
print(b-a if b%a else a+b)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
l=[]
for _ in range(n):
    k,*s=input().split()
    l+=s
se=set(l)
a=0
for i in se:
    c=l.count(i)
    if c==n:
        a+=1
print(a)
Problem p03408 (python)

Fixed submission:
n=int(input())
b=[input() for _ in range(n)]
m=int(input())
r=[input() for _ in range(m)]
l=list(set(b))
a=[]
for s in l:
    a.append(b.count(s) - r.count(s))

print(max(max(a),0))

Buggy submission (verdict: Runtime Error):
n=int(input())
b=[int(input()) for _ in range(n)]
m=int(input())
r=[int(input()) for _ in range(m)]
l=list(set(b))
a=[]
for s in l:
    a.append(b.count(s) - r.count(b))
print(max(max(a),0))
Problem p03635 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
m = int(input())
print((n-1)*(m-1))
Problem p02982 (python)

Fixed submission:
import math
 
n,d=map(int,input().split())
x=[]
for j in range(n):
	tmp=list(map(int,input().split()))
	x.append(tmp)
 
count=0
for i in range(n-1):
	for j in range(i+1,n):
		ans=0
		for (a,b) in zip(x[i],x[j]):
			ans+=(a-b)**2
		if math.sqrt(ans).is_integer():
			count+=1
 
print(count)

Buggy submission (verdict: Runtime Error):
import math

n,d=map(int,input().split())
x=[]
for j in range(n):
tmp=list(map(int,input().split()))
x.append(tmp)

count=0
for i in range(n-1):
for j in range(i+1,n):
ans=0
for (a,b) in zip(x[i],x[j]):
ans+=(a-b)**2
if math.sqrt(ans).is_integer():
count+=1

print(count)
Problem p03000 (python)

Fixed submission:
n,x=map(int,input().split())
l=list(map(int,input().split()))

d=0
for i in range(n+1):
    if (i>n-1)and(d<=x):
        i+=1
        break
    if d>x:
        break
    d=d+l[i]

print(i)

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

d=0
for i in range(n+1):
    if d>x:
        break
    d=d+l[i]

print(i)
Problem p03029 (python)

Fixed submission:
a,p=map(int,input().split())
print((3*a+p)//2)

Buggy submission (verdict: Runtime Error):
a,p=int(input().split())
print((3*a+p)//2)

Buggy submission (verdict: Runtime Error):
a,p=input().split()
print((3*a+p)//2)
Problem p03060 (python)

Fixed submission:
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
ans=0
for i in range(n):
    if v[i]-c[i]>0:
        ans+=v[i]-c[i]

print(ans)

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

print(ans)
Problem p02885 (python)

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

if A[0] < A[1] * 2:
    print(0)
else:
    print(A[0] - 2*A[1])

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

if A < B * 2:
    print(0)
else:
    print(A - 2*B)
Problem p03846 (python)

Fixed submission:
import numpy as np
import math
import sys
def sinput(): return sys.stdin.readline()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(): return list(imap())
def farr(): return list(fmap())
def sarr(): return sinput().split()

n = int(input())
A = iarr()
s = set(A)
if sum(A)==2*sum(s): print(pow(2, len(A)//2, int(1e9+7)))
else: print(0)

Buggy submission (verdict: Runtime Error):
import numpy as np
import math
import sys
def sinput(): return sys.stdin.readline()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(): return list(imap())
def farr(): return list(fmap())
def sarr(): return sinput().split()

n = int(input())
A = iarr()
s = set(A)
if sum(A)==2*sum(s): print(pow(2, l//2, int(1e9+7)))
else: print(0)
Problem p03965 (python)

Fixed submission:
import numpy as np
import sys
def sinput(): return sys.stdin.readline()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(): return list(imap())
def farr(): return list(fmap())
def sarr(): return sinput().split()

s = input()
p = g = ans = 0
for i in s:
    if i=='p':
        if p < g: p += 1
        else: ans -= 1; g += 1
    if i=='g':
        if p < g: ans += 1; p += 1
        else: g += 1
print(ans)

Buggy submission (verdict: Runtime Error):
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const long double PI = (acos(-1));
#define rep(i, x, n) for (int i = x; i < (int)(n); i++)
#define sc(x) scanf("%d",&x)
#define scll(x) scanf("%lld",&x)
int main(){
    string s; cin >> s;
    int n = s.size(), p = 0, g = 0, ans = 0;
    rep(i, 0, n){
        if (s[i]=='p'){
            if (p < g) p++;
            else ans--, g++;
        }else {
            if (p < g) ans++, p++;
            else g++;
        }
    }
    cout << ans << endl;
    return 0;
}