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

Fixed submission:
l = int(input())
s = input()
s_dict = {}
l = len(s)
for i in range(l):
    if not s[i] in s_dict:
        s_dict[s[i]] = 1
    else:
        s_dict[s[i]] += 1
ans = 1
for v in s_dict.values():
    if v == 1:
    	ans *= 2
    else:
        ans *= v+1

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

Buggy submission (verdict: Runtime Error):
l = int(input())
s = input()
s_dict = {}
for i in range(0, len(s)):
    if not s[i] in s_dict:
        s_dict[s[i]] = 1
    else:
        s_dict[s[i]] += 1
ans = 2**l
for v in s_dict.values():
    if not v == 1:
        ans *= (v+1)/2**v

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

Buggy submission (verdict: Runtime Error):
l = int(input())
s = input()
s_dict = {}

for i in range(0, len(s)):
    if not s[i] in s_dict:
        s_dict[s[i]] = 1
    else:
        s_dict[s[i]] += 1

ans = 2**l
for v in s_dict.values():
    if not v == 1:
        ans =ans* (1-1/2**v)

print(int(ans-1))

Buggy submission (verdict: Runtime Error):
l = int(input())
s = input()
s_dict = {}

for i in range(0, len(s)):
    if not s[i] in s_dict:
        s_dict[s[i]] = 1
    else:
        s_dict[s[i]] += 1

ans = 2**l
for v in s_dict.values():
    if not v == 1:
        ans =ans* (1-1/2**v)

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

Buggy submission (verdict: Runtime Error):

l = int(input())
s = input()
s_dict = {}

for i in range(0, len(s)):
    if not s[i] in s_dict:
        s_dict[s[i]] = 1
    else:
        s_dict[s[i]] += 1

ans = 2**l
for v in s_dict.values():
    if not v == 1:
        ans *= ((2**v-1)/2**v)

ans -= 1
print(int(ans%(10**9+7)))
Problem p02957 (python)

Fixed submission:
# | A - K | = | B - K |
A, B = map(int, input().split())

up = (A**2-B**2)
down = (2 * ( A-B ))

if up % down == 0:
	print(int(up/down))
else:
	print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
# | A - K | = | B - K |
raw = raw_input().split()
A = int(raw[0])
B = int(raw[1])

up = (A**2-B**2)
down = (2 * ( A-B ))

if up % down == 0:
	print(up/down)
else:
	print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
# | A - K | = | B - K |
in = raw_input().split()
A = in[0]
B = in[1]

K = (A**2-B**2) / 2 / ( A-B )

if isinstance(K, int):
	print(K)
else
	print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
# | A - K | = | B - K |
in = raw_input().split()
A = in[0]
B = in[1]

K = (A**2-B**2) / 2 / ( A-B )
Problem p02957 (python)

Fixed submission:
a, b = (int(i) for i in input().split())
 
if a % 2 != b % 2:
  print("IMPOSSIBLE")
else:
  print(int((a+b) / 2))

Buggy submission (verdict: Runtime Error):
a, b = (int(i) for i in input().split())
 
if a % 2 != b % 2:
  return "IMPOSSIBLE"
else:
  return int((a+b) / 2)

Buggy submission (verdict: Runtime Error):
a = int(input().split()[0])
b = int(input().split()[1])

for i in range(0, 10**9):
  if (a-i) == (b-i):
    return i
return "IMPOSSIBLE"
Problem p02958 (python)

Fixed submission:
N = int(input())
num_list = [int(_) for _ in input().split()]
 
count = 0
 
for i in range(0, N):
  if num_list[i] != i+1:
    count += 1
    
if count <= 2:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
a = [for int(i) in input.split()]
 
count = 0
for i in range(0, len(a)-1):
  if a[i] > a[i+1]:
    count += 1
    if count > 2:
      print('NO')
      break
  
  if i == len(a)-1:
    print('YES')

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

count = 0
for i in range(0, len(list)-1):
  if list[i] < list[i+1]:
    count += 1
  	
if count > 2:
  print('NO')
else:
  print('YES')
Problem p02957 (python)

Fixed submission:
import sys

i = list(map(int, input().split()))

k = (i[0] + i[1]) / 2

print(int(k), end="") if int(k) == k else print("IMPOSSIBLE", end="")

Buggy submission (verdict: Runtime Error):
import sys


a = int(sys.argv[1])
b = int(sys.argv[2])

k = (a + b) / 2

print(int(k), end="") if int(k) == k else print("IMPOSSIBLE", end="")

Buggy submission (verdict: Runtime Error):
import sys


a = int(sys.argv[1])
b = int(sys.argv[2])

k = (a + b) / 2

print(int(k)) if int(k) == k else print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
import sys


a = sys.argv[1]
b = sys.argv[2]

k = (a + b) / 2

print(k) if int(k) == k else print("IMPOSSIBLE")
Problem p03102 (python)

Fixed submission:
n, m, c = [int(i) for i in input().split(' ')]
b = [int(i) for i in input().split(' ')]
 
r = 0
for i in range(n):
  a = [int(i) for i in input().split(' ')]
  s = 0
  for j in range(m):
    s += a[j] * b[j]
  s += c
  if s > 0:
    r += 1
  
print(r)

Buggy submission (verdict: Runtime Error):
n, m, c - [int(i) for i in input().split(' ')]
b = [int(i) for i in input().split(' ')]

r = 0
for i in range(n):
  a = [int(i) for i in input().split(' ')]
  s = 0
  for j in range(m):
    s += a[j] * b[j]
  s += c
  if s > 0:
    r += 1
  
print(r)
Problem p03103 (python)

Fixed submission:
n,m=[int(i) for i in input().split(' ')]
class P:
  def __init__(self, a, b):
    self.a = a
    self.b = b

p = []
for i in range(n):
  a,b=[int(i) for i in input().split(' ')]
  p.append(P(a, b))

  
mon = 0
p.sort(key=lambda x: x.a)
for e in p:
  if m <= e.b:
    mon += e.a * m
    m = 0
  else:
    m -= e.b
    mon += e.a * e.b

print(mon)

Buggy submission (verdict: Runtime Error):
n,m=[int(i) for i in input().split(' ')]
class P:
  def __init__(self, a, b)
  	self.a = a
    self.b = b

p = []
for i in range(n):
  a,b=[int(i) for i in input().split(' ')]
  p.append(P(a, b))

  
mon = 0
p.sort(key=lambda x: x.a)
for e in p:
  if m <= e.b:
    mon += e.q * m
    m = 0
  else:
    m -= e.b
    mon += e.a * e.b

print(mon)
Problem p03126 (python)

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

c = []
d = []
for i in range(n):
    a = [int(x) for x in input().split(" ")]
    if i == 0:
        c = a[- a[0]:]
    else:
        b = a[- a[0]:]
        for ce in c:
            if ce in b:
                 d.append(ce)
        c = d
        d = []

print(len(c))

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

c = []
d = []
for i in range(n):
	a = [int(x) for x in input().split(" ")]
	if i == 0:
        c = a[- a[0] + 1:]
    else:
        b = a[- a[0]:]
        for ce in c:
            if ce in b:
                 d.append(ce)
        c = d
        d = []

print(len(c))
Problem p02957 (python)

Fixed submission:
A,B=map(int,input().split())
def asf(A,B):
  same_num=(A+B)/2
  if same_num%1==0:
  	return int(same_num)
  else:
    return "IMPOSSIBLE"
print(asf(A,B))

Buggy submission (verdict: Runtime Error):
A,B=int(input()).split()
def asf(A,B):
  same_num=(A+B)/2
  k=same_num-min(A,B)
  return k
print(asf(A,B))
Problem p03037 (python)

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

L=[0]*M
R=[0]*M

for i in range(M):
  L[i],R[i]=map(int,input().split())

def prison(N,M,L,R):
  max_val=min(R)
  min_val=max(L)
  num=max_val-min_val+1
  if num<=0:
    num=0
  return(num)

print(prison(N,M,L,R))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
L=[0]*M
R=[0]*M
for i range(M):
  L[i],R[i]=map(int,input().split())

def prison(N,M,L,R):
  count=0
  for n in range(N):
    num_of_truth=0
    for l,r in zip(L,R):
      if l<=(n+1)<=r:
        num_of_truth+=1
    if num_of_truth==M:
      count+=1
  return count
 
print(prison(N,M,L,R))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
L=[0]*M
R=[0]*M
for i range(M):
  L[i],R[i]=map(int,input().split())

def prison(N,M,L,R):
    count=0
    for n in range(N):
        num_of_truth=0
        for l,r in zip(L,R):
            if l<=(n+1)<=r:
                num_of_truth+=1
        if num_of_truth==M:
            count+=1
    return count

print(prison(N,M,L,R))
Problem p03060 (python)

Fixed submission:
N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
def rescale(V,C):
  price=0
  for v,c in zip(V,C):
    if v>c:
      price=price+v-c
  return price 
print("{}".format(rescale(V,C)))

Buggy submission (verdict: Runtime Error):
N=int(input().split())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
def rescale(V,C):
  price=0
  for v,c in zip(V,C):
    if v>c:
      price=price+v-c
  return price 
print("{}".format(rescale(V,C)))
Problem p03457 (python)

Fixed submission:
N=int(input())
t=[0]*N
x=[0]*N
y=[0]*N
for i in range(N):
  t[i],x[i],y[i]=map(int,input().split())
  
def traveling(t,x,y):
  time_i=0
  x_i=0
  y_i=0
  for i,time in enumerate(t):
    time_i=time-time_i
    x_i=x[i]-x_i
    y_i=y[i]-y_i
    z=x_i+y_i
    if (time_i-z)%2!=0 or z>time_i:
      return "No"
    time_i=time
    x_i=x[i]
    y_i=y[i]
  return "Yes"
    
print("{}".format(traveling(t,x,y)))

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

N=int(input())
t=[0]*N
x=[0]*N
y=[0]*N
for i in range(N):
  t[i],x[i],y[i]=map(int,input().split())
  
def traveling(t,x,y):
  time_i=0
  for i,time in enumerate(t):
    time_i=time-time_i
    z=x[i]+y[i]
    if (t-z)%2==0:
      return "Yes"
    else:
      return "No"
    time_i=time
    
print("{}".format(traveling(t,x,y)))
Problem p02995 (python)

Fixed submission:
a,b,c,d = map(int,input().split())
import math
#最大公約数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

 #最小公倍数
def lcm(a,b):
    return a*b//gcd(a,b)

A = (a-1)//c + (a-1)//d - (a-1)//lcm(c,d)
B = b//c + b//d -b//lcm(c,d)

print((b-B)-((a-1)-A))

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())import math
warareru = b-a+1
x = warareru//c
y = warareru//d
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

 #最小公倍数
def lcm(a,b):
    return a*b//gcd(a,b)
z = warareru//lcm(c,d)
print(warareru-(x+y-z))
Problem p03074 (python)

Fixed submission:
n, k = map(int, input().split())
s = input()
n = len(s)

if n == 1:
    print(1)
    exit(0)

l = []
if s[0] == "0":
    l.append(0)

temp = 1
for i in range(1, n):
    if s[i] == s[i - 1]:
        temp += 1
        if i == n - 1:
            l.append(temp)
    else:
        l.append(temp)
        temp = 1
        if i == n - 1:
            l.append(temp)

if s[-1] == "0":
    l.append(0)

ans = 0

b = []
b.append(l[0])
for i in range(1, len(l)):
    b.append(b[-1] + l[i])


if 2 * k + 1 > len(l) - 1:
    print(b[len(l) - 1])
    exit(0)
else:
    ans = b[2 * k]


for i in range(1, len(l)):
    if i * 2 + 2 * k > len(l) - 1:
        break
    ans = max(ans, b[min(i * 2 + 2 * k, len(l) - 1)] - b[i * 2 - 1])
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()
n = len(s)

if n == 1:
    print(1)
    exit(0)

l = []
if s[0] == "0":
    l.append(0)

temp = 1
for i in range(1, n):
    if s[i] == s[i - 1]:
        temp += 1
        if i == n - 1:
            l.append(temp)
    else:
        l.append(temp)
        temp = 1

if s[-1] == "0":
    l.append(0)

ans = 0
if 2 * k + 1 > len(l):
    sum(l[i * 2 : min(i * 2 + 2 * k + 1, len(l)) : 1])

b = []
b.append(l[0])
for i in range(1, len(l)):
    b.append(b[-1] + l[i])


for i in range((len(l) + 1)):
    if i * 2 + 2 * k + 1 > len(l):
        break
    ans = max(ans, b[min(i * 2 + 2 * k + 1, len(l))] - b[i * 2 - 1])
print(ans)
Problem p03719 (python)

Fixed submission:
a,b,c=map(int,input().split());print(("No","Yes")[a<=c<=b])

Buggy submission (verdict: Runtime Error):
a,b,c=int(input().split());print(("No","Yes")[a<=c<=b])
Problem p03738 (python)

Fixed submission:
a=(int)(input())-(int)(input());print(a>0 and'GREATER'or a<0 and'LESS'or'EQUAL')

Buggy submission (verdict: Runtime Error):
a=input();b=input();print a<b and'LESS'or a>b and'GREATER'or'EQUAL'

Buggy submission (verdict: Runtime Error):
a=(int)(input()-input());print(a>0 and'GREATER'or a<0 and'LESS'or'EQUAL')

Buggy submission (verdict: Runtime Error):
a=int(input()-input());print(a>0 and'GREATER'or a<0 and'LESS'or'EQUAL')

Buggy submission (verdict: Runtime Error):
a=input()-input();print(a>0 and'GREATER'or a<0 and'LESS'or'EQUAL')
Problem p03740 (python)

Fixed submission:
a,b=map(int,raw_input().split());print abs(a-b)<2and'Brown'or'Alice'

Buggy submission (verdict: Runtime Error):
a,b=map(int,raw_input().split());print(abs(a-b)<2and'Brown'or'Alice')
Problem p02993 (python)

Fixed submission:
a=list(input())
flag=True
for i in range(len(a)-1):
  if a[i]==a[i+1]:
    flag=False
print("Good" if flag else "Bad")

Buggy submission (verdict: Runtime Error):
a=list(input())
flag=True
for i in range(len(a)-1):
  if a[i]==a[i+1]:
    print("Bad")
    return
print("Good")
Problem p03471 (python)

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

a = 0  # 1000
b = 0  # 5000
c = 0  # 10000

c = y//10000
b = (y - c*10000)//5000
a = (y - c*10000 - b*5000)//1000

flag = True

while (a+b+c) <= n:
    num = a+b+c
#    print(num)
#    print(c,b,a)
    if num == n:
        flag = False
        break
    else:
        if num + 9 <= n and c > 0:
            c -= 1
            a += 10
            continue
        elif num + 4 <= n and b > 0:
            b -= 1
            a += 5
            continue
        elif num + 1 <= n and c > 0:
            c -= 1
            b += 2
            continue
        else:
            break
if flag:
    print(-1, -1, -1)
else:
    print(c, b, a)

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

a = 0  # 1000
b = 0  # 5000
c = 0  # 10000

c = y//10000
b = (y - c*10000)//5000
a = (y - c*10000 - b*5000)//1000

#print(c,b,a)
flag = True

while (a+b+c) <= n:
    num = a+b+c
    if num == n:
        print(c, b, a)
        flag = False
        break
    else:
        if num + 9 <= n:
            c -= 1
            a += 10
        elif num + 4 <= n:
            b -= 1
            a += 5
        elif num + 1 <= n:
            c -= 1
            b += 2
        if c < 0 or b < 0:
            break

if flag:
   # print(-1, -1, -1)
Problem p02957 (python)

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

if (A+B) % 2 == 0 and A != B:
    print((A+B)//2)
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):

A = input()
B = input()
A = int(A)
B = int(B)

if (A+B) % 2 == 0:
    print((A+B)//2)
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):

A = input()
B = input()
A = int(A)
B = int(B)
K = (A+B) / 2
K = int(K)

if K % 2 == 0:
    print(K)
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):

A = input()
B = input()
A = int(A)
B = int(B)
K = (A+B) / 2

if K % 2 == 0:
    print(K)
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 29 14:29:48 2019

@author: re
"""

A = int(A)
B = int(B)


K = (A+B) / 2
K = int(K)

if abs(A-K) == abs(B-K):
    print(K)
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 29 14:29:48 2019

@author: re
"""

A = input()
B = input()
A = int(A)
B = int(B)


K = (A+B) / 2
K = int(K)

if abs(A-K) == abs(B-K):
    print(K)
else:
    print("IMPOSSIBLE")
Problem p03007 (python)

Fixed submission:
import bisect
n=int(input())
a=[int(i) for i in input().split()]
a.sort()
ans=[]
x=bisect.bisect_left(a, 0)
m=a[:x]
p=a[x:]

if n==2 and len(p)==2:
    print(p[1]-p[0])
    print(p[1],p[0])
    
    exit()
if m==[]:
    m+=[p[0]-p[-1]]
    ans+=[[p[0],p[-1]]]
    del p[0]
    del p[-1]

if p==[]:
    p+=[m[-1]-m[0]]
    ans+=[[m[-1],m[0]]]
    del m[-1]
    del m[0]

while len(p)!=1:

    m+=[m[0]-p[0]]
    ans+=[[m[0],p[0]]]
    del p[0]
    del m[0]
cnt=p[0]
for i in m:
    ans+=[[cnt,i]]
    cnt-=i
print(cnt)
for i,j in ans:print(i,j)

Buggy submission (verdict: Runtime Error):
import bisect
n=int(input())
a=[int(i) for i in input().split()]
a.sort()
ans=[]
x=bisect.bisect_left(a, 0)
m=a[:x]
p=a[x:]
if m==[]:
    m+=[p[0]-p[-1]]
    ans+=[[p[0],p[-1]]]
    del p[0]
    del p[-1]

if p==[]:
    p+=[m[-1]-m[0]]
    ans+=[[m[-1],m[0]]]
    del m[-1]
    del m[0]


while len(p)!=1:

    m+=[m[0]-p[0]]
    ans+=[[m[0],p[0]]]
    del p[0]
    del m[0]
cnt=p[0]
for i in m:
    ans+=[[cnt,i]]
    cnt-=i
print(cnt)
for i,j in ans:print(i,j)

Buggy submission (verdict: Runtime Error):
import itertools
n=int(input())
a=[int(i) for i in input().split()]
a.sort()
for i in range(n-2):
    x,y=a[i],a[i+1]
    del a[i:i+2]
    a+=[x-y]
    a.sort()
    print(x,y)
print(a[1],a[0])
Problem p03074 (python)

Fixed submission:
n,k=map(int,input().split())
s=input()
cnt=1
siten=s[0]
onezero=[0]
for i in range(n-1):
    if s[i]!=s[i+1]:
        onezero+=[cnt]
    cnt+=1

onezero+=[cnt]

x=len(onezero)

if siten=='1':
    onezero+=[onezero[-1]]*2
    t=int(x/2-1)
    if k>=t:
        print(n)
    else:
        ans=[0]
        for i in range(t-k+2):
            ans+=[onezero[2*(i+k)+1]-onezero[2*i]]
        print(max(ans))

else:
    onezero+=[onezero[-1]]
    t=int(x/2)
    if k>=t:
        print(n)
    else:
        ans=[onezero[2*k]]
        for i in range(t-k):
            ans+=[onezero[2*(i+k+1)]-onezero[2*i+1]]
        print(max(ans))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
cnt=0
siten=s[0]
onezero=[]
for i in range(n-1):
    if s[i:i+2]=='01':
        cnt+=1
        onezero+=[cnt]
        cnt=0
        
    else:
        cnt+=1
        if n-2==i:
            cnt+=1
            onezero[-1]+=cnt

ans=[1]
for i in range(max(1,len(onezero)-k+1)):
    #print(onezero[i:i+k])
    if siten=='0':
        ans+=[sum(onezero[i:i+k+1])-1]
    else:
        ans+=[sum(onezero[i:i+k])]

print(max(ans))
Problem p03076 (python)

Fixed submission:
import math
a=[input() for i in range(5)]
nzero=['99999']
for i in a:
    if i[-1]!='0':
        nzero+=[i[-1]]
ans=sum([math.ceil(int(i)/10)*10 for i in a])
h=min(nzero)

if h=='99999':
    print(ans)
else:
    print(ans-10+int(h))

Buggy submission (verdict: Runtime Error):
import math
a=[input() for i in range(5)]
si=min([a[i][-1] for i in range(5)if a[i][-1]!='0'])
ans=[math.ceil(int(i)/10)*10 for i in a]
print(sum(ans)+int(si)-10)
Problem p03086 (python)

Fixed submission:
s=input()
at='ACGT'
cnt=0
ans=[0]
for i in s:
    if i in at:
        cnt+=1
        ans+=[cnt]
    else:

        cnt=0
ans.sort()
print(ans[-1])

Buggy submission (verdict: Runtime Error):
s=input()
at='ACGT'
cnt=0
ans=[]
for i in s:
    if i in at:
        cnt+=1
    else:
        ans+=[cnt]
        cnt=0
print(max(ans))
Problem p03231 (python)

Fixed submission:
def gcd(a, b):
    while b:
            a,b = b,a%b
    return a

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

def atwo(n,m,s,t):
    l=lcm(n,m)
    gc=gcd(n,m)
    if s[0::n//gc]==t[0::m//gc]:
        print(l)
        exit()
    else:
        print(-1)
        exit()

n,m=map(int,input().split())
print(atwo(n,m,input(),input()))

Buggy submission (verdict: Runtime Error):
import math

def lcm(x,y):
    return (x * y) // math.gcd(x, y)
def atwo(n,m,s,t):
    l=lcm(n,m)
    a=l/n
    b=l/m
    for i in range(n):
        for j in range(m):
            if a*i==b*j:
                if s[i]==t[j]:
                    pass
                else:
                    l=-1

    return l

n,m=map(int,input().split())
print(atwo(n,m,input(),input()))
Problem p03361 (python)

Fixed submission:
hw=[int(i) for i in input().split()]
s=['.'+input()+'.' for i in range(hw[0])]
s=['.'*(hw[1]+2)]+s+['.'*(hw[1]+2)]
for i in range(1,hw[0]+1):
    for n in range(1,hw[1]+1):
        if s[i][n]=='#':
            if s[i+1][n]==s[i][n+1]==s[i-1][n]==s[i][n-1]=='.':
                print('No')
                exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
hw=[int(i) for i in input().split()]
s=['.'+input()+'.' for i in range(hw[0])]
s=['.'*(hw[1]+2)]+s+['.'*(hw[1]+2)]
for i in range(1,hw[1]+1):
    for n in range(1,hw[0]+1):
        if s[i][n]=='#':
            if s[i+1][n]=='.' and s[i][n+1]=='.' and s[i-1][n]=='.' and s[i][n-1]=='.':
                print('No')
                exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
def g2():
    hw=[int(i) for i in input().split()]
    s=['.'+input()+'.' for i in range(hw[0])]
    s=['.'*(hw[1]+2)]+s+['.'*(hw[1]+2)]
    for i in range(1,hw[1]+1):
        for n in range(1,hw[0]+1):
            if s[i][n]=='#':
                if s[i+1][n]=='.' and s[i][n+1]=='.' and s[i-1][n]=='.' and s[i][n-1]=='.':
                    print('No')
                    exit()
    print('Yes')
    exit()
print(g2())

Buggy submission (verdict: Runtime Error):
def g2():
    hw=[int(i) for i in input().split()]
    s=['.'+input()+'.' for i in range(hw[0])]
    s=['.'*(hw[1]+2)]+s+['.'*(hw[1]+2)]
    for i in range(1,hw[1]+1):
        for n in range(1,hw[0]+1):
            if s[i][n]=='#':
                if s[i+1][n]=='.' and s[i][n+1]=='.' and s[i-1][n]=='.' and s[i][n-1]=='.':
                    print('No')
                    exit()
    print('Yes')
    exit()
print(g2())
Problem p02957 (python)

Fixed submission:
AB = list(map(int, input().split()))
 
A = int(AB[0])
B = int(AB[1])
 
if A%2 == 0 and B%2 == 0:
    print(int((A+B)/2))
elif A%2 == 1 and B%2 == 1:
    print(int((A+B)/2))
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
AB = int(input().split())

A = AB[0]
B = AB[1]

if A%2 == 0 and B%2 == 0:
  print((A+B)/2)
  
elif A%2 == 1 and B%2 ==1:
  print((A+B)/1)
  
else:
  print("IMPOSSIBLE")
Problem p02957 (python)

Fixed submission:
a, b = map(int, input().split())
c = a + b
if c % 2:
    print('IMPOSSIBLE')
else:
    print(int(c / 2))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = a + b
if c % 2 == 1:
    print('IMPOSSIBLE')
else:
    print(int(c / 2))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = a + b
if c % 2:
    print('IMPOSSIBLE')
else:
    print(int(c / 2))
Problem p02957 (python)

Fixed submission:
a,b=map(int,input().split())
if (a+b)%2 == 0:
    print((a+b)//2)
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if (a+b)%2 == 0:
    print(a+b)/2
else:
    print("IMPOSSIBLE")
Problem p02957 (python)

Fixed submission:
_l = input().split()
_s = sum([int(i) for i in _l])
if _s % 2 != 0:
    print('IMPOSSIBLE')
else:
    print(int(_s / 2))

Buggy submission (verdict: Runtime Error):
_l = '998244353 99824435'
_s = sum([int(i) for i in _l])
if _s % 2 != 0:
    print('IMPOSSIBLE')
else:
    print(_s / 2)

Buggy submission (verdict: Runtime Error):
_l=input().split()
_s=sum([int(i) for i in _l])
if _s % 2 != 0:
  print('IMPOSSIBLE')
else:
  print(s/2)

Buggy submission (verdict: Runtime Error):
_l=input().split()
_s=sum([int(i) for i in s])
if _s % 2 != 0:
  print('IMPOSSIBLE')
else:
  print(s/2)

Buggy submission (verdict: Runtime Error):
s = input()
_list = [int(i) for i in s.split(' ')]
if sum(_list) % 2 != 0:
  print('IMPOSSIBLE')
  return
print(sum(_list) / 2)

Buggy submission (verdict: Runtime Error):
_list = [int(i) for i in input().split(' ')]
if sum(_list) % 2 != 0:
  print("IMPOSSIBLE")
  return
print(sum(_list)/2)
Problem p02969 (python)

Fixed submission:
# -*- coding: utf-8 -*-



if __name__ == '__main__':
    r = int(input())
    area = 3 * r * r
    print(area)

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

import math

if __name__ == '__main__':
    N = int(input())
    colors = [
        10000000000
    ]
    # R = [0 for i in range(N)]
    # M = 0

    for i in range(N-1, -1, -1):
        # print('i={}'.format(i))
        a = int(input())
        for j in range(len(colors)):
            if a < colors[j]:
                colors[j] = a
                break
        else:
            colors.append(
                a
            )

    print(len(colors))

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

import math

if __name__ == '__main__':
    N = int(input())
    A = []
    current_max = -1
    for i in range(N):
        A.append(int(input()))

    index = sorted(range(len(A)), key=lambda k: A[k])
    value = sorted(A)

    # print(A)

    for i in range(N):
        if index[i] < N-1:
            print(value[N-1])
        else:
            print(value[N-2])
Problem p02957 (python)

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

temp = A+B
if temp%2 == 0:
  K = int(temp/2)
  print(K)
else:
  print("IMPOSSIBLE")

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

temp = A+B
if temp%2 == 0:
  K = int(temp/2)
else:
  print("IMPOSSIBLE")
print(K)