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

Fixed submission:
import sys
import math
n = int(input())
T,A = 1,1
for i in range(n):
    t,a = map(int,input().split(" "))
    coef = max((T+t-1)//t,(A+a-1)//a)
    T,A = coef * t, coef * a 
print(T+A)

Buggy submission (verdict: Runtime Error):
import sys
import math
n = map(int,input().split())
T,A = 1,1
for i in range(n):
    t,a = map(int,input().split())
    coef = max((T+t-1)//t,(A+a-1)//a)
    T,A = coef * t, coef * a 
print(T+A)

Buggy submission (verdict: Runtime Error):
import sys
import math
n = map(int,input())
T,A = 1,1
for i in range(n):
    t,a = map(int,input().split())
    coef = max((T+t-1)//t,(A+a-1)//a)
    T,A = coef * t, coef * a 
print(T+A)
Problem p04011 (python)

Fixed submission:
a = [int(input()) for i in range(4)]
sum = 0
for i in range(a[0]):
    if i + 1 <= a[1]:
        sum += a[2]
    else:
        sum += a[3]
print(sum)

Buggy submission (verdict: Runtime Error):
a = [int(input()) for i in range(4)]
sum = 0
for i in range(a[0]):
    if i + 1 <= K:
        sum += a[2]
    else:
        sum += a[3]
print(sum)
Problem p04029 (python)

Fixed submission:
n=int(input())
print(n*(n+1)//2)

Buggy submission (verdict: Runtime Error):
n=input()
print(n*(n+1)//2)
Problem p02888 (python)

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

counts = 0

for i in range(n):
  start, end = 0, i - 1
  while start < end:
    if nums[start] + nums[end] > nums[i]:
      counts += end - start
      end -= 1
    else:
      start += 1
print(counts)

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

nums.sort()
counts = 0

for i in range(n):
  start, end = 0, i - 1
  while start < end:
    if nums[start] + nums[end] > nums[i]:
      counts += end - start
      end -= 1
    else:
      start += 1
print(counts)

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

nums.sort()
res = 0
for k in range(n-1, 1, -1):
    i, j = 0, k-1
    while i < j and nums[i] + nums[j] <= nums[k]:
        i += 1
    while i < j and nums[i] + nums[j] > nums[k]:
        res += j - i
        j -= 1
print(res)

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

nums.sort()
res = 0
for k in range(n-1, 1, -1):
    i, j = 0, k-1
    while i < j and nums[i] + nums[j] <= nums[k]:
      	i += 1
    while i < j and nums[i] + nums[j] > nums[k]:
      	res += j - i
        j -= 1
print(res)
Problem p02890 (python)

Fixed submission:
import bisect
N = int(input())
count = {}
for x in map(int, input().split()):
    count[x] = count.get(x, 0) + 1

a = sorted(count.values())
sums = a[:]
n = len(a)
for i in range(1, n):
    sums[i] += sums[i-1]
    
def check(k, x):
    pos = bisect.bisect_right(a, x)
    if pos == 0:
        return x * n >= k * x
    return sums[pos-1]+ x * (n - pos) >= k * x

x = 0
res = []
for k in range(N, 0, -1):
    while check(k, x+1):
        x += 1
    res.append(x)
    
for x in res[::-1]:
    print(x)

Buggy submission (verdict: Runtime Error):
N = int(input())
count = {}
for x in map(int, input().split()):
    count[x] = count.get(x, 0) + 1

a = sorted(count.values())
sums = a[:]
n = len(a)
for i in range(1, n):
    sums[i] += sums[i-1]
    
def check(k, x):
    pos = bisect.bisect_right(a, x)
    return (sums[pos-1] if pos-1 >= 0 else 0) + x * (n - pos) >= k * x

x = 0
res = []
for k in range(N, 0, -1):
    while check(k, x+1):
        x += 1
    res.append(x)
    
for x in res[::-1]:
    print(x)
Problem p02901 (python)

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

for _ in range(M):
    cost, _ = map(int, input().split())
    mask = 0
    for i in map(int, input().split()):
        mask |= (1 << (i - 1))
    keys.append((cost, mask))


allstate = (1 << N) - 1
dp = [float('inf')] * (1<<N)
dp[0] = 0

for cost, key_set in keys:
    for state in range(1<<N):
        if dp[state] == float('inf'): continue
        nstate = state | key_set
        dp[nstate] = min(dp[nstate], dp[state] + cost)

print(dp[-1] if dp[-1] != float('inf') else -1)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
keys = []
 
for _ in range(M):
    cost, _ = map(int, input().split())
    mask = 0
    for i in map(int, input().split()):
        mask |= (1 << (i - 1))
    keys.append((cost, mask))

import collcetions
allstate = (1 << N) - 1
dp = collections.defaultdict(lambda:float('inf'))
dp[0] = 0
 
for cost, key_set in keys:
    ndp = dp.copy()
    for state, val in dp.items():
        ndp[state|key_set] = min(ndp[state|key_set], val + cost)
    dp = ndp
if allstate in dp:
    print(dp[allstate])
else:
    print(-1)

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

for _ in range(M):
    cost, _ = map(int, input().split())
    mask = 0
    for i in map(int, input().split()):
        mask |= (1 << (i - 1))
    keys.append((cost, mask))


allstate = (1 << N) - 1
dp = [float('inf')] * (1<<N)
dp[0] = 0

for cost, key_set in keys.items():
    for state in range(1<<N):
        if dp[state] == float('inf'): continue
        nstate = state | key_set
        dp[nstate] = min(dp[nstate], dp[state] + cost)

print(dp[-1] if dp[-1] != float('inf') else -1)
Problem p02913 (python)

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

def check(length):
    d = set()
    for i in range(n - 2 * length + 1):
        d.add(s[i:i + length])
        if s[i + length:i + 2 * length] in d:
            return True
    return False
 
 
lo = 0
hi = n // 2 + 1
while lo + 1 < hi:
    mid = (lo + hi) // 2
    if check(mid):
        lo = mid
    else:
        hi = mid
if check(hi):
	print(hi)
else:
  	print(lo)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
 
res = 0
dp = [[0]* (1+n) for _ in range(n+1)]
for i in range(n-1, -1, -1):
    for j in range(i+1, n):
        if s[i] == s[j]:
            dp[i][j] = dp[i+1][j+1] + (j - i > dp[i+1][j+1])
            res = max(res, dp[i][j]
print(res)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
 
mx = 0
for length in range(1, n):
    t = 0
    for u in range(n - length):
        t = t + 1 if s[i] == s[i + length] else 0
        mx = max(mx, min(length, t))
 
print(mx)

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

import collections
dp = collections.defaultdict(int)
for i in range(n-1, -1, -1):
    for j in range(i+1, n):
        if s[i] == s[j]:
            dp[i,j] = dp[i+1, j+1] + (j - i > dp[i+1, j+1])
print(max(dp.values()))
Problem p03372 (python)

Fixed submission:
import numpy as np

n, c = list(map(int, input().split(' ')))
x, v = [], []

for i in range(n):
  x_, v_ = list(map(int, input().split(' ')))
  x.append(x_)
  v.append(v_)
x = np.array(x)
v = np.array(v)
sum_v = np.cumsum(v)
inv_x = c - x[::-1]
inv_v = v[::-1]
sum_inv_v = np.cumsum(inv_v)

cal = sum_v - x
inv_cal = sum_inv_v - inv_x

cal_cummax = np.maximum.accumulate(cal)
inv_cal_cummax = np.maximum.accumulate(inv_cal)

fr_double_cal = sum_v - 2 * x + \
    np.insert(inv_cal_cummax[:-1], 0, 0)[::-1]
fl_double_cal = sum_inv_v - 2 * inv_x + \
    np.insert(cal_cummax[:-1], 0, 0)[::-1]

print(np.max(
    [0, cal.max(), inv_cal.max(), fr_double_cal.max(), fl_double_cal.max()]))

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

n, c = list(map(int, input().split(' ')))
x, v = [], []

for i in range(n):
  x_, v_ = list(map(int, input().split(' ')))
  x.append(x_)
  v.append(v_)
x = np.array(x)
v = np.array(v)
sum_v = np.cumsum(v)
inv_x = c - x[::-1]
inv_v = v[::-1]
sum_inv_v = np.cumsum(inv_v)

cal = sum_v - x
inv_cal = sum_inv_v - inv_x

cal_cummax = pd.Series(cal).cummax().as_matrix()
inv_cal_cummax = pd.Series(inv_cal).cummax().as_matrix()

fr_double_cal = sum_v - 2 * x + \
    np.insert(inv_cal_cummax[:-1], 0, 0)[::-1]
fl_double_cal = sum_inv_v - 2 * inv_x + \
    np.insert(cal_cummax[:-1], 0, 0)[::-1]

print(np.max(
    [0, cal.max(), inv_cal.max(), fr_double_cal.max(), fl_double_cal.max()]))
Problem p03734 (python)

Fixed submission:

if 1:
    N,W = map(int, input().split(' '))
    w,v = [],[]
    for i in range(N):
        w_,v_ = map(int, input().split(' '))
        w.append(w_)
        v.append(v_)
else:
    N,W = 4,6
    w = [2,3,4,3]
    v = [1,4,10,4]

w0 = w[0]

idxs = set()
for i in range(N+1):
    for j in range(3*i+1):
        if i*w0+j <= W:
            idxs.add(i*w0+j)
idxs = sorted(list(idxs))
idx_dict = {idx:i for i,idx in enumerate(idxs)}

dp = [[0 for j in range(len(idxs))] for i in range(N+1)]

for i in range(N):
    for j in range(len(idxs)):
        if idxs[j] < w[i]:
            dp[i+1][j] = dp[i][j]
        else:
            try:
                dp[i+1][j] = max([dp[i][j],dp[i][idx_dict[idxs[j]-w[i]]]+v[i]])
            except:
                dp[i+1][j] = dp[i][j]
        
print(max([max(dp_) for dp_ in dp]))

Buggy submission (verdict: Runtime Error):

import bisect

if 1:
    N,W = map(int, input().split(' '))
    w,v = [],[]
    for i in range(N):
        w_,v_ = map(int, input().split(' '))
        w.append(w_)
        v.append(v_)
else:
    N,W = 4,6
    w = [2,3,4,3]
    v = [1,4,10,4]

w0 = w[0]

idxs = set()
for i in range(N):
    for j in range(3*i+1):
        if i*w0+j <= W:
            idxs.add(i*w0+j)
idxs = list(idxs) 
idx_dict = {idx:i for i,idx in enumerate(idxs)}

dp = [[0 for j in range(len(idxs))] for i in range(N+1)]

for i in range(N):
    for j in range(len(idxs)):
        if idxs[j] < w[i]:
            dp[i+1][j] = dp[i][j]
        else:
            k = bisect.bisect_left(idxs, idxs[j]-w[i])
            dp[i+1][j] = max([dp[i][j],dp[i][idx_dict[idxs[k]]]+v[i]])
                
print(dp[-1][-1])
Problem p04043 (python)

Fixed submission:
x,y,z=input().split()
if (float(x)*float(y)*float(z)==175):
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
x=input()
y=input()
z=input()
if (x*y*z=5*5*7):
    print('true')
else:
    print('False')
Problem p02844 (python)

Fixed submission:
val1=input()
s=input()
n=int(val1)
count=0
for i in range(0,1000):
    a=str(i).zfill(3) #ゼロうめ
    p=0
    for j in range(0,n):
        if a[p]==s[j]:
            p+=1
            if p==3:
                count+=1
                break
print(count)

Buggy submission (verdict: Runtime Error):
import ita
import numpy as np
val1=input()
s=input()
n=int(val1)

data=ita.array.make1d(1000)

for i in range(0,n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            data[int(s[i]+s[j]+s[k])]+=1
1000-data.count(0)

Buggy submission (verdict: Runtime Error):
import ita
import numpy as np
val1=input()
val2=input()
n=int(val1)
s=int(val2)
data=ita.array.make1d(1000)
ss=str(s)
for i in range(0,n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            data[int(ss[i]+ss[j]+ss[k])]+=1
1000-data.count(0)

Buggy submission (verdict: Runtime Error):
import ita
import numpy as np
val1=input()
val2=input()
n=int(val1)
s=int(val2)
data=ita.array.make3d(10,10,10)
ss=str(s)
for i in range(0,n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            data[int(ss[i])][int(ss[j])][int(ss[k])]+=1
np.count_nonzero(data)
Problem p03962 (python)

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

if a != b != c and a != c:
    print(3)
if a == b and a != c and b != c: 
    print(2)
if b == c and b != a and c != a:
    print(2)
if a == c and a != b and c != b:
    print(2)
if a == b == c:
    print(1)

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

if a != b != c:
    print(3)
if a == b and a != c and b != c: 
    print(2)
if b == c and b != a and c != a:
    print(2)
iif a == c and a != b and c != b:
    print(2)
if a == b == c:
    print(1)
Problem p04011 (python)

Fixed submission:
n, k, x, y = [int(input()) for i in range(4)]
if n > k:
    syogaku = k * x
    sagaku = (n - k) * y
    print(syogaku + sagaku)
else:
    syogaku = n * x
    print(syogaku)

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

if s[0] <= s[1]:
    print(s[0]*s[2])
else:
    atamakin = s[1]*s[2]
    nokori = (s[0]-s[1])*s[3]
    print(atamakin + nokori)

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

if s[0] <= s[1]:
    print(s[0]*s[2])
else:
    atamakin = s[1]*s[2]
    nokori = (s[0]-s[1])*s[3]
    print(atamakin + nokori)

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

if s[0] < s[1]:
    print(s[0]*s[2])
else:
    atamakin = s[1]*s[2]
    nokori = (s[0]-s[1])*s[3]
    print(atamakin + nokori)
Problem p02842 (python)

Fixed submission:
taxed_price = int(input())
raw_price = taxed_price // 1.08

if int(raw_price * 1.08) == taxed_price:
    print(int(raw_price))
elif int((raw_price + 1) * 1.08) == taxed_price:
    print(int(raw_price + 1))
else:
    print(':(')

Buggy submission (verdict: Runtime Error):
taxed_price = int(input())
raw_price = taxed_price // 1.08

if int(raw_price * 1.08) == taxed_price:
  print(raw_price)
 elif int((raw_price + 1) * 1.08) == taxed_price:
  print(raw_price + 1)
 else:
  print(':\(')
Problem p02843 (python)

Fixed submission:
sum = input()

if len(sum) < 3:
    print('0')
else:
    last_2_digit = sum[-2:]
    upper_digit = sum[:-2]

    if last_2_digit == '00':
        print('1')
    else:
        required_num = (int(last_2_digit) - 1) // 5 + 1
        # print(upper_digit, last_2_digit, required_num)
        if int(upper_digit) >= required_num:
            print('1')
        else:
            print('0')

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

if len(sum) < 2:
    print('0')
else:
    last_2_digit = sum[-2:]
    upper_digit = sum[:-2]

    if last_2_digit == '00':
        print('1')
    else:
        required_num = int(last_2_digit) // 5 + 1
        if int(upper_digit) >= required_num:
            print('1')
        else:
            print('0')

Buggy submission (verdict: Runtime Error):
sum = input()
last_2_digit = sum[-2:]
upper_digit = sum[:-2]

if last_2_digit == '00':
    print('1')
else:
    required_num = int(last_2_digit) // 5 + 1
    if int(upper_digit) >= required_num:
        print('1')
    else:
        print('0')
Problem p02909 (python)

Fixed submission:
S = input()
if S == "Sunny":
    A = "Cloudy"
elif S == "Cloudy":
    A = "Rainy"
else:
    A = "Sunny"
print(A)

Buggy submission (verdict: Runtime Error):
input(S)
if S = Sunny:
  print("Cloudy")
elif S = Cloudy:
  print("Rainy")
else:
  print("Sunny")

Buggy submission (verdict: Runtime Error):
S = input()
if S = Sunny:
  print("Cloudy")
elif S = Cloudy:
  print("Rainy")
else:
  print("Sunny")

Buggy submission (verdict: Runtime Error):
W = input()
if W = "Sunny":
  print("Cloudy")
elif W = "Cloudy":
  print("Rainy")
else:
  print("Sunny")
Problem p02945 (python)

Fixed submission:
A,B = map(int,input().split())
X = A + B
Y = A - B
Z = A * B
if X >= Y and X >= Z:
     print(X)
elif Y >= Z and Y >= X:
     print(Y)
elif Z >= X and Z >= Y:
     print(Z)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
X = A + B
Y = A - B
Z = A * B
  if X >= Y and X >= Z:
     print(X)
elif Y >= Z and Y >= X:
     print(Y)
elif Z >= X and Z >= Y:
     print(Z)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
X = A + B
Y = A - B
Z = A * B
  if X >= Y and X >= Z :
     print(X)
elif Y >= Z and Y >= X :
     print(Y)
elif Z >= X and Z >= Y :
     print(Z)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split)
X = A + B
Y = A - B
Z = A * B
  if X >= Y and X >= Z : print(X)
elif Y >= Z and Y >= X : print(Y)
elif Z >= X and Z >= Y : print(Z)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split)
X = A + B
Y = A - B
Z = A * B
if X - Y > 0 and X - Z > 0 : print(X)
elif Y - Z > 0 and Y - X > 0 : print(Y)
elif Z - X > 0 and Z - Y > 0 : print(Z)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split)
X = A + B
Y = A - B
Z = A * B
if X > Y and X > Z : print(X)
elif Y > Z and Y > X : print(Y)
elif Z > X and Z > Y : print(Z)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split)
X = A + B
Y = A - B
Z = A * B
if X > Y and X > Z : print(X)
if Y > Z and Y > X : print(Y)
if Z > X and Z > Y : print(Z)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split)
if A*B > A+B and A*B > A-B : print(A*B)
if A+B > A-B and A+B > A*B : print(A+B)
if A-B > A*B and A-B > A+B : print(A-B)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split)
if A*B > A+B or A-B : print(A*B)
if A+B > A-B or A*B : print(A+B)
if A-B > A*B or A+B : print(A-B)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split)
if A*B > A+B|A-B : print(A*B)
if A+B > A-B|A*B : print(A+B)
if A-B > A*B|A+B : print(A-B)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split)
if A*B > A+B|A-B : ans = A*B
if A+B > A-B|A*B : ans = A+B
if A-B > A*B|A+B : ans = A-B
print(ans)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split)
if A+B < A-B < A*B or A-B < A+B < A*B :ans = A*B
if A*B < A-B < A+B or A-B < A*B < A+B :ans = A+B
if A+B < A*B < A-B or A*B < A+B < A-B :ans = A-B
print(ans)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split)
if A+B < A-B < A*B | A-B < A+B < A*B :ans = A*B
if A*B < A-B < A+B | A-B < A*B < A+B :ans = A+B
if A+B < A*B < A-B | A*B < A+B < A-B :ans = A-B
print(ans)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split)
if A+B < A-B < A*B | A-B < A+B < A*B :print(A*B)
if A*B < A-B < A+B | A-B < A*B < A+B :print(A+B)
if A+B < A*B < A-B | A*B < A+B < A-B :print(A-B)
Problem p02957 (python)

Fixed submission:
A,B = map(int,input().split())
K = (A+B)
if K%2 == 0 :
  print(K//2)
else:
  print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
K = (A+B)//2
if type(K) is int:
  print(K)
else:
  print("Impossible")

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
K = (A+B)//2
if type(K) is int:
  print(K)
else:
  print("Impossible")

Buggy submission (verdict: Runtime Error):
A = input(a)
B = input(b)
K == (A+B)/2
if type(K) is int:       
    print(K)
else:
    print("Impossible")
Problem p03434 (python)

Fixed submission:
N=int(input())
cardmap=map(int,input().split())
card=list(cardmap)
card.sort(reverse=True)
Alist=card[0::2]
Blist=card[1::2]
Asum=sum(Alist)
Bsum=sum(Blist)
print(Asum-Bsum)

Buggy submission (verdict: Runtime Error):
N=int(input())
cardlist=list(map(int,input().split())).sort(reverse=True)
Alist=cardlist[0:,2]
Blist=cardlist[1:,2]
Asum=sum(Alist)
Bsum=sum(Blist)
print(Asum-Bsum)
Problem p04011 (python)

Fixed submission:
N,K,X,Y=[int(input()) for i in range(4)]
print(X*N if N<=K else X*K+Y*(N-K))

Buggy submission (verdict: Runtime Error):
N,K,X,Y=map(int,input().split())
print(X*N if N<=K else X*K+Y*(N-K))
Problem p02843 (python)

Fixed submission:
price = int(input())
x = price // 100
y = price % 100
if price < 100:
  	val = 0
elif y / x <= 5:
	val = 1
else:
  	val = 0
print(val)

Buggy submission (verdict: Runtime Error):
price = int(input())
x = price // 100
y = price % 100
if y / x <= 5:
	val = 1
else:
  	val = 0
print(val)
Problem p04043 (python)

Fixed submission:
a = sorted(list(map(int,input().split())))
if a == [5,5,7]:
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
n, l = map(int, input().split())
a = []
for x in range(n):
    a.append(input())
a.sort()
print("".join(a))

Buggy submission (verdict: Runtime Error):
n, l = map(int,input().split())
a = []
for x in range(n):
    a.append(input())
a.sort()
print("".join(a))

Buggy submission (verdict: Runtime Error):
n, l = map(int,input().split())
a = []
for x in range(n):
    a.append(input())
a.sort()
print(""join(a))

Buggy submission (verdict: Runtime Error):
n, l = map(int,input().split())
a = []
for x in range(n):
    a.append(input())
a.sorted()
print(''.join(a))
Problem p03001 (python)

Fixed submission:
w,h,x,y = map(int, input().split())
print(w*h/2, int(2*x==w and 2*y==h))

Buggy submission (verdict: Runtime Error):
import sys
import collections
w,h,x,y = map(int, input().split())

if (x,y) in [(w,0), (0,h), (0,0), (w,h)] or x/w+y/h==1 or y/x==h/w:
    print(w*h/2, 0)
    sys.exit()

s1 = min(x*h, (w-x)*h)
s2 = min(y*w, (h-y)*w)

if s1==s2:
    print(s1, 1)
else:
    print(max(s1,s2), 0)
Problem p03076 (python)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
x=[(i,i%10) for i in [a,b,c,d,e] if i%10!=0]
y=[i for i in [a,b,c,d,e] if i%10==0]
x=sorted(x,key=lambda x:x[1])
ans = sum(y)
if len(x)==0:
  print(ans)
else:
  ans += sum((i[0]//10+1)*10 for i in x[1:])
  ans+=x[0][0]
  print(ans)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
x=[(i,i%10) for i in [a,b,c,d,e] if i%10!=0]
y=[i for i in [a,b,c,d,e] if i%10==0]
x=sorted(x,key=lambda x:x[1])
ans = sum(y)
ans += sum((i[0]//10+1)*10 for i in x[1:])
ans+=x[0][0]
print(ans)
Problem p03195 (python)

Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
print('second' if all(a[i] % 2 == 0 for i in range(n)) else 'first')

Buggy submission (verdict: Runtime Error):
print('second' if all(a[i] % 2 == 0 for i in range(N)) else 'first')
Problem p03215 (python)

Fixed submission:
import itertools
import numpy as np
def main():
    n,k = map(int, input().split())
    a = list(map(int, input().split()))

    x = [sum(a[i:j+1]) for i in range(n) for j in range(i,n)]
    x.sort()
    x = x[::-1]

    MAX = x[0]
    two = 1
    POW = 1
    while(MAX>=two*2):
        two*=2
        POW+=1

#MAXBITソート
    for p in range(POW)[::-1]:
        C = list(filter(lambda y:y>=two,x))
        if len(C)>=k:
            break
        else:
            two//=2

    POW = p+1

    for p in range(POW):
        D = list(filter(lambda x:(x//two)%2==1,C))
        LEN = len(D)
        if LEN>=k:
            C = D[:]
            if LEN==k:break
        two//=2

    ans = C[0]
    for c in C[1:k]:
        ans &= c

    print(ans)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import itertools
import numpy as np
def main():
    n,k = map(int, input().split())
    a = list(map(int, input().split()))

    x = [sum(a[i:j+1]) for i in range(n) for j in range(i,n)]
    x.sort()
    x = x[::-1]
    ans = []
    for ls in itertools.combinations(range(k**2), k):
        y = x[ls[0]]
        for i in ls[1:]:
            y = y & x[i]
        ans.append(y)
    print(max(ans))
    # for i in range(k-1):
    #     ans = ans & x[i+1]
    # print(ans)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import collections
n,k = map(int, input().split())
a = collections.deque(list(map(int, input().split())))

ans = sum(a)
for i in range(k-1):
    if a[0] >= a[-1]:
        a.pop()
        ans = ans & sum(a)
    else:
        a.popleft()
        ans = ans & sum(a)
print(ans)
Problem p03289 (python)

Fixed submission:
a = input()

if a[0]=="A":
  if a[2:-1].count("C")==1:
    s = a[2:-1].replace("C","") + a[-1]
    if a[1].islower() and s.islower():
      print("AC")
    else:
      print("WA")
  else:
    print("WA")
else:
  print("WA")

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

if a[0]=="A":
  if a[2:-1].count("C")==1:
    b,c = a[2:-2].split("C")
    q = b=="" or b.islower()
    r = c=="" or c.islower()
    if a[1].islower() and q and r:
      print("AC")
    else:
      print("WA")
  else:
    print("WA")
else:
  print("WA")