Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
s=input()
s=s[:m]+chr(ord(s[m])-ord('A')+ord('a'))+s[m+1:]
print(s)

Fixed submission:
n,m=map(int,input().split())
s=input()
s=s[:m-1]+chr(ord(s[m-1])-ord('A')+ord('a'))+s[m:]
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
dp1=[None]*100001
dp2=[None]*100001
dp1[0]=0
dp2[0]=0
n,W=map(int,input().split())
for i in range(n):
    w,v=map(int,input().split())
    for i in range(v,100001):
        if(dp2[i-v]!=None):
            if(dp2[i]==None):
                dp1[i]=dp2[i-v]+w
            else:
                dp1[i]=min(dp2[i],dp2[i-v]+w)
    dp2=list(dp1)
for i in range(100000,-1,-1):
    if(dp2[i]!=None and dp2[i]<=W):
        print(i)
        break
# 3 8
# 3 3
# 4 5
# 5 6

Fixed submission:
dp1=[None]*100001
dp2=[None]*100001
dp1[0]=0
dp2[0]=0
n,W=map(int,input().split())
for i in range(n):
    w,v=map(int,input().split())
    for i in range(v,100001):
        if(dp2[i-v]!=None):
            if(dp2[i]==None):
                dp1[i]=dp2[i-v]+w
            else:
                dp1[i]=min(dp2[i],dp2[i-v]+w)
    dp2=list(dp1)
for i in range(100000,-1,-1):
    if(dp2[i]!=None and dp2[i]<=W):
        print(i)
        break
# 3 8
# 3 3
# 4 5
# 5 6
Buggy python submission (verdict: Runtime Error):
S=int(input())
T=int(input())
count=0;
for i in range(0,len(S)):
    if (T[i]!=S[i]):
        count+=1
print(count)

Fixed submission:
S=input()
T=input()
count=0;
for i in range(0,len(S)):
    if (T[i]!=S[i]):
        count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
K=int(input())
N=int(input())
li=[]
for i in range(0,K):
  fruit=int(input())
  li.append(fruit)
  li.sort()
  sum1=0
  for i in range(0,N):
    sum1=sum1+li[i]
  print(sum1) 

Fixed submission:
K, N = (map(int,input().split()))
li=list(map(int,input().split()))
li.sort()
sum1=0
for i in range(0,N):
    sum1=sum1+li[i]
print(sum1)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

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

def solve():
    if 0 in l:
        return (0)
        sys.exit()

    x = 1
    for i in range(N):
        x = x * l[i]

    if x > (1000000000000000000):
        x = -1
        return str(x)
    else:
        return str(x)

print(solve())

Fixed submission:
import sys

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

def solve():
    if 0 in l:
        return (0)
        sys.exit()

    x = 1
    for i in range(N):
        x = x * l[i]
        if x > (1000000000000000000):
            x = -1
            break

    return str(x)

print(solve())

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
l = list(map(int, input().split()))

def solve():
    x = 1
    for i in range(N):
        x = x * l[i]

    if x > (1000000000000000000):
        x = -1
        return str(x)
    else:
        return str(x)

print(solve())

Fixed submission:
import sys

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

def solve():
    if 0 in l:
        return (0)
        sys.exit()

    x = 1
    for i in range(N):
        x = x * l[i]
        if x > (1000000000000000000):
            x = -1
            break

    return str(x)

print(solve())

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
l = list(map(int, input().split()))

x = 1
for i in range(N):
    x = x * l[i]

if x > (1000000000000000000):
    x = -1
    print(x)
else:
    print(x)

Fixed submission:
import sys

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

def solve():
    if 0 in l:
        return (0)
        sys.exit()

    x = 1
    for i in range(N):
        x = x * l[i]
        if x > (1000000000000000000):
            x = -1
            break

    return str(x)

print(solve())

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
l = list(map(int, input().split()))

x = 1
for i in range(N):
    x = x * l[i]

if x > 10 ** 18:
    x = -1
    print(x)
else:
    print(x)

Fixed submission:
import sys

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

def solve():
    if 0 in l:
        return (0)
        sys.exit()

    x = 1
    for i in range(N):
        x = x * l[i]
        if x > (1000000000000000000):
            x = -1
            break

    return str(x)

print(solve())
Buggy python submission (verdict: Runtime Error):
s = input()
x = ord(s[0])
if x>=65 and x<=90:
  print("A")
else if x>=97 and x<=122:
  print("a")

Fixed submission:
s = input()
x = ord(s[0])
if x>=65 and x<=90:
  print("A")
elif x>=97 and x<=122:
  print("a")
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(map(int, input().split()))
u = list(set(l))
if len(u)==1 and u[0]==0:
  print("Yes")
elif n%3==0:
  if len(u)==2:
  	x = l.count(u[0])
  	y = l.count(u[1])
    if (x==2*n/3 and y==n/3) or (y==2*n/3 and x==n/3):
      print("Yes")
    else:
      print("No")
  elif len(u)==3:
    x = l.count(u[0])
  	y = l.count(u[1])
    z = l.count(u[2])
    if x==n/3 and y==n/3 and z==n/3:
      print("Yes")
    else:
      print("No")
  else:
    print("No")
else:
  print("No")

Fixed submission:
n = int(input())
l = list(map(int, input().split()))
u = list(set(l))
if len(u)==1 and u[0]==0:
  print("Yes")
elif n%3==0:
  if len(u)==2:
    x = l.count(u[0])
    y = l.count(u[1])
    if (x==2*n/3 and y==n/3 and u[1]==0) or (y==2*n/3 and x==n/3 and u[0]==0):
      print("Yes")
    else:
      print("No")
  elif len(u)==3:
    x = l.count(u[0])
    y = l.count(u[1])
    z = l.count(u[2])
    if x==n/3 and y==n/3 and z==n/3 and ((u[0]^u[1])^u[2])==0:
      print("Yes")
    else:
      print("No")
  else:
    print("No")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
x = input().split()  
n,q = int(x[0]), int(x[1])  
a = input() 
l = [] 

for i in range(1,n+1):
  x = a[:i] 
  cnt = x.count('AC') 
  l.append(cnt) 

for i in range(q):
  y = input().split()  
  le,ri = int(y[0]),int(y[1])  
  print(l[ri-1]-l[le-1]) 


Fixed submission:
n,q = map(int, input().split())  
a = input() 
l = [0]*n; 

for i in range(2,n+1):
    x = a[(i-2):i]
    l[i-1] = l[i-2]
    if x=='AC':
        l[i-1] += 1

for i in range(q):
  le,ri = map(int, input().split())  
  print(l[ri-1]-l[le-1])

Buggy python submission (verdict: Time Limit Exceeded):
x = input().split() 
n,q = int(x[0]), int(x[1]) 
a = input()
for i in range(q):
  y = input().split() 
  l,r = int(y[0]),int(y[1]) 
  x = a[l-1:r]
  print(x.count('AC')) 

Fixed submission:
n,q = map(int, input().split())  
a = input() 
l = [0]*n; 

for i in range(2,n+1):
    x = a[(i-2):i]
    l[i-1] = l[i-2]
    if x=='AC':
        l[i-1] += 1

for i in range(q):
  le,ri = map(int, input().split())  
  print(l[ri-1]-l[le-1])
Buggy python submission (verdict: Runtime Error):
l = sorted(map,input().split())
print((l[0]*l[1])//2)

Fixed submission:
l = sorted(map(int,input().split()))
print((l[0]*l[1])//2)
Buggy python submission (verdict: Runtime Error):
a,b = map(int, input())
if	(a*b)%2==1:
  print("Yes")
else:
  print("No")

Fixed submission:
a,b = map(int, input().split())
if	(a*b)%2==1:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
a,b = map(int, input().split())
print(max(a+b,max(a-b,a*b))

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

Buggy python submission (verdict: Runtime Error):
a,b = map(int, input().split())
print(min(a+b,min(a-b,a*b))

Fixed submission:
a,b = map(int, input().split())
print(max(a+b,max(a-b,a*b)))
Buggy python submission (verdict: Runtime Error):
s = input()
s[3] = '8'
print(s)

Fixed submission:
s = input()
r = s[:3]+'8'+s[4:]
print(r)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
d = list(map(int,input().split()))
cnt = {}
for i in d:
  if i not in cnt:
    cnt[i] = d.count(i)
m = int(input())
t = list(map(int,input().split()))
flag = True
for i in t:
  if i in cnt:
    if cnt[i]>0:
      cnt[i] -= 1
    else:
      flag = False
      break
  else:
    flag = False
    break
if flag:
  print("YES")
else:
  print("NO")

Fixed submission:
n = int(input())
d = list(map(int,input().split()))
cnt = {}
for i in d:
  if i not in cnt:
    cnt[i] = 1
  else:
    cnt[i] += 1
m = int(input())
t = list(map(int,input().split()))
flag = True
for i in t:
  if i in cnt:
    if cnt[i]>0:
      cnt[i] -= 1
    else:
      flag = False
      break
  else:
    flag = False
    break
if flag:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
s = input()
if len(s)>=4 and s[:4] = "YAKI":
  print("Yes")
else:
  print("No")

Fixed submission:
s = input()
if len(s)>=4 and s[:4] == "YAKI":
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = []
cnt = 0
for i in range(n):
    x = int(input())
    l.append(x)

x = set()
for i in l:
    if i in x:
        continue
    else:
        x.add(i)
        if l.count(i)%2 ==1:
            #print(i, l.count(i))
            cnt+=1
print(cnt)

Fixed submission:
n = int(input())
l = []
cnt = 0
for i in range(n):
    x = int(input())
    l.append(x)


x = sorted(l)
i=1
same=1
while i<n:
    if x[i]==x[i-1]:
        same += 1
    else:
        if same%2 == 1:
            cnt += 1
        same = 1
    i += 1

cnt += same%2
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
c=1
f=1
a=list(map(int,input().split()))
for i in range(0,n):
  if a[i]==0:
    f=1
    c=0
    break
  if c*a[i]>1e18 or f==0:
    c*=a[i]
    f=0
    continue
  c*=a[i]
if f==0: print(-1)
else: print(c)

Fixed submission:
n=int(input())
c=1
f=1
a=list(map(int,input().split()))
for i in range(0,n):
  if a[i]==0:
    f=1
    c=0
    break
  if f==0: continue
  if c*a[i]>1e18:
    c*=a[i]
    f=0
    continue
  c*=a[i]
if f==0: print(-1)
else: print(c)
Buggy python submission (verdict: Runtime Error):
n = input()
print(n**3)

Fixed submission:
n = int(input())
print(n**3)
Buggy python submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
tot = sum(B)
for i in range(n-1):
  if A[i+1] == A[i]+1:
    tot += C[A[i]]
print(tot)

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

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

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
tot = sum(B)
for i in range(n-1):
  if A[i+1] == A[i]+1:
    tot += C[A[i]-1]
print(tot)
Buggy python submission (verdict: Runtime Error):
n = int(input())
B = list(map(int, input().split()))
tot = B[0]+B[-1]
for i in range(n-1):
  tot += min(B[i], B[i+1])
print(tot)

Fixed submission:
n = int(input())
B = list(map(int, input().split()))
tot = B[0]+B[-1]
for i in range(n-2):
  tot += min(B[i], B[i+1])
print(tot)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())

value = abs(N - K)

if K == 1:
    print(0)
    exit()

while True:
    if abs(value - K) > abs(value):
        break
    value = abs(value - K)

print(value)

Fixed submission:
N, K = map(int, input().split())
a = N // K
value = abs(N - a * K)
if K == 1:
    print(0)
    exit()
while True:
    if abs(value - K) > abs(value):
        break
    value = abs(value - K)
print(value)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
ans = {0:1}
memo = [0]
for ind, s in enumerate(S[::-1]):
    memo.append(int(S[-ind-1:]) % 2019)
    if(memo[-1] in ans):
        ans[memo[-1]] += 1
    else:
        ans[memo[-1]] = 1

res = 0
for key in ans.keys():
    res += ans[key]*(ans[key]-1)//2
print(res)

Fixed submission:
S = input()
ans = {0:1}
memo = [0]
last = 1
for ind, s in enumerate(S[::-1]):
    memo.append((int(s) * last + memo[-1]) % 2019)
    last *= 10
    last %= 2019
    if(memo[-1] in ans):
        ans[memo[-1]] += 1
    else:
        ans[memo[-1]] = 1

res = 0
for key in ans.keys():
    res += ans[key]*(ans[key]-1)//2
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
ans = {0:1}
memo = [0]
for ind, s in enumerate(S[::-1]):
    memo.append((memo[-1]+int(s)*(10**ind))%2019)
    if(memo[-1] in ans):
        ans[memo[-1]] += 1
    else:
        ans[memo[-1]] = 1

res = 0
for key in ans.keys():
    res += ans[key]*(ans[key]-1)//2
print(res)






Fixed submission:
S = input()
ans = {0:1}
memo = [0]
last = 1
for ind, s in enumerate(S[::-1]):
    memo.append((int(s) * last + memo[-1]) % 2019)
    last *= 10
    last %= 2019
    if(memo[-1] in ans):
        ans[memo[-1]] += 1
    else:
        ans[memo[-1]] = 1

res = 0
for key in ans.keys():
    res += ans[key]*(ans[key]-1)//2
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
N, K, C = [int(i) for i in input().split()]
S = input()
ok_days = []
for ind, s in enumerate(S):
    if(s=='o'):
        ok_days.append(ind+1)

def search(li, ext):
    last = 0
    cnt = 0
    for i in li:
        if(i==ext):
            continue
        if(i>last):
            cnt += 1
            last = i+C
        if(cnt>=K):
            return True
    return False

for cand in ok_days:
    if(not search(ok_days, cand)):
        print(cand)
    

Fixed submission:
N, K, C = [int(i) for i in input().split()]
S = input()
ok_days = []
fdp = []
bdp = []

for ind, s in enumerate(S):
    if(s=='o'):
        ok_days.append(ind+1)

last = 0
fseen = set()
for i in ok_days:
    if(i>last):
        fseen.add(i)
        last = i+C

last = ok_days[-1]+1
bseen = set()
for i in ok_days[::-1]:
    if(i<last):
        bseen.add(i)
        last = i-C

ans = fseen&bseen
if(len(fseen)<=K and len(bseen)<=K):
    for i in sorted(list(ans)):
        print(i)
Buggy python submission (verdict: Time Limit Exceeded):
N, X, Y = [int(i) for i in input().split()]
gp = [[float('inf')]*N for _ in range(N)]

def warshall_floyd(d,n):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d



for i in range(N-1):
    gp[i][i+1] = 1
    gp[i+1][i] = 1
    if(i==X-1):
        gp[i][Y-1] = 1
        gp[Y-1][i] = 1

d = warshall_floyd(gp, N)
li = [0]*(N-1)
for i in range(N):
    for j in range(i+1, N):
        li[d[i][j]-1] += 1

for i in li:
    print(i)



Fixed submission:
N, X, Y = [int(i) for i in input().split()]
li = [0]*(N-1)
for i in range(1, N+1):
    for j in range(i+1, N+1):
        k = 0
        if(i<X and j<X):
            k = j-i
        if(i<X and X<=j<=Y):
            k = min(j-i, X-i+1+Y-j)
        if(i<X and Y<j):
            k = X-i+1+j-Y
        if(X<=i<=Y and X<=j<=Y):
            k = min(j-i, i-X+1+Y-j)
        if(X<=i<=Y and Y<j):
            k = min(j-i, i-X+1+j-Y)
        if(Y<i and Y<j):
            k = j-i
        li[k-1] += 1

for i in li:
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

def main():
    S = input()[:-1]
    Q = int(input())
    li = ['' for _ in range(2)]
    now = 0
    for _ in range(Q):
        x = input()
        if(x[0] == '2'):
            if(x[2]=='1'):
                li[1-now] += x[4]
            else:
                li[now] += x[4]
        else:
            now = 1-now

    print(li[1-now][::-1]+S[::-(now*2-1)]+li[now])
    

if __name__ == '__main__':
    main()

Fixed submission:
import sys
input = sys.stdin.readline

def main():
    S = input()[:-1]
    Q = int(input())
    li = [[] for _ in range(2)]
    now = 0
    for _ in range(Q):
        x = input()
        if(x[0] == '2'):
            if(x[2]=='1'):
                li[1-now].append(x[4])
            else:
                li[now].append(x[4])
        else:
            now = 1-now

    s = ''.join(li[1-now][::-1]) + S[::-(now*2-1)] + ''.join(li[now])
    print(s)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

def main():
    S = input()[:-1]
    Q = int(input())
    now = 1
    for _ in range(Q):
        x = input()
        if(x[0] == '2'):
            if(x[2]=='1'):
                if(now == 1):
                    S = x[4] + S
                else:
                    S += x[4]
            else:
                if(now == 1):
                    S += x[4]
                else:
                    S = x[4] + S
        else:
            now *= -1

    print(S[::now])

if __name__ == '__main__':
    main()

Fixed submission:
import sys
input = sys.stdin.readline

def main():
    S = input()[:-1]
    Q = int(input())
    li = [[] for _ in range(2)]
    now = 0
    for _ in range(Q):
        x = input()
        if(x[0] == '2'):
            if(x[2]=='1'):
                li[1-now].append(x[4])
            else:
                li[now].append(x[4])
        else:
            now = 1-now

    s = ''.join(li[1-now][::-1]) + S[::-(now*2-1)] + ''.join(li[now])
    print(s)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())
now = 1
for _ in range(Q):
    query = [i for i in input().split()]
    if(query[0] == '2'):
        if(query[1]=='1'):
            if(now == 1):
                S = query[2] + S
            else:
                S += query[2]
        else:
            if(now == 1):
                S += query[2]
            else:
                S = query[2] + S
    else:
        now *= -1

print(S[::now])

Fixed submission:
import sys
input = sys.stdin.readline

def main():
    S = input()[:-1]
    Q = int(input())
    li = [[] for _ in range(2)]
    now = 0
    for _ in range(Q):
        x = input()
        if(x[0] == '2'):
            if(x[2]=='1'):
                li[1-now].append(x[4])
            else:
                li[now].append(x[4])
        else:
            now = 1-now

    s = ''.join(li[1-now][::-1]) + S[::-(now*2-1)] + ''.join(li[now])
    print(s)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
N, M = [int(i) for i in input().split()]
di = {}
flag = True
for _ in range(M):
    s, c = [int(i) for i in input().split()]
    if(s in di):
        if(di[s] != c):
            print(-1)
            flag = False
            break
    else:
        di[s] = c

if(1 in di):
    if(di[1]==0):
        print(-1)
        break

if(flag):
    for i in range(10**(N-1), 10**N):
        x = str(i)
        ok = True
        for ind, s in enumerate(x):
            if(ind+1 in di):
                if(di[ind+1] != int(s)):
                    ok = False
                    continue
        if(ok):
            print(i)
            break
    else:
        print(-1)




Fixed submission:
N, M = [int(i) for i in input().split()]
di = {}
flag = True
for _ in range(M):
    s, c = [int(i) for i in input().split()]
    if(s in di):
        if(di[s] != c):
            print(-1)
            flag = False
            break
    else:
        di[s] = c

if(1 in di):
    if(di[1]==0):
        if(N==1):
            print(0)
        else:
            print(-1)
        flag = False

if(N==1 and M==0):
    print(0)
    flag=False

if(flag):
    for i in range(10**(N-1), 10**N):
        x = str(i)
        ok = True
        for ind, s in enumerate(x):
            if(ind+1 in di):
                if(di[ind+1] != int(s)):
                    ok = False
                    continue
        if(ok):
            print(i)
            break
    else:
        print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
import fractions
import math
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, M = [int(i) for i in input().split()]
A = [int(i)//2 for i in input().split()]

x = lcm(*A)
for a in A:
    if((x//a)%2==0):
        print(0)
        break
else:
    print(math.ceil((M//x)/2))



Fixed submission:
# import fractions as math
import math

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

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

N, M = [int(i) for i in input().split()]
A = [int(i)//2 for i in input().split()]
lcm_A = 1
for a in A:
    lcm_A = lcm(lcm_A, a)
    if((lcm_A//a)%2==0):
        print(0)
        break
else:
    print(math.ceil((M//lcm_A)/2))
Buggy python submission (verdict: Runtime Error):
S, T = [int(i) for i in input().split()]
print(T+S)

Fixed submission:
S, T = [i for i in input().split()]
print(T+S)
Buggy python submission (verdict: Time Limit Exceeded):
import re
N = int(input())
S = input()
cnt = 0

for i in range(1000):
    str_i = '{:03}'.format(i)
    found = 0
    for s in S:
        if(s==str_i[found]):
            found += 1
            if(found == 3):
                cnt += 1
                break
print(cnt)      

Fixed submission:
N = int(input())
S = input()
cnt = 0

for i in range(1000):
    str_i = '{:03}'.format(i)
    found = 0
    for s in S:
        if(s==str_i[found]):
            found += 1
            if(found == 3):
                cnt += 1
                break
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
import re
N = int(input())
S = input()
cnt = 0

for i in range(1000):
    str_i = '{:03}'.format(i)
    pattern = '.*'+str_i[0]+'.*'+str_i[1]+'.*'+str_i[2]
    if(re.match(pattern, S)!=None):
        cnt += 1

print(cnt)


Fixed submission:
N = int(input())
S = input()
cnt = 0

for i in range(1000):
    str_i = '{:03}'.format(i)
    found = 0
    for s in S:
        if(s==str_i[found]):
            found += 1
            if(found == 3):
                cnt += 1
                break
print(cnt)
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input())
if(A<10 and B<10):
  print(A*B)
else:
  print(-1)

Fixed submission:
A,B = map(int,input().split())
if(A<10 and B<10):
  print(A*B)
else:
  print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect

N = int(input())
L = [int(i) for i in input().split()]
L.sort()
ans = 0

for ind_a, a in enumerate(L):
    for ind_b, b in enumerate(L[ind_a+1:]):

        x = bisect.bisect_left(L[ind_b+ind_a+2:], a+b)
        ans += x

print(ans)


Fixed submission:
import bisect

N = int(input())
L = [int(i) for i in input().split()]
L.sort()
ans = 0

for ind_a, a in enumerate(L):
    for ind_b, b in enumerate(L[ind_a+1:]):
        x = bisect.bisect_left(L[ind_b+ind_a+2:], a+b)
        ans += x

print(ans)
Buggy python submission (verdict: Runtime Error):
N,K = [int(x) for x in input().split()]
S = input()
li = [1]
ans = 0
cnt = 0
for ind,s in enumerate(S[:-1]):
    if(s==S[ind+1]):
        li[-1]+=1
    else:
        li.append(1)
for ind,i in enumerate(li):
    if(ind%2==1 and cnt<=K):

Fixed submission:
N,K = [int(x) for x in input().split()]
S = input()
#%%
li = [1]
ans = 0
cnt = 0

for ind,s in enumerate(S[:-1]):
    if(s==S[ind+1]):
        li[-1]+=1
    else:
        li.append(1)

#%%
for ind,i in enumerate(li):
    if(ind==0):
        ans += i-1
    elif(ind<=2*K):
        ans += i
    else:
        ans += max(i-1,0)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
mod = 10**9+7
S = input()
dp = [[0]*13 for _ in range(len(S)+1)]
dp[0][0] = 1
for ind,s in enumerate(S):
    if(s=='?'):
        for i in range(10):
            for j in range(13):
                dp[ind+1][(j*10+i)%13] += dp[ind][j]
                dp[ind+1][(j*10+i)%13] %= mod
    else:
        for j in range(13):
            dp[ind+1][(j*10+int(s))%13] += dp[ind][j]
            dp[ind+1][(j*10+int(s))%13] %= mod
print(dp[len(S)][5])

Fixed submission:
mod = 10**9+7
S = input()
n = len(S)
dp = [[0]*13 for _ in range(n+1)]
dp[0][0] = 1
for ind,s in enumerate(S):
    if(s=='?'):
        for i in range(10):
            for j in range(13):
                dp[ind+1][(j*10+i)%13] += dp[ind][j]
                dp[ind+1][(j*10+i)%13] %= mod
    else:
        for j in range(13):
            dp[ind+1][(j*10+int(s))%13] += dp[ind][j]
            dp[ind+1][(j*10+int(s))%13] %= mod
print(dp[n][5])