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

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

r=N//(A+B)*A
s=N%(A+B)

x=r+min(A,s)
print(x)

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

import numpy as np
blue=np.array([1]*A)
red=np.array([-1]*B)
ball=np.array(list(np.concatenate([blue,red]))*N)
print(np.count_nonzero(ball[0:N]==1))

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

import numpy as np
blue=np.array([1]*A)
red=np.array([-1]*B)
ball=np.array(list(np.concatenate([blue,red]))*int(N/(A+B)+1))
print(np.count_nonzero(ball[0:N]==1))

Buggy submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
blue=[1]*A
red=[-1]*B
ball=(blue+red)*N
X=ball[0:N]
print(X)
print(X.count(1))

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

N,A,B=map(int,input().split())

blue=np.array([1]*A)
red=np.array([-1]*B)
ball=np.array(list(np.concatenate([blue,red]))*N)
print(np.count_nonzero(ball[0:N]==1))

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

import numpy as np
blue=np.array([1]*A)
red=np.array([-1]*B)
ball=np.array(list(np.concatenate([blue,red]))*N)
ball=list(ball[0:N])
print(ball.count(1))

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

N,A,B=map(int,input().split())

blue=np.array([1]*A)
red=np.array([-1]*B)
ball=np.array(list(np.concatenate([blue,red]))*N)
print(np.count_nonzero(ball[0:N]==1))

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

import numpy as np
blue=np.array([1]*A)
red=np.array([-1]*B)
ball=np.array(list(np.concatenate([blue,red]))*N)
print(np.count_nonzero(ball[0:N]==1))

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

import numpy as np
blue=np.array([1]*A)
red=np.array([-1]*B)
ball=np.array(list(np.concatenate([blue,red]))*N)
print(ball)
print(np.count_nonzero(ball[0:N]==1))

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

import numpy as np
blue=np.array([1]*A)
red=np.array([-1]*B)

ball=np.concatenate(([blue, red]*N))

print(np.count_nonzero(ball[0:N]==1))

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

import numpy as np
ball=np.array([])
blue=np.array([1]*A)
red=np.array([-1]*B)
while len(ball)<N:
    ball=np.concatenate([ball, blue, red])
print(np.count_nonzero(ball==1))
Problem p02829 (python)

Fixed submission:
A = int(input())
B = int(input())
print(6-A-B)

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
x = [A,B]
A = [1,2,3]
for idx in range(len(A)):
  if (A[idx] in x )== False:
    print(A[idx])
    break

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
x = [A,B]
A = [1,2,3]
for idx in range(len(A)):
  if A[idx] in x == False:
    print(A[idx])
    break

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
x = [A,B]
A = [1,2,3]
print(A[x in A == False])

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
x=[1,2,3]
print(x[x!=A and x!=B])

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
x=[1,2,3]
print(x(x!=A and x!=B))

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

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

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
pritn(6-A-B)
Problem p02879 (python)

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

if 1<=A<=9 and 1<=B<=9:
  print(A*B)
else:
  print(-1)

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

if 1<=A,B<=9:
  print(A*B)
else:
  print(-1)
Problem p02627 (python)

Fixed submission:
str = input()
if str.islower():
    print('a')
else:
    print('A')

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

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

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
import math
print(math.gcd(a, b))
Problem p02552 (python)

Fixed submission:
x=int(input())

if x==0:
  print(1)
elif x==1:
  print(0)

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

if X==0:
  print(1)
elif x==1:
  print(0)
Problem p02552 (python)

Fixed submission:
x = int(input())
if x == 1:
  print(0)
else:
  print(1)

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
ans = -float("INF")

x = for x in (a,b):
  for y in (c,d):
    ans = max(ans,X*y)
print(ans)
Problem p02570 (python)

Fixed submission:
D,T,S = map(int,input().split())
if D/S>T:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
D,T,S = map(input().split())
if D/S>=T:
  print("No")
else:
  print("Yes")
Problem p02594 (python)

Fixed submission:
x = int(input())

if x>=30:
  print("Yes")
else:
  print("No")

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

if x=>30:
  print("Yes")
else:
  print("No")
Problem p02627 (python)

Fixed submission:
α = input()
if α.islower():
  print("a")
else:
  print("A")

Buggy submission (verdict: Runtime Error):
a = str(input())
if a = str.isupper():
  print("A")
else:
  print("a")

Buggy submission (verdict: Runtime Error):
α　= input()
if α.islower():
  print("A")
else:
  print("a")
Problem p03137 (python)

Fixed submission:
N,M=map(int,input().split())
x=list(map(int,input().split()))
x=sorted(x)
leng=list()

if(N>M):
    N=M
if(M==1):
    print(0)
    exit()
for i in range(0,len(x)-1):
    leng.append([x[i+1]-x[i],i])
leng=sorted(leng)

n=N
max=len(leng)-1
sets=list()
while n>1:
    n-=1
    sets.append(leng[max][1]+1)
    max-=1

for i in x:
    if(x.index(i) not in sets):
        sets.append(x.index(i))
        break
sets=sorted(sets) 
ans=0
for i in range(0,len(sets)-1):
    ans+=x[sets[i+1]-1]-x[sets[i]]

ans+=x[-1]-x[sets[-1]]

print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
x=map(int,input().split())
x=sorted(x)
leng=list()

if(M==1):
    print(0)
    exit()
for i in range(0,len(x)-1):
    leng.append([x[i+1]-x[i],i])
leng=sorted(leng)

n=N
max=len(leng)-1
sets=list()
while n>1:
    n-=1
    sets.append(leng[max][1]+1)
    max-=1

for i in x:
    if(x.index(i) not in sets):
        sets.append(x.index(i))
        break
sets=sorted(sets)
ans=0

for i in range(0,len(sets)-1):
    ans+=x[sets[i+1]-1]-x[sets[i]]

ans+=x[-1]-x[sets[-1]]

print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
x=map(int,input().split())
x=sorted(x)
leng=list()

if(M==1):
    print(0)
    exit()
for i in range(0,len(x)-1):
    leng.append([x[i+1]-x[i],i])
leng=sorted(leng)

n=N
max=len(leng)-1
sets=list()
while n>1:
    n-=1
    sets.append(leng[max][1]+1)
    max-=1

for i in x:
    if(x.index(i) not in sets):
        sets.append(x.index(i))
        break
sets=sorted(sets)
ans=0

for i in range(0,len(sets)-1):
    ans+=x[sets[i+1]-1]-x[sets[i]]

ans+=x[-1]-x[sets[-1]]

print(ans)
Problem p03252 (python)

Fixed submission:
abc=list("abcdefghijklmnopqrstuvwxyz")
S=input()
T=input()

c1=[[] for i in abc]
c2=[[] for i in abc]
for i in range(0,len(S)):
    c1[ord(S[i])-ord("a")].append(i)

for i in range(0,len(T)):
    c2[ord(T[i])-ord("a")].append(i)

ans="Yes"
for i in c1:
    if(i not in c2):
        ans="No"
        break
    
print(ans)

Buggy submission (verdict: Runtime Error):
S=input()
T=input()

c1=[[] for i in abc]
c2=[[] for i in abc]
for i in range(0,len(S)):
    c1[ord(S[i])-ord("a")].append(i)

for i in range(0,len(T)):
    c2[ord(T[i])-ord("a")].append(i)

ans="Yes"
for i in c1:
    if(i not in c2):
        ans="No"
        break
    
print(ans)
Problem p03634 (python)

Fixed submission:
from collections import deque
class edge:
    def __init__(self,to,cost):
        self.to=to
        self.cost=cost

N=int(input())
G=[list() for i in range(N)]
P=[False for i in range(N)]
A=[-100 for i in range(N)]
for i in range(N-1):
    a,b,c=map(int,input().split())
    G[a-1].append(edge(b-1,c))
    G[b-1].append(edge(a-1,c)) #無向グラフならこれも



def solve(G,K,P):
    q=deque()
    q.append(K)
    while q:
        s=q.pop()
        for i in G[s]:
            if(P[i.to]):
                continue
            P[i.to]=True
            A[i.to]=A[s]+i.cost
            q.append(i.to)

Q,K=map(int,input().split())
A[K-1]=0
P[K-1]=True
solve(G,K-1,P)


for i in range(Q):
    x,y=map(int,input().split())
    
    print(A[x-1]+A[y-1])

Buggy submission (verdict: Runtime Error):
import heapq
class edge:
    def __init__(self,to,cost):
        self.to=to
        self.cost=cost

N=int(input())
G=[list() for i in range(N)]
P=[False for i in range(N)]
A=[-100 for i in range(N)]
for i in range(N-1):
    a,b,c=map(int,input().split())
    G[a-1].append(edge(b-1,c))
    G[b-1].append(edge(a-1,c)) #無向グラフならこれも


def solve(G,K,P):
    P[K]=True
    for i in G[K]:
        if(P[i.to]):
            continue
        A[i.to]=A[K]+i.cost
        solve(G,i.to,P)

Q,K=map(int,input().split())
A[K-1]=0
solve(G,K-1,P)


for i in range(Q):
    x,y=map(int,input().split())
    print(A[x-1]+A[y-1])
Problem p03805 (python)

Fixed submission:
import copy
s=list()

N,M=map(int,raw_input().split())
n=[[0 for i in range(N)] for j in range(N)]
for i in range(M):
        a,b=map(int,raw_input().split())
        n[a-1][b-1]=1
        n[b-1][a-1]=1
arrived=[0 for i in range(N)]

arrived[0]=1
def solve(s,arrived):
        narrived=copy.deepcopy(arrived)
        global n
        global N
        op=False
        ans=0
        for i in range(N):
                arrived=copy.deepcopy(narrived)
                if(s[i]==1 and arrived[i]!=1):
                        op=True
                        arrived[i]=1
                        ans+=solve(n[i],arrived)
        
        if(sum(arrived)==N and op==False):
                return 1
        elif(op==False):
                return 0
        return ans
                        
print(solve(n[0],arrived))

Buggy submission (verdict: Runtime Error):
import queue
import copy
s=list()

N,M=map(int,raw_input().split())
n=[[0 for i in range(N)] for j in range(N)]
for i in range(M):
        a,b=map(int,raw_input().split())
        n[a-1][b-1]=1
        n[b-1][a-1]=1
arrived=[0 for i in range(N)]

arrived[0]=1
def solve(s,arrived):
        narrived=copy.deepcopy(arrived)
        global n
        global N
        op=False
        ans=0
        for i in range(N):
                arrived=copy.deepcopy(narrived)
                if(s[i]==1 and arrived[i]!=1):
                        op=True
                        arrived[i]=1
                        ans+=solve(n[i],arrived)
        
        if(sum(arrived)==N and op==False):
                return 1
        elif(op==False):
                return 0
        return ans
                        
print(solve(n[0],arrived))
Problem p02695 (python)

Fixed submission:
# 入力
N, M, Q = map(int, input().split())
a = [0] * Q
b = [0] * Q
c = [0] * Q
d = [0] * Q
for i in range(Q):
    a[i], b[i], c[i], d[i] = map(int, input().split())
    a[i] -= 1
    b[i] -= 1

# スコア計算
def score(A):
    tmp = 0
    for ai, bi, ci, di in zip(a, b, c, d):
        if A[bi] - A[ai] == ci:
            tmp += di
    return tmp

# DFS
def dfs(A):
    if len(A) == N:
        return score(A) # 数列 A のスコアを返す
    res = 0
    prev_last = A[-1] if len(A) > 0 else 0
    for v in range(prev_last, M):
        A.append(v)
        res = max(res, dfs(A)) # 再帰呼出しながら、スコア最大値も更新
        A.pop()
    return res

# 求める
print(dfs([]))

Buggy submission (verdict: Runtime Error):
#C - Many Requirements
#再帰関数(n重のfor文)
N,M,Q = map(int,input().split())
abcd = []
for _ in range(Q):
    a,b,c,d = map(int,input().split())
    abcd.append((a,b,c,d))
def dfs(A):
    if len(A) == N:
        #処理
        score = 0
        for ai,bi,ci,di in abcd:
            if A[bi-1] -A[ai-1] == ci:
                score += di
        return score
    max_score = 0 
    #一つ前の値を保持
    if len(A) > 1:
        prev_last = A[-1]
    else:
        prev_last = 1
    #1つ前の値より大きい値の範囲
    for i in range(prev_last,M+1):
        A.append(i)
        max_score = max(max_score,dfs(A))
        A.pop()
    return max_score#ループの途中のdfs (len(A) != N のとき) に値を返す
print(dfs[])
Problem p02723 (python)

Fixed submission:
S = input()
if (S[2] == S[3]) and (S[4] == S[5]):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
#C - Traveling Salesman around Lake WA(ヒント)
K,N = map(int,input().split())
A = list(map(int, input().split()))

A[N+1:] = [A[0] + K]#Aを二回繰り返して円を表現

distance_list = []
for i in range(N):
    distance = abs(A[i] - A[i+1])
    distance_list.append(distance)
distance_list.remove(max(distance_list))
print(sum(distance_list))
Problem p02819 (python)

Fixed submission:
import math
X = int(input())

def is_prime(x):
    a = int(math.sqrt(X)) + 1
    for i in range(2,a):
        if x % i == 0:
            return False
    return True

for j in range(X,X+100):
    if is_prime(j):
        ans = j    
        break
print(ans)

Buggy submission (verdict: Runtime Error):
import math
X = int(input())

def is_prime(x):
    a = int(math.sqrt(X)) + 1#ある数が素数かどうかはO(√A)で判定できる
    for i in range(2,a):
        if x % i == 0:
            return False
    return True#xは素数

for j in range(X,10**5):
    if is_prime(j):
        ans = j    
        break
print(ans)
Problem p02820 (python)

Fixed submission:
# D - Prediction and Restriction 
N,K = map(int,input().split())
RSP = tuple(map(int,input().split()))
T = input()

# じゃんけんの勝敗を返す関数
def judge(a,b):
    if a == 'r' and b == 2:
        return True
    elif a == 's' and b == 0:
        return True
    elif a == 'p' and b == 1:
        return True
    return False

# dp[i][j]: i 回目のじゃんけんで j を出したときの最大値
# グー:0, チョキ:1, パー:2
dp = [[0]*3 for _ in range(N+1)]

# v 回目のじゃんけん
for v in range(1,N+1):
    # v 回目に出した手
    for w in range(3):
        # v-K 回目に出した手 
        for k in range(3):
            if w == k:
                continue
            # じゃんけんで勝ったとき
            if judge(T[v-1],w):
                dp[v][w] = max(dp[v][w],dp[v-K][k] + RSP[w])
            # じゃんけんで負けか引き分けたとき
            else:
                dp[v][w] = max(dp[v][w],dp[v-K][k])         
# K 個に分けた各グループの部分和の最大値の総和を求める
ans = 0
for a in range(1,K+1):
    ans += max(dp[-a])
print(ans)

Buggy submission (verdict: Runtime Error):
# D - Prediction and Restriction 
N,K = map(int,input().split())
RSP = tuple(map(int,input().split()))
T = input()

# じゃんけんの勝敗を返す関数
def judge(a,b):
    if a == 'r' and b == 2:
        return True
    elif a == 's' and b == 0:
        return True
    elif a == 'p' and b == 1:
        return True
    return False

# dp[i][j]: i 回目のじゃんけんで j を出したときの最大値
# グー:0, チョキ:1, パー:2
dp = [[0]*3 for _ in range(N+1)]

# v 回目のじゃんけん
for v in range(1,N+1):
    # v 回目に出した手
    for w in range(3):
        # v-K 回目に出した手 
        for k in range(3):
            if w == k:
                continue
            # じゃんけんで勝ったとき
            if judge(T[v-1],w):
                dp[v][w] = max(dp[v][w],dp[v-K][k] + RSP[w])
            # じゃんけんで負けか引き分けたとき
            else;
                dp[v][w] = max(dp[v][w],dp[v-K][k])    
# K 個に分けた各グループの部分和の最大値の総和を求める
ans = 0
for a in range(1,K+1):
    ans += max(dp[-a])
print(ans)
Problem p02835 (python)

Fixed submission:
A,B,C = map(int,input().split())
ans = A+B+C
if ans <= 21:
  print('win')
else:
  print('bust')

Buggy submission (verdict: Runtime Error):
#C - HonestOrUnkind2
N = int(input())
A = []
X = []
Y = []
for _ in range(N):
    a = int(input())
    A.append(a)
    box_x = []
    box_y = []
    for _ in range(a):
        x,y = map(int,input().split())
        box_x.append(x)
        box_y.append(y)
    X.append(box_x)
    Y.append(box_y)

person = [2]*N

maxim = 0
for i in range(1<<N):
    c_person = person.copy()
    honest = 0
    for j in range(N):
        mask = 1<<j
        if mask&i != 0:
            c_person[j] = 1
        else:
            c_person[j] = 0
    #正直者かどうかの仮定
    for k,l in enumerate(c_person):
        #kが正直者のとき
        if l == 1:
            #kの証言を判定
            for m,n in zip(X[k],Y[k]):
                #矛盾があるなら honest = 0でbreak
                if c_person[m-1] != n:
                    honest = 0
                    break
            else:
                honest = sum(c_person)
                continue
            break
    maxim = max(maxim,honest)
                
print(maxim)

Buggy submission (verdict: Runtime Error):
#C - HonestOrUnkind2
N = int(input())
A = []
X = []
Y = []
for _ in range(N):
    a = int(input())
    A.append(a)
    box_x = []
    box_y = []
    for _ in range(a):
        x,y = map(int,input().split())
        box_x.append(x)
        box_y.append(y)
    X.append(box_x)
    Y.append(box_y)

person = [2]*N

maxim = 0
for i in range(1<<N):
    c_person = person.copy()
    honest = 0
    for j in range(N):
        mask = 1<<j
        if mask&i != 0:
            c_person[j] = 1
        else:
            c_person[j] = 0
    #正直者かどうかの仮定
    for k,l in enumerate(c_person):
        #kが正直者のとき
        if l == 1:
            #kの証言を判定
            for m,n in zip(X[k],Y[k]):
                #矛盾があるなら honest = 0でbreak
                if c_person[m-1] != n:
                    honest = 0
                    break
            else:
                honest = sum(c_person)
                continue
            break
    maxim = max(maxim,honest)
                
print(maxim)

Buggy submission (verdict: Runtime Error):
#C - HonestOrUnkind2
N = int(input())
A = []
X = []
Y = []
for _ in range(N):
    a = int(input())
    A.append(a)
    box_x = []
    box_y = []
    for _ in range(a):
        x,y = map(int,input().split())
        box_x.append(x)
        box_y.append(y)
    X.append(box_x)
    Y.append(box_y)

person = [2]*N

maxim = 0
for i in range(1<<N):
    c_person = person.copy()
    honest = 0
    for j in range(N):
        mask = 1<<j
        if mask&i != 0:
            c_person[j] = 1
        else:
            c_person[j] = 0
    #正直者かどうかの仮定
    for k,l in enumerate(c_person):
        #kが正直者のとき
        if l == 1:
            #kの証言を判定
            for m,n in zip(X[k],Y[k]):
                #矛盾があるなら honest = 0でbreak
                if c_person[m-1] != n:
                    honest = 0
                    break
            else:
                honest = sum(c_person)
                continue
            break
    maxim = max(maxim,honest)
                
print(maxim)
Problem p02891 (python)

Fixed submission:
# A - Connection and Disconnection
S = input()
K = int(input())
S = S + '1'# 番兵

# 連続する文字数をカウント
cnt = []
conti = 1
for i in range(1,len(S)):
    if S[i-1] == S[i]:
        conti += 1
    else:
        cnt.append(conti)
        conti = 1
        
# 最初と最後の文字が同じときの補正値
comp = 0
if S[0] == S[-2]:
    # 奇数個 + 奇数個のとき
    if cnt[0]%2 == 1 and cnt[-1]%2 == 1:
        comp = K - 1
    # S =aaa などのとき
    if len(set(S[:-1])) == 1 and len(S[:-1])%2 == 1:
        comp = K // 2
        
ans = [a//2 for a in cnt if a >= 2]
ans = sum(ans)*K + comp
print(ans)

Buggy submission (verdict: Runtime Error):
# A - Connection and Disconnection
S = input()
K = int(input())
S = S + '1'# 番兵

# 連続する文字数をカウント
cnt = []
conti = 1
for i in range(1,len(S)):
    if S[i-1] == S[i]:
        conti += 1
    else:
        cnt.append(conti)
        conti = 1

# 最初と最後の文字が同じとき
if S[0] == S[-2]:
    # 奇数個 + 奇数個のとき
    if cnt[0]%2 == 1 and cnt[-1]%2 == 1:
        comp = K - 1
        
ans = [a//2 for a in cnt if a >= 2]
ans = sum(ans)*K + comp
print(ans)
Problem p02915 (python)

Fixed submission:
N = int(input())
print(N**3)

Buggy submission (verdict: Runtime Error):
#C - Maximal Value
N = int(input())
B = list(map(int,input().split()))
A = [B[0]]
for i in range(1,N-1):
    if B[i] > B[i-1]:
        A.append(B[i-1])
    else:
        A.append(B[i])
A.append(B[-1])
print(sum(A))

Buggy submission (verdict: Runtime Error):
#C - Maximal Value
N = int(input())
B = list(map(int,input().split()))
print(B)
A = [B[0]]
for i in range(1,N-1):
    if B[i] > B[i-1]:
        A.append(B[i-1])
    else:
        A.append(B[i])
A.append(B[-1])
print(sum(A))
Problem p03345 (python)

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

if K%2 == 0:
    ans = A - B 
else:
    ans = B - A
print(ans)

Buggy submission (verdict: Runtime Error):
if K%2 == 0:
    ans = A - B 
else:
    ans = B - A
print(ans)
Problem p03617 (python)

Fixed submission:
#A - Ice Tea Store
Q,H,S,D = map(int,input().split())
N = int(input())

Q1,H1 = 4*Q,2*H
S = min(Q1,H1,S)

if 2*S>D:
    cnt_2 = N//2
    cnt_1 = N%2
    pay = D*cnt_2 + S*cnt_1
else:
    pay = N * S
print(pay)

Buggy submission (verdict: Runtime Error):
#A - Ice Tea Store
Q,H,S,D = map(int,input().split())
N = int(input())

Q1,H1 = 4*Q,2*H
S = min(Q1,H1,S)

if 2*S>D:
    cnt_2 = N//2
    cnt_1 = N%2
    pay = a*cnt_2 + S*cnt_1
else:
    pay = N * S
print(pay)

Buggy submission (verdict: Runtime Error):
#A - Ice Tea Store
Q,H,S,D = map(int,input().split())
N = int(input())

Q1,H1 = 4*Q,2*H
S = min(Q1,H1,S)

if 2*S>D:
    cnt_2 = N//2
    cnt_1 = N%2
    pay = a*cnt_2 + S*cnt_1
else:
    pay = N * S
print(int(pay))

Buggy submission (verdict: Runtime Error):
#A - Ice Tea Store
Q,H,S,D = map(int,input().split())
N = int(input())

Q1,H1 = 4*Q,2*H
S = min(Q1,H1,S)

if 2*S>D:
    cnt_2 = N//2
    cnt_1 = N%2
    pay = a*cnt_2 + S*cnt_1
else:
    pay = (N//A) * S
print(int(pay))

Buggy submission (verdict: Runtime Error):
#A - Ice Tea Store
Q,H,S,D = map(int,input().split())
N = int(input())

#2Lあたり
Q1,H1 = 4*Q,2*H
S = min(Q1,H1,S)

if 2*S>D:
    cnt_A = N//2
    cnt_B = N%2
    pay = a*cnt_A + (cnt_B/B)*(b/(2/B))
else:
    pay = (N//A) * (a/(2/A))
print(int(pay))

Buggy submission (verdict: Runtime Error):
#A - Ice Tea Store
Q,H,S,D = map(int,input().split())
N = int(input())

#2Lあたり
Q1,H1,S1 = 8*Q,4*H,2*S
S = min(Q1,H1,S1)

if 2*S>D:
    cnt_A = N//2
    cnt_B = N%2
    pay = a*cnt_A + (cnt_B/B)*(b/(2/B))
else:
    pay = (N//A) * (a/(2/A))
print(int(pay))

Buggy submission (verdict: Runtime Error):
#A - Ice Tea Store
Q,H,S,D = map(int,input().split())
N = int(input())

#2Lあたり
Q1,H1,S1 = 8*Q,4*H,2*S
S = min(Q1,H1,S1)


if 2*S>D:
    cnt_A = N//2
    cnt_B = N%2
    pay = a*cnt_A + (cnt_B/B)*(b/(2/B))
else:
    pay = (N//A) * (a/(2/A))
print(int(pay))
Problem p03785 (python)

Fixed submission:
#54 A - Airport Bus
N,C,K = map(int,input().split())
T = [int(input()) for _ in range(N)]
T = sorted(T,reverse = False)

ans = 0
bus = 1
first = T[0]
for i in range(1,N):
    # T[i] がバスに乗ることができるとき
    if (bus < C) and (T[i] <= first + K):
        bus += 1
    # T[i] がバスに乗ることができないとき
    else:
        # 新しいバスの first になる
        ans += 1
        bus = 1
        first = T[i]
        
print(ans+1)

Buggy submission (verdict: Runtime Error):
#54 A - Airport Bus
N,C,K = map(int,input().split())
T = [int(input()) for _ in range(N)]
T = sorted(T,reverse = False)

ans = 0
bus = 1
first = T[0]
for i in range(1,N+1):
    # T[i] がバスに乗ることができるとき
    if (bus < C) and (T[i] <= first + K):
        bus += 1
    # T[i] がバスに乗ることができないとき
    else:
        # 新しいバスの first になる
        ans += 1
        bus = 1
        first = T[i]
        
print(ans+1)
Problem p02736 (python)

Fixed submission:
n = int(input())
a = input()
x = []
x.extend([int(i) for i in a])

# 1,2,3 を0,1,2として考えてもよい(差は変わらないから)
# もし1と0だけだったら簡単そう
# 2は012を210にする効果しかない 1 or 0,2 と考えたら同値
# 1が混ざっている条件で最後の答えが2になることはあり得ない->2を0と考えてよい
if 2 in x:
    flag = True
    x = [1 if i == 2 else 0 for i in x]
else:
    flag = False
    x = [1 if i == 3 else 0 for i in x]
c=0
n=len(x)
n_b=bin(n-1)
if x[0]==1:
    c+=1
for i in range(1,n-1):
    tmp_nck = int((n-1) == (i | (n-1-i)))
    if x[i] == 1:
        c+=tmp_nck
if x[n-1]==1:
    c+=1
if flag:
    print(c%2)
else:
    if c%2 == 1:
        print(2)
    else:
        print(0)

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

if len(x) > 1:
    x = [abs(x[i] - x[i + 1]) for i in range(len(x) - 1)]


# もし1と0だけだったら簡単そう
# 2は012を210にする効果しかない
# 1が混ざっている条件で最後の答えが2になることはあり得ない->2を0と考えてよい
if 1 in x:
    flag = True
    x = [1 if i == 1 else 0 for i in x]
else:
    flag = False
    x = [1 if i == 2 else 0 for i in x]
c=0
n=len(x)
n_b=bin(n)
if x[0]==1:
    c+=1
for i in range(1,n):
    tmp_nck = int(n_b == (bin(r) or bin(n-r)))
    if x[i] == 1:
        c+=tmp_nck
if flag:
    print(c%2)
else:
    if c%2 == 1:
        print(2)
    else:
        print(0)