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

Fixed submission:
# from math import factorial,sqrt,ceil #,gcd
# from itertools import permutations,combinations,combinations_with_replacement
# from collections import deque,Counter
# import re
# from bisect import bisect_left
# from heapq import heappush,heappop
# from numba import njit,jit
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from fractions import gcd

# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
from networkx import Graph
from networkx.algorithms.traversal.breadth_first_search import bfs_predecessors
G = Graph()
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb,perm #permはnPk

# slist = "abcdefghijklmnopqrstuvwxyz"
N,M = map(int,input().split())
rows = [list(map(int,input().split())) for _ in range(M)]

G.add_edges_from(rows)

# shortestPath = shortest_path(G,target=1)
preds = bfs_predecessors(G,source=1)
# shortestPath = single_target_shortest_path(G,target=1)
# shortestPathLength,shortestPath = single_source_dijkstra(G,source=1)

preds = dict(preds)
if len(preds)+1 != N:
    print("No")
    exit()

print("Yes")
for i in range(2,N+1):
    print(preds[i])

Buggy submission (verdict: Runtime Error):
# from math import factorial,sqrt,ceil #,gcd
# from itertools import permutations,combinations,combinations_with_replacement
# from collections import deque,Counter
# import re
# from bisect import bisect_left
# from heapq import heappush,heappop
# from numba import njit
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from fractions import gcd

# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
from networkx import Graph,shortest_path,single_target_shortest_path,astar_path
G = Graph()
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb,perm #permはnPk

# slist = "abcdefghijklmnopqrstuvwxyz"
N,M = map(int,input().split())
rows = [list(map(int,input().split())) for _ in range(N)]

G.add_edges_from(rows)
# shortestPath = shortest_path(G,target=1)
# shortestPath = single_target_shortest_path(G,target=1)
ans = ["Yes"]
for i in range(2,N+1):
    try:
        shortestPath = astar_path(G,source=i,target=1)
        ans.append(shortestPath[1])
    except:
        print("No")
        exit()

print(*ans,sep="\n")
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))
Problem p02756 (python)

Fixed submission:
s = input()
q = int(input())

query_list = []
for _ in range(q):
    query_list += [input()]


def query1(s):
    s = s[::-1]
    return s

def query2_1(letters,s):
    s = letters[4] + s
    return s

def query2_2(letters,s):
    s = s +  letters[4]
    return s

true_position = True
left = ""
right = ""

for i in range(q):
    if len(query_list[i])==1:
        true_position = not true_position
        # print(s)
    else:
        if query_list[i][2]=="1":
            if true_position:
                left = query_list[i][4] + left
            else:
                right = right + query_list[i][4]
        elif query_list[i][2]=="2":
            if true_position:
                right = right + query_list[i][4]
            else:
                left = query_list[i][4] + left

if true_position:
    ans = left + s + right
else:
    ans = right[::-1]+s[::-1]+left[::-1]

print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque

s = input()
q = int(input())

query_list = []
for _ in range(q):
    query_list += [input()]

deq = deque(s)
true_position = True

for i in range(q):
    if len(query_list[i])==1:
        true_position = not true_position
        # print(s)
    else:
        if query_list[i][2]=="1":
            if true_position:
                deq.appendleft(query_list[i][4])
            else:
                deq.append(query_list[i][4])
        elif query_list[i][2]=="2":
            if true_position:
                deq.append(query_list[i][4])
            else:
                deq.appendleft(query_list[i][4])

if true_position:
    ans = "".join(deq)
else:
    ans = "".join(deq.reverse())

print(ans)
Problem p02772 (python)

Fixed submission:
import numpy as np

n = int(input())
arrA = np.array(input().split(),dtype=np.int64)

filter = (arrA % 2 == 0)
if len(arrA[filter])==0:
    ans = "APPROVED"
else:
    for i in arrA[filter]:
        if i%3==0 or i%5==0:
            ans = "APPROVED"
        else:
            ans = "DENIED"
            break

# APPROVED or DENIED
print(ans)

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

n = int(input())
arrA = np.array(input().split(),dtype=np.int64)

filter = (arrA % 2 == 0)
if len(arrA[filter])==0:
    ans == "APPROVED"
else:
    for i in arrA[filter]:
        if i%3==0 or i%5==0:
            ans = "APPROVED"
        else:
            ans = "DENIED"
            break

# APPROVED or DENIED
print(ans)

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

n = int(input())
arrA = np.array(input().split(),dtype=np.int64)

filter = (arrA % 2 == 0)
for i in arrA[filter]:
    if i%3==0 or i%5==0:
        ans = "APPROVED"
    else:
        ans = "DENIED"
        break

# APPROVED or DENIED
print(ans)
Problem p02882 (python)

Fixed submission:
import math

A,B,X = map(int,input().split())

fullBottle = A*A*B

if fullBottle >= X*2:
    C = 2*X/(A*B)
    ans = math.degrees(math.atan(C/B))
    print(90-ans)
else:
    C = 2*(B-X/(A**2))
    ans = math.degrees(math.atan(C/A))
    print(ans)

Buggy submission (verdict: Runtime Error):
import math

A,B,X = map(int,input().split())

fullBottle = A*A*B

if fullBottle >= X*2:
    C = 2*X/(A*B)
    ans = math.degrees(math.atan(C/B))
    print(90-ans)
else:
    C = 2*(B-X/(A**2))
    ans = math.degrees(math.atan(A/C))
    print(90-ans)

Buggy submission (verdict: Runtime Error):
import math

A,B,X = map(int,input().split())

fullBottle = A*A*B

if fullBottle >= X*2:
    C = 2*X/(A*B)
    ans = math.degrees(math.atan(C/B))
    print(90-ans)
else:
    C = 2*(B-X/(A**2))
    ans = math.degrees(math.atan(A/C))
    print(90-ans)
Problem p02975 (python)

Fixed submission:
from collections import deque,Counter

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

cnt = Counter(lisA)

if len(cnt)>3:
    print("No")
    exit()

if len(cnt) == 1:
    if lisA[0] == 0:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
elif len(cnt) == 2:
    if not 0 in cnt:
        print("No")
        exit()
    else:
        keys = sorted(list(cnt.keys()))
        another = keys[-1]
        if cnt[0]*2 == cnt[another]:
            print("Yes")
            exit()
        else:
            print("No")
            exit()
else:
    keys = sorted(list(cnt.keys()))
    if keys[0]^keys[1]^keys[2] != 0:
        print("No")
        exit()
    else:
        if cnt[keys[0]]==cnt[keys[1]]==cnt[keys[2]]:
            print("Yes")
            exit()
        else:
            print("No")
            exit()

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

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

cnt = Counter(lisA)

if len(cnt)>3:
    print("No")
    exit()

if len(cnt) == 1:
    if lisA[0] == 0:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
elif len(cnt) == 2:
    if not 0 in cnt:
        print("No")
        exit()
    else:
        keys = sorted(list(cnt.keys()))
        another = keys[-1]
        if cnt[0]*2 == cnt[another]:
            print("Yes")
            exit()
        else:
            print("No")
            exit()
else:
    keys = sorted(list(cnt.keys()))
    if keys[0]^keys[1]^keys[2] != 0:
        print("No")
        exit()
    else:
        if cnt(keys[0])==cnt(keys[1])==cnt(keys[2]):
            print("yes")
            exit()
        else:
            print("No")
            exit()
Problem p03102 (python)

Fixed submission:
# from math import factorial,sqrt,ceil
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

import numpy as np
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix

# strlist = "abcdefghijklmnopqrstuvwxyz"
n,m,c = map(int,input().split())
B = np.array(input().split(),dtype=np.int64)
times = n
table = []
for _ in range(times):
    table.append(list(map(int,input().split()))) # 行列の場合
A = np.array(table)

lis = np.dot(A,B) +c
anslis = np.bincount(lis > 0,minlength=2)
ans = anslis[1]

print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

Buggy submission (verdict: Runtime Error):
# from math import factorial,sqrt,ceil
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

import numpy as np
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix

# strlist = "abcdefghijklmnopqrstuvwxyz"
n,m,c = map(int,input().split())
B = np.array(input().split(),dtype=np.int64)
times = n
table = []
for _ in range(times):
    table.append(list(map(int,input().split()))) # 行列の場合
A = np.array(table)

lis = np.dot(A,B) +c
ans = np.bincount(lis > 0)[1]

print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))
Problem p03106 (python)

Fixed submission:
# from math import factorial,sqrt,ceil
# from itertools import permutations as permus
from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix

# strlist = "abcdefghijklmnopqrstuvwxyz"
a,b,k = map(int,input().split())

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

c = gcd(a,b)
anslis = makedivs(c)
anslis.sort()

print(anslis[-k])
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

Buggy submission (verdict: Runtime Error):
from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix

# strlist = "abcdefghijklmnopqrstuvwxyz"
a,b,k = map(int,input().split())

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

c = gcd(a,b)
anslis = makedivs(c)
anslis.sort()

print(anslis[-k])
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))
Problem p03231 (python)

Fixed submission:
from fractions import gcd

N,M = map(int,input().split())
S = input()
T = input()

G = gcd(N, M)
L = N * M // G
ng = N//G
mg = M//G

for i in range(G):
    Nnum = i*ng
    Mnum = i*mg
    if S[Nnum] != T[Mnum]:
        print(-1)
        exit()

print(L)

Buggy submission (verdict: Runtime Error):
from fractions import gcd

N,M = map(int,input().split())
S = input()
T = input()
if len(S) < len(T):
    S,T = T,S

Xlen = N * M // gcd(N, M)
X = [0] * Xlen

for i,s in enumerate(list(S)):
    num = i*(Xlen//N)
    X[num] = s

for i,t in enumerate(list(T)):
    num = i*(Xlen//M)
    if X[num] == 0 or X[num] == t:
        continue
    else:
        print(-1)
        exit()

print(Xlen)

Buggy submission (verdict: Runtime Error):
from fractions import gcd

N,M = map(int,input().split())
S = input()
T = input()

Xlen = N * M // gcd(N, M)
X = [0] * Xlen

for i,s in enumerate(list(S)):
    num = i*(Xlen//N)
    X[num] = s

for i,t in enumerate(list(T)):
    num = i*(Xlen//M)
    if X[num] == 0 or X[num] == t:
        continue
    else:
        print(-1)
        exit()

print(Xlen)
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())

len1s = 0
for i in range(len(s)):
    if s[i] == "1":
        len1s += 1
        continue
    else:
        res = s[i]
        break
else:
    res = "1"

if k <= len1s:
    ans = "1"
else:
    ans = res

print(ans)

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

for i in range(len(s)):
    if s[i] == "1":
        continue
    else:
        ans = s[i]
        break
    ans = "1"

print(ans)
Problem p03319 (python)

Fixed submission:
from math import factorial,sqrt,ceil #,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
N,K = map(int,input().split())
arrA = list(map(int,input().split()))
ans = ceil((N-1)/(K-1))
print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

Buggy submission (verdict: Runtime Error):
from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
N,K = map(int,input().split())
arrA = list(map(int,input().split()))
ans = ceil((N-1)/(K-1))
print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))
Problem p03408 (python)

Fixed submission:
# import math
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque
from collections import Counter

# import numpy as np
# import scipy as scp

# 入力の受け取り
n = int(input())
arrN = []
for _ in range(n):
    arrN += [input()]  #table.append(input())とも書ける
m = int(input())
arrM = []
for _ in range(m):
    arrM += [input()]  #table.append(input())とも書ける

countaN = Counter(arrN)
countaM = Counter(arrM)
countaAns = countaN - countaM

if len(countaAns) !=0:
    s,ans = countaAns.most_common()[0]
else:
    ans = 0

print(ans)

Buggy submission (verdict: Runtime Error):
# import math
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque
from collections import Counter

# import numpy as np
# import scipy as scp

# 入力の受け取り
n = int(input())
arrN = []
for _ in range(n):
    arrN += [input()]  #table.append(input())とも書ける
m = int(input())
arrM = []
for _ in range(m):
    arrM += [input()]  #table.append(input())とも書ける

countaN = Counter(arrN)
countaM = Counter(arrM)
countaAns = countaN - countaM

s,ans = countaAns.most_common()[0]

print(ans)
Problem p03607 (python)

Fixed submission:
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
N = int(input())
rows = [int(input()) for _ in range(N)]
cnt = Counter(rows)
ans = 0
for k,v in cnt.items():
    if v%2 == 1:
        ans += 1
        
print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

Buggy submission (verdict: Runtime Error):
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
N = int(input())
rows = [int(input()) for _ in range(N)]
arr = np.array(rows)
key,idx,cnt = np.unique(arr,return_index=True,return_counts=True)
cnt = cnt[cnt%2==1]
ans = len(cnt)

print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))
Problem p03681 (python)

Fixed submission:
from math import factorial,sqrt,ceil #,gcd

N,M = map(int,input().split())
MOD = 10**9 + 7

if abs(N-M)>=2:
    print(0)
    exit()

if N==M:
    ans = factorial(N) % MOD
    ans = ans * factorial(M) % MOD
    ans = ans * 2 % MOD  
    print(ans)
    exit()
elif N>M:
    ans = factorial(N) % MOD * factorial(M) % MOD
    print(ans)
    exit()
elif M>N:
    ans = factorial(M) % MOD * factorial(N) % MOD
    print(ans)
    exit()

Buggy submission (verdict: Runtime Error):
from math import factorial,sqrt,ceil,gcd

N,M = map(int,input().split())
MOD = 10**9 + 7

if abs(N-M)>=2:
    print(0)
    exit()

if N==M:
    ans = factorial(N) % MOD
    ans = ans * factorial(M) % MOD
    ans = ans * 2 % MOD  
    print(ans)
    exit()
elif N>M:
    ans = factorial(N) % MOD * factorial(M) % MOD
    print(ans)
    exit()
elif M>N:
    ans = factorial(M) % MOD * factorial(N) % MOD
    print(ans)
    exit()
Problem p03695 (python)

Fixed submission:
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
N = int(input())
arrA = np.array(input().split(),dtype=np.int64)
bins = np.array([400,800,1200,1600,2000,2400,2800,3200,4801])
arr = np.digitize(arrA,bins)
ans = np.bincount(arr,minlength=9)
ans1 = len(ans[:-1][ans[:-1]>0])
ans2 = ans1 + ans[-1]
if ans1 == 0:
    ans1 = 1
print(ans1,ans2)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

Buggy submission (verdict: Runtime Error):
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
N = int(input())
arrA = np.array(input().split(),dtype=np.int64)
bins = np.array([400,800,1200,1600,2000,2400,2800,3200,4801])
arr = np.digitize(arrA,bins)
ans = np.bincount(arr,minlength=9)
ans1 = len(ans[:-1][ans[:-1]>0])
ans2 = min(ans1 + ans[-1])
if ans1 == 0:
    ans1 = 1
print(ans1,ans2)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))
Problem p03951 (python)

Fixed submission:
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
N = int(input())
S = input()
T = input()
ans = 2*N
for i in range(N,-1,-1):
    ST = S[:i] + T
    # print(ST,ST[:i],ST[i:])
    if ST[:N]==S and ST[-N:]==T:
        ans = min(len(ST),ans)

print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

Buggy submission (verdict: Runtime Error):
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
N = int(input())
S = input()
T = input()
ans = 2*N
for i in range(N,-1,-1):
    # ST = S[:i] + T
    print(ST,ST[:i],ST[i:])
    if ST[:N]==S and ST[-N:]==T:
        ans = min(len(ST),ans)

print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))
Problem p04025 (python)

Fixed submission:
from math import factorial,sqrt,ceil#,gcd
import numpy as np

N = int(input())
lisA = list(map(int,input().split()))
arrA = np.array(lisA)

mean = np.mean(arrA)

targetnum = round(mean)

arrans = (arrA - targetnum)**2
ans = sum(arrans)

print(int(ans))

Buggy submission (verdict: Runtime Error):
from math import factorial,sqrt,ceil,gcd
import numpy as np

N = int(input())
lisA = list(map(int,input().split()))
arrA = np.array(lisA)

mean = np.mean(arrA)

targetnum = round(mean)

arrans = (arrA - targetnum)**2
ans = sum(arrans)

print(ans)