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

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

for i in range(len(S)):
  x = al.index(S[i])
  c = x+N
  if c <= 25:
      S[i] = al[c]
  else:
      S[i] = al[c-26]
      
print("".join(S))

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

for i in range(len(S)):
  x = al.index(S[i])
  c = x+N
  if c <= 25:
      S[i] = al[c]
  else:
      S[i] = al[c-25]
      
print("".join(S))

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

for i in range(len(S)):
  x = al.index(S[i])
  c = x+N
  if c < 25:
      S[i] = al[c]
  else:
      S[i] = al[c-25]
      
print("".join(S))

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

for i in S:
  x = al.index(S[i])
  c = x+N
  if c < 25:
      S[i] = al[c]
  else:
      S[i] = al[c-25]
      
print(S)
Problem p02909 (python)

Fixed submission:
s = input()
l =["Sunny", "Cloudy", "Rainy", "Sunny"]

print(l[l.index(s)+1])

Buggy submission (verdict: Runtime Error):
s = input()
l = ["Sunny", "Cloudy", "Rainy"]

print(l[l.index(s)+1])
Problem p02911 (python)

Fixed submission:
n, k, q = list(map(int, input().split()))
a = [int(input()) for i in range(q)]
p = [k-q]*n

for i in range(q):
    p[a[i]-1] += 1
    
for n in p:
  if n>0:
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
n, k, q = list(map(int, input().split()))
a = [int(input()) for i in range(q)]
p = [k-q]*n

for i in range(q):
    p[a[i]] += 1

      
for n in p:
  if n>0:
    print("Yes")
  else:
    print("No")
Problem p02923 (python)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
ans = []

for i in range(n-1):
    if h[i]>=h[i+1]:
        ans.append(1)
    else:
        ans.append(0)

count = 0
s = []
for i in range(len(ans)):
    if ans[i]==1:
        count += 1
    else:
        s.append(count)
        count = 0
        continue
    s.append(count)

if s:
    print(max(s))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
ans = []

for i in range(n-1):
    if h[i]>=h[i+1]:
        ans.append(1)
    else:
        ans.append(0)

count = 0
s = []
for i in range(len(ans)):
    if ans[i]==1:
        count += 1
    else:
        s.append(count)
        count = 0
        continue
    s.append(count)

print(max(s))

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
num = 0
now = 0
ans = []

for i in range(n-1):
    now = h[i]
    for j in range(i+1, n):
      if now >= h[j]:
        now = h[j]
        num += 1
      else:
        continue
    ans.append(num)
    num = 0

print(max(ans))
Problem p02936 (python)

Fixed submission:
from collections import deque
N, Q = map(int, input().split())
G = [[] for _ in range(N)]
count = [0] * N
for i in range(N-1):
    a, b = map(int, input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)

for j in range(Q):
    p, x = map(int, input().split())
    count[p-1] += x

que = deque([0])
flag = [False] * N

while que:
    v = que.pop()
    flag[v] = True
    for e in G[v]:
        if flag[e]:
            continue
        count[e] += count[v]
        que.appendleft(e)

print(*count)

Buggy submission (verdict: Runtime Error):
from collections import deque
N, Q = map(int, input().split())
G = [[] * N]
for i in range(N-1):
    a, b = map(int, input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)

count = [0] * N
for j in range(Q):
    p, x = map(int, input().split())
    count[p-1] += x

visited = [False] * N
que = deque([0])

while que:
    now = que.pop()
    visited[now] = True
    for nxt in G[now]:
        if visited[nxt]:
            continue
        count[nxt] += count[now]
        que.appendleft(nxt)

print(*count)
Problem p02971 (python)

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

b = sorted(a, reverse=True)

for i in range(n):
    if a[i] == b[0]:
        print(b[1])
    else:
        print(b[0])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for i in range(n)]

m = max(a)

for i in range(n):
  if a[i]!=m:
    print(m)
  else:
    print(max([j for j in a if index(j)==i ]))
Problem p02981 (python)

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

print(min(n*a, b))

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

print(min(n*a, b))
Problem p02993 (python)

Fixed submission:
s=input()

for i in range(3):
  if s[i] == s[i+1]:
    print("Bad")
    exit()
else:
  print("Good")

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

for i in range(3):
  if s[i] == s[i+1]:
    print("Bad")
    exit()
else:
  print("Good")
Problem p02995 (python)

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

c_count = b//c
d_count = b//d
# 最小公倍数で割る
c_d = b//(c*d//gcd(c, d))

print(b - c_count - d_count + c_d - (a-1 - (a-1)//c - (a-1)//d + (a-1)//(c*d//gcd(c, d))))

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

print(b - b//c - b//d + b//((c*d)//math.gcd(c, d)) - (a-1 - (a-1)//c - (a-1)//d + (a-1)//((c*d)//math.gcd(c, d))))

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

c_count = b//c
d_count = b//d
# 最小公倍数で割る
c_d = b//(c*d//math.gcd(c, d))

print(b - c_count - d_count + c_d - (a-1 - (a-1)//c - (a-1)//d + (a-1)//(c*d//math.gcd(c, d))))

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

c_count = b//c
d_count = b//d
# 最小公倍数で割る
c_d = b//(c*d//math.gcd(c, d))

print(b - c_count - d_count + c_d - (a-1 - (a-1)//c - (a-1)//d + (a-1)//(c*d//math.gcd(c, d))))
Problem p03145 (python)

Fixed submission:
a, b, c = map(int, input().split())
 
print(a*b // 2)

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

print(a*b // 2)
Problem p03243 (python)

Fixed submission:
n = int(input())
 
while True:
  s = str(n)
  if s.count(s[0])==len(s):
    print(n)
    exit()
  else:
    n += 1

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

while True:
  s = str(n)
  if s.count(s[0])==len(s):
    print(m)
    exit()
  else:
    n += 1
Problem p03273 (python)

Fixed submission:
h, w = map(int, input().split())
a = list(input() for i in range(h))

a = list(zip(*[i for i in a if "#" in i]))
a = list(zip(*[i for i in a if "#" in i]))

for i in a:
    print("".join(i))

Buggy submission (verdict: Runtime Error):
import numpy as np
h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]

a = np.array(a).reshape(h, w)
for i, v in enumerate(a):
    if "#" not in v:
        a = np.delete(a, i, 0)

a = np.rot90(a)
for i, v in enumerate(a):
    if "#" not in v:
        a = np.delete(a, i, 0)

a = np.rot90(a, 3)
for i in a:
    print(*i)
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())

for i, v in enumerate(s):
  if i == k-1:
      print(v)
      exit()
  elif v != "1": 
      print(v)
      exit()

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

for i, v in enumerate(s):
  if i == k:

if s[0] != 1:
  print(s[0])
elif k != 1:
  print(s[1])
else:
  print("1")
Problem p03294 (python)

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

print(sum(a)-n)

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

print(sum(a)-n)
Problem p03308 (python)

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

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

print(max(a) - min(a))
Problem p03387 (python)

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

l.sort()

count = 0
while l[2] - l[0] > 1:
    l[0] += 2
    count += 1
    l.sort()

if l[2] == l[1] != l[0]:
    count += 2
elif l[0] == l[1] != l[2]:
    count += 1

print(count)

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

mn = min(a, b, c)
md = statistics.median([a, b, c])
mx = max(a, b, c)

if (md - mn) % 2 == 0:
    print((md - mn) // 2 + (mx - md))
else:
    print((md+1) // mn + (mx - 2 - md) + 2)

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

mn = min(a, b, c)
md = statistics.median([a, b, c])
mx = max(a, b, c)

if (md - mn) % 2 == 0:
    print((md - mn) // 2 + (mx - md))
else:
    print((md+1) // mn + (mx - 2 - md) + 2)
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
 
print("Even" if a*b%2==0 else "Odd")

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

print("Even" if a*b%==0 else "Odd")
Problem p03543 (python)

Fixed submission:
n = str(input())
 
if n[0]==n[1]==n[2] or n[1]==n[2]==n[3]:
  print("Yes")
else:
  print("No")

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

if s[0]==s[1]==s[2] or s[1]==s[2]==s[3]:
  print("Yes")
else:
  print("No")
Problem p03591 (python)

Fixed submission:
s = input()

if s[:4] == "YAKI":
    print("Yes")
else:
    print("No")

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

if s[:4] == "YAKI"
    print("Yes")
else:
    print("No")
Problem p03633 (python)

Fixed submission:
from fractions import gcd
n = int(input())
t = list(int(input()) for _ in range(n))


def lcm(a, b):
    return a * b // gcd(a, b)


ans = 1
for i in t:
    ans = lcm(ans, i)

print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
t = list(int(input()) for _ in range(n))

print(np.lcm.reduce(t))
Problem p03796 (python)

Fixed submission:
import math
n  = int(input())
 
ans = math.factorial(n)
 
s = 10**9 + 7
 
print(ans % s)

Buggy submission (verdict: Runtime Error):
import math
n  = int(input())
 
ans = math.factional(n)
 
s = 10**9 + 7
 
print(ans % s)
Problem p03827 (python)

Fixed submission:
n = int(input())
s = input()

ans = [0]
for i in range(n):
    if s[i] == "I":
        ans.append(ans[i] + 1)
    else:
        ans.append(ans[i] - 1)

print(max(ans))

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

ans = [0]
for i in range(1, n+1):
  if s[i] == "I":
    ans.append(ans[i-1]+1)
  else:
    ans.append(ans[i-1]-1)

print(max(ans))
Problem p03845 (python)

Fixed submission:
import copy

n = int(input())
t = list(map(int, input().split()))
m = int(input())

for _ in range(m):
    temp = copy.copy(t)
    p, x = map(int, input().split())
    temp[p-1] = x
    print(sum(temp))

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

for _ in range(m):
    temp = t.copy()
    p, x = map(int, input().split())
    temp[p-1] = x
    print(sum(temp))
Problem p03951 (python)

Fixed submission:
n = int(input())
s = input()
t = input()

ans = len(s + t)
for i in range(n):
    if s[i:] == t[:n-i]:
        print(n+i)
        exit()
print(n*2)

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

for i in range(n):
    if s[i:] == t[:n-i]:
        print(n + cnt)
        exit()
else:
    print(n*2)
Problem p02608 (python)

Fixed submission:
n=int(input())
d={}
for i in range(1,100):
    if i**2>n: break
    for j in range(i,100):
        if j**2>n: break
        for k in range(j,100):
            tmp=i**2+j**2+k**2+i*j+j*k+k*i
            if tmp>n: break
            if i==k: x=1
            elif i==j or j==k: x=3
            else: x=6
            if tmp in d:
                d[tmp]+=x
            else:
                d[tmp]=x
for i in range(1,n+1):
    if i in d: print(d[i])
    else: print(0)

Buggy submission (verdict: Runtime Error):
n=int(input())
d={}
for i in range(1,100):
    for j in range(i,100):
        if i**2>n or j**2>n: break
        for k in range(j,100):
            tmp=i**2+j**2+k**2+i*j+j*k+k*i
            if tmp>n: break
            if i==k: x=1
            elif i==j or j==k: x=3
            else: x=6
            if tmp in d: d[tmp]+=x
            else: d[tmp]=x
for i in range(1,n+1):
    if i in d: print(d[i]
Problem p02684 (python)

Fixed submission:
n,k=map(int,input().split())
a=[int(i) for i in input().split()]
d=[0]
w=set([0])
x=0
for i in range(n):
    if a[x]-1 not in w:
        d.append(a[x]-1)
        w.add(a[x]-1)
        x=a[x]-1
    else:
        f=a[x]-1
        break

#print(d)
if k<len(d):
    print(d[k]+1)
else:
    x=k-len(d)
    y=d.index(f)
    z=len(d)-y
    #print(d,f,x,y,z)
    #exit()
    print(d[y+x%z]+1)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

n,k=map(int,input().split())
a=[int(i) for i in input().split()]
if (a[0]==1):
    print(1)
    exit()
ans=chk=0
w=[1]
x=set([1])
for i in range(k):
    t=a[w[-1]-1]
    if t in x: break
    x.add(t)
    w.append(t)
p=w.index(t)
if p==0:
    print(w[k%len(w)])
else:
    print(h[0])

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

n,k=map(int,input().split())
a=[int(i) for i in input().split()]
if (a[0]==1):
    print(1)
    exit()
ans=chk=0
w=[1]
x=set([1])
for i in range(k):
    t=a[w[-1]-1]
    if t in x: break
    x.add(t)
    w.append(t)
p=w.index(t)
if p==0:
    print(w[len(w)%k-1])
else:
    print(h[0])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=[int(i) for i in input().split()]
ans=chk=0
w=[1]
x=set([1])
for i in range(k):
    t=a[w[-1]-1]
    if t in x: break
    x.add(t)
    w.append(t)
    if i==k-1:
        print(t)
        exit()
mae=max(0,w.index(t)-1)
k-=mae
loop=len(w)-mae-1
print(w[k%loop+mae])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=[int(i) for i in input().split()]
d=[0]
w=set([0])
x=0
for i in range(n):
    if a[x]-1 not in w:
        d.append(a[x]-1)
        w.add(a[x]-1)
        x=a[x]-1
    else:
        f=a[x]-1
        break

#print(d)
if k<len(d):
    print(d[k])
else:
    x=k-len(d)
    y=d.index(d[f])
    z=len(d)-y+1
    #print(d,y)
    #exit()
    print(d[y+x%z]+1)
Problem p02748 (python)

Fixed submission:
a,b,m=map(int,input().split())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]

ans=99999999999
ans=min(A)+min(B)
for i in range(m):
    x,y,c=map(int,input().split())
    ans=min(ans,A[x-1]+B[y-1]-c)
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,m=map(int,input().split())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]

ans=99999999999
for i in range(a):
    for j in range(i,b)::
        ans=min(ans,A[i]+B[j])
for i in range(m):
    x,y,c=map(int,input().split())
    ans=min(ans,A[x-1]+B[y-1]-c)
print(ans)

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

ans=99999999999
for i a:
    for j in b:
        ans=min(ans,i+j)
for i in range(m):
    x,y,c=map(int,input().split())
    ans=min(ans,a[x-1]+b[y-1]-c)
print(ans)
Problem p02839 (python)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
H,W = map(int,readline().split())
A = [list(map(int,readline().split())) for _ in range(H)]
B = [list(map(int,readline().split())) for _ in range(H)]
 
X = (H + W) * 80
# X点持った状態から始める
dp = [[0] * W for _ in range(H)]
d = abs(A[0][0] - B[0][0])
dp[0][0] = (1 << (X - d))
for h in range(H):
    for w,(a,b) in enumerate(zip(A[h],B[h])):
        if h == w == 0:
            continue
        d = abs(a - b)
        x = 0
        if h != 0:
            x |= (dp[h-1][w] << d) 
            x |= (dp[h-1][w] >> d)
        if w != 0:
            x |= (dp[h][w-1] << d) 
            x |= (dp[h][w-1] >> d)
        dp[h][w] = x
 
dp = dp[-1][-1]
 
B = bin(dp)[2:]
can_make = [i - X for i,b in enumerate(B[::-1]) if b == '1']
 
answer = min(x if x >= 0 else -x for x in can_make)
print(answer)

Buggy submission (verdict: Runtime Error):
for xy in range(h*w):
    i=xy//w
    j=xy%w
    z=a[i][j]-b[i][j]
    if i==0 and j==0:
        x[0].add(abs(a[0][0]-b[0][0]))
    elif i==0 and j!=0:
        for k in x[j-1]:
            if abs(k+z)<81: x[j].add(abs(k+z))
            elif abs(k-z)<81: x[j].add(abs(k-z))
    elif i%2:
        if j==0:
            for k in x[0]:
                if abs(k+z)<81: y[0].add(abs(k+z))
                if abs(k-z)<81: y[0].add(abs(k-z))
        else:
            for k in x[j]:
                if abs(k+z)<81: y[j].add(abs(k+z))
                if abs(k-z)<81: y[j].add(abs(k-z))
            for k in y[j-1]:
                if abs(k+z)<81: y[j].add(abs(k+z))
                if abs(k-z)<81: y[j].add(abs(k-z))
    else:
        if j==0:
            for k in y[0]:
                if abs(k+z)<81: x[0].add(abs(k+z))
                if abs(k-z)<81: x[0].add(abs(k-z))
        else:
            for k in y[j]:
                if abs(k+z)<81: x[j].add(abs(k+z))
                if abs(k-z)<81: x[j].add(abs(k-z))
            for k in x[j-1]:
                if abs(k+z)<81: x[j].add(abs(k+z))
                if abs(k-z)<81: x[j].add(abs(k-z))
    if j==w-1 and i%2==0:
        y=[set([]) for _ in range(w)]
        ans=min(x[-1])
    elif j==w-1:
        x=[set([]) for _ in range(w)]
        ans=min(y[-1])
print(ans)
Problem p02861 (python)

Fixed submission:
import itertools
def sol():
    n=int(input())
    d=list(itertools.permutations([i for i in range(n)]))
    w=[]
    for i in range(n):
        x,y=map(int,input().split())
        w.append((x,y))
    ans=chk=0
    for i in d:
        for j in range(len(i)-1):
            ans+=((w[i[j]][0]-w[i[j+1]][0])**2+(w[i[j]][1]-w[i[j+1]][1])**2)**0.5
    print(ans/len(d))

if __name__=="__main__":
    sol()

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[int(i) for i in range(n)]
ans=chk=p=0
w=[]
for i in range(n):
    x,y=map(int,input().split())
    w.append((x,y))
for i in list(itertools.permutations(l,n)):
    chk=0
    for j in range(n-1):
        chk+=((w[i[j]][0]-w[i[j+1]][0])**2+(w[i[j]][1]-w[i[j+1]][1])**2)**0.5
    ans+=chk
    p+=1

print(ans/p)
Problem p02918 (python)

Fixed submission:
n,k=map(int,input().split())
s=input()
#print(s)
t=s[0]
c=[-1,1][s[0]=="R"]
d=[0]

for i in range(1,n):
    if t!=s[i]:
        d.append(c)
        c=0
    t=s[i]
    c+=[-1,1][s[i]=="R"]
d.append(c)
c=len(d)

#print(c,d)
if c>2:
    for i in range(1,k+1):
        if i*2>=c: break
        d[i*2]*=-1
#print(d)
"""
p=[-1,-1]
for i in range(1,c-1):
    tmp=(abs(d[i-1])+abs(d[i])+abs(d[i+1]))
    if tmp>p[0]:
        p[0]=tmp
        p[1]=i
i=p[1]
for j in range(k):
    if i+j*2>=c: break
    d[i+j*2]*=-1
"""
chk=0
ans=0
for i in d:
    if (i>0 and chk>0) or (i<0 and chk<0):
        chk+=i
    else:
        if chk!=0: ans+=abs(chk)-1
        chk=i

print(ans+(abs(chk)-1))

Buggy submission (verdict: Runtime Error):
import sys
#input=sys.stdin.readline
sys.setrecursionlimit(3000)


#L=-1  R=1
n,k=map(int,input().split())
s=input()
#print(s)
t=s[0]
c=[-1,1][s[0]=="R"]
d=[0]

for i in range(1,n):
    if t!=s[i]:
        d.append(c)
        c=0
    t=s[i]
    c+=[-1,1][s[i]=="R"]
d.append(c)
c=len(d)

#print(c,d)
if c>2:
    for i in range(1,k+1):
        d[i*2]*=-1
#print(d)
"""
p=[-1,-1]
for i in range(1,c-1):
    tmp=(abs(d[i-1])+abs(d[i])+abs(d[i+1]))
    if tmp>p[0]:
        p[0]=tmp
        p[1]=i
i=p[1]
for j in range(k):
    if i+j*2>=c: break
    d[i+j*2]*=-1
"""
chk=0
ans=0
for i in d:
    if (i>0 and chk>0) or (i<0 and chk<0):
        chk+=i
    else:
        if chk!=0: ans+=abs(chk)-1
        chk=i

print(ans+(abs(chk)-1))
Problem p02952 (python)

Fixed submission:
n=int(input())
if n==100000:
    print(90909)
elif n<100:
    print(min(9,n))
elif n<1000:
    print(9+(n-99))
elif n<10000:
    print(909)
else:
    print(909+(n-9999))

Buggy submission (verdict: Runtime Error):
print(len([i for i in range(i,int(input())+1) if len(str(i))%2]))
Problem p02994 (python)

Fixed submission:
n,l=map(int,input().split())
ans=0
chk=10000
for i in range(n):
    ans+=i+l
    if abs(chk)>abs(i+l):
        chk=i+l
print(ans-chk)

Buggy submission (verdict: Runtime Error):
s=input()
print("Bad" if s[0]==s[1] or s[1]==s[2] or s[2]==s[3] else "Good")
Problem p03001 (python)

Fixed submission:
w,h,x,y=map(int,input().split())
s=(w*h)/2
if (h//2==y and h%2==0) and (w//2==x and w%x==0):
    print(s,1)
else:
    print(s,0)

Buggy submission (verdict: Runtime Error):
import sys
w,h,x,y=map(int,input().split())
#l=[int(i) for i in input().split()]
a=[y*w,(h-y)*w]
a.sort()
b=[x*h,(w-x)*h]
b.sort()
d=[a[0],b[0]]
d.sort()
#print(a,b,d)
#0,0 x,y 
if abs((h/w)-(y/x)) < sys.float_info.epsilon:
    print((w*h)/2,0)
elif x!=w and abs((h/w)-y/(x-w))< sys.float_info.epsilon:
    print((w*h)/2,0)
elif (x==0 and y==0) or (x==w and y==h) or (x==0 and y==h) or (x==w and y==0):
    print((w*h)/2,0)
elif d[0]==d[1]:
    print(d[1],1)
else:
    print(d[1],0)

Buggy submission (verdict: Runtime Error):
import sys
w,h,x,y=map(int,input().split())
#l=[int(i) for i in input().split()]
a=[y*w,(h-y)*w]
a.sort()
b=[x*h,(w-x)*h]
b.sort()
d=[a[0],b[0]]
d.sort()
#print(a,b,d)
#0,0 x,y 
if abs((h/w)-(y/x) < sys.float_info.epsilon:
    print((w*h)/2,0)
elif x!=w and abs((h/w)-y/(x-w))< sys.float_info.epsilon:
    print((w*h)/2,0)
elif (x==0 and y==0) or (x==w and y==h) or (x==0 and y==h) or (x==w and y==0):
    print((w*h)/2,0)
elif d[0]==d[1]:
    print(d[1],1)
else:
    print(d[1],0)

Buggy submission (verdict: Runtime Error):
import sys
w,h,x,y=map(int,input().split())
#l=[int(i) for i in input().split()]
a=[y*w,(h-y)*w]
a.sort()
b=[x*h,(w-x)*h]
b.sort()
d=[a[0],b[0]]
d.sort()
#print(a,b,d)
#0,0 x,y 
if abs(h/w-y/x)< sys.float_info.epsilon:
    print((w*h)/2,0)
elif abs(h/w-y/(x-w))< sys.float_info.epsilon:
    print((w*h)/2,0)
elif (x==0 and y==0) or (x==w and y==h) or (x==0 and y==h) or (x==w and y==0):
    print((w*h)/2,0)
elif d[0]==d[1]:
    print(d[1],1)
else:
    print(d[1],0)
Problem p03031 (python)

Fixed submission:
def sol():
    n,m=map(int,input().split())
    k=[]
    for i in range(m):
        l=[int(i) for i in input().split()]
        k.append([l[j]-1 for j in range(1,l[0]+1)])
    p=[int(i) for i in input().split()]
    ans=0
    #for i in range(2**10):
    for i in range(2**n):
        s=bin(i)[2:]
        s="0"*(n-len(s))+s
        s=s[::-1]
        for a,j in enumerate(k):
            chk=f=0
            for x in j:
                if s[x]=="1":
                    chk+=1
            if chk%2!=p[a]:
                f=1
                break
        if f==0:
            ans+=1
    print(ans)

if __name__=="__main__":
    sol()

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
k=[[int(i) for i in input().split()] for j in range(m)]
p=[int(i) for i in input().split()]
ans=chk=0
for i in range(2**n):
    l=[0]*m
    for j in range(n):
        if i&1: l[j]=1
        i=i>>1
    y=0
    for j in range(m):
        x=0
        for a in range(k[j][0]):
            if l[k[j][a+1]-1]==1: x+=1
        if x%2==p[j]%2: y+=1
    if y==m: ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
k=[[int(i) for i in input().split()] for j in range(m)]
p=[int(i) for i in input().split()]
ans=chk=0
for i in range(2**n):
    l=[0]*8
    for j in range(n):
        if i&1: l[j]=1
        i=i>>1
    y=0
    for j in range(m):
        x=0
        for a in range(k[j][0]):
            if l[k[j][a+1]-1]==1: x+=1
        if x%2==p[j]%2: y+=1
    if y==m: ans+=1
print(ans)