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

Fixed submission:
[k, yen] = [int(x) for x in input().split()]
print('Yes') if k*500>=yen else print('No')

Buggy submission (verdict: Runtime Error):
k, yen = [int(x) for x in input("Enter two value: ").split()]
print('Yes') if k*500>=yen else print('No)

Buggy submission (verdict: Runtime Error):
k, yen = input().split()
print('Yes') if k*500>=yen else print('No)

Buggy submission (verdict: Runtime Error):
k = input()
yen = input()
if k*500>yen:
  print('Yes')
else:
  print('No)
Problem p02812 (python)

Fixed submission:
N = int(input())
S = str(input())
print(S.count("ABC"))

Buggy submission (verdict: Runtime Error):
s = str(input())
n = int(input())
s.upper()
print(s.count('ABC')) if len(s)==n

Buggy submission (verdict: Runtime Error):
s = str(input())
n = int(input())
print(s.count('ABC')) if len(s)==n

Buggy submission (verdict: Runtime Error):
s, n = input().split()
print(s.count('ABC'))
Problem p02817 (python)

Fixed submission:
s = input().split()
print(s[1]+s[0])

Buggy submission (verdict: Runtime Error):
string = input().split()
print(string[1]+string[0]

Buggy submission (verdict: Runtime Error):
string = input().split()
print(string[1]+string[0]

Buggy submission (verdict: Runtime Error):
string = str(input()).split()
print(string[1]+string[0]
Problem p02818 (python)

Fixed submission:
cookies = [int(x) for x in input().split()]
leftOver = cookies[0] - cookies[2]
takahashi = max(0, leftOver)
print(str(takahashi)+ ' ' + (str(cookies[1]) if takahashi > 0  else str(max(0,cookies[1] - abs(leftOver)))))

Buggy submission (verdict: Runtime Error):
t,a,k = input().split()
while k>0:
  if t>0:
    t-=1
    k-=1
  elif t==0 and a>0:
    a-=1
    k-=1
  else if t==0 and a==0:
    break
print(str(t)+' '+str(a))
Problem p03455 (python)

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

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

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

Buggy submission (verdict: Runtime Error):
from sys import stdin

a = stdin.readline().rstrip()
a = int(a)

b = stdin.readline().rstrip()
b = int(b)

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

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

b = input()
b = int(b)

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

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

b = input()
b = int(b)

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

Fixed submission:
print(input().count("1"))

Buggy submission (verdict: Runtime Error):

def div(n):
    ans = 0
    while n % 2 == 0:
        n /= 2
        ans+=1
    return ans

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

ans = min(map(div,list))

print(ans)
Problem p03796 (python)

Fixed submission:
import math

n = int(input())

ans = math.factorial(n) % (10**9 + 7)

print(ans)

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(100000)
n = int(input())
def train(n):
    if n == 1:
        return 1
    else:
        return n * train(n-1)

ans = train(n) % (10**9 + 7)

print(ans)
Problem p03854 (python)

Fixed submission:
s = input()

s = s[::-1]
s = list(s)
#print(s)
count = 0
can = True
jm = []
j = 0
maxcount = 0
for i in s:
    jm.append(i)
    j += 1
    count += 1
    if count > 7:
        can = False
#        print(0)
        break
    elif "".join(jm) == "maerd":
        maxcount += count
        count,j = 0,0
        jm = []
#        print(1)
    elif "".join(jm) == "remaerd":
        maxcount += count
        count,j = 0,0
        jm = []
#        print(2)
    elif "".join(jm) == "esare":
        maxcount += count
        count,j = 0,0
        jm = []
#        print(3)
    elif "".join(jm) == "resare":
        maxcount += count
        count,j = 0,0
        jm = []
#        print(4)
    else:
#        print(5,end = "")
        pass


#print("forward bool is" + str(can))

if maxcount == 0:
    can = False

if can:
    print("YES")
else:
    print("NO")

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

s = s[::-1]

s = list(s)
#print(s)
count = 0
can = True
jm = []
j = 0
maxcount = 0

for i in s:
    jm.append(s[j])
    j += 1
    count += 1
    if count > 7:
        can = False
#        print(0)
        break
    elif "".join(jm) == "maerd":
        maxcount += count
        count,j = 0,0
#        print(1)
    elif "".join(jm) == "remaerd":
        maxcount += count
        count,j = 0,0
        jm = []
#        print(2)
elif "".join(jm) == "esare":
        maxcount += count
        count,j = 0,0
        jm = []
#        print(jm + 1)
elif "".join(jm) == "rersare":
        maxcount += count
        count,j = 0,0
        jm = []
    else:
        pass


#print("forward bool is" + str(can))

if maxcount == 0:
    can = False

if can:
    print("YES")
else:
    print("NO")
Problem p02664 (python)

Fixed submission:
import numpy as np

input_str  = list(input())
count = 0



if len(input_str) == 1:
    input_str[0] = 'D'
else:
    if input_str[0] == '?':
        if input_str[1] == 'P':
            input_str[0] = 'D'
        else:
            input_str[0] = 'P'

    if input_str[-1] == '?':
        input_str[-1] = 'D'

    for i in range(1,len(input_str)-1):
        if input_str[i] == '?':
            if input_str[i-1] == 'P':
                input_str[i] = 'D'
            elif input_str[i+1] == 'D':
                input_str[i] = 'P'
            elif input_str[i+1] == '?':
                if input_str[i-1] == 'P':
                    input_str[i] = 'D'
                else:
                    input_str[i] = 'P'
            else:
                input_str[i] = 'D'

ans = ''.join(input_str)

print(ans)

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

input_str  = list(input())
count = 0

if input_str[0] == '?':
    if input_str[1] == 'P':
        input_str[0] == 'D'
    else:
        input_str[0] = 'P'

if input_str[-1] == '?':
    input_str[-1] = 'D'


for i in range(1,len(input_str)-1):
    if input_str[i] == '?':
        if input_str[i-1] == 'P':
            input_str[i] = 'D'
        elif input_str[i+1] == 'P':
            input_str[i] = 'D'
        elif input_str[i+1] == 'D':
            input_str[i] = 'P'
        elif input_str[i+1] == '?':
            if input_str[i-1] == 'P':
                input_str[i] = 'D'
            else:
                input_str[i] = 'P'
        elif input_str[i+1] == 'D':
            input_str[i] = 'D'

for i in range(len(input_str)-1):
    if input_str[i] == 'D':
        count = count + 1
    if input_str[i] == 'P' and input_str[i+1] == 'D':
        count = count + 1
if input_str[-1] == 'D':
    count = count + 1
ans = ''.join(input_str)

print(ans)

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

input_str  = list(input())
count = 0

if input_str[0] == '?':
    if input_str[1] == 'P':
        input_str[0] == 'D'
    else:
        input_str[0] = 'P'

if input_str[-1] == '?':
    input_str[-1] = 'D'


for i in range(1,len(input_str)-1):
    if input_str[i] == '?':
        if input_str[i-1] == 'P':
            input_str[i] = 'D'
        elif input_str[i+1] == 'P':
            input_str[i] = 'D'
        elif input_str[i+1] == '?':
            if input_str[i-1] == 'P':
                input_str[i] = 'D'
            else:
                input_str[i] = 'P'
        elif input_str[i+1] == 'D':
            input_str[i] = 'D'

for i in range(len(input_str)-1):
    if input_str[i] == 'D':
        count = count + 1
    if input_str[i] == 'P' and input_str[i+1] == 'D':
        count = count + 1
if input_str[-1] == 'D':
    count = count + 1
ans = ''.join(input_str)
print(ans)
Problem p02675 (python)

Fixed submission:
import numpy as np

N = int(input())

amari = N%10
hon_set = [2,4,5,7,9]
pon_set = [0,1,6,8]
bon_set = [3]

for x in hon_set:
    if amari == x:
        print('hon')

for x in pon_set:
    if amari == x:
        print('pon')

for x in bon_set:
    if amari == x:
        print('bon')

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

K = int(input())
S = input()
S = list(S)
mojiretu=''
if len(S) <= K:
    print(S)

else:
    del S[K:len(S)]
    for x in S:
        mojiretu += x
    print(str(mojiretu)+'...')
Problem p02993 (python)

Fixed submission:
abcd = int(input())
d = int(abcd % 10)
c = int(((abcd - d) % 100)/10)
b = int((abcd - c*10 - d)%1000/100)
a = int(abcd / 1000)

if(a == b):
  print("Bad")
elif(b == c):
  print("Bad")
elif(c == d):
  print("Bad")
else:
  print("Good")

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
  while b:
    a, b = b, a % b
  return a

a, b, c, d = map(int, input().split())
num = 0
cd = c*d/(gcd(c,d))
s = b - a + 1
s_c = int(s/c)
s_d = int(s/d)
s_cd = int(s/cd)
if(a%c >= b%c):
  num = num + 1
if(a%d >= b%d):
  num = num + 1
if(a%cd >= b%cd):
  num = num - 1
print(s -(s_c + s_d - s_cd) - num)

Buggy submission (verdict: Runtime Error):
abcd = int(input())
d = abcd % 10
c = int(((abcd - d) % 100)/10)
b = (abcd - c*10 - d)%1000
a = int(abcd / 1000)

s = "Good"
if(a == b){
  s = "Bad"
}
if(b = c){
  s = "Bad"
}
if(c == d){
  s = "Bad"
}

print(s)
Problem p02664 (python)

Fixed submission:
s = list(input())

for i in range(len(s)):
  if s[i] == '?':
    if i-1 >= 0 and s[i-1] == 'P':
      s[i] = 'D'
    elif i+1 < len(s) and s[i+1] == 'D':
      s[i] = 'P'
    elif i+1 < len(s) and  s[i+1] == '?':
      s[i] = 'P'
      s[i+1] = 'D'
    else :
      s[i] = 'D'
      
print("".join(s))

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

for i in range(len(s)):
  if s[i] == '?':
    if s[i+1] == 'D':
      s[i] = 'P'
    elif s[i+1] == '?':
      s[i] = 'P'
      s[i+1] = 'D'
    else :
      s[i] = 'D'
      
print("".join(s))
Problem p02660 (python)

Fixed submission:
import math
from collections import Counter



def prime_factorization(num):
    """
    素因数分解
    ;param num 素因数分解したい数字
    ;return result {素因数: 回数, ・・・}
    """

    result = dict()

    N = num

    x = 2
    while x <= int(math.sqrt(num)) + 1:
        if (num % x) == 0:
            count = 0
            while (num % x) == 0:
                count += 1
                num = num / x

            result[x] = count

        x += 1

    if num != 1:
        result[num] = 1

    if result == []:
        result[N] = 1

    return result


N = int(input())

# 素因数分解
result = prime_factorization(N)

# 操作の回数を求める
ans = 0
for value in result.values():
    c = 1
    while (value - c) >= 0:
        ans += 1
        value -= c
        c += 1

print(ans)

Buggy submission (verdict: Runtime Error):
import math


def prime_factorization(n):
    result = []

    N = n
    x = 2
    while x <= math.sqrt(N):
        if n % x == 0:
            result.append(x)
            n = n / x

        x += 1

    if n != 1:
       result.append(n)

    if result.count(result[-1]) > 1:
      result.pop(-1)
        
    return result


N = int(input())

result = prime_factorization(N)

print(len(result))

Buggy submission (verdict: Runtime Error):
import math


def prime_factorization(n):
    result = []

    N = n
    x = 2
    while x <= math.sqrt(N):
        if n % x == 0:
            result.append(x)
            n = n / x

        x += 1

    if n != 1:
       result.append(n)

    if result[-1] == result[-2]:
      result.pop(-1)
        
    return result


N = int(input())

result = prime_factorization(N)

print(len(result))
Problem p02658 (python)

Fixed submission:
n = int(input())
MX = 10 **18
a = list(map(int, input().split()))
for x in a:
    if x == 0:
        print(0)
        exit(0)
ans = 1
for x in a:
    ans *= x
    if ans > MX:
        print(-1)
        exit(0)
print(ans)

Buggy submission (verdict: Runtime Error):
#include <iostream>
using namespace std;

int main ()
{
	long n, a;
	long ret = 1;
	bool flag = true;

	cin >> n;

	for (int i=0; i<n; i++) {
		cin >> a;
		if (a == 0) {
			cout << 0 << endl;
			return 0;
		}
		ret *= a;
		if (ret <= 0 || 1000000000000000000 < ret) {
			flag = false;
		}
	}

	if (flag == false) {
		cout << -1 << endl;
	} else {
		cout << ret << endl;
	}

	return 0;
}
Problem p02717 (python)

Fixed submission:
# -*- coding: utf-8 -*-
X, Y, Z = map(int, input().split())
print(Z, X, Y)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
N, M = map(int, input().split())
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
if N != 0:
  if N != 1:
    N_sum = combinations_count(N, 2)
  else:
    N_sum = 0
else:
  N_sum = 0
if M != 0:
  if M != 1:
    M_sum = combinations_count(M, 2)
  else:
    M_sum = 0
else:
  M_sum = 0
print(N_sum + M_sum)
Problem p02772 (python)

Fixed submission:
# -*- coding: utf-8 -*-
n = input() # 2 ~ 99
an = [int(x.strip()) for x in input().split(' ')]

count = 0
check = 0
for i in an:
  if i % 2 == 0:
    check += 1
    if i % 3 == 0 or i % 5 == 0:
      count += 1
if count == check or check == 0:
  print('APPROVED')
else:
  print('DENIED')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 整数の入力
# 1以上N以下の整数のうち、10進法での各桁の和が
# A以上B以下であるものの総和を求めてください。
n = input() # 2 ~ 99
an = []
an = input().split() 1 ~ 1000

ocunt = 0
for i in an:
  if i % 2 == 0:
    if i % 3 == 0 or i % 5 == 0:
      count += 1
      break:
if count == 1:
  print('APPROVED')
else:
  print('DENIED')
Problem p02713 (python)

Fixed submission:
import math

K=int(input())
sum=0


for i in range(1,K+1):
    for j in range(1,K+1):
        a=math.gcd(i,j)
        for k in range(1,K+1):
            b=math.gcd(a, k)
            sum = sum + b

print(sum)

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

for p in range(1,k+1):
    for q in range(1,k+1):
        for r in range(1,k+1):
            ans=p
            ans = fractions.gcd(ans, q)
            ans = fractions.gcd(ans, r)
            sum_g+=ans
            ans=0
print(sum_g)

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

for p in range(1,k+1):
    for q in range(1,k+1):
        for r in range(1,k+1):
            ans=p
            ans = math.gcd(ans, q)
            ans = math.gcd(ans, r)
            sum_g+=ans
            ans=0
print(sum_g)
Problem p02732 (python)

Fixed submission:
import collections
n = int(input())
a = list(map(int,input().split()))
c = collections.Counter(a)
ans = sum(i*(i-1)//2 for i in c.values())
[print(ans-c[i]+1) for i in a]

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result



for k in range(N):
    cnt=0
    L=A
    L.pop(k)
    aK=L
    lK=list(set(aK))
    for i in lK:
        if aK.count(i)>=2:
            cnt+=cmb(N-1,aK.count(i))
    print(cnt)
Problem p02760 (python)

Fixed submission:
def main():
    a = [input().split() for _ in range(3)]
    ans = [[0] * 3 for _ in range(3)]
    n = int(input())
    b = [input() for _ in range(n)]

    for bi in b:
        for y in range(3):
            for x in range(3):
                if bi == a[y][x]:
                    ans[y][x] = 1

    if ans[0][0] == ans[0][1] == ans[0][2] == 1:
        print('Yes')
    elif ans[1][0] == ans[1][1] == ans[1][2] == 1:
        print('Yes')
    elif ans[2][0] == ans[2][1] == ans[2][2] == 1:
        print('Yes')
    elif ans[0][0] == ans[1][0] == ans[2][0] == 1:
        print('Yes')
    elif ans[0][1] == ans[1][1] == ans[2][1] == 1:
        print('Yes')
    elif ans[0][2] == ans[1][2] == ans[2][2] == 1:
        print('Yes')
    elif ans[0][0] == ans[1][1] == ans[2][2] == 1:
        print('Yes')
    elif ans[0][2] == ans[1][1] == ans[2][0] == 1:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
a1=input().split()
a2=input().split()
a3=input().split()
A=[a1,a2,a3]
b=int(input()) for i in range(int(input()))
if a1[0] and a1[1] and a1[2] in b:
    print("Yes")
elif a2[0] and a2[1] and a2[2] in b:
    print("Yes")
elif a3[0] and a3[1] and a3[2] in b:
    print("Yes")
elif a1[0] and a2[0] and a3[0] in b:
    print("Yes")
elif a1[1] and a2[1] and a3[1] in b:
    print("Yes")
elif a1[2] and a2[2] and a3[2] in b:
    print("Yes")
elif a1[0] and a2[1] and a3[2] in b:
    print("Yes")
elif a1[2] and a2[1] and a3[0] in b:
    print("Yes")
else:
    print("No")
Problem p02761 (python)

Fixed submission:
n,m=map(int,input().split())
s=[]
c=[]
for i in range(m):
    st,ct=map(int,input().split())
    s.append(st)
    c.append(ct)
ans=[[0,0] for i in range(n)]
for i in range(m):
    if s[i]==1 and c[i]==0 and n>=2:
        print(-1)
        exit()
    if ans[s[i]-1][1]==0:
        ans[s[i]-1][0]=c[i]
        ans[s[i]-1][1]=1
    else:
        if ans[s[i]-1][0] != c[i]:
            print(-1)
            exit()
if ans[0][0]==0 and n>=2:
    ans[0][0]=1
ansn=0
for i in range(n):
    ansn+=ans[i][0]*10**(n-i-1)
print(ansn)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
s=[]
c=[]
for i in range(m):
    st,ct=map(int,input().split())
    s.append(st)
    c.append(ct)
ans=[[0,0] for i in range(n)]
for i in range(m):
    if s[i]==1 and c[i]==0 and n>=2:
        print(-1)
        exit()
    if ans[s[i]-1][1]==0:
        ans[s[i]-1][0]=c[i]
        ans[s[i]-1][1]=1
    else:
        if ans[s[i]-1][0] != c[i]:
            print(-1)
            exit()
if ans[0][0]==0 and n>=2:
    ans[0][0]=1
ansn=0
for i in range(n):
    ansn+=ansn[i][0]*10**(n-i-1)
print(ansn)

Buggy submission (verdict: Runtime Error):
import sys
n,m=map(int,input().split())
s=[]
c=[]
for i in range(m):
    st,ct=map(int,input().split())
    s.append(st)
    c.append(ct)
ans=[[0,0] for i in range(n)]
for i in range(m):
    if s[i]==1 and c[i]==0 and n>=2:
        print(-1)
        sys.exit()
    if ans[s[i]-1][1]==0:
        ans[s[i]-1][0]=c[i]
        ans[s[i]-1][1]=1
    else:
        if ans[s[i]-1][0] != c[i]:
            print(-1)
            sys.exit()
if ans[0][0]==0 and n>=2:
    ans[0][0]=1
ansn=0
for i in range(n):
    ansn+=ansn[i][0]*10**(n-i-1)
print(ansn)

Buggy submission (verdict: Runtime Error):
import sys
n,m=map(int,input().split())
s=[]
c=[]
for i in range(m):
    st,ct=map(int,input().split())
    s.append(st)
    c.append(ct)
ans=[[0,0] for i in range(n)]
for i in range(m):
    if s[i]==1 and c[i]==0 and n>=2:
        print(-1)
        sys.exit()
    if ans[s[i]-1][1]==0:
        ans[s[i]-1][0]=c[i]
        ans[s[i]-1][1]=1
    else:
        if ans[s[i]-1][0] != c[i]:
            print(-1)
            sys.exit()
if ans[0][0]==0 and n>=2:
    ans[0][0]=1
ansn=0
for i in range(n):
    ansn+=ansn[i][0]*10**(n-i-1)
print(ansn)
Problem p02811 (python)

Fixed submission:
k,x=map(int,input().split())
if 500*k>=x:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
k,x =map(int,input())
if x<=500*k:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
k,x =map(int,input())
if x<=500*k:
  print("Yes")
else:
  print("No")
Problem p02899 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
ans = [0] * N
for i, a in enumerate(A):
  ans[a-1] = i+1
print(*ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input.split())
h=[0]*n
for i in range(1,n+1):
       h[i-1]=A.index(i)+1
print(*h)

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input.split())
h=[]
for i in range(1,n+1)
       h.append(A.index(i)+1)
print(*h)
Problem p02917 (python)

Fixed submission:
n=int(input())
B=list(map(int,input().split()))  
C=[0]*n
C[0]=B[0]
C[1]=B[0]
for i in range(1,n-1):
    if C[i]>B[i]:
        C[i+1]=B[i]
        C[i]=B[i]
    else:
        C[i+1]=B[i]
print(sum(C))

Buggy submission (verdict: Runtime Error):
n=int(input())
B=list(map(int,input().split()))  
C=[0]*n
C[0]=B[0]
C[1]=B[1]
for i in range(1,n-1):
    if C[i]>B[i]:
        C[i+1]=B[i]
        C[i]=B[i]
    else:
        C[i+1]=B[i]
print(sum(C))
Problem p02971 (python)

Fixed submission:
n=int(input())
A=[int(input()) for i in range(n)]
B=sorted(A)
for a in A:
    if a == B[-1]:
      print(B[-2])
    else:
        print(B[-1])

Buggy submission (verdict: Runtime Error):
import copy
n=int(input())
A=[int(input()) for i in range(n)]
B=copy.copy(A)
for i in range(n):
    A.pop(i)
    print(max(A))
    A = B
Problem p02995 (python)

Fixed submission:
from fractions import gcd
a,b,c,d = map(int,input().split())
def l(x,y):
    return (x*y)//gcd(x,y)
U = b-a+1
s1 = b//c - (a-1)//c
s2 = b//d - (a-1)//d
s3 = b//l(c,d) - (a-1)//l(c,d)
print(U-(s1+s2-s3))

Buggy submission (verdict: Runtime Error):
from gcd import fractions
a,b,c,d = map(int,input().split())
def l(x,y):
    return x*y//gcd(x,y)
U = b-a+1
s1 = b//c - (a-1)//c
s2 = b//d - (a-1)//d
s3 = b//l(a,b) - (a-1)//l(a,b)
print(U-(s1+s2-s3))
Problem p03031 (python)

Fixed submission:
N, M = [int(x) for x in input().split()]
K = [[0]*N]*M
for i in range(M):
  K[i] = [int(x) for x in input().split()]
P = [int(x) for x in input().split()]
total = 0
for i in range(2 ** N):
    lamp = [0] * N
    for j in range(N):
        if ((i >> j) & 1):
            lamp[j] = 1
    flag = True
    for x in range(M):
      result = 0
      for y in K[x][1:]:
        if lamp[y-1] == 1:
          result += 1
      result %= 2
      if result != P[x]:
        flag = False
    if flag:
      total += 1
print(total)

Buggy submission (verdict: Runtime Error):
, M = [int(x) for x in input().split()]
K = [[0]*N]*M
for i in range(M):
  K[i] = [int(x) for x in input().split()]
P = [int(x) for x in input().split()]
total = 0
for i in range(2 ** N):
    lamp = [0] * N
    for j in range(N):
        if ((i >> j) & 1):
            lamp[j] = 1
    flag = True
    for x in range(M):
      result = 0
      for y in K[x][1:]:
        if lamp[y-1] == 1:
          result += 1
      result %= 2
      if result != P[x]:
        flag = False
    if flag:
      total += 1
print(total)
Problem p03145 (python)

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

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

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

print(a*b//2)
Problem p03162 (python)

Fixed submission:
N = int(input())
a, b, c = [0] * N, [0] * N, [0] * N
for i in range(N):
	a[i], b[i], c[i] = map(int, input().split())
dp = [[0] * 3 for _ in range(N)]

dp[0] = [a[0], b[0], c[0]]
for i in range(N - 1):
	dp[i + 1][0] = max(dp[i + 1][0], dp[i][1] + a[i + 1], dp[i][2] + a[i + 1])
	dp[i + 1][1] = max(dp[i + 1][1], dp[i][0] + b[i + 1], dp[i][2] + b[i + 1])
	dp[i + 1][2] = max(dp[i + 1][2], dp[i][0] + c[i + 1], dp[i][1] + c[i + 1])
print(max(dp[N - 1]))

Buggy submission (verdict: Runtime Error):
N = int(input())
a, b, c = [0] * N, [0] * N, [0] * N
for i in range(N):
	a[i], b[i], c[i] = map(int, input().split())
dp=[[0]*3 for _  in range(N)]
dp[0]=[a[0],b[0],c[0]]
for i in range(N-1):
    for j in range(2):
        for k in range(2):
            if j!=k:
                dp[i+1][j]=max(dp[i+1][j],dp[i][k] + a[i+1][j])
            else:
                pass

print(max(dp[N-1]))

Buggy submission (verdict: Runtime Error):
N = int(input())
a, b, c = [0] * N, [0] * N, [0] * N
for i in range(N):
	a[i], b[i], c[i] = map(int, input().split())
dp=[[0]*3 for _  in range(n)]
dp[0]=[a[0],b[0],c[0]]
for i in range(N-1):
    for j in range(2):
        for k in range(2):
            if j!=k:
                dp[i+1][j]=max(dp[i+1][j],dp[i][k] + a[i+1][j])
            else:
                pass

print(max(dp[N-1]))