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

Fixed submission:
import math
s = str(input())
cou = 0
co = 0
ans = 0
while cou + co +2 <= len(s):
  if s[cou] == "x":
    if s[-1-co] == "x":
      cou += 1
      co += 1
    else:
      cou += 1
      ans += 1
  else:
    if s[-1-co] == "x":
      co += 1
      ans += 1
    else:
      if s[cou] == s[-1-co]:
        cou += 1
        co += 1
      else:
        print(-1)
        exit()
print(ans)

Buggy submission (verdict: Runtime Error):
import math
s = list(str(input()))
lis = ""
li = ""
num = 0
cou = [0 for i in range(26)]
for i in range(len(s)):
  if s[i] != "x":
    lis += s[i]
    li = s[i] + li
  else:
    num += 1
if lis != li:
  print(-1)
  exit()
point = lis[len(lis)//2]
ss = ["1"]
tt = ["1"]
nu = 0
while s[nu] != point:
  ss.append(s[nu])
  nu += 1
nu = 0
while s[-1-nu] != point:
  tt.append(s[-1-nu])
  nu += 1
ans = 0
for i in range(max(len(ss),len(tt))):
  try:
    if ss[i] != tt[i]:
      ans += 1
  except:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import math
s = list(str(input()))
lis = ""
li = ""
num = 0
cou = [0 for i in range(26)]
for i in range(len(s)):
  if s[i] != "x":
    lis += s[i]
    li = s[i] + li
  else:
    num += 1
if lis != li:
  print(-1)
  exit()
point = lis[len(lis)//2]
ss = ["1"]
tt = ["1"]
nu = 0
while s[nu] != point:
  ss.append(s[nu])
  nu += 1
nu = 0
while s[-1-nu] != point:
  tt.append(s[-1-nu])
  nu += 1
ans = 0
for i in range(max(len(ss),len(tt))):
  try:
    if ss[i] != tt[i]:
      ans += 1
  except:
    ans += 1
print(ans,ss,tt)

Buggy submission (verdict: Runtime Error):
import math
s = list(str(input()))
lis = ""
li = ""
num = 0
cou = [0 for i in range(26)]
for i in range(len(s)):
  if s[i] != "x":
    lis += s[i]
    li = s[i] + li
  else:
    num += 1
if lis != li:
  print(-1)
  exit()
point = lis[len(lis)//2]
ss = []
tt = []
nu = 0
while s[nu] != point:
  ss.append(s[nu])
  nu += 1
nu = 0
while s[-1-nu] != point:
  tt.append(s[-1-nu])
  nu += 1
ans = 0
for i in range(len(ss)):
  if ss[i] != tt[i]:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import math
s = list(str(input()))
lis = ""
li = ""
num = 0
cou = [0 for i in range(26)]
for i in range(len(s)):
  if s[i] != "x":
    lis += s[i]
    li = s[i] + li
  else:
    num += 1
if lis != li:
  print(-1)
  exit()
point = lis[len(lis)//2]
ss = []
tt = []
nu = 0
while s[nu] != point:
  ss.append(s[nu])
  nu += 1
nu = 0
while s[-1-nu] != point:
  tt.append(s[-1-nu])
  nu += 1
ans = 0
for i in range(n):
  if ss[i] != tt[i]:
    ans += 1
print(ans)
Problem p03574 (python)

Fixed submission:
h, w = map(int, input().split())
s = [input() for i in range(h)]

x = [-1, -1, 0, 1, 1, 1, 0, -1]
y = [0, 1, 1, 1, 0, -1, -1, -1]
for px in range(h):
    for py in range(w):
        if s[px][py] == '#': continue

        cou = 0
        for d in range(len(x)):
            tempx = px + x[d]
            tempy = py + y[d]

            if tempx < 0 or tempx >= h or tempy < 0 or tempy >= w:
                continue
            if s[tempx][tempy] == '#':
                cou += 1

        s[px] = s[px].replace('.', str(cou), 1)

for i in range(h):
    print(s[i])

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
lis = []
for i in range(n):
    a = list(input())
    for l in range(m):
        lis.append(a[l])
for t in range(15):
    if lis[t] == ".":
        cou = 0
        try:
            if lis[t-(m+1)] == "#":
                cou += 1
        except:
            cou = cou
        try:
            if lis[t - m] == "#":
                cou += 1
        except:
            cou = cou
        try:
            if lis[t -(m-1)] == "#":
              cou += 1
        except:
            cou = cou
        try:
            if lis[t -1] == "#":
                cou += 1
        except:
            cou = cou
        try:
            if lis[t+1]== "#":
                cou += 1
        except:
            cou = cou
        try:
            if lis[t +m] == "#":
                cou += 1
        except:
            cou = cou
        try:
            if lis[t +(m-1)]== "#":
                cou += 1
        except:
            cou = cou
        try:
            if lis[t+(m+1)]== "#":
                cou += 1
        except:
            cou = cou
        lis[t] = cou

for p in range(n):
    li = []
    for h in range(m):
        li.append(lis[(p * m) + h])
    print("".join(map(str,li)))
Problem p03576 (python)

Fixed submission:
n,k = map(int,input().split())
x = []
y = []
xx = []
yy = []
for i in range(n):
    a,b = map(int,input().split())
    x.append(a)
    y.append(b)
    xx.append(a)
    yy.append(b)
ans = 10 ** 40
x.sort()
y.sort()
for i in range(n):
    for j in range(i+1,n):
        for l in range(n):
            for h in range(l+1,n):
                lx = x[i]
                rx = x[j]
                uy = y[h]
                dy = y[l]
                cnt = 0
                for ii in range(n):
                    if lx <= xx[ii] <= rx and dy <= yy[ii] <= uy:
                        cnt += 1
                if cnt >= k:
                    if (rx-lx) * (uy-dy) != 0:
                        ans = min(ans,(rx-lx)*(uy-dy))
print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
x = []
y = []
xx = []
yy = []
for i in range(n):
    a,b = map(int,input().split())
    x.append(a)
    y.append(b)
ans = 10 ** 40
x.sort()
y.sort()
for i in range(n):
    for j in range(i+1,n):
        for l in range(n):
            for h in range(l+1,n):
                lx = x[i]
                rx = x[j]
                uy = y[h]
                dy = y[l]
                cnt = 0
                for ii in range(n):
                    if lx <= xx[ii] <= rx and dy <= yy[ii] <= uy:
                        cnt += 1
                if cnt >= k:
                    if (rx-lx) * (uy-dy) != 0:
                        ans = min(ans,(rx-lx)*(uy-dy))
print(ans)
Problem p03605 (python)

Fixed submission:
a = input()
b = int(a[0])
c = int(a[1])
if b==9 or c==9:
 print("Yes")
else:
 print("No")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = a[0]
c = a[1]
if b==9 or c==9:
print("Yes")
else:
print("No")
Problem p03623 (python)

Fixed submission:
a, b, c =map(int,input().split())
import math
if abs(a-b) > abs(a-c):
 print("B")
else:
 print("A")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int,input().split())
R = int(|a-b|)
E = int(|a-c|)
if R > E:
 print("B")
else:
 print("A")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int,input().split())
if |a-b| > |a-c|:
 print("B")
else:
 print("A")
Problem p03632 (python)

Fixed submission:
a,b,c,d = map(int,input().split())
lisa = []
lisb = []
for n in range((b-a)+1):
  lisa.append(n + a)
for m in range((d-c)+1):
  lisb.append(m + c)
ans = 0
for i in range(101):
  if i in lisa and i in lisb:
    ans += 1
if ans > 0:
  print(ans-1)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int,input())
print(min(b,d)-max(a,c))
Problem p03639 (python)

Fixed submission:
n = int(input())
cou1 = 0
cou2 = 0
cou4 = 0
lis = list(map(int,input().split()))
for i in range(n):
    if lis[i] % 2 == 0:
        if lis[i] % 4 == 0:
            cou4 += 1
        else:
            cou2 += 1
    else:
        cou1 += 1
if cou2 == 0:
    if cou1 <= cou4 + 1:
        print("Yes")
    else:
        print("No")
else:
    if cou1 <= cou4:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
n=int(input())
lis=list(map(int,input().split()))
ans=[]
cnt=0
s=""
hh=0
for i in range(n):
  for j in range(lis[i]):
    if hh==0:
      s=s+str(i+1)+" "
    else:
      s=str(i+1)+" "+s
    cnt+=1
    if cnt==w:
      ans.append(s)
      s=""
      cnt=0
      hh=(hh+1)%2
for i in range(h):
  print(ans[i])
Problem p03643 (python)

Fixed submission:
a = input()
print("ABC"+a)

Buggy submission (verdict: Runtime Error):
a = int(input())
print("ABC"+a)
Problem p03657 (python)

Fixed submission:
a , b = map(int,input().split())
if a%3 == 0 or b%3 == 0 or (a+b)%3 == 0:
 print("Possible")
else:
 print("Impossible")

Buggy submission (verdict: Runtime Error):
n , k = map(int,input().split())
lis = list(map(int,input().split()))
lis = sorted(lis,reverse = True)
ans = 0
for i in range(k):
  ans += lis[i]
print(ans)
Problem p03673 (python)

Fixed submission:
n = int(input())
lis = []
li = list(map(str,input().split()))
if n % 2 == 0:
    b = li[1::2]
    for m in range(n//2):lis.append(b[-(m + 1)])
    print(" ".join(lis[::] + li[::2]))
else:
    b = li[::2]
    for m in range((n//2)+1):lis.append(b[-(m + 1)])
    print(" ".join(lis[::]+li[1::2]))

Buggy submission (verdict: Runtime Error):
n = int(input())
lis = list(map(int,input().split()))
li = lis[::2]
l = lis[1::2]

if n % 2 == 0:
  l = l[::-1]
  ans = l+li
  print(" ".join(ans))
else:
  li = li[::-1]
  ans = li+l
  print(" ".join(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
lis = list(map(int,input().split()))
li =[]
cou = 0
key = 0
if n % 2 == 1:
  while cou < n:
    if key == 0:
      li.insert(0,lis[cou])
      cou += 1
      key = 1
    else:
      li.append(lis[cou])
      cou += 1
      key = 0
else:
  while cou < n:
    if key == 0:
      li.append(lis[cou])
      cou += 1
      key = 1
    else:
      li.insert(0,lis[cou])
      cou += 1
      key = 0
print(" ".join(li))
Problem p03679 (python)

Fixed submission:
a, b, c = map(int,input().split())
if c-b <= 0:
 print("delicious")
elif a+b >= c:
 print("safe")
else:
 print("dangerous")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int,input().split())
if c-b <= 0:
 print("delicious")
elif a+b => c:
 print("safe")
else:
 print("dangerous")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int,input().split())
if c-b <=0:
 print("delicious")
elif a+b=>c:
 print("safe")
else:
 print("dangerous")
Problem p03683 (python)

Fixed submission:
n,m = map(int,input().split())
if abs(n - m) >= 2:
  print("0")
else:
  if n == m:cou = 2
  else:cou = 1
  while n > 1:
    cou *= n
    cou %= (10 ** 9 + 7)
    n -= 1
  while m > 1:
    cou *= m
    cou %= (10 ** 9 + 7)
    m -= 1
  print(cou)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
if abs(n - m) >= 2:
  print("0")
else:
  if n == m:cou = 2
  else:cou = 1
  while n > 1:
    cou *= n
    cou %= (10 ** 9 + 7)
    n -= 1
  while m > 1:
    cou *= m
    cou %= (10 ** 9 + 7)
    m -= 1
print(cou)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
if abs(n - m) >= 2:
  print("0")
else:
  cou = 2
  while n > 1:
    cou *= n
    cou %= (10 ** 9 + 7)
    n -= 1
  while m > 1:
    cou *= m
    cou %= (10 ** 9 + 7)
    m -= 1
print(cou)
Problem p03694 (python)

Fixed submission:
n = int(input())
lis = list(map(int,input().split()))
print(max(lis)-min(lis))

Buggy submission (verdict: Runtime Error):
n = int(input())
lis = list(int,input().split())
print(max(lis)-min(lis))
Problem p03696 (python)

Fixed submission:
n = int(input())
s = input()
cnt = [0, 0]
add = [0, 0]
ans = ''
for i in range(n):
    if s[i] == ')':
        cnt[0] += 1
        if cnt[0] > cnt[1]:
            add[1] += 1
            cnt[1] += 1
    else:
        cnt[1] += 1

print('(' * add[1] + s + ')'*(cnt[1] -cnt[0]))

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
lis = []
cou = 0
ans = 0
li = list(map(int,input().split()))
for i in range(n):
    if li[i] >= 3200:
        cou += 1
    else:
        if math.floor(li[i] / 400) not in lis:
            ans += 1
print(ans,min(8,ans + cou))
Problem p03699 (python)

Fixed submission:
n = int(input())
li = []
for i in range(n):li.append(int(input()))
li.sort()
if sum(li) % 10 == 0:
    for k in range(n):
        if (sum(li)-li[k]) % 10 != 0:
            print(sum(li)-li[k])
            exit()
else:
    print(sum(li))
    exit()
print("0")

Buggy submission (verdict: Runtime Error):
n = int(input())
li = []
for i in range(n):li.append(int(input())
if sum(li) % 10 == 0:print("0")
else:print(sum(li))
Problem p03700 (python)

Fixed submission:
n,a,b = map(int,input().split())
lis = [int(input()) for i in range(n)]
more = a-b

def tansaku(x):
  cou = 0
  normal = b * x
  for hp in lis:
    r = hp -normal
    if r <= 0:continue
    cou += r // more
    
    if r % more != 0:
      cou += 1
  return cou <= x

left = 1
right = max(lis)
while right - left > 1:
  mid = (right + left)//2
  if tansaku(mid):
    right = mid
  else:
    left = mid
print(right)

Buggy submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
lis = [int(input()) for i in range(n)]
more = a-b

def tansaku(x):
  cou = 0
  normal = b * x
  for hp in lis:
    r = hp -normal
    if r <= 0:continue
    cou += r // more
    
    if r % more != 0:
      cou += 1
  return cnt <= t

left = 1
right = max(lis)
while right - left > 1:
  mid = (right + left)/2
  if tansaku(mid):
    right = mid
  else:
    left = mid
print(right)

Buggy submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
lis = [int(input()) for i in range(n)]
more = a-b

def tansaku(x):
  cou = 0
  normal = b * x
  for hp in lis:
    r = hp -normal
    if r <= 0:continue
    cou += r // more
    
    if r % ab != 0:
      cou += 1
  return cnt <= t

left = 1
right = max(lis)
while right - left > 1:
  mid = (right + left)/2
  if tansaku(mid):
    right = mid
  else:
    left = mid
print(right)
Problem p03711 (python)

Fixed submission:
a,b = map(int,input().split())
listA =[1,3,5,7,8,10,12]
listB =[4,6,9,11]
if a in listA and b in listA:
 print("Yes")
elif a in listB and b in listB:
 print("Yes")
else:
 print("No")

Buggy submission (verdict: Runtime Error):
a, b = map(int,input().split())
if a == 1,3,5,7,8,10:
 if b == 3,5,7,8,10,12:
   print("Yes")
 else:
   print("No")
elif a == 4,6,9:
 if b == 6,9,11:
  print("Yes")
 else:
  print("No")
else:
 print("No")
Problem p03741 (python)

Fixed submission:
n = int(input())
lis = list(map(int,input().split()))
cou = 0
co = 0
ans1 = 0
ans2 = 0
for i in range(n):
  cou += lis[i]
  co += lis[i]
  if cou <= 0 and i % 2 == 0:
    ans1 += (1 -cou)
    cou = 1
  if cou >= 0 and i % 2 == 1:
    ans1 += (cou +1)
    cou = -1
  if co >= 0 and i % 2 == 0:
    ans2 += (co +1)
    co = -1
  if co <= 0 and i % 2 == 1:
    ans2 += (1 -co)
    co = 1
print(min(ans1,ans2))

Buggy submission (verdict: Runtime Error):
n = int(input())
lis = list(map(int,input().split()))
cou = 0
co = 0
ans1 = 0
ans2 = 0
for i in range(n):
  cou += lis[i]
  co += lis[i]
  if cou <= 0 and i % 2 == 0:
    ans1 += (1 -cou)
    cou = 1
  if cou => 0 and i % 2 == 1:
    ans1 += (cou +1)
    cou = -1
  if co => 0 and i % 2 == 0:
    ans2 += (co +1)
    co = -1
  if co <= 0 and i % 2 == 1:
    ans2 += (1 -co)
    co = 1
print(min(ans1,ans2))
Problem p03801 (python)

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

key = lis[0]
num = [0]
li = [key]
for i in range(1,n):
	if lis[i] > key:
		key = lis[i]
		num.append(i)
		li.append(key)

m = len(li)
nu = [li[0]]+[li[i+1]-li[i] for i in range(m-1)]

he = [0]*m
cou = [0]*m

from bisect import bisect_left

for k in lis:
	sen = bisect_left(li,k)
	cou[sen] += k -li[sen]
	he[sen] += 1

key = 0
for i in reversed(range(m)):
	key += he[i]
	he[i] = key

for i in range(m):
	cou[i] += he[i]*nu[i]

ans = [0]*n
for i,c in zip(num,cou):
	ans[i] = c

for r in ans:
	print(r)

Buggy submission (verdict: Runtime Error):
n = int(input())
lis = list(map(int, input().split()))
key = lis[0]
num = [0]
li = [key]
for i in range(1,n):
	if lis[i] > key:
		line = lis[i]
		num.append(i)
		li.append(line)
m = len(li)
nu = [li[0]]+[li[i+1]-li[i] for i in range(m-1)]
he = [0]*m
cou = [0]*m
from bisect import bisect_left
for k in lis:
	sen = bisect_left(li,k)
	cou[sen] += k -li[sen]
	he[sen] += 1
t = 0
for i in reversed(range(m)):
	t += he[i]
	he[i] = t
for i in range(m):cou[i] += he[i]*nu[i]
ans = [0]*n
for i,c in zip(num,cou):ans[i] = c
for r in ans:print(r)
Problem p03808 (python)

Fixed submission:
n=int(input())
lis=list(map(int,input().split()))
num=(n*(n+1))//2
ll=sum(lis)
if ll%num!=0:
  print("NO")
  exit()
ans=0
for i in range(n):
  if abs(lis[i]-lis[i-1]-ll//num)%n!=0:
    print("NO")
    exit()
  ans+=abs(lis[i]-lis[i-1]-ll//num)//n
if ans == ll//num:print("YES")
else:print("NO")

Buggy submission (verdict: Runtime Error):
n=int(input())
lis=list(map(int,input().split()))
num=(n*(n+1))//2
if sum(lis)%num!=0:
  print("NO")
  exit()
ans=0
for k in range(n):
  if -(lis[i]-lis[i-1]-sum(lis)//num)%n!=0:
    print("NO")
    exit()
  ans+=-(lis[i]-lis[i-1]-sum(lis)//num)//n
if ans == sum(lis)//num:print("YES")
else:print("NO")

Buggy submission (verdict: Runtime Error):
n=int(input())
lis=list(map(int,input.split()))
num=(n*(n+1))//2
if sum(lis)%num!=0:
  print("No")
  exit()
li=[lis[i]-lis[i-1]-sum(lis)//num for i in range(n)]
ans=0
for k in range(n):
  if -li[k]%n!=0:
    print("No")
    exit()
  ans+=-li[k]//n
if ans == sum(lis)//num:print("Yes")
else:print("No")
Problem p03817 (python)

Fixed submission:
import math
n = int(input())
print(2 * (n // 11) + math.ceil((n % 11) / 6))

Buggy submission (verdict: Runtime Error):
n = int(input())
lis = list(map(int,input().split()))
ans = set()
for num in lis:ans.add(num)
print(len(ans)-((len(ans) % 2)+1)%2)
Problem p03818 (python)

Fixed submission:
n = int(input())
lis = list(map(int,input().split()))
s = set()
for i in range(n):s.add(lis[i])
lis.sort()
if (len(lis)-len(s)) % 2 == 1:
	print(len(s)-1)
else:
	print(len(s))

Buggy submission (verdict: Runtime Error):
n = int(input())
lis = list(map(int,input().split()))
ans = set()
for num in lis:ans.add(num)
print(len(num)-((len(num) % 2)+1)%2)
Problem p03826 (python)

Fixed submission:
a = input().split()
A = int(a[0])
B = int(a[1])
C = int(a[2])
D = int(a[3])
q = A*B
w = C*D
if q <= w:
 print(w)
else:
 print(q)

Buggy submission (verdict: Runtime Error):
a = input().spulit()
A = int(a[0])
B = int(a[1])
C = int(a[2])
D = int(a[3])
q = A*B
w = C*D
if q <= w:
 print(w)
else:
 print(q)

Buggy submission (verdict: Runtime Error):
a = input().spulit()
A = int(a[0])
B = int(a[1])
C = int(a[2])
D = int(a[3])
if A*B <= C*D:
 print(C*D)
else:
 print(A*B)
Problem p03838 (python)

Fixed submission:
x,y = map(int,input().split())
ans = 0
if abs(y) > abs(x):
  if x < 0:ans += 1
  if y < 0:ans += 1
  ans += (abs(y)-abs(x))
else:
  if x > 0:ans += 1
  if y > 0:ans += 1
  ans += (abs(x)-abs(y))
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
ans = 0
if abs(y) > abs(x):
  if x < 0:ans += 1
  if y < 0:ans += 1
  ans += (abs(y)-abs(x))
else:
  if x > 0:ans += 1
  if y > 0:ans += 1
  ans += (abs(x)-abs(y))
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
cou = 0
if n != 0 and m != 0:
  if n / m < 0:
    cou += 1
    n *= (-1)
  elif n < 0 and m < 0:
    cou += 2
    n *= (-1)
    m *= (-1)
  else:
    continue
print(cou + abs(n-m))
Problem p03844 (python)

Fixed submission:
a = input().split()
A = int(a[0])
o = a[1]
B = int(a[2])
if o == "+":
 print(A+B)
else:
 print(A-B)

Buggy submission (verdict: Runtime Error):
a = input()
A = int(a[0])
o = a[1]
B = int(a[2])
if o == "+":
 print(A+B)
else:
 print(A-B)
Problem p03845 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
m = int(input())
for i in range(m):
    b,c = map(int,input().split())
    nu = a[b-1] -c
    print(sum(a)-nu)

Buggy submission (verdict: Runtime Error):
n = int(input())
lis = list(map(int,input().split()))
m = int(input())
num = sum(lis)
for i in range(n):
  a,b = map(int,input().split())
  print(num-(lis[a-1]-b))
Problem p03848 (python)

Fixed submission:
import math
n = int(input())
lis = list(map(int,input().split()))
li = [0 for _ in range(math.ceil(n / 2))]

for i in range(n):
  li[math.floor(lis[i] / 2)] += 1
for i in range(len(li)):
  if n % 2 == 1 and i == 0:
    if li[i] != 1:
      print("0")
      exit()
  else:
    if li[i] != 2:
      print("0")
      exit()
cou = 1
for i in range(math.floor(n/2)):
  cou *= 2
  cou %= (10 ** 9 + 7)
print(cou)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
lis = list(map(str,input().split()))
li = [0 for _ in range(math.ceil(n / 2))]

for i in range(n):
  li[math.floor(lis[i] / 2)] += 1
for i in range(len(li)):
  if n % 2 == 1 and i == 0:
    if li[i] != 1:
      print("0")
      exit()
  else:
    if li[i] != 2:
      print("0")
      exit()
print(2 ** (math.floor(n/2)))
Problem p03937 (python)

Fixed submission:
h,w = map(int,input().split())
x = 0
y = 0
time = 0
cou = 0
lis = ""
for i in range(h):lis += str(input())
for i in range(h * w):
    if lis[i] == "#":
        cou += 1
for i in range(h):
    while lis[i * w + x] == "#" and y == 0:
        x += 1
        time += 1
        if x == w:
            x -= 1
            y = 1
    if i == h-1 and time == (h + w)-1 and time == cou:
        print("Possible")
        exit()
    time += 1
print("Impossible")

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
num=0
s=[str(input()) for i in range(h):]
for i in range(h):
  num+=s[i].count("#")
if num>h+w-1:
  print("Impossible")
  exit()
print("Possible")
Problem p03962 (python)

Fixed submission:
j = input().split()
a = int(j[2])
b = int(j[1])
c = int(j[0])
if a == b and b== c:
 print("1")
elif a == b:
 print("2")
elif b == c:
 print("2")
elif a==c:
 print("2")
else:
 print("3")

Buggy submission (verdict: Runtime Error):
lis = list(input())
cou = 0
ans = 0
for i in range(len(lis)):
	if lis[i] == "g":
		if cou > 0:
        	cou -= 1
        	ans += 1
		else:
        	cou += 1
	else:
		if cou > 0:
        	cou -= 1
		else:
			cou += 1
			ans -= 1
print(max(0,ans))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
if a == b and b== c:
 print("1")
elif a == b:
 print("2")
elif b == c:
 print("2")
elif a==c:
 print("2")
else:
 print("3")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
if a == b and b== c:
 print("1")
elif a == b or b ==c or a == c:
 print("2")
else:
 print("3")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
if a == b == c:
 print("1")
elif a == b or b ==c or a ==c:
 print("2")
else:
 print("3")
Problem p03965 (python)

Fixed submission:
lis = list(input())
cou = 0
ans = 0
for i in range(len(lis)):
	if lis[i] == "g":
		if cou > 0:
			cou -= 1
			ans += 1
		else:
			cou += 1
	else:
		if cou > 0:
			cou -= 1
		else:
			cou += 1
			ans -= 1
print(max(0,ans))

Buggy submission (verdict: Runtime Error):
lis = list(input())
cou = 0
ans = 0
for i in range(len(lis)):
	if lis[i] == "g":
		if cou > 0:
        	cou -= 1
        	ans += 1
		else:
        	cou += 1
	else:
		if cou > 0:
        	cou -= 1
		else:
			cou += 1
			ans -= 1
print(max(0,ans))

Buggy submission (verdict: Runtime Error):
lis = list(input())
cou = 0
ans = 0
for i in range(len(lis)):
	if lis[i] == "g":
      if cou > 0:
        cou -= 1
        ans += 1
      else:
        cou += 1
    else:
      if cou > 0:
        cou -= 1
      else:
        cou += 1
        ans -= 1
print(max(0,ans))
Problem p03993 (python)

Fixed submission:
n = int(input())
cou = 0
ans = 1
lis = list(map(int,input().split()))
for i in range(n):
    a = lis[i]
    if lis[a-1] == i + 1:
        ans += 1
print(ans//2)

Buggy submission (verdict: Runtime Error):
n = int(input())
lis = list(map(int,input().split()))
ans = 0
for i in range(n):
  if lis[lis[i]] == i+1:
    ans += 1
print(ans//2)

Buggy submission (verdict: Runtime Error):
n =int(input())
lis =list(map(int,input().split()))
ans =0
for i in range(n):
  if lis[lis[i]-1]=i+1:
    ans +=1
print(ans//2)