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

Fixed submission:
import sys

sys.setrecursionlimit(4100000)

N,M = map(int,input().split(' '))

already_reach = [-1]*(N+1)
already_reach_1st = [-1]*(N+1)
already_reach_2nd = [-1]*(N+1)
graph = [[] for _ in range(N+1)]
for _ in range(M):
    u,v = map(int,input().split(' '))
    graph[u].append(v)
S,T = map(int,input().split(' '))

next_list = []
def search(S_list,current_count=0):
    next_list = []
    for s in S_list:
        for i1 in graph[s]:
            #print(already_reach_1st)
            if already_reach_1st[i1] != -1:
                continue
            already_reach_1st[i1] = 0
            for i2 in graph[i1]:
                #print(already_reach_2nd)
                if already_reach_2nd[i2] != -1:
                    continue
                already_reach_2nd[i2] = 0
                for i3 in graph[i2]:
                    if already_reach[i3] == -1: #はじめての到達
                        already_reach[i3] = current_count+1
                        next_list.append(i3)
    if len(next_list) > 0:
        search(next_list,current_count+1)
search([S])
print(already_reach[T])

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split(' '))

already_reach = [-1]*(N+1)
graph = [[] for _ in range(N+1)]
for _ in range(M):
    u,v = map(int,input().split(' '))
    graph[u].append(v)
S,T = map(int,input().split(' '))

def search(S_list,current_count=0):
    for s in S_list:
        already_reach[s] = current_count
    #print(already_reach)
    next_list = []
    for s in S_list:
        for i1 in graph[s]:
            for i2 in graph[i1]:
                for i3 in graph[i2]:
                    if already_reach[i3] == -1: #はじめての到達
                        next_list.append(i3)
    if len(next_list) > 0:
        search(next_list,current_count+1)
search([S])
print(already_reach[T])
Problem p02995 (python)

Fixed submission:
A,B,C,D = map(int,input().split(' '))

#最大公約数
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

#最小公倍数
def lcm(a,b):
    return a*b//gcd(a,b)

c_num = (B//C - (A-1)//C)
d_num = (B//D - (A-1)//D)
cd_num = (B//lcm(C, D) - (A-1)//lcm(C, D))
print((B-A+1) - (c_num+d_num-cd_num))

Buggy submission (verdict: Runtime Error):
import math
A,B,C,D = map(int,input().split(' '))

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

c_num = (B//C - (A-1)//C)
d_num = (B//D - (A-1)//D)
cd_num = (B//lcm(C, D) - (A-1)//lcm(C, D))
print((B-A+1) - (c_num+d_num-cd_num))
Problem p02996 (python)

Fixed submission:
N = int(input())
ABn = [ list(map(int,input().split(' '))) for _ in range(N) ]
ABn.sort(key=lambda x: x[1])

count_time = 0
for AB in ABn:
    count_time += AB[0]
    if count_time <= AB[1]:
        continue
    else:
        print('No')
        exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
N = int(input())
ABn = [ list(map(int,input().split(' '))) for _ in range(N) ]
ABn.sort(key=lambda x: x[1])

count_time = 0
for AB in ABn:
    count_time += AB[0]
    if count_time <= AB[1]:
        continue
    else:
        print('No')
        exit(1)
print('Yes')
Problem p03044 (python)

Fixed submission:
import sys

sys.setrecursionlimit(4100000)
N = int(input())
graph = [[] for _ in range(N+1)]
for _ in range(N-1):
    u,v,w = map(int,input().split(' '))
    graph[u].append((v,w))
    graph[v].append((u,w))

color_list = [-1]*(N+1)
color_list[1] = 0
'''
for i in range(1,N+1):
    for node in graph[i]:
        if node[1]%2 ==0:
            num =  color_list[i]
        else:
            num =  0 if color_list[i] == 1 else 1
        if color_list[node[0]] == -1:
            color_list[node[0]] = num
'''
def search(n):
    for node in graph[n]:
        if node[1]%2 ==0:
            num =  color_list[n]
        else:
            num =  0 if color_list[n] == 1 else 1
        if color_list[node[0]] == -1:
            color_list[node[0]] = num
            search(node[0]) 
search(1)
#print(color_list)
for i in range(1,N+1):
    print(color_list[i])

Buggy submission (verdict: Runtime Error):
N = int(input())
graph = [[] for _ in range(N+1)]
for _ in range(N-1):
    u,v,w = map(int,input().split(' '))
    graph[u].append((v,w))
    graph[v].append((u,w))

color_list = [-1]*(N+1)
color_list[1] = 0
'''
for i in range(1,N+1):
    for node in graph[i]:
        if node[1]%2 ==0:
            num =  color_list[i]
        else:
            num =  0 if color_list[i] == 1 else 1
        if color_list[node[0]] == -1:
            color_list[node[0]] = num
'''
def search(n):
    for node in graph[n]:
        if node[1]%2 ==0:
            num =  color_list[n]
        else:
            num =  0 if color_list[n] == 1 else 1
        if color_list[node[0]] == -1:
            color_list[node[0]] = num
            search(node[0]) 
search(1)
print(color_list)
for i in range(1,N+1):
    print(color_list[i])
Problem p02658 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = 1
for i in range(n):
    if a[i] == 0:
        print(0)
        exit()
for i in range(n):
    ans *= a[i]
    if ans > 1e18:
        print(-1)
        exit()
if ans > 1e18:
    print(-1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
a, b = map(float,input().split())
print(int((a*b)//1))
Problem p02888 (python)

Fixed submission:
from bisect import bisect_left

N = int(input())

L = list(map(int, input().split()))
L.sort()

ans = 0


for i in range(N):
    for j in range(i + 1, N):
        c = L[i] + L[j]
        # a+bが入る場所を返す
        idx = bisect_left(L, c)
        ans += max(0, idx - (j + 1))

print(ans)

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

L = list(map(int, input().split()))
L.sort()

ans = 0

for i in range(N):
    L_count[L[i]] += 1

for i in range(N-1):
    for j in reversed(range(i + 2, N)):
        for k in range(i + 1, j):
            if L[j] - L[i] < L[k] and L[k] < L[j] + L[i]:
                ans += 1

print(ans)
Problem p02901 (python)

Fixed submission:
N, M = map(int, input().split())

dp = [float("inf")] * (2 ** N)

dp[0] = 0

for i in range(M):

    a, b = map(int, input().split())
    c = list(map(int, input().split()))

    key = 0

    for j in c:
        key += 2 ** (j-1)

    for j in range(2**N):
        if dp[j | key] > dp[j] + a:
            dp[j | key] = dp[j] + a

if dp[2 ** N - 1] == float("inf"):
    print(-1)
else:
    print(dp[2 ** N - 1])

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())

dp = [float("inf")] * (2 ** N)

dp[0] = 0

for i in range(M):
    
    a, b = map(int, input().split())
    c = list(map(int, input().split()))

    key = 0

    for j in c:
        key += 2 ** (j-1)

    for j in range(2**N):
        if dp[j | num] > dp[j] + a:
            dp[j | num] = dp[j] + a

if dp[2 ** N - 1] == float("inf"):
    print(-1)
else:
    print(dp[2 ** N - 1])
Problem p02918 (python)

Fixed submission:
N, K = map(int, input().split())
S = input()
counter = 0
RL = 0
RL_L = 0
RL_R = 0

if S[0] == 'L':
    RL_L += 1

if S[N-1] == 'R':
    RL_R += 1

for i in range(N-1):
    if S[i:i+2] == 'RL':
        counter += 1

if (counter - K) >= 0:
    counter -= K
    K = 0
else:
    K -= counter
    counter = 0
    RL = 0

if RL_L == 1 and K > 0:
    RL_L -= 1
    K -= 1

if RL_R == 1 and K > 0:
    RL_R -= 1
    K -= 1

ans = N - (counter*2 + RL_L + RL_R)

print(min(ans, N-1))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = input()
counter = 0

ans = N-1

for i in range(N-1):
    if S[i] != S[i+1]:
        ans -= 1

print(min(N-1), ans+2*K)
Problem p02927 (python)

Fixed submission:
M,D = map(int, input().split())

D = int(D)
ans = 0

for i in range(1,M+1):
    for j in range(1,D+1):
        j = str(j)
        if len(j) == 2:
            j1 = int(j[0])
            j2 = int(j[1])
            if j1 >= 2 and j2 >= 2 and j1 * j2 == i:
                ans += 1


print(ans)

Buggy submission (verdict: Runtime Error):
M,D = map(int, input().split())

D = int(D)
ans = 0

for i in range(1,M+1):
    for j in range(1,D+1):
        if len(j) == 2:
            j1 = j // 10
            j2 = j % 10
            if j1 >= 2 and j2 >= 2 and j1 * j2 == i:
                ans += 1


print(ans)
Problem p02960 (python)

Fixed submission:
mod = 10 ** 9 + 7

S = input()

dp = [0] * 13

dp[0] = 1

l = len(S)

for i in S:
    nextdp = [0] * 13
    if i == "?":
        for k in range(10):
            for j in range(13):
                nextdp[((j * 10) + k) % 13] += dp[j]
                # nextdp[((j * 10) + k) % 13] %= mod

    else:
        k = int(i)
        for j in range(13):
            nextdp[((j * 10) + k) % 13] += dp[j]
            # nextdp[((j * 10) + k) % 13] %= mod

    dp = [nextdp[i] % mod for i in range(13)]

    # for i in range(13):
    #     dp[i] = nextdp[i] % mod

print(dp[5])

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

mod = 10 ** 9 + 7
S = input()

l = len(S)

dp = np.zeros((l + 1, 13))

# dp = [[0 for i in range(13)] for j in range(l+1)]

dp[0][0] = 1

for i, num in enumerate(S):

    if num == "?":
        for k in range(10):
            for j in range(13):
                dp[i+1][((j * 10) + k) % 13] += dp[i][j]
                # nextdp[((j * 10) + k) % 13] %= mod

    else:
        k = int(num)
        for j in range(13):
            dp[i+1][((j * 10) + k) % 13] += dp[i][j]
            # nextdp[((j * 10) + k) % 13] %= mod

    for j in range(13):
        dp[i+1][j] %= mod

print(int(dp[l][5]))
Problem p02972 (python)

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

hako = [0] * (N+1)

for i in range(1,N+1)[::-1]:
    if i > N / 2:
        if a[i-1] == 1:
            hako[i] = a[i-1]
    else:
        count = 0
        for j in range(i,N+1,i):
            if j%i == 0:
                count += hako[j]

        if count % 2 == a[i-1]:
            hako[i] = 0
        else:
            hako[i] = 1

print(sum(hako))

if sum(hako):
    ans = []
    for i, bin in enumerate(hako):
        if bin:
            ans.append(i)
    print(*ans)

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

hako = [0] * (N+1)

for i in range(1,N+1)[::-1]:
    if i > N / 2:
        if a[i-1] == 1:
            hako[i] = a[i-1]
    else:
        count = 0
        for j in range(i+1,N+1,j):
            if j%i == 0:
                count += a[j-1]

        if count % 2 == a[i-1]:
            hako[i] = 0
        else:
            hako[i] = 1

print(sum(hako))

if sum(hako):
    ans = []
    for i, bin in enumerate(hako):
        if bin:
            ans.append(i)
    print(*ans)
Problem p02995 (python)

Fixed submission:
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

A, B, C, D = map(int, input().split())

CD = C*D//gcd(C, D)

count1 = (B // C - A // C)
count2 = (B // D - A // D)
count3 = (B // CD - A // CD)

if A % C == 0:
    count1 += 1

if A % D == 0:
    count2 += 1

if A % CD == 0:
    count3 += 1 

print(B - A + 1 - ((count1 + count2) - count3))

Buggy submission (verdict: Runtime Error):
import math

A, B, C, D = map(int, input().split())

CD = C*D//math.gcd(C, D)

Cs = A - (A%C)
Ds = A - (A%D)
CDs = A - (A%CD)

count1 = 0
count2 = 0
count3 = 0

while(True):
    if A <= Cs <= B:
        count1 += 1
    elif Cs > B:
        break
    Cs += C

while(True):
    if A <= Ds <= B:
        count2 += 1
    elif Ds > B:
        break
    Ds += D

while(True):
    if A <= CDs <= B:
        count3 += 1
    elif CDs > B:
        break
    CDs += CD

print(B - A + 1 - ((count1 + count2) - count3))
Problem p03037 (python)

Fixed submission:
N,M=map(int, input().split())

max = 0
min = 0

for _ in range(M):
    L,R = map(int, input().split())

    if min <= L:
        min = L
    elif min == 0:
        min = L

    if max >= R:
        max = R
    elif max == 0:
        max = R

ans = max - min + 1

if ans < 0:
    ans = 0

print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int, input().split())

max = 0
min = 0

for _ in range(M):
    L,R = map(int, input().split())

    if min < L:
        min = L
    elif min == 0:
        min = L

    if max > R:
        max = R
    elif max =+ 0:
        max = R

ans = max - min + 1

print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int, input().split())

max = 0
min = 0

for _ in range(M):
    L,R = map(int, input().split())

    if min < L:
        min = L
    elif min == 0:
        min = L

    if max > R:
        max = R
    elif max =+ 0:
        max = R

ans = max - min + 1

print(ans)
Problem p03061 (python)

Fixed submission:
def gcd(x,y):
    if x<y:
        x,y=y,x
    #x>y
    if y==0:
        return x
    if x%y==0:
        return y
    else:
        return gcd(y,x%y)

N=int(input())
A=[int(i) for i in input().split()]

L = [0 for i in range(N)]
R = [0 for i in range(N)]

for i in range(1,N):
    L[i] = gcd(L[i-1],A[i-1])

for i in range(N-1)[::-1]:
    R[i] = gcd(R[i+1],A[i+1])

Z=[gcd(L[i],R[i]) for i in range(N)]

print(max(Z))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

N = int(input())
A = tuple(map(int, input().split()))
ans = 1

for i in range(N):
    AL = list(A)
    AL.pop(i)
    ans = max(ans, gcd_list(AL))

print(ans)
Problem p03106 (python)

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

def func(M, L, K):
    count = 0

    for ans in reversed(range(1,L+1)):
        if M % ans == 0 and L % ans == 0:

            count += 1

            if count == K:
                print(ans)

if A > B:
    func(A, B, K)
else:
    func(B, A, K)

Buggy submission (verdict: Runtime Error):
def gcd( x, y ):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

N = gcd(A, B)
print(make_divisors(N)[-K])
Problem p03126 (python)

Fixed submission:
N, M = map(int, input().split())

C = [0]*(M+1)

for _ in range(N):
    li = list(map(int, input().split()))
    K = li[0]
    for i in range(K):
        C[li[i+1]] += 1
        # print(C)

print(C.count(N))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())

C = [0]*M

for _ in range(N):
    li = list(map(int, input().split()))
    K = li[0]
    for i in range(K):
        C[li[i]] += 1

print(C.count(N))
Problem p03290 (python)

Fixed submission:
import numpy as np

D, G = map(int, input().split())

PC = []
ans = 10 ** 9

for _ in range(D):
    PC.append(list(map(int, input().split())))

PC = np.array(PC)

for i in range(2 ** D):
    score = 0
    count = 0

    for j in range(D):
        if (i >> j) & 1:
            score += (j+1) * 100 * PC[j,0] + PC[j,1]
            count += PC[j,0]

    if score >= G:
        ans = min(ans, count)

    if score < G:
      for k in range(D):
            sub_score = 0
            sub_count = 0

            if ~(i >> k) & 1:
                for _ in range(PC[k,0] - 1):
                    sub_score += (k+1) * 100
                    sub_count += 1
                    if sub_score >= (G - score):
                        ans = min(ans, count+sub_count)
                        break

print(ans)

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

D, G = map(int, input().split())

PC = []
ans = 10 ** 9

for _ in range(D):
    PC.append(list(map(int, input().split())))

PC = np.array(PC)

for i in range(2 ** D):
    score = 0
    count = 0

    for j in range(D):
        if (i >> j) & 1:

          	score += (j+1) * 100 * PC[j,0] + PC[j,1]
            count += PC[j,0]

    if score >= G:
        ans = min(ans, count)

    if score < G:
      for k in range(D):
            sub_score = 0
            sub_count = 0

            if ~(i >> k) & 1:
                for _ in range(PC[k,0] - 1):
                    sub_score += (k+1) * 100
                    sub_count += 1
                    if sub_score >= (G - score):
                        ans = min(ans, count+sub_count)
                        break


print(ans)
Problem p03324 (python)

Fixed submission:
D,N = map(int, input().split())

if D == 0:
    if N != 100:
        print(N)
    else:
        print(101)

elif D == 1:
    if N != 100:
        print(100*N)
    else:
        print(100*101)

elif D == 2:
    if N != 100:
        print(100*100*N)
    else:
        print(100*100*101)

Buggy submission (verdict: Runtime Error):
D,N = map(int, input().split())

if D == 0:
    if N! = 100:
        print(N)
    else:
        print(101)

elif D == 1:
    if N != 100:
        print(100*N)
    else:
        print(100*101)

elif D == 2:
    if N != 100:
        print(100*100*N)
    else:
        print(100*100*101)
Problem p03433 (python)

Fixed submission:
N = int(input())
A = int(input())

n=N%500
if n<=A:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
S=0
N = int(input())
l = map(int, input().split())

l = list(sorted(l))

for i in range(1, N+1):
    if i%2 == 1:
        S+=l[N-i]
        #print(S)
    else:
        S-=l[N-i]
        #print(S)
            

#print('--------')
print(S)
Problem p03473 (python)

Fixed submission:
M = int(input())
print(48-M)

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

print(M+24)
Problem p03627 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))

C = {}

count = 0
H = 0
W = 0

res1=res2=res3=0

for i in A:
    C[i] = 0

for i in A:
    C[i] += 1

for i in A:
    if C[i] >= 2:
        res1 = max(res1, i)

for i in A:
    if C[i] >= 2 and i != res1:
        res2 = max(res2, i)

for i in A:
    if C[i] >= 4:
        res3 = max(res3, i)


print(max(res1 * res2, res3 * res3))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

C = [0] * 10 ** 9
count = 0
H = 0
W = 0

for i in range(N):
    C[A[i]] += 1

for i in range(N)[::-1]:
    if (C[i] >= 2) and (count == 0):
        H = i
        count += 1
    elif (C[i] >= 2) and (count == 1):
        W = i
        break

print(H * W)
Problem p03854 (python)

Fixed submission:
S = input()

while True:
    if len(S) == 0:
        print('YES')
        break
    else:
        if S[-5:]=='dream':
            S = S[:-5]
        elif S[-7:] == 'dreamer':
            S = S[:-7]
        elif S[-5:]== 'erase':
            S = S[:-5]
        elif S[-6:] == 'eraser':
            S = S[:-6]
        else:
            print('NO')
            break

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

while True:
    if len(S) == 0:
        print('YES')
        break
    else:
        if S[-5:]=='dream':
            S = S[:-5]
        elif S[-7:] == 'dreamer':
            S = S[:-7]
        elif S[-5:]== 'erase':
            S = S[:-5]
        elif S[-6:] == X4:
            S = S[:-6]
        else:
            print('NO')
            break
Problem p02981 (python)

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

Buggy submission (verdict: Runtime Error):
n,a,b = map(int,input.split())
return(min(n*a,b))
Problem p03455 (python)

Fixed submission:
a,b = map(int, raw_input().split())
c = a*b
if c % 2 == 0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
c = a*b
if c % 2 == 0:
  return Even
else:
  return Odd
Problem p03493 (python)

Fixed submission:
shio = str(raw_input())
counter = 0
i=0
while i < 3:
  if shio[i] == "1":
    counter +=1
  i +=1
print(counter)

Buggy submission (verdict: Runtime Error):
shio = string(raw_input())
counter = 0
for i in 2:
  if shio[i] == "1":
    counter +=1
print(counter)

Buggy submission (verdict: Runtime Error):
shio = string(raw_input())
counter = 0
for i in 2
	if shio[i] = "1":
    	counter+=1
print(counter)

Buggy submission (verdict: Runtime Error):
shio = string(input())
x = 0
for i in shio:
  if shio = "0":
    x+=1
Problem p02684 (python)

Fixed submission:
n,k=map(int,input().split())
a=[0]*n
a=list(map(int,input().split()))

List=[0]*n
pattern=[1]
now=0
nex=0
List[0]=1
end_flag=0

while end_flag==0:
    nex=a[now]
    if (List[nex-1]==1):
        target1=nex
        end_flag=1
        break
    else:
        List[nex-1]+=1
        pattern.append(nex)
        now=nex-1

left=pattern.index(target1)
right=len(pattern)
kaisu=right-left
kaisu2=(k-right)%kaisu


if (k<=right-1):
    print(pattern[k])
else:
    print(pattern[left+kaisu2])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=[0]*n
a=list(map(int,input().split()))

List=[0]*n
pattern=[1]
now=0
nex=0
List[0]=1
end_flag=0

while end_flag==0:
    nex=a[now]
    if (List[nex-1]==1):
        target1=nex
        end_flag=1
        break
    else:
        List[nex-1]+=1
        pattern.append(nex)
        now=nex-1

left=pattern.index(target1)
right=len(pattern)
kaisu=right-left
kaisu2=(k-right)%kaisu

if (k<=right):
    print(pattern[k])
else:
    print(pattern[left+kaisu2])
    
    
##print("left",left,"right",right)
#print(pattern[target])
#print(kaisu,target)
Problem p02690 (python)

Fixed submission:
x=int(input())
A=0
B=0

for i in range(-200,200):
    for j in range(-200,200):
        if (i**5-j**5==x):
            A=i
            B=j
print(A,B)

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

def make_divisors(n):
    divisors=[]
    for i in range(1,int(n**0.5)+1):
        if (n%i==0):
            divisors.append(i)
            if (i!=n//i):
                divisors.append(n//i)
    return divisors

Flag=0
for i in range(1,int(x**0.5)+1):
    if (x%i==0):
        List=make_divisors(i)
        for j in List:
            if ((j+i)**5-j**5==x):
                B=j
                A=B+i
                Flag=1
                break
            if ((-j+i)**5+j**5==x):
                B=-j
                A=B+i
                Flag=1
                break
        if (Flag==1):
            break
            
print(A,B)
Problem p02841 (python)

Fixed submission:
a,b=map(int,input().split())
c,d=map(int,input().split())
print(0 if a==c else 1 )

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
count=0
for i in range(1000):
    if (i<10):
        num="00"+str(i)
    elif (i<100):
        num="0"+str(i)
    else:
        num=str(i)
    k=0
    flag=num[0]
    for j in range(len(s)):
        if (flag==s[j]):
            if (k<2):
                k=k+1
                flag=num[k]
            elif (k==2):
                count+=1
                #print(num)
                break
print(count)
Problem p02885 (python)

Fixed submission:
a,b=map(int,input().split())
print(a-b*2 if (a-b*2>0) else 0)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input())
print(a-b*2 if (a-b*2>0) else 0)
Problem p03161 (python)

Fixed submission:
import sys
import numpy as np

input=sys.stdin.readline

n,k=map(int,input().split())
h=[0]*n
h=list(map(int,input().split()))

dp=np.zeros(n,dtype=int)
h=np.array(h)

for i in range(1,n):
  start=max(0,i-k)
  dp[i]=min(dp[start:i] + np.abs(h[i]-h[start:i]))

print(dp[n-1])

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

input=sys.stdin.readline

n,k=map(int,input().split())
h=[0]*n
h=list(map(int,input().split()))

dp=np.zeros(n,dtype=int)
h=np.array(h)

for i in range(1,n):
  start=max(0,i-k)
  dp[i]=min(dp[start:i] + np.abs(h[i]-h[start:i]))

print(dp[n-1])
Problem p03387 (python)

Fixed submission:
a=[0,0,0]
a[0],a[1],a[2]=map(int,input().split())
a=sorted(a)
sa1=a[2]-a[0]
sa2=a[2]-a[1]
if (a[0]%2==a[1]%2==a[2]%2):
  print(sa1//2 + sa2//2)
else:
  if (sa1%2==0 and sa2%2==1):
    print((sa1//2)+1 + (sa2+1)//2)
  elif (sa1%2==1 and sa2%2==0):
    print(((sa1+1)//2)+(sa2//2)+1)
  else:
    print((sa2-sa1)//2+sa1)

Buggy submission (verdict: Runtime Error):
a=[0,0,0]
a[0],a[1],a[2]=map(int,input().split())
a=sorted(a)
sa1=a[2]-a[0]
sa2=a[2]-a[1]
if (a[0]%2==a[1]%2==a[2]%2):
  print(sa1//2 + sa2//2)
else:
  if (sa1%2==0 and sa2%2==1):
    print((sa1//2)+1 + (sa2+1)//2)
  elif (sa1%2==1 and sa2%2==0):
    print(((sa1+1)//2) (sa2//2)+1)
  else:
    print((sa2-sa1)//2+sa1)