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

Fixed submission:
from bisect import bisect_right,bisect_left
alphabet_small = [chr(i) for i in range(97, 97+26)]
s = input()
t = input()
m = len(s)
n = len(t)

alpha = [[] for i in range(26)]
for i,let in enumerate(s):
    for j,al in enumerate(alphabet_small):
        if let == al:
            alpha[j].append(i)

#alpha　はsのどこに文字があるか

dp = [0 for i in range(n+1)] #i文字目までの最小
#求めるのはdp[n]
t_num = []
append = t_num.append
for let in t:
    for j,al in enumerate(alphabet_small):
        if let == al:
            t_num.append(j)

#t_num　はtの文字を数字に変換
now = -1
for i,let_num in enumerate(t_num):
    #print(i,let_num,alpha[let_num])
    if len(alpha[let_num]) == 0:
        print(-1)
        exit()
    else:
        q = bisect_right(alpha[let_num], now)
        #print(q)
        if q != len(alpha[let_num]):
            next = alpha[let_num][q]
            #print(now,next,1)
            if now == next:
                dp[i+1] += m
                #print(dp[i+1])
            dp[i+1] += dp[i] + next - now
        else:
            next = alpha[let_num][0]
            dp[i+1] += dp[i] + next - now + m
        now = next



print(dp[n])

Buggy submission (verdict: Runtime Error):
from bisect import bisect_right
alphabet_small = [chr(i) for i in range(97, 97+26)]
s = input()
t = input()
m = len(s)
n = len(t)

alpha = [[] for i in range(26)]
for i,let in enumerate(s):
    for j,al in enumerate(alphabet_small):
        if let == al:
            alpha[j].append(i)

#alpha　はsのどこに文字があるか

dp = [0 for i in range(n+1)] #i文字目までの最小
#求めるのはdp[n]
t_num = []
append = t_num.append
for let in t:
    for j,al in enumerate(alphabet_small):
        if let == al:
            t_num.append(j)

#t_num　はtの文字を数字に変換
now = -1
for i,let_num in enumerate(t_num):
    #print(i,let_num,alpha[let_num])
    if len(alpha[let_num]) == 0:
        print(-1)
        exit()
    else:
        if alpha[let_num][-1] >= now:
            q = bisect_right(alpha[let_num],now)
            next = alpha[let_num][q]
            #print(next)
            dp[i+1] = dp[i] + next - now
        else:
            next = alpha[let_num][0]
            #print(next)
            dp[i+1] = dp[i] + next - now + m
        now = next


print(dp[n])
Problem p02972 (python)

Fixed submission:
n = int(input())


def divisor(n):  # 約数全列挙
    ans = [1, n]
    i = 2
    while i ** 2 <= n:
        if n % i == 0:
            ans.append(i)
            if i ** 2 < n:
                ans.append(n // i)
        i += 1
    ans.sort()
    return ans
a = list(map(int,input().split()))
ans = []
for num in range(n-1,-1,-1):
    if a[num] %2== 1:
        ans.append(num+1)
        q = divisor(num+1)
        for j in q:
            a[j-1] += 1

print(len(ans))
for i in ans:
    print(i,end=' ')

print()

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left
n = int(input())
ans = [int(input())]
for i in range(n-1):
    now = int(input())
    j = bisect_left(ans,now)
    if j == 0:
        ans.insert(0,now)
    else:
        ans[j-1] = now

print(len(ans))
Problem p02973 (python)

Fixed submission:
def bisect_right(a, x, lo=0, hi=None):
    """Return the index where to insert item x in list a, assuming a is sorted.

    The return value i is such that all e in a[:i] have e <= x, and all e in
    a[i:] have e > x.  So if x already appears in the list, a.insert(x) will
    insert just after the rightmost x already there.

    Optional args lo (default 0) and hi (default len(a)) bound the
    slice of a to be searched.
    """

    if lo < 0:
        raise ValueError('lo must be non-negative')
    if hi is None:
        hi = len(a)
    while lo < hi:
        mid = (lo+hi)//2
        if x < a[mid]: hi = mid
        else: lo = mid+1
    return lo

n = int(input())
f = int(input())
ans = [-f]
for i in range(n-1):
    now = -int(input())
    j = bisect_right(ans,now)
    if j == len(ans):
        ans.append(now)
    else:
        ans[j] = now

print(len(ans))

Buggy submission (verdict: Runtime Error):
from collections import deque
from bisect import bisect_left
n = int(input())
ans = deque([int(input())])
for i in range(n-1):
    now = int(input())
    j = bisect_left(ans,now)
    if j == 0:
        ans.insert(0,now)
    else:
        ans[j-1] = now

print(len(ans))

Buggy submission (verdict: Runtime Error):
from collections import deque
from bisect import bisect_left
n = int(input())
ans = deque([int(input())])
for i in range(n-1):
    now = int(input())
    j = bisect_left(ans,now)
    if j == 0:
        ans.insert(0,now)
    else:
        ans[j-1] = now

print(len(ans))
Problem p02985 (python)

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7

n,k = map(int,input().split())
graph = [[] for _ in range(n)]
for i in range(n-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)

def dfs(now,pre):
    available_color = 0  # 子ノードに使用可能な色の数
    if pre == -1:
        available_color = k-1
    else:
        available_color = k-2
    if k < len(graph[now]):
        return 0
    res = 1
    for son in graph[now]:
        if son == pre:continue
        res *= available_color
        available_color -= 1
        res %= MOD
    for son in graph[now]:
        if son == pre:continue
        res *= dfs(son,now)
        res %= MOD

    return res

ans = (k*dfs(0,-1)) % MOD
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7

n,k = map(int,input().split())
graph = [[] for _ in range(n)]
for i in range(n-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)

def dfs(now,pre):
    available_color = 0  # 子ノードに使用可能な色の数
    if pre == -1:
        available_color = k-1
    else:
        available_color = k-2
    if k < len(graph[now]):
        return 0
    res = 1
    for son in graph[now]:
        if son == pre:continue
        res *= available_color
        available_color -= 1
        res %= MOD
    for son in graph[now]:
        if son == pre:continue
        res *= dfs(son,pre)
        res %= MOD

    return res

ans = (k*dfs(0,-1)) % MOD
print(ans)
Problem p03006 (python)

Fixed submission:
from collections import Counter
n = int(input())
xy = [list(map(int,input().split())) for i in range(n)]
pq = []
if n == 1:
    print(1)
    exit()
for i in range(n):
    for j in range(n):
        r = (xy[i][0]-xy[j][0],xy[i][1]-xy[j][1])
        if i!=j:
            pq.append(r)
#print(pq)
ans = Counter(pq).most_common()
print(n-ans[0][1])

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
xy = [list(map(int,input().split())) for i in range(n)]
pq = []
for i in range(n):
    for j in range(n):
        r = (xy[i][0]-xy[j][0],xy[i][1]-xy[j][1])
        if i!=j:
            pq.append(r)
#print(pq)
ans = Counter(pq).most_common()
print(n-ans[0][1])
Problem p03030 (python)

Fixed submission:
n = int(input())
sp = []
for i in range(n):
    s,t = map(str,input().split())
    t = int(t)
    sp.append([s,-t,i+1])

sp.sort()
for i in range(n):
    print(sp[i][2])

Buggy submission (verdict: Runtime Error):
n = int(input())
sp = []
for i in range(n):
    s,t = map(str,input().split())
    sp.append([s,-t,i+1])

sp.sort()
for i in range(n):
    print(sp[i][2])
Problem p03044 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**8)

n = int(input())
ans = [-1]*(n+1)
data =[[] for i in range(n+1)]

for i in range(n-1):
    u,v,w = map(int,input().split())
    data[u].append([v,w])
    data[v].append([u,w])

ans[1] = 1
def color(i):
    for v, w in data[i]:
        if ans[v] == -1:
            if w % 2 == 0:
                ans[v] = ans[i]
            else:
                ans[v] = 1 - ans[i]
            color(v)
    return

color(1)
for i in range(n):
    print(ans[i+1])

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = [-1]*(n+1)
data =[[] for i in range(n+1)]

for i in range(n-1):
    u,v,w = map(int,input().split())
    data[u].append([v,w])
    data[v].append([u,w])

ans[1] = 1
def color(i):
    for v, w in data[i]:
        if ans[v] == -1:
            if w % 2 == 0:
                ans[v] = ans[i]
            else:
                ans[v] = 1 - ans[i]
            color(v)
    return

color(1)
for i in range(n):
    print(ans[i+1])

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = [-1]*n
data =[[] for i in range(n+1)]

for i in range(n-1):
    u,v,w = map(int,input().split())
    u -= 1
    v -= 1
    data[u].append([v,w])
    data[v].append([u,w])

ans[0] = 1
def color(i):
    for v,w in data[i]:
        if ans[v] == -1:
            if w % 2 == 0:
                ans[v] = ans[i]
            else:
                ans[v] = 1 - ans[i]
            color(v)
    return

color(0)
for i in range(n):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = [-1]*n
data =[[] for i in range(n)]

for i in range(n-1):
    u,v,w = map(int,input().split())
    u -= 1
    v -= 1
    data[u].append([v,w])
    data[v].append([u,w])

ans[0] = 0
def color(i):
    for v,w in data[i]:
        if ans[v]== -1:
            if w%2 == 0:
                ans[v] = ans[i]
            else:
                ans[v] = 1 - ans[i]
            color(v)
    return

color(0)
for i in range(n):
    print(ans[i])
Problem p03103 (python)

Fixed submission:
n,m = map(int,input().split())
AB = [list(map(int,input().split())) for i in range(n)]
AB.sort()
c = 0
ans = 0
i = 0
while c < m:
  if  c + AB[i][1] <= m:
    c += AB[i][1]
    ans += AB[i][0]*AB[i][1]
    i += 1
  else:
    ans += AB[i][0]*(m-c)
    break

print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
AB = [list(map(int,input().split())) for i in range(n)]
AB.sort(reverse = True)
c = 0
ans = 0
i = 0
while c < m:
  if  c + AB[i][1] <= m:
    c += AB[i][1]
    ans += AB[i][0]*AB[i][1]
    i += 1
  else:
    ans += Ab[i][0]*(m-c)
    break

print(ans)
Problem p03106 (python)

Fixed submission:
import fractions
a,b,k = map(int,input().split())
q = fractions.gcd(a,b)
count = 0
for i in range(q,-1,-1):
    if q%i == 0:
        count += 1
        if count == k:
            print(i)
            exit()

Buggy submission (verdict: Runtime Error):
from fractions import gcd
a,b,k = map(int,input().split())
x = gcd(a,b)
now = 1
for i in range(x-1,-1,-1):
    if x%i == 0:now += 1
    if now == k:
        print(i)
        exit()
Problem p03111 (python)

Fixed submission:
n, a, b, c = map(int,input().split())
L = [int(input()) for i in range(n)]
ans = 10**10

for i in range(4**n):
    ta, tb, tc = 0, 0, 0
    tmp = 0
    for j in range(n):
        k = (i>>(2*j)) & 3
        if k == 1:
            if ta > 0:
                tmp += 10
            ta += L[j]
        elif k == 2:
            if tb > 0:
                tmp += 10
            tb += L[j]
        elif k == 3:
            if tc > 0:
                tmp += 10
            tc += L[j]
    if ta * tb * tc == 0:
        continue
    tmp += abs(a - ta) + abs(b - tb) + abs(c - tc)
    ans = min(ans,tmp)

print(ans)

Buggy submission (verdict: Runtime Error):
n,a,b,c = map(int,input().split())
l=[int(input()) for i in range(n)]
answer = 10*100
for i in range(1,2**(2*n)):
    a_u = []
    b_u = []
    c_u = []
    ans = 0
    j = i
    counte = 0
    while counte <= n:
        if j%4 == 0:
            a_u.append(l[counte])
        if j%4 == 1:
            b_u.append(l[counte])
        if j%4 == 2:
            c_u.append(l[counte])
        j = j//4
        counte += 1
    if len(a_u)*len(b_u)*len(c_u) > 0:
        ans += abs(sum(a_u)-a) + 10*(len(a_u)-1)
        ans += abs(sum(b_u)-b) + 10*(len(b_u)-1)
        ans += abs(sum(c_u)-c) + 10*(len(c_u)-1)
        answer = min(ans,answer)

print(answer)
Problem p03128 (python)

Fixed submission:
all_match = [2,5,5,4,5,6,3,7,6]

n,m = map(int,input().split())
a = list(map(int,input().split()))
a.sort(reverse=True)
match = []
for num in a:
    match.append(all_match[num-1])

dp = [-10**7 for i in range(n+1)] #桁数
dp[0] = 0

for i in range(1,n+1):
    possible = []
    for honsu in match:
        if i >= honsu:
            possible.append(dp[i-honsu] + 1)
    if len(possible)>0:
        dp[i] = max(possible)

length = dp[n]
ans = 0
now = n
for i in range(length):
    for j in range(m):
        if now >= match[j]:
            if dp[now-match[j]] == dp[now]-1:
                ans += a[j]*10**(length-i-1)
                now -= match[j]
                break

print(ans)

Buggy submission (verdict: Runtime Error):
all_match = [2,5,5,4,5,6,3,7,6]

n,m = map(int,input().split())
a = list(map(int,input().split()))
a.sort(reverse=True)
match = []
for num in a:
    match.append(all_match[num-1])

dp = [-10**7 for i in range(n+1)] #桁数
dp[0] = 0

for i in range(1,n+1):
    possible = []
    for honsu in match:
        if i >= honsu:
            possible.append(dp[i-honsu] + 1)
    if len(possible)>0:
        dp[i] = max(possible)

length = dp[n]
ans = 0
now = n
for i in range(length):
    for j in range(m):
        if dp[now-match[j]] == dp[now]-1:
            ans += a[j]*10**(length-i-1)
            now -= match[j]
            break

print(ans)
Problem p03194 (python)

Fixed submission:
n,p = map(int,input().split())
if n == 1:
    print(p)
    exit()
if n >=40:
    print(1)
    exit()
i =2
ans =1
while i**n <= p:
    if p%(i**n)==0:
        ans *= i
        p =p//(i**n)

    else:
        i += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n,p = map(int,input().split())
if n == 1:
    print(p)
    exit()
if p == 1:
    print(1)
    exit()
for i in range(2,int(p**(1/n)+2)):
    if p%(i**n)==0:
        ans = i
print(ans)
Problem p03230 (python)

Fixed submission:
n=int(input())
k=2
while n>=k*(k-1)/2:
    if n==k*(k-1)/2:
        print('Yes')
        print(k)
        a=list([] for i in range(k))
        t=1
        for i in range(0,k):
            for j in range(1,k-i):
                a[i].append(t)
                a[i+j].append(t)
                t+=1
        for i in range(k):
            print(str(k-1)+" "+" ".join(map(str,a[i])))
        exit()
    else:
        k+=1
print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
for k in range(2,n + 1):
    if k * (k - 1) // 2 == n:
        print("Yes")
        break
    if k * (k - 1) // 2 > n:
        print("No")
        exit()

print(k)
answer = [[] for _ in range(k)]

num = [[i,j] for i in range(k) for j in range(i+1,k)]

for i,st in enumerate(num):
    s,t = st
    answer[s].append(i + 1)
    answer[t].append(i + 1)

for ans in answer:
    print(k-1,*ans)
Problem p03244 (python)

Fixed submission:
from collections import Counter
n=int(input())
v=list(map(int,input().split()))
a=Counter(v[::2]).most_common() #(数字,何回出現)が出現回数が大きい方から
b=Counter(v[1::2]).most_common()
if len(a)==1:
    a.append([0,0])
if len(b)==1:
    b.append([0,0])
if a[0][0]==b[0][0]:
    print(min(n-a[1][1]-b[0][1],n-a[0][1]-b[1][1]))
else:
    print(n-a[0][1]-b[0][1])

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
v=list(map(int,input().split()))
a=Counter(v[::2]).most_common() #(数字,何回出現)が出現回数が大きい方から
b=Counter(v[1::2]).most_common()
if len(a)==1:
    a.append([0,0])
if len(b)==1:
    b.append([0,0])
if a[0][0]==b[0][0]:
    print(min(n-a[1,1]-b[0,1],n-a[0,1]-b[1,1]))
else:
    print(n-a[0,1]-b[0,1])

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
v=list(map(int,input().split()))
a=Counter(v[::2]).most_common() #(数字,何回出現)が出現回数が大きい方から
b=Counter(v[1::2]).most_common()
if len(a)==1:
    a.append([0,0])
if len(b)==1:
    b.append([0,0])
if a[0,0]==b[0,0]:
    print(min(n-a[1,1]-b[0,1],n-a[0,1]-b[1,1]))
else:
    print(n-a[0,1]-b[0,1])
Problem p03262 (python)

Fixed submission:
import fractions
N,X=map(int,input().split())
x=list(map(int,input().split()))
d=abs(x[0]-X)
if N==1:
    print(d)
    exit()
for i in range(1,len(x)):
    d=fractions.gcd(d,abs(x[i]-X))
print(d)

Buggy submission (verdict: Runtime Error):
import math
N,X=map(int,input().split())
x=list(map(int,input().split()))
d=abs(x[0]-X)
if N==1:
    print(d)
    exit()
for i in range(1,len(x)):
    d=math.gcd(d,abs(x[i]-X))
print(d)

Buggy submission (verdict: Runtime Error):
import math
N,X=map(int,input().split())
x=list(map(int,input().split()))
d=abs(x[0]-X)
for i in range(1,len(x)):
    d=math.gcd(d,abs(x[i]-X))
print(d)

Buggy submission (verdict: Runtime Error):
import sys
import math
N,X=map(int,input().split())
x=list(map(int,input().split()))
d=abs(x[0]-X)
for i in range(1,len(x)):
    d=math.gcd(d,abs(x[i]-X))
print(d)
Problem p03274 (python)

Fixed submission:
n,k=map(int,input().split())
x=list(map(int,input().split()))
for i in range(n-k+1):
    if i==0:
        a=min(abs(x[i])+abs(x[i]-x[i+k-1]),abs(x[i+k-1])+abs(x[i]-x[i+k-1]))
    else:
        a=min(a,min(abs(x[i])+abs(x[i]-x[i+k-1]),abs(x[i+k-1])+abs(x[i]-x[i+k-1])))
print(a)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
x=list(map(int,input().split()))
for i in range(n-k+1):
    if i==0:
        a=min(abs(x[i])+abs(x[i]-x[i+k-1]),abs(x[i+k-1])+abs(x[i]-x[i+k-1]))
    else:
        a=min(ans,min(abs(x[i])+abs(x[i]-x[i+k-1]),abs(x[i+k-1])+abs(x[i]-x[i+k-1])))
print(a)
Problem p03283 (python)

Fixed submission:
n, m, Q = map(int, input().split())
data = [[0]*(n+2) for i in range(n+2)]
for i in range(m):
    l, r = map(int, input().split())
    data[l][r] += 1

for i in range(n+2):
    for j in range(n+1):
        data[i][j+1] += data[i][j]

for i in range(n+1, -1, -1):
    for j in range(n+2):
        data[i-1][j] += data[i][j]

for i in range(Q):
    p, q = map(int, input().split())
    print(data[p][q])

Buggy submission (verdict: Runtime Error):
n,m,q = map(int,input().split())
LR = []
ansl = []
for _ in range(m):
    LR.append(list(map(int,input().split())))
for _ in range(q):
    p,q = map(int,input().split())
    ans = 0
    for i in range(m):
        if p<=LR[i][0] and LR[i][1] <= q:
            ans += 1
    ansl.append(ans)
for i in range(q):
    print(ansl[i])
Problem p03292 (python)

Fixed submission:
a=list(map(int,input().split()))
ans=abs(a[0]-a[1])+abs(a[0]-a[2])
ans=min(ans,abs(a[1]-a[0])+abs(a[1]-a[2]))
ans=min(ans,abs(a[2]-a[1])+abs(a[0]-a[2]))
print(ans)

Buggy submission (verdict: Runtime Error):
a_list=list(map(int,input().split()))
ans=abs(a[0]-a[1])+abs(a[0]-a[2])
ans=min(ans,abs(a[1]-a[0])+abs(a[1]-a[2]))
ans=min(ans,abs(a[2]-a[1])+abs(a[0]-a[2]))
print(ans)

Buggy submission (verdict: Runtime Error):
a_list=list(int,input().split())
ans=abs(a[0]-a[1])+abs(a[0]-a[2])
ans=min(ans,abs(a[1]-a[0])+abs(a[1]-a[2]))
ans=min(ans,abs(a[2]-a[1])+abs(a[0]-a[2]))
print(ans)
Problem p03294 (python)

Fixed submission:
import fractions
from functools import reduce
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
n=int(input())
numbers=list(map(int,input().split()))
m=lcm(*numbers)-1
ans=0
for i in range(n):
    ans+=m%numbers[i]
print(ans)

Buggy submission (verdict: Runtime Error):
import fractions
import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
n=int(input())
numbers=list(map(int,input().split()))
m=lcm(*numbers)-1
ans=0
for i in range(n):
    ans+=m%numbers[i]
print(ans)
Problem p03347 (python)

Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]
ans = 0
for i in range(n-1,-1,-1):
    if i == 0:
        if a[i] != 0:
            print(-1)
            exit()
    else:
        if a[i-1] + 1 < a[i]:
            print(-1)
            exit()
        elif a[i-1] + 1 == a[i]:
            ans += 1
        else:
            ans += a[i]
print(ans)

Buggy submission (verdict: Runtime Error):
def makelist2(n, m):
    return [[0 for k in range(m)] for i in range(n)]


N = int(input())
A = []
append = A.append
for i in range(1,N+1):
    a = int(input())
    if a >=i:
        print(-1)
        exit()
    elif A[i-1] > a:
        print(-1)
        exit()
    append(a)
Problem p03401 (python)

Fixed submission:
n=int(input())
a=[0]+list(map(int,input().split()))+[0]
ans=0
for i in range(n+1):
    ans+=abs(a[i]-a[i+1])
for i in range(1,n+1):
    print(ans-abs(a[i]-a[i+1])-abs(a[i-1]-a[i])+abs(a[i-1]-a[i+1]))

Buggy submission (verdict: Runtime Error):
import sys
n=int(input())
word=[]
word.append('０')
for i in range(1,n+1):
    word.append(input())
    for j in range(0,i):
        if word[j]==word[i]:
            print('No')
            sys.exit()
        else:
            j+=1
    if (i>1)& (word[i-1][len(word[i-1])-1]!=word[i][0]):
        print('No')
        sys.exit()

print('Yes')
Problem p03433 (python)

Fixed submission:
n=int(input())
a=int(input())
if n%500<=a:
    print('Yes')
else:
    print('No')

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

int main() {
  int A, N;
  cin >> A >> N;
  
  if (0 <= A <=499 && (N - A) % 500 <= A){
    cout << "Yes" << endl;
  }
  else if (0 <= A <= 499 && A < (N - A) % 500){
    cout << "No" << endl;
  }
  else if (500 <= A <= 1000){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}
Problem p03485 (python)

Fixed submission:
a,b=map(int,input().split())
if (a+b)%2==0:
  print((a+b)//2)
else:
  print((a+b)//2+1)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input())
if (a+b)%2==0:
  print((a+b)//2)
else:
  print((a+b)//2+1)
Problem p03502 (python)

Fixed submission:
N=int(input())
n=N
a=0
while n!=0:
    a+=n%10
    n=n//10
if N%a==0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
def solve(n):
  m = 0
  while n > 0:
    m += n%10
    n //= 10
  if m%n != 0:print("No")
  else:print("Yes")

n = int(input())
solve(n)

Buggy submission (verdict: Runtime Error):
def solve(n):
  m = 0
  while n > 0:
    m += n%10
    n //= 10
  if m%n:print("No")
  else:print("Yes")

n = int(input())
solve(n)
Problem p03609 (python)

Fixed submission:
x,t=map(int,input().split())
print(max(0,x-t))

Buggy submission (verdict: Runtime Error):
x=int(input())
t=int(input())
print(max(0,x-t))
Problem p03674 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
search = [-1 for i in range(n)]
l,r = -1,-1
for i,x in enumerate(a):
    if search[x-1] == -1:
        search[x-1] = i
    else:
        l = search[x-1]
        r = i
#print(l,r)
p = 10**9 + 7

#前計算
comb1 = [0 for _ in range(n+1)]
comb1[0] = n+1
x = n+1
for i in range(1,n+1):
    x = (x*(n-i+1))%p
    x = (x*pow(i+1,p-2,p))%p
    comb1[i] = x

comb2 = [0 for _ in range(n+1)]
comb2[0] = 1
x = 1
for i in range(1,l+n-r+1):
    x = (x*(n+l-r-i+1))%p
    x = (x*pow(i,p-2,p))%p
    comb2[i] = x

for i in range(n+1):
    ans = comb1[i]-comb2[i]

    print(ans%p)

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
search = [-1 for i in range(n)]
l,r = -1,-1
for i,x in enumerate(a):
    if search[x-1] == -1:
        search[x-1] = i
    else:
        l = search[x-1]
        r = i
#print(l,r)
p = 10**9 + 7

#前計算
comb1 = [0 for _ in range(n+1)]
comb1[0] = n+1
x = n+1
for i in range(1,n+1):
    x = (x*(n-i+1))%p
    x = (x*pow(i+1,p-2,p))%p
    comb1[i] = x

comb2 = [0 for _ in range(n+1)]
comb2[0] = 1
x = 1
for i in range(1,l+n-r+1):
    x = (x*(n+l-r-i+1))%p
    x = (x*pow(i,p-2,p))%p
    comb2[i] = x

for i in range(n+1):
    ans = comb1[i]-comb2[i]

    print(ans%p)