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

Fixed submission:
N, X = map(int, input().split())
L = map(int, input().split())
D = 0
count = 1
for i, l in enumerate(L):
  D += l
  if D <= X:
      count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N, X = list(int, input().split()[:2])
L = map(int, input().split())
D = 0
count = 0
for l in L:
  if D <= X:
      count += 1
  D += l
print(count)

Buggy submission (verdict: Runtime Error):
N, X = list(int, input().split()))[:2]
L = map(int, input().split())
D = 0
count = 0
for l in L:
  if D <= X:
      count += 1
  D += l
print(count)

Buggy submission (verdict: Runtime Error):
N, X = map(lambda x: int(x), input().split())[:2]
L = map(lambda x: int(x), input().split())
D = 0
count = 0
for l in L:
  if D <= X:
      count += 1
  D += l
print(count)

Buggy submission (verdict: Runtime Error):
N, X = map(lambda x: int(x), input().split())[:2]
L = map(lambda x: int(x), input().split())
D = 0
count = 0
for l in L:
  if D <= X:
      count += 1
  D += int(l)
print(count)

Buggy submission (verdict: Runtime Error):
N, X = map(lambda x: int(x), input().split())[:2]
L = map(lambda x: int(x), input().split())
D = 0
count = 0
for i, l in enumerate(L):
if D <= X:
    count += 1
D += int(l)
print(count)

Buggy submission (verdict: Runtime Error):
N, X = map(lambda x: int(x), input().split())
L = map(lambda x: int(x), input().split())
D = 0
count = 0
for i, l in enumerate(L):
if D <= X:
    count += 1
D += int(l)
print(count)

Buggy submission (verdict: Runtime Error):
import sys

if __name__ == '__main__':
  N, X = map(input().split(), lambda x: int(x))
  L = map(input().split(), lambda x: int(x))
  D = 0
  count = 0
  for i, l in enumerate(L):
    if D <= X:
      count += 1
    D += l
  print(count)

Buggy submission (verdict: Runtime Error):
import sys

if __name__ == '__main__':
  N = 0
  X = 0
  L = []
  for i, line in enumerate(sys.stdin):
    if i == 2:
      break
    line = line.split()
    if i == 0:
      N = line[0]
      X = line[1]
    if i == 1:
      L = line
  D = 0
  count = 0
  for l in L:
    if D < X:
      count += 1
    D += int(l)
  print(count)

Buggy submission (verdict: Runtime Error):
import sys

if __name__ == '__main__':
  N = 0
  X = 0
  L = []
  for i, line in enumerate(sys.stdin):
    if i == 2:
      break
    line = line.split()
    if i == 0:
      N = line[0]
      X = line[1]
    if i == 1:
      L = line
  D = 0
  count = 0
  for l in L:
    if D < X:
      count += 1
    D += int(l)
  print(count)
Problem p03006 (python)

Fixed submission:
import sys
from collections import Counter

N = int(input())
points = []
for i, line in enumerate(sys.stdin):
    x, y = map(int, line.split())
    points.append([x, y])
    if i == N - 1:
        break
if len(points) == 1:
    print(1)
    sys.exit(0)

counts = []
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        p = points[j][0] - points[i][0]
        q = points[j][1] - points[i][1]
        counts.append((p, q))

pq = Counter(counts).most_common()[0][1]
cost = N - pq
print(cost)

Buggy submission (verdict: Runtime Error):
import sys
from collections import Counter

N = int(input())
points = []
for i, line in enumerate(sys.stdin):
    x, y = map(int, line.split())
    points.append([x, y])
    if i == N - 1:
        break

counts = []
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        p = points[j][0] - points[i][0]
        q = points[j][1] - points[i][1]
        counts.append((p, q))

pq = Counter(counts).most_common()[0][1]
cost = N - pq
print(cost)

Buggy submission (verdict: Runtime Error):
import sys
from collections import Counter

N = int(input())
points = []
for i, line in enumerate(sys.stdin):
    x, y = map(int, line.split())
    points.append([x, y])
    if i == N - 1:
        break

counts = []
for i in range(N - 1):
    p = points[i][0] - points[i+1][0]
    q = points[i][1] - points[i+1][1]
    counts.append((p, q))

pq = Counter(counts).most_common()[0][1]
cost = N - pq
print(cost)

Buggy submission (verdict: Runtime Error):
import sys
from collections import Counter

N = int(input())
points = []
for i, line in enumerate(sys.stdin):
    x, y = map(int, input().split())
    points.append([x, y])
    if i == N:
        break

counts = []
for i in range(N - 1):
    p = points[i][0] - points[i+1][0]
    q = points[i][1] - points[i+1][1]
    counts.append((p, q))

pq = Counter(counts).most_common()[1]
cost = N - pq
print(cost)
Problem p02994 (python)

Fixed submission:
if __name__ == '__main__':
    N, A = input().split()[0:]
    assert 2<=int(N)<=200
    assert -100<=int(A)<=100

    L = int(A)
    R = int(A)+int(N)-1

    if R <= 0:
        eat = R
    elif L >= 0:
        eat = L
    else:
        eat = 0

    ans = (R+L)*(R-L+1)//2-eat
    print(ans)

Buggy submission (verdict: Runtime Error):
import sys

if __name__ == '__main__':
    N, A = sys.argv[1:]
    assert 2<=int(N)<=200
    assert -100<=int(A)<=100

    L = int(A)
    R = int(A)+int(N)-1

    if R <= 0:
        eat = R
    elif L >= 0:
        eat = L
    else:
        eat = 0

    ans = (R+L)*(R-L+1)//2-eat
    print(ans)
Problem p03030 (python)

Fixed submission:
n = int(input())
data =[]
for i in range(n):
  sity, score = input().split()
  data.append([sity, int(score),i+1])
  
data.sort(key=lambda x:(x[0], -x[1]))
for j in range(n):
  print(data[j][2])

Buggy submission (verdict: Runtime Error):
n = int(input())
data =[]
for i in range(n):
  sity, score = input().split()
  data.append([sity, int(score),i+1])
  
data.sort(key=lambda x:x[0], -x[1])
for j in range(n):
  print(data[j][2])
Problem p03282 (python)

Fixed submission:
s = int(input())
k = int(input())
li = [int(k) for k in list(str(s))]
#print(li)
count = 0
for i in li:
  if i ==1:
    count+=1
  else:
    ans = i
    break
    
if k <= count:
  print(1)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
s = int(input())
k = int(input())
li = [int(k) for k in list(str(s))]
#print(li)
if k == 1:
  print(li[0])
else:
  print(li[1])

Buggy submission (verdict: Runtime Error):
s = int(input())
k = int(input())
li = [int(k) for k in list(str(s))]
#print(li)
if k = 1:
  print(li[0])
else:
  print(li[1])
Problem p03711 (python)

Fixed submission:
lis = [0,1,3,1,2,1,2,1,1,2,1,2,1]

x,y = (int(i) for i in input().split())

if lis[x] == lis[y] :
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
H,W = buf.split()
H = int(H)
W = int(W)
pic = []
 
for i in range(H):
    pic.append(input())
 
#for row in pic:
#    print(row)
 
for i in range(W+2):
    print("#",end="")
print()
 
for i in range(H):
    print("#"+pic[i]+"#")
 
for i in range(W+2):
    print("#",end="")
Problem p03712 (python)

Fixed submission:
buf = input()
H,W = buf.split()
H = int(H)
W = int(W)
pic = []
 
for i in range(H):
    pic.append(input())
 
#for row in pic:
#    print(row)
 
for i in range(W+2):
    print("#",end="")
print()
 
for i in range(H):
    print("#"+pic[i]+"#")
 
for i in range(W+2):
    print("#",end="")

Buggy submission (verdict: Runtime Error):
H,W = buf.split()
H = int(H)
W = int(W)
pic = []
 
for i in range(H):
    pic.append(input())
 
#for row in pic:
#    print(row)
 
for i in range(W+2):
    print("#",end="")
print()
 
for i in range(H):
    print("#"+pic[i]+"#")
 
for i in range(W+2):
    print("#",end="")

Buggy submission (verdict: Runtime Error):
H,W = buf.split()
H = int(H)
W = int(W)
pic = []

for i in range(H):
    pic.append(input())

#for row in pic:
#    print(row)

for i in range(W+2):
    print("#",end="")
print()

for i in range(H):
    print("#"+pic[i]+"#")

for i in range(W+2):
    print("#",end="")
print()
Problem p03316 (python)

Fixed submission:
n_str = raw_input()
n = int(n_str)
total = sum(map(int, list(n_str)))
if n % total == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n_str = raw_input()
n = int(n_str)
total = sum(map(int, list(n_str)))
if n % total == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n_str = raw_input()
n = int(n_str)
total = sum(map(int, list(n_str)))
if n % total == 0:
  print('Yes')
else:
  print('No')
Problem p04011 (python)

Fixed submission:
n = int(raw_input())
k = int(raw_input())
x = int(raw_input())
y = int(raw_input())
if n <= k:
  print(x*n)
else:
  print(x*k+y*(n-k))

Buggy submission (verdict: Runtime Error):
n = int(raw_input())
k = int(raw_input())
x = int(raw_input())
y = int(raw_input())
if n < = k:
  print(x*n)
else:
  print(x*k+y*(n-k))
Problem p03067 (python)

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

def max(a,b):
    if a > b:
        return a
    else:
        return b

def min(a,b):
    if a < b :
        return a
    else:
        return b

if min(a,b) < c < max(a,b):
    print('Yes')
else:
    print('No')

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

def max(a,b):
    if a > b:
        return a
    else:
        return b

def min(a,b):
    if a < b :
        return a
    else:
        return b

if min(a,b) < c < max(a,b):
    print('Yes')
else:
    print('No')
Problem p03068 (python)

Fixed submission:
N = int(input())
S = list(input())
K = int(input())

key = S[K-1]

for i in range(len(S)):
    if not S[i] == key:
        S[i] = '*'

print(''.join(S))

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

key = S[K-1]

for i in renge(len(S)):
    if not S[i] == key:
        S[i] = '*'

print(''.join(S))
Problem p03076 (python)

Fixed submission:
A=[]
Y=[]
for i in range(5):
    x = int(input())
    y = x % 10
    if y != 0:
        x = x + (10-y)
    A.append((y,x))

B = sorted(A)
sum = 0
flag = 0
#print(B)
for i in range(len(B)):
    y,x = B[i]
    sum += x
    if flag == 0:
        if y != 0:
            sum -= 10-y
            flag = 1

print(sum)

Buggy submission (verdict: Runtime Error):
A=[]
Y = []
for i in range(5):
    x = int(input())
    y = x % 10
    x = x + (10-y)
    A.append((y,x))

B = sorted(A):
sum = 0

for i in range(len(B)):
    x,y = B[i]
    sum += x
    if i == len(B)-1:
        sum -= y

print(sum)
Problem p03078 (python)

Fixed submission:
#実験をしっかりとしよう
X,Y,Z,K = (int(_) for _ in input().split())
A = (int(_) for _ in input().split())
B = (int(_) for _ in input().split())
C = (int(_) for _ in input().split())
#この手の問題はまずsortする(今回は大きい順の方がすっきり)
A = sorted(A)
B = sorted(B)
C = sorted(C)
#Aのa位とb位とc位ならその上にはa*b*c-1(自分以外)が上にいる。
A.reverse()
B.reverse()
C.reverse()

ABC = []
for i in range(len(A)):
    for j in range(len(B)):
        if (i+1)*(j+1) > K:
            break
        for k in range(len(C)):
            if (i+1)*(j+1)*(k+1) > K:
                break
            ABC.append(A[i]+B[j]+C[k])
ABC.sort()
ABC.reverse()

for i in range(K):
    print(ABC[i])
#pythonだとTLEになる?

Buggy submission (verdict: Runtime Error):
#実験をしっかりとしよう
X,Y,Z,K = (int(_) for _ in input().split())
A = (int(_) for _ in input().split())
B = (int(_) for _ in input().split())
C = (int(_) for _ in input().split())
#この手の問題はまずsortする(今回は大きい順の方がすっきり)
A = sorted(A)
B = sorted(B)
C = sorted(C)
#Aのa位とb位とc位ならその上にはa*b*c-1(自分以外)が上にいる。
A.reverse()
B.reverse()
C.reverse()

ABC = []
for i in range(len(A)):
    for j in range(len(B)):
        if (i+1)*(j+1) > K:
            break
        for k in range(len(C)):
            if (i+1)*(j+1)*(k+1) > K:
                break
            ABC.append(A[i]+B[j]+C[k])
ABC.sort().reverse()

for i in range(K):
    print(ABC[i])
#pythonだとTLEになる?

Buggy submission (verdict: Runtime Error):
#実験をしっかりとしよう
X,Y,Z,K = (int(_) for _ in input().split())
A = (int(_) for _ in input().split())
B = (int(_) for _ in input().split())
C = (int(_) for _ in input().split())
#この手の問題はまずsortする(今回は大きい順の方がすっきり)
A = sorted(A).reverse()
B = sorted(B).reverse()
C = sorted(C).reverse()
#総和は変わらないので残ったやつの累積和で考えてみる。
#1000*1000なら全列挙できるそのうち3000個を取り除いて、3の1000個を
#それに組み合わせて全探索する。(2重forかな)
AB = []

for i in range(X):
    for j in range(Y):
        AB.append(A[i]+B[i])
AB = sorted(AB).reverse()[:3001]

ABC = []
for i in range(len(AB)):
    for j in range(Z):
        ABC.append(AB[i]+C[j])

ABC = sorted(ABC).reverse()
for i in range(3000):
    print(ABC[i])
Problem p03079 (python)

Fixed submission:
A,B,C = (int(_) for _ in input().split())

if A == B and B == C:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
A,B,C = (int(_) for _ in input().split())

if A == B and B == C:
    print(Yes)
else:
    print(No)
Problem p03085 (python)

Fixed submission:
S = input()

if S == 'A':
    print('T')
elif S == 'C':
    print('G')
elif S == 'G':
    print('C')
elif S == 'T':
    print('A')

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

if S == 'A':
    print('T')
elif S == 'C':
    print('G')
elif S == 'G':
    print('C')
elif S == 'T'::
    print('A')

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

if S == 'A':
    print('T')
elif S == 'C':
    print('G')
elif S == 'G':
    print('C')
elif S == 'T'::
    print('A')

Buggy submission (verdict: Runtime Error):
N,Q = map(int,input().split())
S = input()
for i in range(Q):
    l,r = (int(_) for _ in input().split())
    s = S[l-1:r]
    print(s.count('AC'))
Problem p03110 (python)

Fixed submission:
def main():
    N = int(input())
    sum = 0
    for i in range(N):
        x,y = (_ for _ in input().split())
        if y == 'JPY':
            sum += float(x)
        elif y == 'BTC':
            sum += float(x) * 380000.0
    print(sum)

if __name__  == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    sum = 0
    for i in range(N):
        x,y = (int(_) for _ input().split())
        if y == 'JPY':
            sum += x
        elif y == 'BTC':
            sum += x * 380000.0
    print(sum)

if __name__  == '__main__':
    main()
Problem p03565 (python)

Fixed submission:
sp = input()
t = input()
len_t = len(t)
len_s = len(sp)
cand = []
part_start = -1

for i in range(len_s - len_t + 1):
    num = 0
    for j in range(len_t):
        if (sp[i + j] == '?' or sp[i + j] == t[j]):
            num += 1

    if (num == len_t):
        part_start = i

if part_start != -1:
    # 部分文字列は最後にあったほうがいい?はaで最小化できる可能性があり、文字列の先頭に近い部分にそれらがあったほうがよい
    ans = sp[:part_start] + t + sp[part_start + len_t:]
    ans = ans.replace('?', 'a')
    print(ans)
else:
    print('UNRESTORABLE')

Buggy submission (verdict: Runtime Error):
#文字列Tを突っ込むのはできるだけ最後の方が良い(残りは全てaにしないと辞書順で負けうる。)
#if 文字列が入らない→UNRESTORABLE
#if 文字列が入ったら全部aを入れられる。(ん？これってここまでやったら絶対に一番最初のやつになるのでは?)
#※すでに文字が入っていたら、文字列を入れずに全てaを突っ込む
#文字列をどうやって探すか。
#Tの長さと同じだけ?が連続している場所があるならいける
#というか一文字ずつみて(その文字or?ならオーケー)失敗したらindexを戻していけばいいので

def strProduct(S,T):
    Tindex = 0#Tのindex失敗するたびに0に戻る
    lt = len(T) #Tの文字列の長さ
    flag = False#Tの材料に ?がなければFalse
    reasonable = False#文字を作れるかどうか
    translateIndex = [] #SがTの文字列になる場所の初めの位置
    S.reverse()
    T.reverse()
    for si in range(len(S)):
        s = S[si]
        if s == T[Tindex] or s == "?":
            if Tindex == 0:#初めての一致
                translateIndex.append(si)
            if s == "?":#?をつかって文字列をつくる時と作らない時で異なるし、?を使わないのがあればそれを優先するべき
                flag = True
                if len(translateIndex) > 1:#すでに一つ完成している時はそっちを優先する
                    translateIndex.pop()#translateIndexには残らない
            Tindex += 1
            if Tindex == lt:#全てmatchingした時
                reasonable = True
                if not flag:#?を使わないなら優先的にそれを使う
                    break
                #初期化して次のを探す
                Tindex = 0
                flag = False
        else: #一回でも失敗すれば初期化
            Tindex = 0
            flag = False
            #translateIndexはあまり関係ない
    if flag:#?を使わないとできないなら変更します。
        for j in range(translateIndex[len(translateIndex)-1],translateIndex[len(translateIndex)-1]+lt):
            S[j] = T[j-translateIndex[len(translateIndex)-1]]
    S.reverse()
    #T.reverse()
    if not reasonable:
        return "UNRESTORABLE"
    else:
        for si in range(len(S)):
            if S[si] == "?":
                S[si] = "a"
        modifiedS = ''.join(S)
        return modifiedS

S = list(input())
T = list(input())
#print(S)
#print(T)
print(strProduct(S,T))
Problem p03109 (python)

Fixed submission:
S = input()
s = list(S)
year = int(s[0] + s[1] + s[2] + s[3])
month = int(s[5] + s[6])
day = int(s[8] + s[9])
if year <2019:
    print('Heisei')
elif month < 5:
    print('Heisei')
else:
    print('TBD')

Buggy submission (verdict: Runtime Error):
S = input()
s = list(S)
year = int(s[0] + s[1] + s[2] + s[3])
month = int(s[5] + s[6])
day = int(s[8] + s[9])
if year <2019:
    print('Heisei')
    break
elif month < 5:
    print('Heisei')
    break
else:
    print('TBD')
Problem p03110 (python)

Fixed submission:
N = int(input())
xu = [[] for i in range(N)]
otoshidama = 0
for i in range(N):
    xu[i] = list(input().split())
for i in xu:
    if i[1] == 'JPY':
        otoshidama += int(i[0])
    else:
        otoshidama += float(i[0])*380000
print(otoshidama)

Buggy submission (verdict: Runtime Error):
N = int(input())
xu = [[] for i in range(N)]
otoshidama = 0
for i in range(N):
    xu[i] = list(input().split())
for i in xu:
    if i[1] == 'JPY':
        otoshidama += int(i[0])
    else:
        otoshidama +=
Problem p03125 (python)

Fixed submission:
A, B = map(int, input().split())
if B % A ==0:
    print(A + B)
else:
    print(B - A)

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
if B % A =0:
    print(A + B)
else:
    print(B - A)
Problem p03206 (python)

Fixed submission:
D = int(input())
if D ==25:
    print('Christmas')
elif D == 24:
    print('Christmas Eve')
elif D == 23:
    print('Christmas Eve Eve')
elif D == 22:
    print('Christmas Eve Eve Eve')

Buggy submission (verdict: Runtime Error):
D = input()
if D ==25:
    print('Christmas')
elif D == 24:
    print('Christmas Eve')
elif D == 23:
    print('Christmas Eve Eve')
else D == 22:
    print('Christmas Eve Eve Eve')
Problem p03239 (python)

Fixed submission:
N, T = map(int, input().split())
ct = [[] for _ in range(N)]
for i in range(N):
    ct[i] = list(map(int, input().split()))
cost =[]
for v in ct:
    if v[1] <= T:
        cost.append(v)
if len(cost) <1:
    print('TLE')
else:
    for i, v in enumerate(cost):
        if i == 0:
            least = v[0]
        else:
            if v[0] <= least:
                least = v[0]
    print(least)

Buggy submission (verdict: Runtime Error):
N, T = map(int, input().split())
ct = [[] for _ in range(N)]
for i in range(N):
    ct[i] = list(map(int, input().split()))
cost =[]
for v in ct:
    if v[1] <= T:
        cost.append(v)
if len(cost) <1:
    print('TLE')
else:
    for i, v in enumerate(cost):
        if i == 0:
            least = v[0]
        else:
            if v[0] <= least:
                least = v[0]
print(least)

Buggy submission (verdict: Runtime Error):
N, T = map(int, input().split())
ct = [[] for _ in range(N)]
for i in range(N):
    ct[i] = list(map(int, input().split()))
cost =[]
for v in ct:
    if v[1] <= T:
        cost.append(v)
for i, v in enumerate(cost):
    if i == 0:
        least = v[0]
    else:
        if v[0] <= least:
            least = v[0]
if least <= T:
    print(least)
else:
    print('TLE')

Buggy submission (verdict: Runtime Error):
N, T = map(int, input().split())
ct = [[] for _ in range(N)]
for i in range(N):
    ct[i] = list(map(int, input().split()))
cost =[]
for v in ct:
    if v[1] <= T:
        cost.append(v)
for i, v in enumerate(cost):
    if i == 0:
        least = v[0]
    else:
        if v[0] <= least:
            least = v[0]
if least <= T:
    print(least)
else:
    print('TLE')
Problem p02995 (python)

Fixed submission:
# coding: utf-8
import re
import bisect
from datetime import datetime as dt
import bisect
import fractions

def gcd(a, b):
    return fractions.gcd(a, b)

def lcm(a, b):
    return a * b // gcd(a, b)

def calc(n, a, b):
    return n//a + n//b - n//lcm(a,b)

if __name__ == '__main__':
    a, b, c, d = map(int, input().split())
    num1 = b - calc(b,c,d)
    num2 = (a-1) - calc(a-1, c,d)
    # ans = calc(b, c, d) - calc(a - 1, c, d)
    # print(b - a + 1 - ans)
    print(num1-num2)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import re
import bisect
from datetime import datetime as dt
import bisect
import math

def gcd(a, b):
    return math.gcd(a, b)

def lcm(a, b):
    return a * b / gcd(a, b)

class slist(list):
    def __init__(self, *args, **kw):
        list.__init__(self, *args, **kw)
        self.sort()

    def append(self, value):
        bisect.insort(self,value)

    def index_left(self, value):
        return bisect.bisect_left(self, value)

def calc(n, a, b):
    return int(n/a) + int(n/b) - int(n/lcm(a,b))

if __name__ == '__main__':
    a, b, c, d = map(int, input().split())
    ans = calc(b, c, d) - calc(a - 1, c, d)
    print(b - a + 1 - ans)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import re
import bisect
from datetime import datetime as dt
import bisect
import math

def gcd(a, b):
    return math.gcd(a, b)

def lcm(a, b):
    return a * b / gcd(a, b)

class slist(list):
    def __init__(self, *args, **kw):
        list.__init__(self, *args, **kw)
        self.sort()

    def append(self, value):
        bisect.insort(self,value)

    def index_left(self, value):
        return bisect.bisect_left(self, value)

def calc(n, a, b):
    return int(n/a) + int(n/b) - int(n/lcm(a,b))

if __name__ == '__main__':
    a, b, c, d = map(int, input().split())
    ans = calc(b, c, d) - calc(a - 1, c, d)
    print(b - a + 1 - ans)
Problem p03323 (python)

Fixed submission:
# coding: utf-8
import re
import bisect
from datetime import datetime as dt
import bisect
import math
import sys
input = sys.stdin.readline

def gcd(a, b):
    return math.gcd(a, b)

def lcm(a, b):
    return a * b / gcd(a, b)

class slist(list):
    def __init__(self, *args, **kw):
        list.__init__(self, *args, **kw)
        self.sort()

    def append(self, value):
        bisect.insort(self,value)

    def index_left(self, value):
        return bisect.bisect_left(self, value)


if __name__ == '__main__':
    a,b = map(int, input().split())
    if a <= 8 and b <= 8:
        print('Yay!')
    else:
        print(':(')

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import re
import bisect
from datetime import datetime as dt
import bisect
import math
input = sys.stdin.readline

def gcd(a, b):
    return math.gcd(a, b)

def lcm(a, b):
    return a * b / gcd(a, b)

class slist(list):
    def __init__(self, *args, **kw):
        list.__init__(self, *args, **kw)
        self.sort()

    def append(self, value):
        bisect.insort(self,value)

    def index_left(self, value):
        return bisect.bisect_left(self, value)


if __name__ == '__main__':
    a,b = map(int, input().split())
    if a <= 8 and b <= 8:
        print('Yay!')
    else:
        print(':()')
Problem p03424 (python)

Fixed submission:
import re
import sys

if __name__ == '__main__':
    N = int(input())
    li = raw_input().split()
    d = dict()
    for l in li:
        d[l] = 1
    if len(d) == 4:
        print 'Four'
    else:
        print 'Three'

Buggy submission (verdict: Runtime Error):
import re
import sys

if __name__ == '__main__':
    N = int(input())
    li = input().split()
    d = dict()
    for l in li:
        d[l] = 1
    print len(d)
Problem p03544 (python)

Fixed submission:
# -*- coding: utf-8 -*-

if __name__ == '__main__':
    N = input()
    n0 = 2
    n1 = 1
    if N == 1:
        print(1)
    else:    
        now = 1
        while now != N:
            n = n0 + n1
            n0 = n1
            n1 = n
            now += 1
        print(n)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

if __name__ == '__main__':
    N = input()
    n0 = 2
    n1 = 1
    if N == 1:
        print(1)
    now = 1
    while now != N:
        n = n0 + n1
        n0 = n1
        n1 = n
        now += 1
    print(n)