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

Fixed submission:
import sys
n = int(input())

#条件満たす数カウント
cn = 0
#約数カウント
cy = 0

if n < 105:
    print(0)
    sys.exit()
    
for i in range(105, n+1):
    if i % 2 == 0:
        continue

    for j in range(1, i+1):
        if i % j == 0:
            cy += 1
    if cy == 8:
        cn += 1
    cy = 0
print(cn)

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

cnt1 = 0
if s[0]==1:
    cnt1 += 1
    
for i in range(1, len(s)):
    if s[0] == 1 and s[i-1] == 1 and s[i] == s[i-1]:
        cnt1 += 1
        
if k <= cnt1:
    print(1)
elif cnt1 == 0:
    print(s[0])
else:
    print(s[cnt1])
Problem p03284 (python)

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

if(n[0] % n[1] == 0):
    print("0")
else:
    print("1")

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

s = 0

while(s <= N):
    if((N - s) % 4 == 0):
        print("Yes")
        sw = 1
        sys.exit()
    s += 7


print("No")

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

if(n % k == 0):
    print("0")
else:
    print("1")
Problem p03289 (python)

Fixed submission:
import sys
s = input("")

count_c = 0

if(s[0] == "A"):
    for i in range(1, len(s)):

        if(s[i]=="C" and i >= 2 and i <= len(s)-2):
            count_c += 1
        elif(s[i].isupper()):
            print("WA")
            sys.exit()
            
        
    if(count_c != 1):
        print("WA")
    else:
        print("AC")
else:
    print("WA")

Buggy submission (verdict: Runtime Error):
import sys
s = input("")

count_c = 0

if(s[0] == "A"):
    for i in range(1, len(s)):
        if(s[i]=="C" and i >= 2 and i <= len(s)-2):
            count_c += 1
        elif(i.isupper):
            print("WA")
            sys.exit()
            
        
    if(count_c != 1):
        print("WA")
    else:
        print("AC")
else:
    print("WA")
Problem p03280 (python)

Fixed submission:
b, c = map(int, input().split())
print ((b-1)*(c-1))

Buggy submission (verdict: Runtime Error):
N = int(input())
count = 0
answer = 0
for x in range(1,N+1,2):
    for i in range(1,x+1):
        if x % i == 0:
            count += 1
    if count == 8:
        answer +=1
    count = 0
print (answer)
Problem p03280 (python)

Fixed submission:
a=input().split();print((int(a[0])-1)*(int(a[1])-1));

Buggy submission (verdict: Runtime Error):
import math
a=input().split("¥n")
K=int(a[1])
S_len=len(a[0])

print("K="+str(K) +" S_len="+str(S_len))

for i in range(S_len):
    # print("i="+str(i) +" n="+a[0][i])
    n=int(a[0][i])
    # print("i="+str(i) +" n="+str(n))

    # if(n==1):
    #     K-=1
    #     if(K<=0):
    #         print("1")
    #         break
    # else:

    L=int(K*math.log10(n))
    # print("K="+str(K) +" L="+str(L))
    K-=L+1
    if(K<=0):
        print(n)
        break

Buggy submission (verdict: Runtime Error):
a=raw_input().split();print((int(a[0])-1)*(int(a[1])-1));

Buggy submission (verdict: Runtime Error):
a = raw_input().split();
print((int(a[0])-1)*(int(a[1])-1));

Buggy submission (verdict: Runtime Error):
return (A-1)*(B-1);
Problem p03282 (python)

Fixed submission:
S=input()
S_len=len(S)
K=int(input())
for i in range(S_len):
  if(int(S[i])==1):
    K-=1
    if(K<=0):
      print("1")
      break
  else:
    print(S[i])
    break

Buggy submission (verdict: Runtime Error):
S_len=len(input())
K=int(input())
for i in range(S_len):
  if(int(a[0][i])==1):
    K-=1
    if(K<=0):
      print("1")
      break
  else:
    print(a[0][i])
    break

Buggy submission (verdict: Runtime Error):
a=input().split("¥n")
S_len=len(a[0])
K=int(a[1])
for i in range(S_len):
  if(int(a[0][i])==1):
    K-=1
    if(K<=1):
      print("1")
      break
  else:
    print(a[0][i])
    break

Buggy submission (verdict: Runtime Error):
    a=input().split("¥n")
    goal=int(a[1])
    keta=len(a[0])
    for i in range(keta):
        if(int(a[0][i])==1):
            goal-=1
            if(goal<0):
                print("1")
                break
        else:
            print(a[0][i])
            break

Buggy submission (verdict: Runtime Error):
    a=input().split("¥n")
    goal=int(a[1])
    keta=len(a[0])
    for i in range(keta):
        if(int(a[0][i])==1):
            goal-=1
            if(goal<=0):
                print("1")
                break
        else:
            print(a[0][i])
            break

Buggy submission (verdict: Runtime Error):
a=input().split("¥n")
K=int(a[1])
S_len=len(a[0])
for i in range(S_len):

    if(int(a[0][i])==1):
        K-=1
        if(K<=0):
            print("1")
            break

    elif(int(a[0][i])==2):
        K2=format(K,'b')
        K2_len=len(K2)
        K2_len-=5000*10000*10000*10000
        if(K2_len<=0):
            print("2")
            break
        K=pow(2, K2_len)

    else:
        print(a[0][i])
        break

Buggy submission (verdict: Runtime Error):
a=input().split("¥n")
goal=int(a[1])
keta=len(a[0])
for i in range(keta):
    if(int(a[0][i])==1):
        goal-=1
        if(goal<=0):
            print("1")
            break
    else:
        print(a[0][i])
        break
Problem p03997 (python)

Fixed submission:
lis = [int(input()) for i in range(3)]
print(int((lis[0]+lis[1])*lis[2]/2))

Buggy submission (verdict: Runtime Error):
lis = [int(input()) for i in range 3]
print(int(lis[0]*lis[1]*lis[2]/2))
Problem p03280 (python)

Fixed submission:
inp = input()
inp = inp.split()
men = (int(inp[0]) - 1 ) * (int(inp[1]) - 1)
print(men)

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

if  n < 105:
  print(0)
elif 105 <= n <135:
  print(1)
elif 135 <= n <165:
  print(2)
elif 165 <= n <189:
  print(3)
elif 189 <= n <195:
  print(4)
elif 195 <= n:
  print(5)
Problem p03282 (python)

Fixed submission:
inp = [input() for _ in range(2)]
s = inp[0]
k = int(inp[1])
j = 0

for i in s:
  if i == "1":
    j += 1
  else:
    ans = int(i)
    break

if j >= k:
  print(1)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
inp = [input() for _ in range(2)]
s = inp[0]
k = int(inp[1])
i = 0

while True:
  if s[i] == "1":
    i += 1
  else:
    ans = int(s[i])
    break

if i >= k:
  print(1)
else:
  print(ans)
Problem p03292 (python)

Fixed submission:
task = input().split()
for i, j in enumerate(task):
    task[i] = int(j)
task.sort()
score = int(task[2])  - int(task[0])
print(score)

Buggy submission (verdict: Runtime Error):
inp = [input() for _ in range(2)]
s = inp[0]
t = inp[1]

s = list(s)
t = list(t)
check = []
for i in t:
    if i in s:
        s[s.index(i)] = 0
    check.append(0)

if s == check:
    print("Yes")
else:
    print("No")
Problem p03282 (python)

Fixed submission:
S=input()
K=int(input())
a=0
b=0
N=len(S)
for i in range(N):
    if S[i]=="1":
        a=i+1
    else:
        b=S[i]
        break
if K<=a:
    print(1)
else:
    print(b)

Buggy submission (verdict: Runtime Error):
x=int(input())
k=int(input())
s=0
for i in range(0,20):
    b=int(str(x)[i:i+1])
    if b==1:
        s=s+1
    elif(b>1):
        s=s+1
        c=b
        break;
if (k<s):
    print("1")
else:
    print(c)
Problem p03781 (python)

Fixed submission:
x = int(input())
d = 0
for i in range(1, 10 ** 6):
    d += i
    if x <= d:
        print(i)
        break

Buggy submission (verdict: Runtime Error):
x = input()
d = 0
for i in range(1, 10 ** 6):
  d += i
  if x <= d:
    print(i)
    break
Problem p03280 (python)

Fixed submission:
def SolveABC106A(A,B):
    print (int(A)-1) * (int(B)-1)

A, B = map(int, raw_input().split())
SolveABC106A(A,B)

Buggy submission (verdict: Runtime Error):
def SolveABC106A(A,B):
    print (int(A)-1) * (int(B)-1)

A = raw_input()
B = raw_input()
SolveABC106A(A,B)
Problem p03284 (python)

Fixed submission:
N, K = map(int, input().split())
r = N % K
if r == 0:
  print(0)
else:
  print(1)

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


x = 0
for l in range(N):
  for r in range(N-l):
    hoge = float(sum(A_s[l:l+r+1]) / M)
    if hoge.is_integer():
      x += 1
      
print(x)

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

q = N
r_s = []
while q!=1:
  hoge = (q-1) / (-2)
  if hoge.is_integer():
    r = int(1)
    q = float(hoge)
  else:
    r = int(0)
    q = float(q/(-2))
  
  r_s.append(r)
r_s.append(1)
r_s = r_s[::-1]

for i in range(len(r_s)):
  print(r_s[i], end="")

Buggy submission (verdict: Runtime Error):
N = float(input())
q = N
while q!=1:
  hoge = (q-1) / (-2)
  if hoge.is_integer():
    r = int(1)
    q = float(hoge)
  else:
    r = int(0)
    q = float(q/(-2))
  r_s.append(r)
r_s.append(1)
r_s = r_s[::-1]
for i in range(len(r_s)):
  print(r_s[i], end="")

Buggy submission (verdict: Runtime Error):
N = int(input())
import numpy as np
a = np.empty((26,15))
for i in range(26):
  for j in range(15):
    a[i][j] = 4 * i + 7 * j

if N in a:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N, K = map(int, raw_input().split())
r = N % K
if r == 0:
  print(0)
else:
  print(1)
Problem p03285 (python)

Fixed submission:
N = int(input())
import numpy as np
a = np.empty((26,15))
for i in range(26):
  for j in range(15):
    a[i][j] = 4 * i + 7 * j

if N in a:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
import numpy as np
a = np.array((26,15))
for i in range(26):
  for j in range(15):
    a[i][j] = 4 * i + 7 * j

if N in a:
  print('Yes')
else:
  print('No')
Problem p03999 (python)

Fixed submission:
import sys

S = input()

# 2^n-1の2進数は全組み合わせを表す
combs = pow(2, len(S) - 1)
if len(S) == 1:
    print(S)
    sys.exit()

total = 0
for i in range(combs):
    # i番目の組み合わせ（2進数）
    comb_i = format(i, '0' + str(len(S)) + 'b')
    if len(comb_i) > 1:
        comb_i = comb_i[1:]

    tmp = S[0]
    for j in range(len(comb_i)):
        b = int(comb_i[j])
        if b == 1:
            tmp += "+"
        tmp += S[j + 1]
    total += eval(tmp)
print(total)

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

# 2^n-1の2進数は全組み合わせを表す
combs = pow(2, len(S) - 1)
total = 0
for i in range(combs):
    # i番目の組み合わせ（2進数）
    comb_i = format(i, '0' + str(len(S)) + 'b')
    if len(comb_i) > 1:
        comb_i = comb_i[1:]

    tmp = S[0]
    for j in range(len(comb_i)):
        b = int(comb_i[j])
        if b == 1:
            tmp += "+"
        tmp += S[j + 1]
    total += eval(tmp)
print(total)
Problem p04000 (python)

Fixed submission:
H, W, N = (int(i) for i in input().split())

P = []
for i in range(N):
    pa, pb = input().split()
    P.append((int(pa)-1, int(pb)-1))

Q = {}
for pa, pb in P:
    for i in range(3):
        for j in range(3):
            if (pa - i >= 0) and (pb - j >= 0) and (pa - i <= H - 3) and (pb - j <= W - 3):
                if (pa - i, pb - j) in Q:
                    Q[(pa - i, pb - j)] += 1
                else:
                    Q[(pa - i, pb - j)] = 1
cnt = [0] * 10
for k, v in Q.items():
    cnt[v] += 1
cnt[0] = (H - 2) * (W - 2) - len(Q)
for i in range(10):
    print(cnt[i])

Buggy submission (verdict: Runtime Error):
H, W, N = (int(i) for i in input().split())

P = []
for i in range(N):
    pa, pb = input().split()
    P.append((int(pa)-1, int(pb)-1))

Q = {}
for pa, pb in P:
    for i in range(3):
        for j in range(3):
            if (pa - i >= 0) and (pb - j >= 0) and (pa - i <= H - 3) and (pb - j <= W - 3):
                if (pa - i, pb - j) in Q:
                    Q[(pa - i, pb - j)] += 1
                else:
                    Q[(pa - i, pb - j)] = 1
cnt = [0] * 9
for k, v in Q.items():
    cnt[v] += 1
cnt[0] = (H - 2) * (W - 2) - len(Q)
print(cnt)
Problem p04045 (python)

Fixed submission:
n, k = (int(char) for char in input().split())
d = [int(i) for i in input().split()]

'''
n = 10
k = 8
d = [0, 2, 3]
'''
D = [i for i in range(10)]

like_vals = [int(str(i)) for i in D if i not in d]

i = 0

n = [int(str(n)[i]) for i in range(len(str(n)))]
r = [-1] * len(n)
while i < len(n):
    if n[i] in like_vals:
        r[i] = n[i]
        i += 1
    elif n[i] < max(like_vals):
        like_bigger = [like_val for like_val in like_vals if like_val > n[i]]
        r[i] = min(like_bigger)
        for j in range(i + 1, len(n)):
            r[j] = min(like_vals)
        break
    else:
        r = [-1] * (len(n) + 1)
        if min(like_vals) != 0:
            r[0] = min(like_vals)
        else:
            r[0] = min([like_val for like_val in like_vals if like_val != 0])

        for j in range(1, len(n) + 1):
            r[j] = min(like_vals)
        break

newr = ""
for _r in r:
    newr += str(_r)
newr = int(newr)
print(newr)

Buggy submission (verdict: Runtime Error):
n, k = (int(char) for char in input().split())
d = [int(i) for i in input().split()]

'''
n = 10
k = 8
d = [0, 2, 3]
D = [i for i in range(10)]
'''
like_vals = [int(str(i)) for i in D if i not in d]

i = 0

n = [int(str(n)[i]) for i in range(len(str(n)))]
r = [-1] * len(n)
while i < len(n):
    if n[i] in like_vals:
        r[i] = n[i]
        i += 1
    elif n[i] < max(like_vals):
        like_bigger = [like_val for like_val in like_vals if like_val > n[i]]
        r[i] = min(like_bigger)
        for j in range(i + 1, len(n)):
            r[j] = min(like_vals)
        break
    else:
        r = [-1] * (len(n) + 1)
        if min(like_vals) != 0:
            r[0] = min(like_vals)
        else:
            r[0] = min([like_val for like_val in like_vals if like_val != 0])

        for j in range(1, len(n) + 1):
            r[j] = min(like_vals)
        break

print(r)
Problem p04046 (python)

Fixed submission:
H, W, A, B = (int(i) for i in input().split())

#H, W, A, B = (10, 7, 3, 4)
#H, W, A, B = (2, 3, 1, 1)

def mycomb(n,r):
    return (factorials[n] * pow(factorials[r],MOD-2,MOD) % MOD) * pow(factorials[n-r],MOD-2,MOD) % MOD

MOD = int(1e9 + 7)

factorials = []
factorials.append(1)
for i in range(1, W + H):
    factorials.append((factorials[i - 1] * i) % MOD)

r = 0
for i in range(H - A):
    combination = mycomb(B-1+i, B-1) * mycomb(W+H-B-i-2, W-B-1)
    r += int(combination)

print(r%MOD)

Buggy submission (verdict: Runtime Error):
H, W, A, B = (int(i) for i in input().split())

#H, W, A, B = (10, 7, 3, 4)
#H, W, A, B = (2, 3, 1, 1)

def mycomb(n, k):
    return factorials[n] / (factorials[k] * factorials[n - k])

MOD = int(1e9 + 7)

factorials = []
factorials.append(1)
for i in range(1, W + H):
    factorials.append(factorials[i - 1] * i)

r = 0
for i in range(H - A):
    combination = mycomb(B-1+i, B-1) * mycomb(W+H-B-i-2, W-B-1)
    r += int(combination % MOD)

print(r)

Buggy submission (verdict: Runtime Error):
H, W, A, B = (int(i) for i in input().split())

#H, W, A, B = (10, 7, 3, 4)
#H, W, A, B = (2, 3, 1, 1)

def mycomb(n, k):
    return factorials[n] / (factorials[k] * factorials[n - k])

MOD = int(1e9 + 7)

factorials = []
factorials.append(1)
for i in range(1, W + H):
    factorials.append(factorials[i - 1] * i)

r = 0
for i in range(H - A):
    combination = mycomb(B-1+i, B-1) * mycomb(W+H-B-i-2, W-B-1)
    r += combination % MOD

print(r)
Problem p03285 (python)

Fixed submission:
N=int(input())

if (N%4)==0:
    print("Yes")
elif(N%7)==0:
    print("Yes")
elif(N%11)==0:
    print("Yes")
elif(1):
    while N>0:
        i=1
        N=N-11*i
        if(N<0):
            print("No")
            break
        if(N%4)==0 or (N%7)==0:
            print("Yes")
            break
        i=i+1

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

if (N%4)==0:
    print("Yes")
    break
elif(N%7)==0:
    print("Yes")
    break
elif(N%11)==0:
    print("Yes")
    break
while N>0:
    i=1
    N=N-11*i
    if(N%4)==0 or (N%7)==0:
        print("Yes")
        break
    i=i+1
else:
    print("No")
Problem p03288 (python)

Fixed submission:
t=int(input())

if t<1200:
    print("ABC")
elif t<2800:
    print("ARC")
else:
    print("AGC")

Buggy submission (verdict: Runtime Error):
t=list(input())

if t[0]=="A" and not t[1]=="C" and not t[-1]=="C":
    rs=1
else:
    rs=0

if t[1].isupper()==True or t[-1].isupper()==True:
    rs -=1

del t[:2]
del t[-1]

if not t.count("C")==1:
    rs -=1

if rs==1:
    t.remove("C")

for i in t:
    if i.isupper()==True:
        rs -=1

if rs==1:
    print("AC")
else:
    print("WA")

Buggy submission (verdict: Runtime Error):
t=list(input())

if t[0]=="A" and not t[1]=="C" and not t[-1]=="C":
    rs=1
else:
    rs=0

if t[1].isupper==True or t[-1].isupper==True:
    rs -=1

del t[:2]
del t[-1]

if not t.count("C")==1:
    rs -=1

if rs==1:
    t.remove("C")

for i in t:
    if i.isupper()==True:
        rs -=1

if rs==1:
    print("AC")
else:
    print("WA")

Buggy submission (verdict: Runtime Error):
t=list(input())

if t[0]=="A" and not t[1]=="C" and not t[-1]=="C" and t[-1].islower==True and t[1].islower==True:
    rs=1
else:
    rs=0

del t[:2]
del t[-1]

if not t.count("C")==1:
    rs -=1

if rs==1:
    t.remove("C")

for i in t:
    if i.isupper()==True:
        rs -=1

if rs==1:
    print("AC")
else:
    print("WA")
Problem p03283 (python)

Fixed submission:
N, M , Q = map(int, input().split())

LR = [[0]*(N+2-i) for i in range(N+2)]
for i in range(M):
  L, R = map(int, input().split())
  LR[L][R-L+1] += 1

  
for i in range(2,N+2):
  for j in range(1,N-i+2):
    LR[j][i] += LR[j][i-1] + LR[j+1][i-1] - LR[j+1][i-2]
    
for i in range(Q):
  p, q = map(int, input().split())
  print(LR[p][q-p+1]-LR[q+1][0])

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

LR = [[0 for _ in range(N+2-i)] for _ in range(N+2)]
for i in range(M):
  L, R = map(int, input().split())
  LR[L][R-L+1] += 1

  
for i in range(2,N+2):
  for j in range(1,N-i+2):
    LR[j][i] += LR[j][i-1] + LR[j+1][i-1] - LR[j+1][i-2]
    
for i in range(Q):
  p, q = map(int, input().split())
  print(LR[p][q-p+1]-LR[q+1][0])

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

LR = [[0 for _ in range(N+2-i) for _ in range(N+2)]
for i in range(M):
  L, R = map(int, input().split())
  LR[L][R-L+1] += 1

  
for i in range(2,N+2):
  for j in range(1,N-i+2):
    LR[j][i] += LR[j][i-1] + LR[j+1][i-1] - LR[j+1][i-2]
    
for i in range(Q):
  p, q = map(int, input().split())
  print(LR[p][q-p+1]-LR[q+1][0])

Buggy submission (verdict: Runtime Error):
10 10 10
1 6
2 9
4 5
4 7
4 7
5 8
6 6
6 7
7 9
10 10
1 8
1 9
1 10
2 8
2 9
2 10
3 8
3 9
3 10
1 10
Problem p03369 (python)

Fixed submission:
S = str(input())
count = S.count('o')

print(700 + count*100)

Buggy submission (verdict: Runtime Error):
N,X = list(map(int,input().split()))
M = [int(input()) for i in range(N)]
diff  = X - sum(M)
print(N+diff//min(M))

Buggy submission (verdict: Runtime Error):

N, X = map(int, input().split())
m = [int(input()) for i in range(1, N+1)]

diff = X - sum(m)
print(N+(diff//min(m)))

Buggy submission (verdict: Runtime Error):

N, X = map(int, input().split())
m = [int(input()) for i in range(N)]

diff = X - sum(m)
print(N+(diff//min(m)))

Buggy submission (verdict: Runtime Error):
import math

N, X = map(int, input().split())
m = [int(input()) for i in range(1, N+1)]

diff = X - sum(m)
print(math.floor(N+(diff/min(m))))
Problem p03373 (python)

Fixed submission:
a, b, c, x, y = map(int, input().split())

res = a*x + b*y # 条件を満たす買い方のうちABピザの枚数(*2)を全探索する。ABピザを一切買わない場合を一旦答えにする（これを大きい値にして、for ループを0からにしてもよい）
for i in range(1, max(x, y)+1): # 全部ABピザでまかなう時は x,yの内多い方分買うことになる
    ab = i*2 # ABピザを買う枚数奇数枚買うことはないので2倍
    cand = ab*c + a*max(0, x-i) + b*max(0, y-i) # i枚分はABピザになるので-i 負の値にはならない（あまりになる）ので0とのmaxをとる

    res = min(res, cand) # 候補との最小値を保持

print(res)

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

min_sum = int(float('inf'))
for c in range(0, 200000+2, 2):
    print(c)
    sum = C*c
    if X - c/2 > 0:
        sum += A * (X - c/2)
    if Y - c/2 > 0:
        sum += B * (Y - c/2)
    if sum < min_sum:
        min_sum = sum
print(min_sum)

Buggy submission (verdict: Runtime Error):
ll A, B, C, X, Y;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> A >> B >> C >> X >> Y;
    
    ll ans = infl;
    rep(ab, 0, 201010) {
        ll sm = C * ab;
 
        ll x = X - ab / 2;
        ll y = Y - ab / 2;
 
        if (0 < x) sm += x * A;
        if (0 < y) sm += y * B;
 
        chmin(ans, sm);
    }
 
    cout << ans << endl;
}
Problem p03434 (python)

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

Alice = 0
Bob = 0
A.sort(reverse=True)
Alice += sum(A[::2])
Bob += sum(A[1::2])
print(Alice - Bob)

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

Alice = 0
Bob = 0
while len(A)>0:
    Alice += max(A)
    A.remove(max(A))
    Bob += max(A)
    A.remove(max(A))
print(Alice - Bob)

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

Alice = 0
Bob = 0
while len(A)>0:
    Alice += max(A)
    A.remove(max(A))
    Bob += max(A)
    A.remove(max(A))
print(Alice - Bob)
Problem p03284 (python)

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

if N%M == 0:
    print(0)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
N,M = input().split()

if N%M ==0:
    print(0)
else:
    print(1)
Problem p03415 (python)

Fixed submission:
f = list(input())
s = list(input())
t = list(input())

a = [f[i: i+1] for i in range(0, len(f), 1)]
b = [s[i: i+1] for i in range(0, len(s), 1)]
c = [t[i: i+1] for i in range(0, len(t), 1)]
d = ''.join(a[0] + b[1] + c[2])
print(d)

Buggy submission (verdict: Runtime Error):
a,b,c=(str(x) for x in input().split())
d,e,f=(str(x) for x in input().split())
g,h,i=(str(x) for x in input().split())

print(a + e + i)

Buggy submission (verdict: Runtime Error):
a,b,c=(str(x) for x in input().split())
d,e,f=(str(x) for x in input().split())
g,h,i=(str(x) for x in input().split())

print(a + e + i)
Problem p03485 (python)

Fixed submission:
import numpy as np

l = input().split()
l = list(map(int, l))

mean    = np.mean(l)
integer = int(mean)
decimal = mean - integer

j = decimal * 10

if j >= 5 :
    res = integer + 1
else :
    res = integer

print(res)

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

l = input().split()
l = list(map(int, l))

mean    = np.mean(l)
integer = int(mean) # 切り捨て                                                                                     
decimal = mean - integer

j = decimal * 10

if j >= 5 :
    res = integer + 1
else :
    res = integer

print(res)
Problem p03658 (python)

Fixed submission:
l1 = input().split()
N, K = map(int, l1)
max  = K+1
l2 = input().split()
l2 = list(map(int, l2))

l3 = sorted(l2)
sum = 0


for i in range(1, max) :
    sum += l3[-i]

print(sum)

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

l2 = input().split()
l2 = list(map(int, l2))

l3 = sorted(l2)
sum = l3[-1] + l3[-2] + l3[-3]
print(sum)
Problem p03285 (python)

Fixed submission:
four_w = []
seven_w = []
cross = []

for i in range(1,101):
    if i % 4 == 0:
        four_w.append(i)
    elif i % 7 ==0:
        seven_w.append(i)

for four in four_w:
    for seven in seven_w:
        cross.append(four + seven)

n = int(input())

if n in cross:
    print("Yes")
elif n in seven_w:
    print("Yes")
elif n in four_w:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
four_w = []
seven_w = []
cross = []

for i in range(0,100):
    if i % 4 == 0:
        four_w.append(i)
    elif i % 7 ==0:
        seven_w.append(i)

for four in four_w:
    for seven in seven_w:
        cross.append(four + seven)

n = int(input())

if n in cross:
    print("Yes")
elif n in seve_w:
    print("Yes")
elif n in four_w:
    print("yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
four_w = []
seven_w = []
cross = []

for i in range(1,100):
    if i % 4 == 0:
        four_w.append(i)
    elif i % 7 ==0:
        seven_w.append(i)

for four in four_w:
    for seven in seven_w:
        cross.append(four + seven)

n = int(input())

if n in four_w,seven_w,cross:
    print("Yes")
else:
    print("No")
Problem p03308 (python)

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

Buggy submission (verdict: Runtime Error):
input;n=list(map(itn,input().split()))
print(max(n) - min(n))