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

Fixed submission:
n = int(input())
V = [int(v) for v in input().split()]

V1 = [V[n] for n in range(0, n, 2)] #v1, v3, v5, ...
V2 = [V[n] for n in range(1, n, 2)] #v2, v4, v6, ...

mx_V1 = max(V1)
V1_cnt = [[0, 0]] # V1に一種類しか数字が存在しなかったときのために
for i in range(1, mx_V1+1):
  V1_cnt.append([i, 0])
for v in V1:
  V1_cnt[v][1] += 1  
V1_cnt.sort(key=lambda x: x[1], reverse=True)

mx_V2 = max(V2)
V2_cnt = [[0, 0]] # V2に一種類しか数字が存在しなかったときのために
for j in range(1, mx_V2+1):
  V2_cnt.append([j, 0])
for v in V2:
  V2_cnt[v][1] += 1  
V2_cnt.sort(key=lambda x: x[1], reverse=True)

mxnum_V1_cnt = V1_cnt[0][0] #V1の中で一番出現回数多い数字
mxnum_V2_cnt = V2_cnt[0][0] #V2の中で一番出現回数多い数字
if mxnum_V1_cnt != mxnum_V2_cnt:
  ans = n - (V1_cnt[0][1] + V2_cnt[0][1])
else:
  ans = n - max(V1_cnt[0][1] + V2_cnt[1][1], V1_cnt[1][1] + V2_cnt[0][1])

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
V = [int(v) for v in input().split()]

V1 = [V[n] for n in range(0, n, 2)] #v1, v3, v5, ...
V2 = [V[n] for n in range(1, n, 2)] #v2, v4, v6, ...

V1_set = list(set(V1))
V1_cnt = []
for i in V1_set:
  i_cnt = V1.count(i)
  V1_cnt += [i, i_cnt]
V1_cnt += [0, 0] #V1に一種類しか数字が存在しなかったときのために
V1_cnt.sort(key=lambda x: x[1], reverse=True)
  
V2_set = list(set(V2))
V2_cnt = []
for i in V2_set:
  i_cnt = V2.count(i)
  V2_cnt += [i, i_cnt]
V2_cnt += [0, 0] #V2に一種類しか数字が存在しなかったときのために
V2_cnt.sort(key=lambda x: x[1], reverse=True)

mxnum_V1_cnt = V1_cnt[0][0] #V1の中で一番出現回数多い数字
mxnum_V2_cnt = V2_cnt[0][0] #V2の中で一番出現回数多い数字
if mxnum_V1_cnt != mxnum_V2_cnt:
  ans = n - (V1_cnt[0][1] + V2_cnt[0][1])
else:
  ans = n - max(V1_cnt[0][1] + V2_cnt[1][1], V1_cnt[1][1] + V2_cnt[0][1])

print(ans)
Problem p03261 (python)

Fixed submission:
N = int(input())
W = []
W.append(input())
for n in range(N-1):
  w = input()
  if w[0] != W[-1][-1]:
    print("No")
    break
  elif W.count(w) != 0:
    print("No")
    break
  W.append(w)
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
N = int(input())
W = []
W.append(input())
for n in range(N):
  w = input()
  if w[0] != W[-1][-1]:
    print("No")
    break
  elif W.count(w) != 0:
    print("No")
    break
  W.append(w)
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
N = int(input())
W = []
W.append(input())
for n in range(N):
  w = input()
  if w[0] != W[-1][-1]:
    print("No")
    break
  elif W.count(w) != 0:
    print("No")
    break
else:
  print("Yes")
Problem p03262 (python)

Fixed submission:
N, X = [int(nx) for nx in input().split()]
x = [abs(int(xx) - X) for xx in input().split()]

while len(x) > 1:
  x2 = []
  mn_x = min(x)
  for n in range(len(x)):
    mod = x[n] % mn_x
    if mod != 0:
      x2.append(mod)
  x2.append(mn_x)
  x = x2
  
ans = x[0]
print(ans)

Buggy submission (verdict: Runtime Error):
N, X = [int(nx) for nx in input().split()]
x = [abs(int(xx) - X) for xx in input().split()]

while len(x) > 1:
  x2 = []
  mn_x = min(x)
  for n in range(N):
    mod = x[n] % mn_x
    if mod != 0:
      x2.append(mod)
  x2.append(mn_x)
  x = x2
  
ans = x[0]
print(ans)

Buggy submission (verdict: Runtime Error):
N, X = [int(nx) for nx in input().split()]
x = [abs(int(xx) - X) for xx in input().split()]

while len(x) > 1:
  x2 = []
  mn_x = min(x)
  for n in range(N):
    mod = x[n] % mn_x
    if mod != 0:
      x2.append(mod)
  x2.append(mn_x)
  x = x2
print(x)
Problem p03273 (python)

Fixed submission:
H, W = [int(hw) for hw in input().split()]
A = []
for h in range(H):
  a = [a for a in input()]
  if a.count("#") > 0:
    A.append(a)

for w in reversed(range(W)):
  cnt = 0
  for h in range(len(A)):
    if A[h][w] == ".":
      cnt += 1
  if cnt == len(A):
    for h in range(len(A)):
      del A[h][w]

for h in range(len(A)):
  ans = "".join(A[h])
  print(ans)

Buggy submission (verdict: Runtime Error):
H, W = [int(hw) for hw in input().split()]
A = []
for h in range(H):
  a = [a for a in input()]
  if a.count("#") > 0:
    A.append(a)
for w in range(W):
  cnt = 0
  for h in range(len(A)):
    if A[h][w] == ".":
      cnt += 1
  if cnt == len(A):
    for h in range(len(A)):
      del A[h][w]
for h in range(len(A)):
  print(A[h])
Problem p03282 (python)

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

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())
if S[0] == "1":
  print(S[1])
else:
  print(S[0])
Problem p03353 (python)

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

S = [ss for ss in s]
S_set = list(set(S))
S_set.sort()

substring = []
for c in S_set:
  idx_c = [i for i, x in enumerate(s) if x == c]
  substring_c = []
  for x in idx_c:
    for dx in range(1, min(5, len(s)-x)+1):
      substring_c.append(s[x:x+dx])
  substring_c = list(set(substring_c))
  substring += substring_c
  if len(substring) >= 5:
    break

substring.sort()
print(substring[K-1])

Buggy submission (verdict: Runtime Error):
s = input()
K = int(input())
SK2 = list(set(s))
for i in range(2, len(s)):
  for j in range(len(s)-(i-1)):
    SK2.append(s[j:j+i])
SK2.sort()
print(SK2[K-1])
Problem p03359 (python)

Fixed submission:
a, b = [int(ab) for ab in input().split()]
if a <= b:
  print(a)
else:
  print(a-1)

Buggy submission (verdict: Runtime Error):
a, b = list(input().split())
if a <= b:
  print(a)
else:
  print(a-1)
Problem p03415 (python)

Fixed submission:
c_1 = input()
c_2 = input()
c_3 = input()
print(c_1[0] + c_2[1] + c_3[2])

Buggy submission (verdict: Runtime Error):
c_1 = input()
c_2 = input()
c_3 = input()
print(c_11[0] + c_22[1] + c_33[2])

Buggy submission (verdict: Runtime Error):
c_11, c_12, c_13 = [int(a) for a in input().split()]
c_21, c_22, c_23 = [int(b) for b in input().split()]
c_31, c_32, c_33 = [int(c) for c in input().split()]
print(str(c_11) + str(c_22) + str(c_33))
Problem p03544 (python)

Fixed submission:
N = int(input())
L_i2 = 2
L_i1 = 1
if N == 0:
  L_i = L_i2
elif N == 1:
  L_i = L_i1
else:
  for n in range(N-1):
    L_i = L_i1 + L_i2
    L_i2 = L_i1
    L_i1 = L_i
print(L_i)

Buggy submission (verdict: Runtime Error):
N = int(input())
L_i2 = 2
L_i1 = 1
for n in range(N-1):
  L_i = L_i1 + L_i2
  L_i2 = L_i1
  L_i1 = L_i
print(L_i)
Problem p02909 (python)

Fixed submission:
s = str(raw_input())

if s=="Sunny":
    print ("Cloudy")
if s=="Cloudy":
    print ("Rainy")
if s=="Rainy":
    print ("Sunny")

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

if s=="Sunny":
    print ("Cloudy")
if s=="Cloudy":
    print ("Rainy")
if s=="Rainy":
    print ("Sunny")

Buggy submission (verdict: Runtime Error):
s = str(input())

if s=="Sunny":
    print ("Cloudy")
if s=="Cloudy":
    print ("Rainy")
if s=="Rainy":
    print ("Sunny")

Buggy submission (verdict: Runtime Error):
s = str(input())

if s=="Sunny":
    print s("Cloudy")
if s=="Cloudy":
    print ("Rainy")
if s=="Rainy":
    print ("Sunny")

Buggy submission (verdict: Runtime Error):
s = str(input())

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

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

Buggy submission (verdict: Runtime Error):
s = str(input())

if s=="Sunny":
    print("Cloudy")
else if s=="Cloudy":
    print("Rainy")
else if s=="Rainy":
    print("Sunny")

Buggy submission (verdict: Runtime Error):
s = str(input())

if (s=="Sunny"):
    print("Cloudy")
else if (s=="Cloudy"):
    print("Rainy")
else if (s=="Rainy"):
    print("Sunny")

Buggy submission (verdict: Runtime Error):
s = string(input())

if (s=="Sunny"):
    print("Cloudy")
else if (s=="Cloudy"):
    print("Rainy")
else if (s=="Rainy"):
    print("Sunny")

Buggy submission (verdict: Runtime Error):
s = string(input())

if (s=="Sunny"):
    print("Cloudy")
else if	(s=="Cloudy"):
    print("Rainy")
else if (s=="Rainy"):
    print("Sunny")

Buggy submission (verdict: Runtime Error):
s = string(input())

if (s=="Sunny"):
    print("Cloudy")
else if	(s=="Cloudy"):
    print("Rainy")
else:
    print("Sunny")
Problem p03126 (python)

Fixed submission:
import sys
import collections

a=[]
l = map(int, raw_input().split())
for n in range(l[0]):
    x = map(int, raw_input().split())
    a.extend(x[1:])

c = collections.Counter(a)
values, counts = zip(*c.most_common())
print(counts.count(l[0]))

Buggy submission (verdict: Runtime Error):
File Edit Options Buffers Tools Python YASnippet Help                           
import sys
import collections

l = map(int, raw_input().split())
a=[]
for n in range(l[0]):
    x = map(int, raw_input().split())
    a.extend(x[1:])

c = collections.Counter(a)
values, counts = zip(*c.most_common())
print(counts.count(l[0]))
Problem p03288 (python)

Fixed submission:
x = int(input())
print("ABC" if x < 1200 else ("ARC" if x < 2800 else "AGC"))

Buggy submission (verdict: Runtime Error):
x=input()
if (x< 1200):
  print("ABC")
elif (x<2800):
  print("ARC")
else:
  print("AGC")

Buggy submission (verdict: Runtime Error):
x=input()
if (x< 1200):
  	print("ABC")
elif (x<2800):
  	print("ARC")
else:
  	print("AGC")
Problem p03337 (python)

Fixed submission:
a, b= map(int, input().split())
 
c=a+b
d=a-b
e=a*b
 
f=max([c, d, e])
 
print(f)

Buggy submission (verdict: Runtime Error):
n=int(input())
x=input()
s=list(x)
 
list=[]
for i in range(n):
    a=0
    l=s[:i]
    a+=l.count("W")
    k=s[i+1:]
    a+=k.count("E")
    list.append(a)
 
f=min(list)

print(f)

Buggy submission (verdict: Runtime Error):
n=int(input())
x=input()
s=list(x)
 
list=[]
for i in range(n):
    a=0
    l=s[:i]
    a+=l.count("W")
    k=s[i+1:]
    a+=k.count("E")
    list.append(a)
 
f=min(list)

Buggy submission (verdict: Runtime Error):
n=int(input())
x=input()
s=list(x)
list=[]
 
for i in range(n):
    a=0
    moji=[]
    for j in range(i):
        for k in range(n-i):
            if s[j]==s[k+i-1]:
                if s[j] not in moji:
                    a+=1
                    moji.append(s[j])
    list.append(a)
 
f=max(list)
print(f)

Buggy submission (verdict: Runtime Error):
n=int(input())
x=input()
s=list(x)
list=[]

for i in range(n):
    a=0;
    for j in range(i):
        for k in range(n-i):
            if s[j]==s[k+i-1]:
                a+=1
    list.append(a)

f=max(list)
print(f)

Buggy submission (verdict: Runtime Error):
n=int(input())
x=input()
s=list(x)
list=[]

for i in range(n):
    a=0;
    for j in range(i):
        for k in range(n-i):
            if s[j]==s[k]:
                a+=1
    list.append(a)

f=max(list)
print(f)

Buggy submission (verdict: Runtime Error):
a, b= map(int, input().split())
 
c=a+b
d=a-b
e=a*b
 
f=max[c, d, e]

print(f)

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

c=a+b
d=a-b
e=a*b

print(max[c, d, e])
Problem p03338 (python)

Fixed submission:
n=int(input())
x=input()
s=list(x)
list=[]
 
for i in range(n):
    a=0
    moji=[]
    for j in range(i):
        for k in range(n-i):
            if s[j]==s[k+i]:
                if s[j] not in moji:
                    a+=1
                    moji.append(s[j])
    list.append(a)
 
f=max(list)
print(f)

Buggy submission (verdict: Runtime Error):
n=input()
x=input()
s=list(x)
list=[]

for i in range(n):
    a=0;
    for j in range(i):
        for k in range(n-i):
            if s[j]=s[k]:
                a+=1
    list.append(a)

f=max(list)
print(f)
Problem p02923 (python)

Fixed submission:
n = input()
h = input().split()
res = []
ct = 0

for i in range(len(h) - 1):
  if int(h[i]) >= int(h[i+1]):
    ct = ct + 1
  else:
    res.append(ct)
    ct = 0

res.append(ct)

print(max(res))

Buggy submission (verdict: Runtime Error):
n = input()
h = input().split()

hl = [int(int(h[i+1]) - int(h[i]) <= 0) for i in range(len(h) - 1)]
res = []
ct = 0

for i in range(len(hl) - 1):
  if hl[i] == 1:
    ct = ct + 1
  else:
    res.append(ct)
    ct = 0
    
if hl[len(hl) - 1] == 1:
  ct = ct + 1
else:
  pass

res.append(ct)
    
if len(res) == 0:
  print(0)
elif len(res) == 1:
  print(res[0])
else:
  print(max(res))

Buggy submission (verdict: Runtime Error):
n = input()
h = input().split()

hl = [int(int(h[i+1]) - int(h[i]) <= 0) for i in range(len(h) - 1)]
res = []
ct = 0

for i in range(len(hl) - 1):
  if hl[i] == 1:
    ct = ct + 1
  else:
    res.append(ct)
    ct = 0
    
if hl[len(hl) - 1] == 1:
  ct = ct + 1
else:
  pass

res.append(ct)
    
if len(res) == 0:
  print(0)
elif len(res) == 1:
  print(res[0])
else:
  print(max(res))

Buggy submission (verdict: Runtime Error):
n = input()
h = input().split()

hl = [int(int(h[i+1]) - int(h[i]) <= 0) for i in range(len(h) - 1)]
res = []
ct = 0

for i in range(len(hl) - 1):
  if hl[i] == 1:
    ct = ct + 1
  else:
    res.append(ct)
    ct = 0
    
if hl[len(hl) - 1] == 1:
  ct = ct + 1
else:
  pass

res.append(ct)
    
if len(res) == 0:
  print(0)
elif len(res) == 1:
  print(res[0])
else:
  print(max(res))
Problem p03471 (python)

Fixed submission:
i = input()
i = i.split(" ")
n = int(i[0])
y = int(i[1])
y = y / 1000
cn = []

for c in range(int(((y-n) // 9))+1):
  if (int((y-n-9*c)) % 4) == 0:
    cn.append([int((y-n-9*c) / 4), c])
  else:
    pass

if(len(cn) == 0):
  rs = [-1, -1, -1]
else:
  rs = []
  for j in cn:
    a = n - j[0] - j[1]
    if a >= 0:
      rs = [a, j[0], j[1]]
      break
    else:
      pass
  
  if len(rs) != 3:
    rs = [-1, -1, -1]
  else:
    pass
    
print(str(rs[2]) + " " + str(rs[1]) + " " + str(rs[0]))

Buggy submission (verdict: Runtime Error):
i = input()
i = i.split(" ")
n = int(i[0])
y = int(i[1])
y = y / 1000

for c in range(int(((y-n) // 9))+1):
  if (int((y-n-9*c)) % 4) == 0:
    cn = [int((y-n-9*c) / 4), c]
    break
  else:
    pass
  
if(len(cn) == 0):
  rs = [-1, -1, -1]
else:
  a = n - cn[0] - cn[1]
  if a >= 0:
    rs = [a, cn[0], cn[1]]
  else:
    rs = [-1, -1, -1]

print(str(rs[2]) + " " + str(rs[1]) + " " + str(rs[0]))

Buggy submission (verdict: Runtime Error):
i = input()
i = i.split(" ")
n = int(i[0])
y = int(i[1])
y = y / 1000

for c in range(int(((y-n) // 9))+1):
  if (int((y-n-9*c)) % 4) == 0:
    cn = [int((y-n-9*c) / 4), c]
    break
  else:
    pass
  
if(len(cn) == 0):
  rs = [-1, -1, -1]
else:
  a = n - cn[0] - cn[1]
  if a >= 0:
    rs = [a, cn[0], cn[1]]
  else:
    rs = [-1, -1, -1]

print(str(rs[2]) + " " + str(rs[1]) + " " + str(rs[0]))
Problem p02909 (python)

Fixed submission:
now = input()
weather = ["Sunny", "Cloudy", "Rainy"]
print(weather[(weather.index(now) + 1) % 3])

Buggy submission (verdict: Runtime Error):
weather = ["Sunny", "Cloudy", "Rainy"]
now = input()
print(weather[(now.find()+1) % 3]
Problem p02910 (python)

Fixed submission:
dance = input()
judge = True

for i in range(len(dance)):
    if i % 2 == 1 and dance[i] == "R":
        judge = False
        break
    if i % 2 == 0 and dance[i] == "L":
        judge = False
        break

if judge:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
dance = input()
judge = True

for i in dance:
  if i % 2 == 0 and dance[i] == "R":
    judge = False
    break
  if i % 2 == 1 and dance[i] == "L":
    judge = False
    break

if judge:
  print("Yes")
else:
  print("No")
Problem p02911 (python)

Fixed submission:
tmp = input().split(" ")
person = int(tmp[0])
init_pt = int(tmp[1])
questions = int(tmp[2])
points = [0] * (person + 1)
  
for i in range(questions):
  points[int(input())] += 1
  
for i in range(1, person + 1):
  if points[i] > questions - init_pt:
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
tmp = input().split(" ")
person = int(tmp[0])
init_pt = int(tmp[1])
questions = int(tmp[2])

ans = ""
for i in range(questions):
  ans = ans + input()

for i in range(1, len(person) + 1):
  if ans.count(str(i)) > questions - init_pt:
    print("Yes")
  else:
    print("No")
Problem p02731 (python)

Fixed submission:
l = int(input())
a = l / 3
print(a**3)

Buggy submission (verdict: Runtime Error):
import sympy
l = int(input())

x = sympy.Symbol('x')
y = sympy.Symbol('y')

f = l*x*y - y*x**2 - x*y**2

dfdx = sympy.diff(f, x)
#dfdx = sympy.diff(dfdx, y)

dfdy = sympy.diff(f, y)
#dfdy = sympy.diff(dfdy, x)

#print(f)
#print(dfdx)
#print(dfdy)
ans = sympy.solve([dfdx, dfdy])
#print(ans[0][x])

length = len(ans)
res = 0
for i in range(length):
    x1 = ans[i][x]
    y1 = ans[i][y]
    z1 = l - x1 - y1
    su = x1 * y1 * z1
    if res < su:
        res = su
        
print(float(res))
Problem p02741 (python)

Fixed submission:
n = int(input())
lis = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

for i in range(1, 33):
    if i == n:
        print(lis[i-1])

Buggy submission (verdict: Runtime Error):
import copy

n = int(input())
#res = []
table = ['a']

def dfs(s, time, table):
    tab = copy.deepcopy(table)
    l = len(tab)
    mi = ord(s[0])
    for i in range(time):
        if mi < ord(s[i]):
            mi = ord(s[i])
            if s[i] in tab:
                 pass
            else:
                tab.append(s[i])
    mi += 1
    
    if time == n:
        #print(tab)
        if s in res:
            pass
        else:
            #res.append(s)
            print(s)
    else:
        #dfs(s+chr(mi), time+1, tab)
        for i in range(l):
            dfs(s+tab[i], time+1, tab)
        dfs(s+chr(mi), time+1, tab)
            
dfs('a', 1, table)

#res.sort()
#for i in range(len(res)):
#    print(res[i])
Problem p02756 (python)

Fixed submission:
import copy
from collections import deque
s = deque(input())
sc = copy.deepcopy(s) 
sc.reverse()
n = int(input())
l = [list(input().split()) for i in range(n)]

for i in range(n):
    if l[i][0] == '1':
        save = s
        s = sc
        sc = save
    elif l[i][1] == '1':
        s.appendleft(l[i][2])
        sc.append(l[i][2])
        #s = l[i][2] + s
        #sc += l[i][2]
    else:
        s.append(l[i][2])
        sc.appendleft(l[i][2])
        #s += l[i][2]
        #sc = l[i][2] + sc

print(''.join(s))

Buggy submission (verdict: Runtime Error):
s = input()
sc = s[::-1]
n = int(input())
l = [list(input().split()) for i in range(n)]

#last = 1

for i in range(n):
    if l[i][0] == '1':
        save = s
        s = sc
        sc = save
    
if last > 0:
    print(s)
else:
    print(sc)
Problem p02768 (python)

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

mod = 10**9 + 7
res = pow(2, n, mod)

def cmb(n, r, mod):
    r = min(n-r, r)
    if r == 0:
        return 1
    over, under = 1, 1
    for i in range(1, r+1):
        over = over * (n-i+1) % mod
        under = under * i % mod
    inv = pow(under, mod-2, mod)
    return over * inv % mod


A = cmb(n, a, mod)
B = cmb(n, b, mod)

print((res - A - B - 1) % mod)

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
#res = 2 ** n - 1
res = pow(2, n, mod)
mod = 10**9 + 7

def cmb(n, r, mod):
    r = min(n-r, r)
    if r == 0:
        return 1
    over, under = 1, 1
    for i in range(1, r+1):
        over = over * (n-i+1) % mod
        under = under * i % mod
    inv = pow(under, mod-2, mod)
    return over * inv % mod

res -= cmb(n,a,mod)
res -= cmb(n,b,mod)

print(res % mod)

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
res = 2 ** n - 1

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**4
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

res -= cmb(n,a,mod)
res -= cmb(n,b,mod)

print(res)
Problem p02780 (python)

Fixed submission:
n, k = map(int, input().split())
List = list(map(int, input().split()))
score = []
score1 = []

def cal_score(num):
    return 1 + 0.5 * (num - 1)

score.append(cal_score(List[0]))

for i in range(1, n):
    score.append(score[i - 1] + cal_score(List[i]))
    
score1.append(score[k - 1])
m = 0
for i in range(k, n):
    score1.append(score[i] - score[m])
    m += 1

#print(score)    
#print(score1)
print(max(score1))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
List = list(map(int, input().split()))
score = [1, 1.5, 2, 2.5, 3, 3.5]
max = 0
index = 0
res = 0

for i in range(n-k+1):
    pre = List[i]
    for j in range(k-1):
        pre += List[i+j]
    

    if max < pre:
        index = i
        pre = 0
    else:
        pre = 0
    
#print(index)
for i in range(index, index+k):
    res += score[List[i]-1]
    #print(List[i])

print(res)
Problem p03434 (python)

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

a = 0
b = 0

for i in range(len(list)):
  if i % 2 == 0:
    a += list[i]
  else:
    b += list[i]

print(a - b)

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

a = 0
b = 0

for i in list:
  if i % 2 == 0:
    a += list[i]
  else:
    b += list[i]

print(a - b)
Problem p03455 (python)

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

c = a * b
if(c % 2 == 0):
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
def(a, b)
  c = a * b
  if(c % 2 == 0):
  	print("Even")
  else:
    print("Odd")

Buggy submission (verdict: Runtime Error):
def(a, b)
  c = a * b
  if(c % 2 == 0)
  	print("Even")
  else
    print("Odd")

Buggy submission (verdict: Runtime Error):
def(a, b)
  c = a * b
  if(c / 2 == 0)
  	print("Even")
  else
    print("Odd")
Problem p03470 (python)

Fixed submission:
n = int(input())
d = [int(input()) for i in range(n)]
res = 1

d.sort()
first = d[0]

for i in range(1, n):
  if first < d[i]:
    res += 1
  first = d[i]
  
print(res)

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

d.sort()
first = d[0]

for i in range(1, n):
  if first < d[i]:
    res += 1
  first = d[i]
  
print(res)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(int, input().split())
res = 0

d.sort()
first = d[0]

for i in range(1, n):
  if first > d[i]:
    res += 1
  first = d[i]
  
print(res)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(int, input().split())
res = 0

d.sort()
first = d[0]

for i in range(1, n):
  if first > range[i]:
    res += 1
  first = range[i]
  
print(res)
Problem p03471 (python)

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

a = -1
b = -1
c = -1

for i in range(n + 1):
  for t in range(i, n + 1):
    sum = 10000 * i + 5000 * (t - i)  + 1000 * (n - t)
    if sum == y:
      a = i
      b = t - i
      c = n - t
      
print(a, b, c)

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

a = -1
b = -1
c = -1

for i in range(n):
  for t in range(i, n):
    sum = 10000 * i + 5000 * (t - i)  + 1000 * (n - t)
    if sum == y:
      a = i
      b = t - i
      c = n - t
      
print(x, y, z)

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

x = -1
y = -1
z = -1

for i in range(n):
  for t in range(i, n):
    sum = 10000 * i + 5000 * (t - i)  + 1000 * (n - t)
    if sum == y:
      x = i
      y = t - i
      z = n - t
      
print(x, y, z)
Problem p03478 (python)

Fixed submission:
n, a, b = map(int, input().split())
x = 0

for i in range(1, n+1):
  q = i // 10000
  qi = i % 10000
  w = qi // 1000
  wi = qi % 1000
  e = wi // 100
  ei = wi % 100
  r = ei // 10
  ri = ei % 10
  t = ri
  sum = q + w + e + r + t
  if sum >= a and sum <= b:
    x += i
    
print(x)

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

for i in range(1:n+1):
  q = i
  w = i / 10
  e = i / 100
  r = i / 1000
  sum = q + w + e + r
  if sum >= a and sum <= b:
    x += sum
    
print(x)

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

for i in range(1:n+1):
  q = i
  w = i / 10
  e = i / 100
  r = i / 1000
  sum = q + w + e + r
  if sum >= a and sum <= b:
    x += 1
    
print(x)