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

Fixed submission:
import math

# 最大公約数を求める問題
N, X = map(int, input().split())
x = [int(_) for _ in input().split()]
if N == 1:
    print(abs(x[0]-X))
    exit()

x.sort()
# N > 1と仮定
for i in range(N-1):
    if x[i] < X and x[i+1] > X:
        x = x[:i+1] + [X] + x[i+1:]
        break
    elif x[i] >= X:
        x = [X] + x
        break
    elif x[i+1] <= X:
        x = x + [X]
        break

if len(x) >= 3:
    base = math.gcd(x[1]-x[0], x[2]-x[1])
    for i in range(2, N):
        diff = x[i+1] - x[i]
        base = math.gcd(base, diff)
    print(base)
else:
    print(x[1] - x[0])

Buggy submission (verdict: Runtime Error):
import math

# 最大公約数を求める問題
N, X = map(int, input().split())
x = [int(_) for _ in input().split()]
if N == 1:
    print(abs(x[0]-X))
    exit()

x.sort()
# N > 1と仮定
for i in range(N-1):
    if x[i] < X and x[i+1] > X:
        x = x[:i+1] + [X] + x[i+1:]
        break

if len(x) >= 3:
    base = math.gcd(x[1]-x[0], x[2]-x[1])
    for i in range(2, N):
        diff = x[i+1] - x[i]
        base = math.gcd(base, diff)
    print(base)
else:
    print(x[1] - x[0])

Buggy submission (verdict: Runtime Error):
import math

# 最大公約数を求める問題
N, X = map(int, input().split())
x = [int(_) for _ in input().split()]
if N == 1:
    print(abs(x[0]-X))
    exit()

x.sort()
# N >= 1と仮定
for i in range(N-1):
    if x[i] <= X and x[i+1] > X:
        x = x[:i+1] + [X] + x[i+1:]
        break

base = math.gcd(x[1]-x[0], x[2]-x[1])
for i in range(2, N):
    diff = x[i+1] - x[i]
    base = math.gcd(base, diff)
print(base)

Buggy submission (verdict: Runtime Error):
import math

# 最大公約数を求める問題
N, X = map(int, input().split())
x = [int(_) for _ in input().split()]
if N == 1:
    print(abs(x[0]-X))
    exit()

x.sort()
# N >= 1と仮定
for i in range(N-1):
    if x[i] <= X and x[i+1] > X:
        x = x[:i-2] + [X] + x[i+1:]
        break

base = math.gcd(x[1]-x[0], x[2]-x[1])
for i in range(2, N):
    diff = x[i+1] - x[i]
    base = math.gcd(base, diff)
print(base)
Problem p03565 (python)

Fixed submission:
S = input()
T = input()
def checkstr(ss):
    for (s,t) in zip(ss,T):
        check = True
        if s=="?":
            continue
        elif s!=t:
            check = False
            break
    return check
ans = ""
for i in range(len(S)-len(T)+1):
    strs = S[i:i+len(T)]
    if checkstr(strs):
        ans = S[:i].replace("?","a")+T+S[i+len(T):].replace("?","a")
if ans=="":
    print("UNRESTORABLE")
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
S = list(input())
T = list(input())
pos = []
for i in range(len(S)):
    if S[i] == T[0]:
        flag = 1
        for j in range(len(T)):
            if not T[j] == S[i+j] and not S[i+j] == '?':
                flag = 0
                break
        if flag:
            pos.append(i)

if not pos:
    print('UNRESTORABLE')
    exit()

words = []
for p in pos:
    word = S[0:p] + T + S[p+len(T):]
    for i in range(len(word)):
        if word[i] == '?':
            word[i] = 'a'
    words.append(word)
words.sort()
print("".join(words[0]))
Problem p02628 (python)

Fixed submission:
N,K=map(int,input().split())
p=list(map(int, input().split()))
p.sort()

price=0
for idx in range(K):
    price=price+p[idx]
print(price)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
p = list(map(int,input().split()))
p=p.sort()
price=0
for idx in range(K):
  price=price+p[idx]
print(price)
Problem p02639 (python)

Fixed submission:
x1, x2, x3, x4, x5 = map(int, input().split())

if x1 == 0:
  print(1)
elif x2 == 0:
  print(2)
elif x3 == 0:
  print(3)
elif x4 == 0:
  print(4)
else:
  print(5)

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

for idx in range(len(x)):
  if x[idx] == 0:
    print(idx + 1)
    break

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

x = tuple(x)

for idx in range(5):
  if x[idx] == 0:
    print(idx + 1)
    break
Problem p02657 (python)

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

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

print(A*B
Problem p02658 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
X=1
if 0 in A:
    print(0)
else:
    for idx in range(N):
        X=X*A[idx]
        if X >10**18:
            print(-1)
            break
    else:
        print(X)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
X=1
if 0 in A:
  print(0)
  break

else:
  for idx in range(N):
  	X=X*A[idx]
  	if X >1*10**18:
   		print(-1)
    	break
	else:
  	print(X)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
X=1
if 0 in A:
  print(0)
  return

for idx in range(N):
  X=X*A[idx]
  if X >1*10**18:
    print(-1)
    return

print(X)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
X=1
for idx in range(N):
  X=X*A[idx]

if X >10**18:
  print(-1)
  break
else:
  print(X)
Problem p02705 (python)

Fixed submission:
import numpy as np
R=int(input())
circle=float(R*2*np.pi)
print(circle)

Buggy submission (verdict: Runtime Error):
import numpy as np
R=int(input())
circle=float(R*2*np.pi))
print(circle)
Problem p02717 (python)

Fixed submission:
X,Y,Z=map(int,input().split())
A,B,C=X,Y,Z
 
A = Y
B = X
A = Z
C = Y
 
print(str(A)+' '+str(B)+' '+str(C))

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

A = Y
B = X
A = Z
C = X

print(str(A)+' '+str(B)+' '+str(C))
Problem p02760 (python)

Fixed submission:
import numpy as np

A1=np.array(list(map(int,input().split())))
A2=np.array(list(map(int,input().split())))
A3=np.array(list(map(int,input().split())))
A=np.concatenate([A1,A2,A3]).reshape(3,3)

N=int(input())

for i in range(N):
    b=int(input())
    A[np.where(A==b)] = 0

if np.all(A[0,:]==0) or np.all(A[1,:]==0) or np.all(A[2,:]==0) or np.all(A[:,0]==0) or np.all(A[:,1]==0) \
    or np.all(A[:,2]==0) or A[0,0]**2+A[1,1]**2+A[2,2]**2==0 or A[0,2]**2+A[1,1]**2+A[2,0]**2==0:
    print('Yes')
else:
    print('No')

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

A1=np.array(list(map(int,input().split())))
A2=np.array(list(map(int,input().split())))
A3=np.array(list(map(int,input().split())))
A=np.concatenate([A1,A2,A3]).reshape(3,3)

N=int(input())

for i in range(N):
    b=int(input())
    A[np.where(A==b)] = 0

if np.all(A[0,:]==0) or np.all(A[1,:]==0) or np.all(A[2,:]==0) or np.all(A[:,0]==0) or np.all(A[:,1]==0) 
\or np.all(A[:,2]==0) or A[0,0]**2+A[1,1]**2+A[2,2]**2==0:
    print('Yes')
else:
    print('No')
Problem p02801 (python)

Fixed submission:
C=input()
al=[]
for idx in range(97,123):
  al.append(chr(idx))
idx = al.index(C)
print(al[idx+1])

Buggy submission (verdict: Runtime Error):
alphabet = [a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,\
            t,u,v,w,x,y,z]
C=input()
idx=alphabet.index(C)
print(alphabet[idx+1])
Problem p02909 (python)

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

Buggy submission (verdict: Runtime Error):
S=input()
weather=['Sunny','Cloudy','Rainy','Sunny']
print(weather[weather.index(S)+1)
Problem p02582 (python)

Fixed submission:
s = input()
ans = 0
if 'RRR' in s:
    ans = 3
elif 'RR' in s:
    ans = 2
elif 'R' in s:
    ans = 1
print(ans)

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

if 'RRR' in s:
    ans = 3
elif 'RR' in s:
    ans = 2
elif 'R' in s:
    ans = 1
print(ans)
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
input()
a = list(map(int,input().split()))
ans = 1
for n in a:
    ans *= n
    if ans <= 10**18:
        print(ans)
        break:
print(-1)
Problem p02658 (python)

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

if 0 in a:
    print(0)
    exit()

ans = 1
for n in a:
    ans*=n
    
    if ans > 10**18:
        ans = -1
        break
    
print(ans)

Buggy submission (verdict: Runtime Error):
input()
a = list(map(int,input().split()))
ans = 1
for n in a:
    ans *= n
    if ans <= 10**18:
        print(ans)
    break:
print(-1)
Problem p02681 (python)

Fixed submission:
s = input()
t = input()
o = t[:-1]
if ( o == s ):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s,t = input().split()
o = t[:-1]
if ( o == s ):
    print('Yes')
else:
    print('No')
Problem p02556 (python)

Fixed submission:
n = int(input())
l = []
for i in range(n):
  l.append(list(map(int,input().split())))

k = []
m = []
for i in l:
  a,b = i
  k.append(a+b)
  m.append(a-b)
k.sort()
m.sort()
print(max([k[-1]-k[0],m[-1] -m[0]]))

Buggy submission (verdict: Runtime Error):
n = int(input())
l = []
for i in range(n):
  l.append(list(map(int,input().split())))
m = []
for i in l:
  a,b = i
  k.append(a+b)
  m.append(a-b)
k.sort()
m.sort()
print(max([k[-1]-k[0],m[-1] -m[0]]))
Problem p02664 (python)

Fixed submission:
s = input()
j = ""
for i in range(len(s)):
  if s[i] == "?":
    j = j + "D"
  else:
    j = j + s[i]
print(j)

Buggy submission (verdict: Runtime Error):
s = input()
for i in range(len(s)):
  if s[i] == "?":
    s[i] = "D"
print(s)
Problem p02801 (python)

Fixed submission:
print(chr(ord(input())+1))

Buggy submission (verdict: Runtime Error):
print(ord(ord(input())+1))
Problem p03103 (python)

Fixed submission:
n,m=map(int,input().split())
lis = []
for _ in range(n):
  lis.append(list(map(int,input().split())))
lis.sort()
ans=0
for i in range(n):
  x,y = lis[i]
  if y >= m:
    ans += x*m
    print(ans)
    quit()
  ans += x * y
  m -= y
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
lis = []
for _ in range(n):
  lis.append(list(map(int,input().split())))
lis.sort()
while(1):
  x,y = lis[0]
  if y >= m:
    ans += x*m
    break
  ans += x * y
  m -= y
  del(lis[0])
print(ans)
Problem p03211 (python)

Fixed submission:
s = input()
t = len(s)
lis = []
for i in range(t-2):
  lis.append(s[i:i+3])
def f(x):
  return(abs(int(x) - 753))
lis = list(map(f,lis))
print(min(lis))

Buggy submission (verdict: Runtime Error):
s = input()
t = len(s)
lis = []
for i in range(t-2):
  lis.append(t[i:i+3])
def f(x):
  return(abs(int(x) - 753))
lis = list(map(f,lis))
print(min(lis))

Buggy submission (verdict: Runtime Error):
s = input()
lis = []
for i in range(10):
  for j in range(10):
    for k in range(10):
      if i != j and i != k and j != k:
        lis.append(s[i]+s[j]+s[k])
def f(x):
  return(abs(int(x) - 753))
lis = list(map(f,lis))
print(min(lis))
Problem p03213 (python)

Fixed submission:
ps = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97]
N = int(input())
if N == 1:
  print(0)
  quit()
l = [0 for _ in range(98)]
def fac(n):
  for k in ps:
   if n == 1:
     break
   if n % k == 0:
    l[k] += 1
    fac(n // k)
    break

for i in range(2,N+1):
  fac(i)

p = [k for k in l if k > 1]

ans = 0

def num(n):
  r = 0
  for k in p:
    if k >= n:
      r += 1
  return(r)

if p[0] >= 74:
  ans += 1

#5*15

ans += (num(14) * (num(14) - 1))
ans += (num(14) * (num(4) - num(14)))

#3 * 25
ans += (num(24) * (num(24) - 1))
ans += (num(24) * (num(2) - num(24)))

#3 * 5 * 5
ans += (num(4) * (num(4) - 1) * (num(4) - 2) // 2)
ans += (num(4) * (num(4) - 1) //2) * (num(2) - num(4))

print(ans)

Buggy submission (verdict: Runtime Error):
ps = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97]
N = int(input())
l = [0 for _ in range(98)]
def fac(n):
  for k in ps:
   if n == 1:
     break
   if n % k == 0:
    l[k] += 1
    fac(n // k)
    break

for i in range(2,N+1):
  fac(i)

p = [k for k in l if k > 1]

ans = 0

def num(n):
  r = 0
  for k in p:
    if k >= n:
      r += 1
  return(r)

if p[0] >= 74:
  ans += 1

#5*15

ans += (num(14) * (num(14) - 1))
ans += (num(14) * (num(4) - num(14)))

#3 * 25
ans += (num(24) * (num(24) - 1))
ans += (num(24) * (num(2) - num(24)))

#3 * 5 * 5
ans += (num(4) * (num(4) - 1) * (num(4) - 2) // 2)
ans += (num(4) * (num(4) - 1) //2) * (num(2) - num(4))

print(ans)
Problem p03220 (python)

Fixed submission:
input();t,a=map(int,input().split());l=list(map(lambda x:abs(t-int(x)*0.006-a),input().split()));print(l.index(min(l))+1)

Buggy submission (verdict: Runtime Error):
i=input;s=split;t,a=map(int,i().s());l=list(map(lambda x:abs(t-int(x)*0.006-a),i().s()));print(l.index(min(l))+1)
Problem p03227 (python)

Fixed submission:
s=input()
if len(s)%2:
  s = s[::-1]
print(s)

Buggy submission (verdict: Runtime Error):
s=input()
if len(s)%2:
  s.reverse()
print(s)
Problem p03239 (python)

Fixed submission:
n,t=list(map(int,input().split()))
lis = []
for i in range(n):
  s,k = list(map(int,input().split()))
  if k <= t:
    lis.append(s)
if lis == []:
  print("TLE")
  quit()
print(min(lis))

Buggy submission (verdict: Runtime Error):
n,t=list(map(int,input().split()))
lis = []
for i in range(n):
  s,k = list(map(int,input().split()))
  if k <= t:
    lis.append(s)
print(min(lis))
Problem p03311 (python)

Fixed submission:
N = int(input())
lis = list(map(int,input().split()))
for i in range(len(lis)):
  lis[i] -= (i+1)
lis.sort()
m = N // 2
c = lis[m]
print(sum(list(map(lambda x: abs(x - c), lis))))

Buggy submission (verdict: Runtime Error):
i=int
k=input
N = i(k())
l = list(map(i,k().split()))
for j in range(n):
 lis[j] -= (j+1)
l.sort()
print(sum(list(map(lambda x: abs(x - l[N//2]),l))))
Problem p03325 (python)

Fixed submission:
n = int(input())
lis = list(map(int,input().split()))
ans = 0
def f(x):
 if x%2:
  return(0)
 else:
  return(f(x//2)+1)
for i in range(n):
 ans += f(lis[i])
print(ans)

Buggy submission (verdict: Runtime Error):
n = map(int,input().split())
lis = list(map(int,input().split()))
ans = 0
def f(x):
 if x%2:
  return(0)
 else:
  return(f(x//2)+1)
for i in range(n):
 ans += f(lis[i])
print(ans)

Buggy submission (verdict: Runtime Error):
n = map(int,input().split())
lis = list(map(int,input().split()))
ans = 0
def f(x):
 if x%2:
  return 0
 else:
  return f(x//2)+1
for i in range(n):
 ans += f(lis[i])
print(ans)
Problem p03360 (python)

Fixed submission:
x=list(map(int,input().split()));x.sort();print(x[0]+x[1]+x[2]*2**int(input()))

Buggy submission (verdict: Runtime Error):
x=list(map(int,input().split()));x.sort();print(x[0]+x[1]+x[2]*2**int(input())
Problem p03361 (python)

Fixed submission:
h,w=map(int,input().split())
lis = []
for _ in range(h):
 lis.append(input())
for i in range(h):
 for j in range(w):
  if lis[i][j] == "#":
    if (i == 0 or lis[i-1][j] == ".") and (j==0 or lis[i][j-1] == ".")  and (i == h-1 or lis[i+1][j] == ".") and (j == w-1 or lis[i][j+1] == "."):
      print("No")
      quit()
print("Yes")

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
lis = []
for _ in range(h):
 lis.append(input())
for i in range(h):
 for j in range(w):
  if lis[i][j] = "#":
    if (i == 0 or lis[i-1][j] == ".") and (j==0 or lis[i][j-1] == ".")  and (i == h-1 or lis[i+1][j] == ".") and (j == w-1 or lis[i][j+1] == "."):
      print("No")
      quit()
print("Yes")

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
a = []
for i in range(h):
  a.append(input())
for i in range(h):
  for j in range(w):
    if i !=0:
      if a[i][j] != a[i-1][j]:
        print("No")
        quit()
    if j !=0:
      if a[i][j] != a[i][j-1]:
        print("No")
        quit()
    if i !=h:
      if a[i][j] != a[i+1][j]:
        print("No")
        quit()
    if j !=w:
      if a[i][j] != a[i][j+1]:
        print("No")
        quit()
print("Yes")
Problem p03394 (python)

Fixed submission:
n = int(input())
k = n%8
t = n//8
if n == 3:
  print(*[2,5,63])
  quit()
ans = [[2,3,4,6,8,9,10,12],[6],[3,9],[3,6,9],[2,3,9,10],[2,3,6,9,10],[2,3,4,8,9,10],[2,3,4,6,8,9,10]][k]
if k == 0:
  for i in range(1,t):
    ans.append(i * 12 + 2)
    ans.append(i * 12 + 3)
    ans.append(i * 12 + 4)
    ans.append(i * 12 + 6)
    ans.append(i * 12 + 8)
    ans.append(i * 12 + 9)
    ans.append(i * 12 + 10)
    ans.append(i * 12 + 12)
else:
  for i in range(1,t+1):
    ans.append(i * 12 + 2)
    ans.append(i * 12 + 3)
    ans.append(i * 12 + 4)
    ans.append(i * 12 + 6)
    ans.append(i * 12 + 8)
    ans.append(i * 12 + 9)
    ans.append(i * 12 + 10)
    ans.append(i * 12 + 12)
print(*ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
k = n%8
t = n//k
ans = [[2,3,4,6,8,9,10,12],[6],[6,12],[2,6,12],[2,4,8,10],[2,4,6,8,10],[2,3,4,8,9,10],[2,3,4,6,8,9,10]][k]
if k == 0:
  for i in ranke(1,t):
    ans.append(i * 12 + 2)
    ans.append(i * 12 + 3)
    ans.append(i * 12 + 4)
    ans.append(i * 12 + 6)
    ans.append(i * 12 + 8)
    ans.append(i * 12 + 9)
    ans.append(i * 12 + 10)
    ans.append(i * 12 + 12)
else:
  for i in ranke(1,t+1):
    ans.append(i * 12 + 2)
    ans.append(i * 12 + 3)
    ans.append(i * 12 + 4)
    ans.append(i * 12 + 6)
    ans.append(i * 12 + 8)
    ans.append(i * 12 + 9)
    ans.append(i * 12 + 10)
    ans.append(i * 12 + 12)
print(*ans)
Problem p03401 (python)

Fixed submission:
n = int(input())
lis = [0] + list(map(int,input().split())) + [0]
b = 0
for i in range(n+1):
 b += abs(lis[i+1]-lis[i])
for i in range(1,n+1):
 if (lis[i-1] <= lis[i] <= lis[i+1]) or (lis[i+1] <= lis[i] <= lis[i-1]):
   print(b)
 else:
  print(b-abs(lis[i-1] - lis[i]) - abs(lis[i+1] - lis[i]) + abs(lis[i+1] - lis[i-1]))

Buggy submission (verdict: Runtime Error):
n = int(input())
lis = [0] + list(map(int,input().split())) + [0]
b = 0
for i in range(n+1):
 b += abs(lis[i+1]-lis[i])
for i in range(1,n+1):
 if lis[i-1] <= lis[i] <= lis[i+1] or lis[i-1] => lis[i] => lis[i+1]:
   print(b)
 else:
  print(b-abs(lis[i-1] - lis[i]) - abs(lis[i+1] - lis[i]) + abs(lis[i+1] - lis[i-1]))
Problem p03415 (python)

Fixed submission:
a = input()
b = input()
c = input()
print(a[0]+b[1]+c[2])

Buggy submission (verdict: Runtime Error):
k = list(map(int,input()))
N , M =k[0],k[1]
if N == 2 or M == 2:
  print(0)
elif N == 1 or M == 1:
  print(abs(max(N,M)-2))
else:
  print((N-2) * (M-2))
Problem p03417 (python)

Fixed submission:
k = list(map(int,input().split()))
N, M = k[0],k[1]
if N == 2 or M == 2:
  print(0)
elif N == 1 or M == 1:
  print(abs(max(N,M)-2))
else:
  print((N-2) * (M-2))

Buggy submission (verdict: Runtime Error):
N ,M = list(map(int,input()))
if N == 2 or M == 2:
  print(0)
elif N == 1 or M == 1:
  print(abs(max(N,M)-2))
else:
  print((N-2) * (M-2))
Problem p03425 (python)

Fixed submission:
n = int(input())
names = []
for i in range(n):
  names.append(input())
names = [i[0] for i in names]
nm = ["M","A","R","C","H"]
ks = [names.count(nm[i]) for i in range(5)]
ans = 0
for i in range(3):
  for j in range(i+1,4):
    for k in range(j+1,5):
      ans += ks[i] * ks[j] * ks[k]
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
names = []
for i in range(n):
  names.appen(input())
names = [i[0] for i in names]
nm = ["M","A","R","C","H"]
ks = [names.count(nm[i]) for i in range(5)]
ans = 0
for i in range(3):
  for j in range(i+1,4):
    for k in range(j+1,5):
      ans += i*j*k
print(ans)
Problem p03633 (python)

Fixed submission:
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)
        
def lcm(a,b):
    return b * a//gcd(a,b)
    
n = int(input())
ans=1
for i in range(n):
    t = int(input())
    ans = lcm(ans,t)
    
print(ans)

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)
        
def lcm(a,b):
    return int(a/gcd(a,b)*b)
    
n = int(input())
ans=1
for i in range(n):
    t = int(input())
    ans = lcm(ans,t)
    
print(ans)
Problem p03665 (python)

Fixed submission:
tmp = list(map(int,input().split()))
As = list(map(int,input().split()))
n,p = tmp[0],tmp[1]
o ,e  = 0,0
for i in range(n):
  if As[i] % 2:
    o += 1
  else:
    e += 1
def comb(j,k):
  if k == 0:
    return(1)
  else:
    return comb(j-1,k-1) * j / k
ans = 0
if p == 0:
  for i in range(o+1):
    if not i % 2:
      ans += int(comb(o,i))
else:
  for i in range(o+1):
    if i % 2:
      ans += int(comb(o,i))
ans *= (2 ** e)
print(ans)

Buggy submission (verdict: Runtime Error):
tmp = list(map(int,input().split()))
As = list(map(int,input().split()))
n,p = tmp[0],tmp[1]
o ,e  = 0,0
for i in range(n):
  if As[i] % 2:
    o += 1
  else:
    e += 1
def comb(j,k):
  if k == 1:
    return(j)
  else:
    return comb(j-1,k-1) * j / k
ans = 0
if p == 0:
  for i in range(o+1):
    if not i % 2:
      ans += int(comb(o,i))
else:
  for i in range(o+1):
    if i % 2:
      ans += int(comb(o,i))
ans *= (2 ** e)
print(ans)
Problem p03947 (python)

Fixed submission:
s=input()
ans = 0
for i in range(len(s)-1):
 if s[i]!=s[i+1]:
  ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
ans = 0
for I in range(len(s)-1):
 if s[i]!=s[i+1]:
  ans += 1
print(ans)
Problem p02553 (python)

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

print(max(a*c, a*d, b*c, b*d))

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

print(max(int(x)*int(y)))
Problem p02576 (python)

Fixed submission:
N, X, T = map(int,input().split())
C=1
if N%X!=0:
     C=N//X+1
else:
    C=N//X
 
print(C*T)

Buggy submission (verdict: Runtime Error):
N, X, T = map(int,input().split())
C=1
  if N%X!=0:
     C=N//X+1
  else:
    C=N//X

print(C*T)
Problem p02684 (python)

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    R = [False] * (N + 1)
    D = []

    p = 1

    while True:
        if R[p]:
            break
        D.append(p)
        R[p] = True
        p = A[p - 1]

    m = D.index(p)
    c = len(D) - m

    if K <= m:
        print(D[K])
    else:
        print(D[m + (K - m) % c])


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    R = [False] * (N + 1)
    D = []

    p = 1

    while True:
        if R[p]:
            break
        D.append(p)
        R[p] = True
        p = A[p - 1]

    m = D.index(p)
    c = len(D) - m

    if K <= m:
        print(D[K])
    else:
        print(D[m + K - m] % c)


if __name__ == "__main__":
    main()
Problem p02791 (python)

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    n = int(input())
    p = list(map(int, input().split()))

    count = 0
    n_min = 0
    for i in range(0, n):
        if i == 0:
            count += 1
            n_min = p[i]
            continue
        if p[i] <= n_min:
            count += 1
            n_min = p[i]
    print(count)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    P = list(map(int, input().split()))
    cnt = 0
    pmax = P[0]
    for i in P:
        if P[i] <= pmax:
            pmax = P[i]
            cnt += 1
        print(cnt)


if __name__ == "__main__":
    main()
Problem p03386 (python)

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    A, B, K = map(int, input().split())
    AK = [i for i in range(A, min(B + 1, A + K))]
    BK = [i for i in range(max(A, B - K + 1), B + 1)]

    result = list(set(AK) | set(BK))
    result.sort()

    for i in result:
        print(i)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    A, B, K = map(int, input().split())

    for i in list(range(A, B + 1)):
        if A <= i <= A + K - 1 or B + 1 >= i >= B - K + 1:
            print(i)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    A, B, K = map(int, input().split())

    for i in list(range(A, B + 1)):
        if A - 1 <= i <= A + K - 1 or B + 1 >= i >= B + 1 - K:
            print(i)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    A, B, K = map(int, input().split())

    for i in list(range(A, B + 1)):
        if A - 1 <= i <= A + K - 1 or B + 1 >= i >= B + 1 - K:
            print(i)


if __name__ == "__main__":
    main()