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

Fixed submission:
n, m = map(int, input().split())
indices = []
for _ in range(m):
  s_map = map(int, input().split())
  next(s_map)
  indices.append([s-1 for s in s_map])
p = list(map(int, input().split()))
count = 0
for i in range(1 << n):
  list_i = [int(bit) for bit in format(i, '0{}b'.format(n))]
  flag = True
  for j in range(m):
    on = 0
    for idx in indices[j]:
      on ^= list_i[idx]
    if on != p[j]:
      flag = False
      break
  if flag:
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
light = []
for _ in range(m):
  s_map = map(int, input().split())
  next(s_map)
  indices = [s-1 for s in s_map]
  light.append(int('0b' + ''.join(number)))
p = list(map(int, input().split()))
count = 0
for i in range(1 << n):
  list_i = [int(bit) for bit in format(i, '0{}b'.format(n))]
  flag = True
  for j in range(m):
    on = 0
    for idx in indices:
      on ^= list_i[idx]
    if on != p[j]:
      flag = False
      break
  if flag:
    count += 1
print(count)
Problem p03032 (python)

Fixed submission:
n, k = map(int, input().split())
v = list(map(int, input().split()))
mini = min(n, k)
value = 0
for a in range(mini + 1):
  for b in range(mini - a + 1):
    c = k - a - b
    j = v[:a] + v[n-b:]
    j.sort(reverse=True)
    for _ in range(c):
      if j and j[-1] < 0:
        j.pop()
      else:
        break
    value = max(value, sum(j))
print(value)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
v = list(map(int, input().split()))
mini = min(n, k)
value = 0
for a in range(mini + 1):
  for b in range(mini - a + 1):
    c = k - a - b
    j = v[:a] + v[n-b:]
    j.sort(reverse=True)
    for _ in range(c):
      if j[-1] < 0:
        j.pop()
      else:
        break
    value = max(value, sum(j))
print(value)
Problem p03044 (python)

Fixed submission:
n = int(input())
adj = [[] for _ in range(n)]
for _ in range(n-1):
  u, v, w = map(int, input().split())
  adj[u-1].append((w, v-1))
  adj[v-1].append((w, u-1))
paint = [None] * n
paint[0] = 0
stack = [0]
while stack:
  u = stack.pop()
  for w, v in adj[u]:
    if paint[v] is None:
      stack.append(v)
      paint[v] = (paint[u] + w) % 2
for p in paint:
  print(p)

Buggy submission (verdict: Runtime Error):
n = int(input())
adj = [[] for _ in range(n)]
for _ in range(n-1):
  u, v, w = map(int, input())
  adj[u-1].append((w, v-1))
  adj[v-1].append((w, u-1))
paint = [None] * n
paint[0] = 0
stack = [0]
while stack:
  u = stack.pop()
  for w, v in adj[u]:
    if paint[v] is None:
      stack.append(v)
      paint[v] = (paint[u] + w) % 2
for p in paint:
  print(p)
Problem p03163 (python)

Fixed submission:
import numpy as np

N, W = map(int, input().split())
dp = np.zeros(W + 1, dtype=np.int)
for _ in range(N):
  w, v = map(int, input().split())
  dp[w:] = np.maximum(dp[w:], dp[:-w] + v)
print(dp[W])

Buggy submission (verdict: Runtime Error):
N, W = map(int, input().split())
dp = np.zeros(W + 1, dtype=np.int)
for _ in range(N):
  w, v = map(int, input().split())
  dp[w:] = np.maximum(dp[w:], dp[:-w] + v)
print(dp[W])
Problem p03164 (python)

Fixed submission:
import numpy as np

N, W = map(int, input().split())
dp = np.array([W + 1] * (N * 1000 + 1))
dp[0] = 0
for _ in range(N):
  w, v = map(int, input().split())
  dp[v:] = np.minimum(dp[v:], dp[:-v] + w)
max_value = 0
for v, w in enumerate(dp):
  if w <= W:
    max_value = v
print(max_value)

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

N, W = map(int, input().split())
dp = np.zeros(W + 1, dtype=np.int)
for _ in range(N):
  w, v = map(int, input().split())
  dp[w:] = np.maximum(dp[w:], dp[:-w] + v)
print(dp[W])
Problem p03165 (python)

Fixed submission:
s = input()
t = input()
len_s, len_t = len(s), len(t)
dp = [[0] * (len_t + 1) for _ in range(len_s + 1)]
for index_s in range(len_s):
  char_s = s[index_s]
  dp_s = dp[index_s]
  dp_ss = dp[index_s + 1]
  for index_t in range(len_t):
    if char_s == t[index_t]:
      dp_ss[index_t + 1] = dp_s[index_t] + 1
    else:
      dp_ss[index_t + 1] = max(dp_s[index_t + 1], dp_ss[index_t])
index_s, index_t = len_s - 1, len_t - 1
lcs_reverse = []
len_lcs = dp_ss[-1]
while len_lcs > 0:
  if s[index_s] == t[index_t]:
    lcs_reverse.append(s[index_s])
    index_s -= 1
    index_t -= 1
    len_lcs -= 1
  elif dp[index_s][index_t + 1] == len_lcs:
    index_s -= 1
  else:
    index_t -= 1
print(''.join(lcs_reverse[::-1]))

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

s = input()
t = input()
len_s, len_t = len(s), len(t)
dp = np.zeros((len_s + 1, len_t + 1), dtype=np.int)
for index_s in range(len_s):
  char_s = s[index_s]
  for index_t in range(len_t):
    if char_s == t[index_t]:
      dp[index_s + 1, index_t + 1] = dp[index_s, index_t] + 1
    else:
      dp[index_s + 1, index_t + 1] = max(
        dp[index_s, index_t + 1], dp[index_s + 1, index_t])
index_s, index_t = len_s - 1, len_t - 1
lcs_reverse = []
len_lcs = dp[-1, -1]
while len_lcs > 0:
  if s[index_s] == t[index_t]:
    lcs_reverse.append(s[index_s])
    index_s -= 1
    index_t -= 1
    len_lcs -= 1
  elif dp[index_s, index_t + 1] == len_lcs:
    index_s -= 1
  elif dp[index_s + 1, index_t] == len_lcs:
    index_t -= 1
  else:
    raise ValueError
print(''.join(lcs_reverse[::-1]))

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

s = input()
t = input()
len_s, len_t = len(s), len(t)
dp = [[0] * (len_t + 1) for _ in range(len_s + 1)]
for index_s in range(len_s):
  char_s = s[index_s]
  dp_s = dp[index_s]
  dp_ss = dp[index_s + 1]
  for index_t in range(len_t):
    if char_s == t[index_t]:
      dp_ss[index_t + 1] = dp_s[index_t] + 1
    else:
      dp_ss[index_t + 1] = max(dp_s[index_t + 1], dp_ss[index_t])
index_s, index_t = len_s - 1, len_t - 1
lcs_reverse = []
len_lcs = dp_ss[-1]
while len_lcs > 0:
  if s[index_s] == t[index_t]:
    lcs_reverse.append(s[index_s])
    index_s -= 1
    index_t -= 1
    len_lcs -= 1
  elif dp[index_s][index_t + 1] == len_lcs:
    index_s -= 1
  else:
    index_t -= 1
print(''.join(lcs_reverse[::-1]))

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

s = input()
t = input()
len_s, len_t = len(s), len(t)
dp = [[0] * (len_t + 1) for _ in range(len_s + 1)]
for index_s in range(len_s):
  char_s = s[index_s]
  dp_s = dp[index_s]
  dp_ss = dp[index_s + 1]
  for index_t in range(len_t):
    if char_s == t[index_t]:
      dp_ss[index_t + 1] = dp_s[index_t] + 1
    else:
      dp_ss[index_t + 1] = max(dp_s[index_t + 1], dp_ss[index_t])
index_s, index_t = len_s - 1, len_t - 1
lcs_reverse = []
len_lcs = dp[-1, -1]
while len_lcs > 0:
  if s[index_s] == t[index_t]:
    lcs_reverse.append(s[index_s])
    index_s -= 1
    index_t -= 1
    len_lcs -= 1
  elif dp[index_s][index_t + 1] == len_lcs:
    index_s -= 1
  else:
    index_t -= 1
print(''.join(lcs_reverse[::-1]))
Problem p03244 (python)

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

odd = [[0, i] for i in range(100001)]
even = [[0, i] for i in range(100001)]

for i in range(0, n, 2):
  odd[v[i]][0] += 1
for i in range(1, n, 2):
  even[v[i]][0] += 1

odd.sort()
even.sort()

if odd[-1][1] != even[-1][1]:
  print(n - odd[-1][0] - even[-1][0])
else:
  print(n - max(odd[-2][0] + even[-1][0], odd[-1][0] + even[-2][0]))

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

odd = [[0, i] for i in range(10001)]
even = [[0, i] for i in range(10001)]

for i in range(0, n, 2):
  odd[v[i]][0] += 1
for i in range(1, n, 2):
  even[v[i]][0] += 1

odd.sort()
even.sort()

if odd[-1][1] != even[-1][1]:
  print(n - odd[-1][0] - even[-1][0])
else:
  print(n - max(odd[-2][0] + even[-1][0], odd[-1][0] + even[-2][0]))
Problem p04046 (python)

Fixed submission:
mod = 10**9 + 7
h, w, a, b = map(int, input().split())

fact = [1] * (h + w + 1)
invf = [1] * (h + w + 1)
invn = [1] * (h + w + 1)
for i in range(2, h + w + 1):
  fact[i] = fact[i-1] * i % mod
  invn[i] = (-invn[mod % i]) * (mod // i) % mod
  invf[i] = invf[i-1] * invn[i] % mod

count = 0
for i in range(min(h-a, w-b)):
  count += fact[h+b-a-1] * invf[h-a-i-1] * invf[b+i] * fact[w+a-b-1] * invf[a+i] * invf[w-b-i-1]
  count %= mod
print(count)

Buggy submission (verdict: Runtime Error):
mod = 10**9 + 7
h, w, a, b = map(int, input().split())

fact = [1] * (h + w + 1)
invf = [1] * (h + w + 1)
invn = [1] * (h + w + 1)
for i in range(1, h + w + 1):
  fact[i] = fact[i-1] * i % mod
  invn[i] = -invn[mod % i] * (p // i) % mod
  invf[i] = invf[i-1] * invn[i] % mod

count = 0
for i in range(min(h-a, w-b)):
  count += fact[h+b-a-1] * invf[h-a-i-1] * invf[b+i] * fact[w+a-b-1] * invf[a+i] * invf[w-b-i-1]
  count %= mod
print(count)
Problem p02553 (python)

Fixed submission:
a,b,c,d=list(map(int,input().split()))
x=[a*c,a*d,b*c,b*d]
print(max(x))

Buggy submission (verdict: Runtime Error):
a,b,c,d=[int(input()) for i in range(4)]
x=[a*b,a*c,b*d,b*c]
print(max(x))
Problem p02582 (python)

Fixed submission:
S=input()
count=[0]
s=0
for i in range(3):
    if S[i]=='R':
        if i==2 or S[i+1]=='S':
            s=s+1
            count.append(s)
            s=0
        else:
            s=s+1
print(max(count))

Buggy submission (verdict: Runtime Error):
S=input()
count=[]
s=0
for i in range(3):
    if S[i]=='R':
        if i==2 or S[i+1]=='S':
            s=s+1
            count.append(s)
            s=0
        else:
            s=s+1
print(max(count))
Problem p02555 (python)

Fixed submission:
S=int(input())
x=10**9+7
a=[0 for i in range(2001)]
a[3]=1
a[4]=1
a[5]=1
a[6]=2
for i in range(7,S+1):
    a[i]=(a[i-1]+a[i-3])%x
print(a[S])

Buggy submission (verdict: Runtime Error):
S=int(input())
x=10**9+7
a=[0 for i in range(S+1)]
a[3]=1
a[4]=1
a[5]=1
a[6]=2
for i in range(7,S+1):
    a[i]=(a[i-1]+a[i-3])%x
print(a[S])
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
a,b=int(map(int,input().split()))
print(a*b)
Problem p02658 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
A=sorted(A,reverse=True)
if(A[-1]==0):
    print(0)
else:
    ans=1
    flag=0
    for i in range(N):
        ans=ans*A[i]
        if(ans>10**18):
            flag=1
            break
    if(flag==0):
        print(ans)
    else:
        print(-1)

Buggy submission (verdict: Runtime Error):
A=list(map(int,input().split()))
A=sorted(A,reverse=True)
if(A[-1]==0):
    print(0)
else:
    ans=1
    flag=0
    for i in range(N):
        ans=ans*A[i]
        if(ans>10**18):
            flag=1
            break
    if(flag==0):
        print(ans)
    else:
        print(-1)
Problem p02690 (python)

Fixed submission:
X=int(input())
for i in range(121):
    a=i
    for j in range(121):
        b=j
        if(a**5-b**5==X):
            A=a
            B=b
        b=-j
        if(a**5-b**5==X):
            A=a
            B=b
print(A,B)

Buggy submission (verdict: Runtime Error):
X=int(input())
for i in range(65):
    a=i
    for j in range(65):
        b=j
        if(a**5-b**5==X):
            A=a
            B=b
        b=-j
        if(a**5-b**5==X):
            A=a
            B=b
print(A,B)
Problem p02713 (python)

Fixed submission:
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)


N=int(input())
S=0
T=0
for i in range(1,N+1):
    for j in range(i+1,N+1):
        for k in range(j+1,N+1):
            S+=gcd(i,j,k)
for i in range(1,N+1):
    for j in range(i+1,N+1):
            T+=gcd(i,j,j)
            T+=gcd(i,j,j)
print(6*S+3*T+N*(N+1)//2)

Buggy submission (verdict: Runtime Error):
mport math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)


N=int(input())
S=0
T=0
for i in range(1,N+1):
    for j in range(i+1,N+1):
        for k in range(j+1,N+1):
            S+=gcd(i,j,k)
for i in range(1,N+1):
    for j in range(i+1,N+1):
            T+=gcd(i,j,j)
            T+=gcd(i,j,j)
print(6*S+3*T+N*(N+1)//2)
Problem p02714 (python)

Fixed submission:
import collections
N=int(input())
S=input()
lis=list(S)
C= collections.Counter(lis)
count=list(C.values())
c=0
for i in range(N):
    for j in range(i,(N+i-1) // 2+1):
        if(lis[i]!=lis[j]):
            if(lis[j]!=lis[2*j-i]):
                if(lis[i]!=lis[2*j-i]):
                    c+=1
if(len(count)==3):
    print(count[0]*count[1]*count[2]-c)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import collections
N=int(input())
S=input()
lis=list(S)
C= collections.Counter(lis)
count=list(C.values())
c=0
for i in range(N):
    for j in range(i,(N+i-1) // 2+1):
        if(lis[i]!=lis[j]):
            if(lis[j]!=lis[2*j-i]):
                if(lis[i]!=lis[2*j-i]):
                    c+=1
print(count[0]*count[1]*count[2]-c)

Buggy submission (verdict: Runtime Error):
import collections
N=int(input())
S=input()
lis=list(S)
C= collections.Counter(lis)
count=list(C.values())
c=0
for i in range(N):
    print(i)
    for j in range(i,(N+i-1) // 2+1):
        if(lis[i]!=lis[j]):
            if(lis[j]!=lis[2*j-i]):
                if(lis[i]!=lis[2*j-i]):
                    c+=1
print(count[0]*count[1]*count[2]-c)
Problem p02718 (python)

Fixed submission:
N,M=map(int,input().split())
A=list(map(int,input().split()))
new_A= sorted(A,reverse=True)
if(new_A[M-1]>=sum(A)/(4*M)):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
A=list(map(int,input().split()))
new_A= sorted(A,reverse=True)
if(new_A[M-1]>=sum(A)/(4*M):
    print("Yes")
else:
    print("No")
Problem p03292 (python)

Fixed submission:
import numpy as np
A = list(map(int, input().split()))

A = np.array(A)
A.sort()

print(np.diff(A).sum())

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

import pandas as pd

print(int(pd.Series(A).sort_values().diff().sum()))
Problem p03597 (python)

Fixed submission:
A = int(input())
B = int(input())


print(A*A-B)

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

print(A*A-B)

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

print(A*A-B)
Problem p02612 (python)

Fixed submission:
n = int(input())
n = n % 1000
if 1000 - n == 1000:
    print(0)
else:
    print(1000 - n)

Buggy submission (verdict: Runtime Error):
n = input()
n = int(n[1:])
if 1000 - n == 1000:
    print(0)
else:
    print(1000 - n)
Problem p02677 (python)

Fixed submission:
import math
# a: 時
# b: 分
# 
a, b, h, m = map(int, input().split())

angle_h = h * 30 + m * 0.5
angle_m = m * 6

cos_ = math.cos( math.radians( abs( angle_h - angle_m ) ) )

x = ( a**2 + b**2 - 2*a*b*cos_ ) ** 0.5

print(x)

Buggy submission (verdict: Runtime Error):
import math
# a: 時
# b: 分
# 
a, b, h, m = map(int, input().split())

x = ( a**2 + b**2 - 2*a*b* math.cos(int(360 / h) * 30) - int(360 / m) * 6 ) ** 0.5
print(x)

Buggy submission (verdict: Runtime Error):
import math
# a: 時
# b: 分
# 
a, b, h, m = map(int, input().split())


x = ( a**2 + b**2 - 2*a*b* math.cos(int(360 / h) * 30) - int(360 / m) * 6 ) ** 0.5
print(x)

Buggy submission (verdict: Runtime Error):
import math
# a: 時
# b: 分
# 
a, b, h, m = map(int, input().split())


x = ( a**2　+　b**2　−　2 * a * b * math(int(360 / h) * 30) + int(360 / m) * 6 ) ** 0.5
print(x)

Buggy submission (verdict: Runtime Error):
import math
# a: 時
# b: 分
# 
a, b, h, m = map(int, input().split())


x　=　( a**2　+　b**2　−　2 * a * b * math(int(360 / h) * 30) + int(360 / m) * 6 ) ** 0.5
print(x)
Problem p02909 (python)

Fixed submission:
s = input()
if s == "Sunny":
  print("Cloudy")
elif s == "Cloudy":
  print("Rainy")
elif s == "Rainy":
  print("Sunny")

Buggy submission (verdict: Runtime Error):
# D - Powerful Discount Tickets

def power(price, ticket_count):
    return int(price // (2 ** ticket_count))

# n: 商品数
# m: チケットの枚数
n, m = map(int, input().split())
data = list(map(int, input().split()))

ans = 0

for i in range(m):
    data.sort()
    data = data[::-1]

    max_data = data[0]
    if max_data == 0:
        break

    max_point = 0
    data[max_point] = power(data[max_point], 1)

print(sum(data))
Problem p02910 (python)

Fixed submission:
s = list(input())
odd_s = ["R", "U", "D"]
even_s = ["L", "U", "D"]

ans = "Yes"

for i in range(len(s)):
  if i % 2 == 0:
    if s[i] not in odd_s:
      ans = "No"
  
  if i % 2 == 1:
    if s[i] not in even_s:
      ans = "No"

print(ans)

Buggy submission (verdict: Runtime Error):
odd = ["R", "U", "D"]
even = ["L", "U", "D"]
s_list = list(input())

ans = "Yes"
for i in range(s_list):
  if i % 2 == 0:
    if not s_list[i] in odd:
      ans = "No"
  
  if i % 2 == 1:
    if not s_list[i] in even:
      ans = "No"

print(ans)

Buggy submission (verdict: Runtime Error):
odd = ["R", "U", "D"]
even = ["L", "U", "D"]
s_list = list(input())

ans = "Yes"
for i in range(s_list):
  if i % 2 == 0:
	  if not s_list[i] in odd:
    	ans = "No"
  
  if i % 2 == 1:
	  if not s_list[i] in even:
    	ans = "No"

print(ans)

Buggy submission (verdict: Runtime Error):
odd = ["R", "U", "D"]
even = ["L", "U", "D"]
s_list = list(input())

ans = "Yes"
for i in range(s_list):
  if i % 2 == 0:
	  if not data[i] in odd:
    	ans = "No"
  
  if i % 2 == 0:
	  if not data[i] in even:
    	ans = "No"

print(ans)
Problem p02934 (python)

Fixed submission:
def main():
    n = int(input())
    data = list(map(int, input().split()))

    for k in data:
        if k == 0:
            return 0

    up = 1
    for i in range(n):
        up *= data[i]

    down = 0
    for j in range(n):
        down += up / data[j]

    return (up / down)

print(main())

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

    for k in data:
        if k == 0:
            return 0

    up = 0
    for i in range(n):
        up *= data[i]

    down = 0
    for j in range(n):
        down += up / data[j]

    return up / down

print(main())

Buggy submission (verdict: Runtime Error):
n = int(input())
data = map(int, input().split())
up = 0
for i in range(n):
  up *= data[i]
 
down = 0
for j in range(n):
  down += up / data[j]
 
print(up / down)
Problem p02945 (python)

Fixed submission:
a, b = map(int, input().split())
p = a + b
m = a - b
d = a * b
print(max(p, m, d))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
p = a + b
m = max(a - b)
d = a * b
print(max(p, m, d))
Problem p02957 (python)

Fixed submission:
data = list(map(int, input().split()))
data.sort()
if abs(data[0] - data[1]) / 2 == int(abs(data[0] - data[1]) / 2):
  print(int(data[1] - (abs(data[0]-data[1]) / 2) ))
else:
  print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if abs(a-b) / 2 == int(abs(a-b) / 2):
  print( abs(a-b) / 2 )
else:
  print("IMPOSSIBLE")
Problem p02993 (python)

Fixed submission:
s = input()
ans = "Good"
for i in range(3):
    if s[i] == s[i+1]:
        ans = "Bad"
 
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
ans = "Good"
for i in range(3)
	if s[i] == s[i+1]:
		ans = "Bad"
 
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
ans = "Good"
for i in range(3)
	if s[i] == s[i+1]:
    	ans = "Bad"

print(ans)
Problem p03029 (python)

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

Buggy submission (verdict: Runtime Error):
a, b = map(int, input())
print(int((a * 3 + b) / 2))
Problem p03062 (python)

Fixed submission:
# 解説を見て書いたコード
N = int(input())
data = list(map(int, input().split()))
count = 0

def ary_abs(data):
    for i in range(len(data)):
        data[i] = abs(data[i])


for i in data:
    if i <= 0:
        count += 1

if count % 2 == 0:
    # 負が 偶数 個のとき
    # 全てを正にした和
    ary_abs(data)
    print(sum(data))
else:
    # 負が 奇数 個のとき
    # どれか一つを負(最小のもの)
    ary_abs(data)
    print(sum(data) - min(data) * 2)

Buggy submission (verdict: Runtime Error):

N = int(input())
data = list(map(int, input().split()))

def ary_abs(data):
    for i in range(len(data)):
        data[i] = abs(data[i])


for i in data:
    count = 0
    if data <= 0:
        count += 1

if count % 2 == 0:
    # 負が 偶数 個のとき
    # 全てを正にした和
    ary_abs(data)
    print(sum(data))
else:
    # 負が 奇数 個のとき
    # どれか一つを負(最小のもの)
    ary_abs(data)
    print(sum(data) - min(data) * 2)
Problem p03273 (python)

Fixed submission:
h, w = map(int, input().split())
data = []
for _ in range(h):
    data.append( list(input()) )

next_data = []
# 横列処理
for d in data:
    if "#" in d:
        next_data.append( d )

next_next_data = []
origin_v_data = []
# 縦列処理
for i in range( len(next_data[0]) ):
    # 縦配列生成
    v_data = []
    for j in range( len(next_data) ):
        v_data.append( next_data[j][i] )

    # 配列チェック
    if "#" in v_data:
        origin_v_data.append( v_data )

ans_data = []
for i in range( len(origin_v_data[0]) ):
    join_data = []
    for j in range( len(origin_v_data) ):
        join_data.append( origin_v_data[j][i] )
    ans_data.append( join_data )

# 標準出力
for a in ans_data:
    print("".join(a))

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
data = []
for _ in range(h):
    data.append( list(input()) )

next_data = []
# 横列処理
for d in data:
    if "#" in d:
        next_data.append( d )

next_next_data = []
origin_v_data = []
# 縦列処理
for i in range( len(next_data[0]) ):
    # 縦配列生成
    v_data = []
    for j in range( len(next_data) ):
        v_data.append( next_data[j][i] )

    # 配列チェック
    if "#" in v_data:
        origin_v_data.append( v_data )

ans_data = []
for i in range( len(origin_v_data[0]) ):
    join_data = []
    for j in range( len(origin_v_data) ):
        join_data.append( origin_v_data[i][j] )
    ans_data.append( join_data )

# 標準出力
for a in ans_data:
    print("".join(a))
Problem p03455 (python)

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

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

Buggy submission (verdict: Runtime Error):
if int(input()) * int(input()) % 2 == 0:
  print("Even")
else:
  print("Odd")
Problem p03860 (python)

Fixed submission:
a, s, c = map(str, input().split())
print(a[0] + s[0] + c[0])

Buggy submission (verdict: Runtime Error):
a, s, c = map(int, input().split())
print(a[0] + s[0] + c[0])
Problem p02983 (python)

Fixed submission:
L,R = map(int,input().split())

total = 2019

if R-L >= 2019:
  print(0)
  exit()

for l in range(L,R):
  for r in range(L+1,R+1):
    if l*r%2019 == 0:
      print(0)
      exit()
    else:
      total = min(total,l*r%2019)
    
print(total)

Buggy submission (verdict: Runtime Error):
L,R = map(int,input().split())

if L == 0 or L%2019 == 0 or R%2019 == 0:
  print(0)
  exit()
elif R - L == 1:
  print(L*R)
  exit()

a = list(range(L,R+1))

N = len(a)
r = 0
total = []

for l in range(N):
  r = l + 1
  while r < N:
    total.append((a[l]*a[r])%2019)
    r += 1
  if l == r:
    l += 1
    
print(min(total))

Buggy submission (verdict: Runtime Error):
L,R = map(int,input().split())

a = list(range(L,R+1))

N = len(a)
r = 0
total = []

for l in range(N):
  r = l + 1
  while r < N:
    total.append((a[l]*a[r])%2019)
    r += 1
  if l == r:
    l += 1
    
print(min(total))
Problem p03285 (python)

Fixed submission:
import itertools

N = int(input())

if N%4 ==0 or N%7 ==0:
  print('Yes')
  exit()
else:
  i = itertools.product(range(N//4+1),range(N//7+1))
  

c = [a for a in i]
for i in c:
  if i[0]*4+i[1]*7 == N:
    print('Yes')
    exit()
  else:
    continue

print('No')

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

if (N%7)%4 == 0 or (N%4)%7 == 0
  print('Yes')
else:
  print('No')
Problem p03338 (python)

Fixed submission:
N = int(input())
S = input()

z = []
for i in range(1,N):
  x = S[:i]
  y = S[i:]
  if set(x) & set(y):
    z.append(len(set(x)&set(y)))
  else:
    continue

print(max(z) if len(z) != 0 else 0)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()

z = []
for i in range(1,N):
  x = S[:i]
  y = S[i:]
  if set(x) & set(y):
    z.append(len(set(x)&set(y)))
  else:
    continue

print(max(z))