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

Fixed submission:
l = ['Sunny', 'Cloudy', 'Rainy' ]
S = input()
if S == 'Rainy':
    print('Sunny')
else:
    print(l[l.index(S)+1])

Buggy submission (verdict: Runtime Error):
S = list(map(str, input()))
count1 = 0
count2 = 1
while count2 < len(S):        
    if S[count2] == 'R':
        print('No')
        break
    else:
        count2 += 2
while count1+1 <= len(S):
    if S[count1] == 'L':
        print('No')
        break
    else: count +=2

else:
    print('Yes')
Problem p02910 (python)

Fixed submission:
S = list(map(str, input()))
count1 = 0
count2 = 1
while count1+1 <= len(S):
    if S[count1] == 'L':
        print('No')
        break
    else: count1 +=2
else:
    while count2 < len(S):        
        if S[count2] == 'R':
            print('No')
            break
        else:
            count2 += 2
    else:
        print('Yes')

Buggy submission (verdict: Runtime Error):
S = list(map(str, input()))
count1 = 0
count2 = 1
while count2 < len(S):        
    if S[count2] == 'R':
        print('No')
        break
    else:
        count2 += 2
while count1+1 <= len(S):
    if S[count1] == 'L':
        print('No')
        break
    else: count +=2

else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
S = list(map(str, input()))
count1 = 0
count2 = 1
while count2 < len(S):        
    if S[count2] == 'R':
        print('No')
        break
    else:
        count2 += 2
while count1+1 <= len(S):
    if S[count1] == 'L':
        print('No')
        break
    else: count +=2

else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
S = list(map(str, input()))
count1 = 0
count2 = 1
while count2 < len(S):        
    if S[count2] == 'R':
        print('No')
        break
    else:
        count2 += 2
while count1+1 <= len(S):
    if S[count1] == 'L':
        print('No')
        break
    else: count +=2

else:
    print('Yes')
Problem p02921 (python)

Fixed submission:
a,b,c =input()
d,e,f =input()
cnt = 0
if a == d:
    cnt = cnt +1
if b == e:
    cnt = cnt +1
if c == f:
    cnt = cnt +1
print(cnt)

Buggy submission (verdict: Runtime Error):
A,B = map(int, input().split())
n =1
while True:
    if B == 1:
        print(0)
        break
    if B <= n*(A-1)+1:
        print(n)
        break
    else:
        n += 1
Problem p03000 (python)

Fixed submission:
N, X = map(int, input().split())
L = list(map(int, input().split()))
cnt = 0
if sum(L) <= X:
    print(N+1)
else:
    for i in range(N+1):
        if cnt <= X:
            cnt += L[i]
        else:
            print(i)
            break

Buggy submission (verdict: Runtime Error):
N, X = map(int, input().split())
L = list(map(int, input().split()))
cnt = 0
for i in range(N+2):
    if cnt <= X:
        cnt += L[i]
    else:
        print(i)
        break
Problem p02584 (python)

Fixed submission:
#n, m, q = map(int, input().split())
#List = list(map(int, input().split()))
#req = [list(map(int, input().split())) for _ in range(q)]
#t = t[:-1]
#print(ans[j], end = "") 改行無しで出力
#[0]*n
#sort = sorted(a)[::-1] 降順
import math
x, k, d = map(int, input().split())

num = k*d

x = abs(x)
flag = 0

if x >= num:
    print(x - num)
else:
    if x > d:
        j = int(x / d)
    else:
        if x*2 > d:
            j = 1
            flag = 1
        else:
            j = 0

    if j == 0:
        b = x
    elif j == 1 and flag == 1:
        b = d - x
    else:
        b = x % (d*j)
    min = min(b, d - b)
    max = max(b, d - b)
    if min == d - b:
        j += 1

    if (k - j) % 2 == 0:
        print(min)
    else:
        print(max)

Buggy submission (verdict: Runtime Error):
#n, m, q = map(int, input().split())
#List = list(map(int, input().split()))
#req = [list(map(int, input().split())) for _ in range(q)]
#t = t[:-1]
#print(ans[j], end = "") 改行無しで出力
#[0]*n
#sort = sorted(a)[::-1] 降順
import math
x, k, d = map(int, input().split())

num = k*d

x = abs(x)

if x >= num:
    print(x - num)
else:
    j = int(x / d)
    b = x % (d*j)
    min = min(b, d - b)
    max = max(b, d - b)
    if min == d - b:
        j += 1

    if (k - j) % 2 == 0:
        print(min)
    else:
        print(max)

Buggy submission (verdict: Runtime Error):
#n, m, q = map(int, input().split())
#List = list(map(int, input().split()))
#req = [list(map(int, input().split())) for _ in range(q)]
#t = t[:-1]
#print(ans[j], end = "") 改行無しで出力
#[0]*n
#sort = sorted(a)[::-1] 降順
import math
x, k, d = map(int, input().split())

num = k*d

x = abs(x)

if x >= num:
    print(x - num)
else:
    j = int(x / d)
    min = min(x % (d*j), d - (x % (d*j)))
    if min == d - (x % (d*j)):
        j += 1

    if (k - j) % 2 == 0:
        print(min)
    else:
        print(max(x % (d*j), d - (x % (d*j))))
Problem p02613 (python)

Fixed submission:
#n, m, q = map(int, input().split())
#List = list(map(int, input().split()))
#req = [list(map(int, input().split())) for _ in range(q)]
#t = t[:-1]
#print(ans[j], end = "") 改行無しで出力
#[0]*n
n = int(input())
s = [input()for _ in range(n)]
ac = 0
wa = 0
tle = 0
re = 0

for i in s:
    if i == "AC":
        ac += 1
    elif i == "WA":
        wa += 1
    elif i == "TLE":
        tle += 1
    else:
        re += 1

print("AC" + " x ", end = "")
print( ac)
print("WA" + " x ", end = "")
print( wa)
print("TLE" + " x ", end = "")
print( tle)
print("RE" + " x ", end = "")
print( re)

Buggy submission (verdict: Runtime Error):
#n, m, q = map(int, input().split())
#List = list(map(int, input().split()))
#req = [list(map(int, input().split())) for _ in range(q)]
#t = t[:-1]
#print(ans[j], end = "") 改行無しで出力
#[0]*n
n = int(input())
s = [input()for _ in range(n)]
ac = 0
wa = 0
tle = 0
re = 0

for i in s:
    if i == "AC":
        ac += 1
    elif i == "WA":
        wa += 1
    elif i == "TLE":
        tle += 1
    else:
        re += 1

print("AC" + " x", end = "")
print( ac)
print("WA" + " x", end = "")
print( wa)
print("TLE" + " x", end = "")
print( tle)
print("RE" + " x", end = "")
print( re)
#n, m, q = map(int, input().split())
#List = list(map(int, input().split()))
#req = [list(map(int, input().split())) for _ in range(q)]
#t = t[:-1]
#print(ans[j], end = "") 改行無しで出力
#[0]*n
n = int(input())
s = [input()for _ in range(n)]
ac = 0
wa = 0
tle = 0
re = 0

for i in s:
    if i == "AC":
        ac += 1
    elif i == "WA":
        wa += 1
    elif i == "TLE":
        tle += 1
    else:
        re += 1

print("AC" + " x", end = "")
print( ac)
print("WA" + " x", end = "")
print( wa)
print("TLE" + " x", end = "")
print( tle)
print("RE" + " x", end = "")
print( re)
Problem p02687 (python)

Fixed submission:
#n, m, q = map(int, input().split())
#List = list(map(int, input().split()))
s = input()

if s == "ABC":
    print("ARC")
else :
    print("ABC")

Buggy submission (verdict: Runtime Error):
#n, m, q = map(int, input().split())
#List = list(map(int, input().split()))
s = input()

if s == ABC:
    print("ARC")
else :
    print("ABC")

Buggy submission (verdict: Runtime Error):
#n, m, q = map(int, input().split())
#List = list(map(int, input().split()))
s = input()

if s == ABC:
    print("ARC")
else s == ARC:
    print("ABC")
Problem p02536 (python)

Fixed submission:
import sys
import math,bisect
sys.setrecursionlimit(10 ** 5)
from itertools import groupby,accumulate
from heapq import heapify,heappop,heappush
from collections import deque,Counter,defaultdict
def I(): return int(sys.stdin.readline())
def neo(): return map(int, sys.stdin.readline().split())
def Neo(): return list(map(int, sys.stdin.readline().split()))
def dfs(t):
    vis[t] = 1
    for i in G[t]:
        if not vis[i]:
            dfs(i)
N,M = neo()
G = defaultdict(list)
vis = [0]*(N+1)
for i in range(M):
    x,y = neo()
    G[x] += [y]
    G[y] += [x]
c = 0
for i in range(1,N+1):
    if not vis[i]:
        dfs(i)
        c += 1
print(c-1)

Buggy submission (verdict: Runtime Error):
import sys
import math,bisect
sys.setrecursionlimit(10 ** 5)
from itertools import groupby,accumulate
from heapq import heapify,heappop,heappush
from collections import deque,Counter,defaultdict
def I(): return int(sys.stdin.readline())
def neo(): return map(int, sys.stdin.readline().split())
def Neo(): return list(map(int, sys.stdin.readline().split()))
class Graph:
    def __init__(self,V):
        self.V = V
        self.adj = [[] for i in range(V)]
    def DFSUtil(self, temp, v, visited):
        visited[v] = True
        temp.append(v)
        for i in self.adj[v]:
            if visited[i] == False:
                temp = self.DFSUtil(temp, i, visited)
        return temp
    def addEdge(self, v, w):
        self.adj[v].append(w)
        self.adj[w].append(v)
    def connectedComponents(self):
        visited = []
        cc = []
        for i in range(self.V):
            visited.append(False)
        for v in range(self.V):
            if visited[v] == False:
                temp = []
                cc.append(self.DFSUtil(temp, v, visited))
        return cc
N,M = neo()
G = Graph(N)
for i in range(M):
    x,y = neo()
    G.addEdge(x,y)
    G.addEdge(y,x)
print(len(G.connectedComponents())-1)
Problem p02767 (python)

Fixed submission:
import sys

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

# i = min(x)
# while i <= max(x):
for i in range(min(x),max(x)+1,1):
    tmp = sum(map(lambda p: (p-i)**2,x))
    if ans > tmp:
        ans = tmp
    # i += 1
print(ans)

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

# i = min(x)
# while i <= max(x):
for i in range(min(x),max(x)+1,1):
    tmp = sum(map(lambda p: (p-i)**2,x))
    if ans > tmp:
        ans = tmp
    # i += 1
print(ans)
Problem p03574 (python)

Fixed submission:
import numpy as np

h,w = map(int,(input().split()))
s = [list(map(str,input())) for i in range(h)]
l = [[0]*(w+2) for i in range(h+2)]


def addFlag(i,j):
    for x in range(3):
        for y in range(3):
            if l[i+x][j+y] != '#':
                l[i+x][j+y] += 1
                
for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            l[i+1][j+1] = '#'
            addFlag(i,j)

l = np.delete(l,[0,h+1],0)
l = np.delete(l,[0,w+1],1)


for i in l:
    ans = ''.join(map(str,i))
    print(ans)

Buggy submission (verdict: Runtime Error):

import numpy as np

h,w = map(int,(input().split()))
s = [list(map(str,input())) for i in range(h)]
l = [[0]*(w+2) for i in range(h+2)]


def addFlag(i,j):
    for x in range(3):
        for y in range(3):
            if l[i+x][j+y] != '#':
                l[i+x][j+y] += 1
                
for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            l[i+1][j+1] = '#'
            addFlag(i,j)

l = np.delete(l,[0,h+1],0)
l = np.delete(l,[0,w+1],1)

for i in l:
    if len(i)>1:
        ans = ''.join(i)
    else:
        ans = int(i)
    print(ans)

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

h,w = map(int,(input().split()))
s = [list(map(str,input())) for i in range(h)]
l = [[0]*(w+2) for i in range(h+2)]


def addFlag(i,j):
    for x in range(3):
        for y in range(3):
            if l[i+x][j+y] != '#':
                l[i+x][j+y] += 1
                
for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            l[i+1][j+1] = '#'
            addFlag(i,j)

l = np.delete(l,[0,h+1],0)
l = np.delete(l,[0,w+1],1)

for i in l:
    if len(i)>1:
        ans = ''.join(i)
    else:
        ans = print(*i)
    print(ans)

Buggy submission (verdict: Runtime Error):

import numpy as np

h,w = map(int,(input().split()))
s = [list(map(str,input())) for i in range(h)]
l = [[0]*(w+2) for i in range(h+2)]


def addFlag(i,j):
    for x in range(3):
        for y in range(3):
            if l[i+x][j+y] != '#':
                l[i+x][j+y] += 1
                
for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            l[i+1][j+1] = '#'
            addFlag(i,j)

l = np.delete(l,[0,h+1],0)
l = np.delete(l,[0,w+1],1)

for i in l:
    if len(i)>1:
        ans = ''.join(i)
    else:
        ans = i
    print(*ans)

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

h,w = map(int,(input().split()))
s = [list(map(str,input())) for i in range(h)]
l = [[0]*(w+2) for i in range(h+2)]


def addFlag(i,j):
    for x in range(3):
        for y in range(3):
            if l[i+x][j+y] != '#':
                l[i+x][j+y] += 1
                
for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            l[i+1][j+1] = '#'
            addFlag(i,j)

l = np.delete(l,[0,h+1],0)
l = np.delete(l,[0,w+1],1)

for i in l:
    ans = ''.join(i)
    print(ans)
Problem p02584 (python)

Fixed submission:
X,K,D = map(int,input().split())
if X > 0:
  if X // D >= K:
    ans = X - D*K
  else:
    K -= X//D
    X = X%D
    if K%2 == 0:
      ans = X
    else:
      ans = abs(X -D)
if X < 0:
  if -1*X // D >= K:
    ans = abs(X + D*K)
  else:
    K -= (-1*X)//D
    X = (-1*X)%D
    if K%2 == 0:
      ans = X
    else:
      ans = abs(X -D)
if X == 0:
  if K%2==0:
    ans = 0
  else:
    ans = D
print(ans)

Buggy submission (verdict: Runtime Error):
X,K,D = map(int,input().split())
if X > 0:
  if X // D >= K:
    ans = X - D*K
  else:
    K -= X//D
    X = X%D
    if K%2 == 0:
      ans = X
    else:
      ans = abs(X -D)
if X < 0:
  if -1*X // D >= K:
    ans = abs(X + D*K)
  else:
    K -= X//D
    X = (-1*X)%D
    if K%2 == 0:
      ans = x
    else:
      ans = abs(X -D)
print(ans)
Problem p02608 (python)

Fixed submission:
N = int(input())
ans = [0]*10050
for i in range(1,105):
  for j in range(1,105):
    for k in range(1,105):
      v = i**2 + j**2 + k**2 + i*j + j*k + k*i
      if v < 10050:
        ans[v] += 1
for i in range(N):
  print(ans[i+1])

Buggy submission (verdict: Runtime Error):
N = int(input())
def func(n):
  ret = 0
  for i in range(p):
    for j in range(p):
      for k in range(p):
        if (i+j)**2+(j+k)**2+(k+i)**2 == 2*p:
          ans += 1
for i in range(N):
  print(func(i))
Problem p02665 (python)

Fixed submission:
n = int(input())
nums = list(map(int, input().split()))
if n == 0:
  if nums[0] == 1:
    print(1)
  else:
    print(-1)
  exit()
if n > 0 and nums[0] != 0:
  print(-1)
  exit()
n_nods = 1
ans = 1
ret = sum(nums)
for i in range(1,n+1):
  n_nods = min(n_nods*2,ret)
  ans += n_nods
  ret -= nums[i]
  n_nods -= nums[i]
  if n_nods < 0:
    print(-1)
    exit()
  if n_nods == 0 and i < n:
    print(-1)
    exit()
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
nums = list(map(int, input().split()))
if n == 0:
  if nums[0] == 1:
    print(1)
  else:
    print(-1)
  exit()
if n >=1 and nums[0] != 0:
  print(-1)
  exit()
n_nods = 1
ans = 1
ret = sum(nums)
for i in range(1,n+1):
  n_nods = min(n_nods*2,ret)
  ans += n_nods
  ret -= nums[i]
  n_nods -= nums[i]
  if n_nods < 0:
    print(-1)
    exxit()
  if n_nods == 0 and i < n:
    print(-1)
    exit()
print(ans)
Problem p02742 (python)

Fixed submission:
H,W = map(int,input().split())
if H == 1 or W == 1:
  print(1)
elif H*W % 2 == 0:
  print(H*W//2)
else:
  print(H*W//2+1)

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
if H == 1 or W == 1:
  print(I)
elif H*W % 2 == 0:
  print(H*W//2)
else:
  print(H*W//2+1)
Problem p02761 (python)

Fixed submission:
N,M = map(int,input().split())
ret = ['a']*N
for _ in range(M):
  s,c = map(int,input().split())
  if ret[s-1] not in ['a', c]:
    print(-1)
    exit()
  ret[s-1] = c
if ret[0] == 0:
  if N != 1:
    print(-1)
    exit()
ans = ''
for i in range(N):
  if ret[i] != 'a':
    ans += str(ret[i])
  else:
    if i == 0 and N > 1:
      ans += '1'
    else:
      ans += '0'
print(int(ans))

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
if M == 0:
  if N == 1:
    print(0)
    exit()
  elif N == 2:
    print(10)
    exit()
  else:
    print(100)
    exit()
dic = {} 
for _ in range(M):
  s,c = map(int,input().split())
  if s in dic and dic[s] != c:
    print(-1)
    exit()
  else:
    dic[s] = c
if N != 1 and dic[1] == 0:
  print(-1)
  exit()
ans = ''
for i in range(N):
  if i+1 in dic:
    ans += str(dic[i+1])
  elif i+1 == 1:
    ans += '1'
  else:
    ans += '0'
print(ans)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = ['a']*N
dic = {} 
for _ in range(M):
  s,c = map(int,input().split())
  if s in dic and dic[s] != c:
    print(-1)
    exit()
  elif s==1 and c == 0:
    print(-1)
    exit()
  else:
    dic[s] = c
  ans = ''
  for i in range(N):
    if i+1 in dic:
      ans += str(dic[i+1])
    elif i+1 == 1:
      ans += '1'
    else:
      ans += '0'
print(ans)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = ['a']*N
for _ in range(M):
  s,c = map(int,input().split())
  if A[s-1] !='a' and A[s-1] != c:
    print(-1)
    exit()
  else:
    A[s-1] = c

for i in range(N):
  if A[0] == 'a' and N==3:
    A[0] = 1
  else A[i] == 'a':
    A[i] = 0
Answer = ''.join(map(str,A))

if Answer != '0' and len(Answer) != N:
  Answer = -1
if Answer == '000':
  Answer = -1
print(Answer)
Problem p02843 (python)

Fixed submission:
N=int(input())
coins = [100,101,102,103,104,105]
dp = [int(i%coins[0]==0) for i in range(N+1)]
for coin in coins[1:]:
  for i in range(coin,N+1):
    dp[i] += dp[i - coin]
if dp[-1] != 0:
  print(1)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
X = int(input())
coins = [100,101,102,103,105]
DP = [int(i%coins[0]==0) for i in range(X+1)]
for coin in coins[1:]:
  for i in range(X+1):
    DP[i] += DP[i - coin]
if DP[-1] != 0:
  print(1)
else:
  print(0)
Problem p02900 (python)

Fixed submission:
import fractions
A,B = map(int,input().split())
x = fractions.gcd(A,B)
pf = {}
for i in range(2,int(x**0.5)+2):
  while x%i == 0:
    pf[i] = pf.get(i,0) +1
    x //= i
if x > 1:
  pf[x] = 1
print(len(pf)+1)

Buggy submission (verdict: Runtime Error):
import fractions
A,B = map(int,input().split())
x = fractions.gcd(A,B)
pf = {}
for i in range(2,int(x**0.5)+2):
  while x%i == 0:
    pf[i] = pf.get(i,0) +1
    x //= i
if x > 1:
  pf[m] = 1
print(len(pf)+1)
Problem p02901 (python)

Fixed submission:
N,M = map(int,input().split())
dp = [float('inf')]*2 ** N
dp[0] = 0
for _ in range(M):
  a, b = map(int, input().split())
  c = sum([2**(int(i)-1) for i in input().split()])
  for s in range(2**N):
    t = s|c
    if dp[t] > dp[s] + a:
      dp[t] = dp[s] +a
ans = dp[-1]
if dp[-1] == float('inf'):
  print(-1)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
dp = [float('inf')]*2 ** N
dp[0] = 0
for _ in range(N):
  a,b = map(int,input().split())
  c = sum([2**(int(i)-1) for i in input().split()])
  for s in range(2**N):
    t = s|c
    if dp[t] > dp[s] + a:
      dp[t] = dp[s] +a
ans = dp[-1]
if dp[-1] == float('inf'):
  print(-1)
else:
  print(ans)
Problem p02937 (python)

Fixed submission:
s = input()
t = input()
counter = 0
idx = -1
if set(t) <= set(s):
  for i in range(len(t)):
    idx = s.find(t[i],idx+1)
    if idx == -1:
      counter += 1
      idx = s.find(t[i],idx+1)
  print(counter * len(s) +idx +1)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
counter = 0
idx = -1
if set(t) <= set(s):
  for i in range(len(t)):
    idx = s.find(t[i],idx+1)
    if idx == -1:
      counter += 1
      idx = s.find(t[i],idx+1)
  print(counter * len(s) +idx +1)
elsse:
  print(-1)
Problem p02983 (python)

Fixed submission:
L,R = map(int,input().split())
MOD = 2019
ans = 2020
if R - L > 2010:
  print(0)
  exit()
for i in range(L,R):
    for j in range(i+1,R+1):
        ans = min(ans,i*j%MOD)
print(ans)

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

Answers = []

for i in range(R-L):
  for j in range(R-L-i-1):
    Answers.append((L+i)*(L+i+j+1)%2019)

#print(len(Answer))

print(min(Answers))
Problem p03163 (python)

Fixed submission:
def dynamicprogramming():
  N, W = map(int, input().split())
  dp = [-1] * (W + 1)
  dp[0] = 0
  for _ in range(N):
    w, v = map(int, input().split())
    for i in range(W - w, -1, -1):
        dpi = dp[i]
        if dpi != -1:
          if dp[i + w] < dpi + v:
            dp[i + w] = dpi + v
  print(max(dp))

dynamicprogramming()

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

N,W = map(int,input().split())
"""
DP = np.zeros(W+1,dtype=int)
for _ in range(N):
  w,v = map(int,input().split())
  np.maximum(DP[:-w]+v,DP[w:],out=DP[w:])
print(DP.max())
"""
DP= np.full(N*10000000+1,W+1)
DP[0] = 0
for _ in range(N):
  w,v = map(int,input().split())
  np.minimum(DP[:-v]+w,DP[v:],out = DP[v:])
print(np.max(np.where(DP<=W)))
Problem p03170 (python)

Fixed submission:
N,K =map(int,input().split())
List = list(map(int,input().split()))
DP = [False]*(2*K+1)
for i in range(K):
  for item in List:
    if DP[i]==False:
      DP[i+item] = True
if DP[K]==True:
  print('First')
else:
  print('Second')

Buggy submission (verdict: Runtime Error):
N,K =map(int,input().split())
List = list(map(int,input().split()))
DP = [False]*(2*K+1)
for i in range(K):
  for item in List:
    if DP[i]==False:
      DP[i+item] = True
if DP[k]==True:
  print('First')
else:
  print('Second')
Problem p03244 (python)

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

S0 = {}
S1 = {}
for i in range(len(S)):
  if i%2 == 0:
    if S[i] not in S0:
      S0[S[i]] =1
    else:
      S0[S[i]] += 1
  else:
    if S[i] not in S1:
      S1[S[i]] =1
    else:
      S1[S[i]] += 1

if max(S0, key = S0.get) != max(S1, key = S1.get):
  Answer = len(S) - max(S0.values()) -max(S1.values())
  print(Answer)
  exit()
      
S0list = sorted(list(S0.values()),reverse = True)
S1list = sorted(list(S1.values()),reverse = True)

S00 = S0list[0]

if len(S0list) == 1:
  S01 = 0
else:
  S01 = S0list[1]
S10 = S1list[0]
if len(S1list) == 1:
  S11 = 0
else:
  S11 = S1list[1]
Answer = min(len(S) - S00 - S11,len(S) - S01 - S10)

print(Answer)

Buggy submission (verdict: Runtime Error):
n = int(input())
S = list(input())
S0 = {}
S1 = {}
for i, item in enumerate(S):
  if i%2 == 0:
    if item not in S0:
      S0[item] =1
    else:
      S0[item] += 1
  else:
    if item not in S1:
      S1[item] =1
    else:
      S1[item] += 1

S0list = list(S0.values()).sort(reverse=True)
S1list = list(S1.values()).sort(reverse=True)

S00 = S0list[0]
if len(S0list) == 1:
  S01 = 0
else:
  S01 = S0list[1]
S10 = S1list[0]
if len(S1list) == 1:
  S11 = 0
else:
  S11 = S1list[1]
Answer = min(len(S) - S00 - S11,len(S) - S01 - S10)

print(Answer)
Problem p03284 (python)

Fixed submission:
N, K = (int(i) for i in input().split())
if N % K == 0:
  print(0)
else:
  print(1)

Buggy submission (verdict: Runtime Error):
100 10
Problem p03341 (python)

Fixed submission:
N = int(input())
S = input()
W = S.count('W')
E = S.count('E')
counter = len(S)
cost = E
for i in range(len(S)):
  if S[i] == 'E':
    cost -= 1
    if cost < counter:
      counter = cost
  else:
    if cost < counter:
      counter = cost
    cost +=1
print(counter)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
CS = [0]*N
for i in range(1,N):
  if S[i] == 'W':
    CS[i] = CS[i-1]+1
  else:
    CS[i] = CS[i-1]-1
min_value = min(CS)
Leader = CS.index(min_value) + 1
counter = 0
for i in range(1,Leader):
  if CS[i]<CS[i+1]:
    counter += 1
for i in range(Leader,N-1):
  if CS[i]>CS[i+1]:
    counter +=1
print(counter)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
W = S.count('W')
E = S.count('E')
counter = len(S)
cost = E
for i in range(len(S)):
  if S[i] = 'E':
    cost -= 1
    if cost < counter:
      counter = cost
  else:
    cost +=1
print(counter)
Problem p03360 (python)

Fixed submission:
calc_list = list(map(int,input().split()))
k = int(input())
 
calc_list = sorted(calc_list)
Answer = calc_list[0] + calc_list[1] + calc_list[2]*(2**k)
print(Answer)

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

calc_list = sorted(calc_list)
Answer = calc_list[0] + calc_list[1] + calc_list[2]**k
print(Answer)

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

calc_list = [a, b, c]
calc_list = sorted(calc_list)
Answer = calc_list[0] + calc_list[1] + calc_list[2]**k
print(Answer)